function parse_xml_fields($filename) { global $msg; $f_pos = strrpos($filename, '.'); $f_end = substr($filename, $f_pos); $f_deb = substr($filename, 0, $f_pos); if (file_exists($f_deb . "_subst" . $f_end)) { $filename = $f_deb . "_subst" . $f_end; } $fp = fopen($filename, "r") or die("Can't find XML file"); $xml = fread($fp, filesize($filename)); fclose($fp); $param = _parser_text_no_function_($xml, "FIELDS"); for ($i = 0; $i < count($param['FIELD']); $i++) { $name = $param['FIELD'][$i]['NAME']; $this->fields[$name]['name'] = $param['FIELD'][$i]['NAME']; $this->fields[$name]['size_max'] = $param['FIELD'][$i]['SIZE_MAX']; $this->fields[$name]['html'] = $param['FIELD'][$i]['HTML'][0]['value']; $this->fields[$name]['html_ext'] = $param['FIELD'][$i]['HTML_EXT'][0]['value']; $this->fields[$name]['sql'] = $param['FIELD'][$i]['SQL'][0]['value']; $this->fields[$name]['sql_ext'] = $param['FIELD'][$i]['SQL_EXT'][0]['value']; $label = $param['FIELD'][$i]['LABEL']; if (stripos($label, 'msg:') === 0) { $label = $msg[substr($label, 4)]; } $this->fields[$name]['label'] = $label; } return 0; }
function run_task($id_tache, $type_tache, $id_planificateur, $num_es_user, $connectors_out_source_id) { global $base_path, $dbh; global $PMBuserid; @ini_set('zend.ze1_compatibility_mode', 0); $query = "select * from connectors_out_sources where connectors_out_source_id=" . $connectors_out_source_id; $res = mysql_query($query); $row = mysql_fetch_object($res); $connectors_out_sources_connectornum = $row->connectors_out_sources_connectornum; $daconn = instantiate_connecteur_out($connectors_out_sources_connectornum); if ($daconn) { $source_object = $daconn->instantiate_source_class($connectors_out_source_id); } else { $source_object = NULL; } $es = new external_services(); $array_functions = array(); foreach ($source_object->config["exported_functions"] as $exported_function) { $array_functions[] = $exported_function["group"] . "_" . $exported_function["name"]; } $proxy = $es->get_proxy($PMBuserid, $array_functions); $filename = $base_path . "/admin/planificateur/catalog.xml"; $xml = file_get_contents($filename); $param = _parser_text_no_function_($xml, "CATALOG"); foreach ($param["ACTION"] as $anitem) { if ($type_tache == $anitem["ID"]) { require_once $base_path . "/admin/planificateur/" . $anitem["NAME"] . "/" . $anitem["NAME"] . ".class.php"; $obj_type = new $anitem["NAME"]($id_tache); $obj_type->setEsProxy($proxy); $obj_type->execute(); $obj_type->checkParams($id_planificateur); } } }
function parse_config() { global $include_path; global $lang; $fp = fopen($include_path . "/create_proc/{$lang}.xml", "r") or die("Can't find XML file"); $xml = fread($fp, filesize($include_path . "/create_proc/{$lang}.xml")); fclose($fp); $param = _parser_text_no_function_($xml, "PMBFIELDS"); for ($i = 0; $i < count($param["LISTFIELDS"][0]["ITEM"]); $i++) { $this->list_fields[$param["LISTFIELDS"][0]["ITEM"][$i]["ID"]]["TITLE"] = $param["LISTFIELDS"][0]["ITEM"][$i]["TITRE"]; $this->list_fields[$param["LISTFIELDS"][0]["ITEM"][$i]["ID"]]["SEPARATOR"] = $param["LISTFIELDS"][0]["ITEM"][$i]["SEPARATEUR"]; $this->list_fields[$param["LISTFIELDS"][0]["ITEM"][$i]["ID"]]["DATATYPE"] = $param["LISTFIELDS"][0]["ITEM"][$i]["TYPE"]; $this->list_fields[$param["LISTFIELDS"][0]["ITEM"][$i]["ID"]]["CHAMP"] = $param["LISTFIELDS"][0]["ITEM"][$i]["CHAMP"]; $this->list_fields[$param["LISTFIELDS"][0]["ITEM"][$i]["ID"]]["TABLE"] = $param["LISTFIELDS"][0]["ITEM"][$i]["TABLE"]; $this->list_fields[$param["LISTFIELDS"][0]["ITEM"][$i]["ID"]]["JOINTURE"] = $param["LISTFIELDS"][0]["ITEM"][$i]["JOINTURE"]; $this->list_fields[$param["LISTFIELDS"][0]["ITEM"][$i]["ID"]]["INDEX"] = $param["LISTFIELDS"][0]["ITEM"][$i]["INDEX"]; } for ($i = 0; $i < count($param["TYPEFIELDS"][0]["FIELD"]); $i++) { for ($j = 0; $j < count($param["TYPEFIELDS"][0]["FIELD"][$i]["QUERY"]); $j++) { $this->op_type[$param["TYPEFIELDS"][0]["FIELD"][$i]["DATATYPE"]][$j] = $param["TYPEFIELDS"][0]["FIELD"][$i]["QUERY"][$j]["FOR"]; } } for ($i = 0; $i < count($param["OPERATORS"][0]["OPERATOR"]); $i++) { $this->operateur[$param["OPERATORS"][0]["OPERATOR"][$i]["NAME"]]["TITRE"] = $param["OPERATORS"][0]["OPERATOR"][$i]["value"]; $this->operateur[$param["OPERATORS"][0]["OPERATOR"][$i]["NAME"]]["DEB"] = $param["OPERATORS"][0]["OPERATOR"][$i]["DEB"]; $this->operateur[$param["OPERATORS"][0]["OPERATOR"][$i]["NAME"]]["FIN"] = $param["OPERATORS"][0]["OPERATOR"][$i]["END"]; } }
static function parseXml() { global $include_path; $xmlFile = $include_path . "/classementGen/classementGen.xml"; // Gestion de fichier subst $xmlFile_subst = substr($xmlFile, 0, -4) . "_subst.xml"; if (file_exists($xmlFile_subst)) { $xmlFile = $xmlFile_subst; } //Parse le fichier dans un tableau $fp = fopen($xmlFile, "r") or die("Can't find XML file {$xmlFile}"); $xml = fread($fp, filesize($xmlFile)); fclose($fp); $param = _parser_text_no_function_($xml, "PMBCLASSEMENT"); //Récupération des éléments for ($i = 0; $i < count($param["TYPES"][0]["TYPE"]); $i++) { $p_typ = $param["TYPES"][0]["TYPE"][$i]; $typ = array(); $typ["TABLE"] = $p_typ["TABLE"][0]["value"]; $typ["TABLE_ID"] = $p_typ["TABLE_ID"][0]["value"]; $typ["TABLE_CLASSEMENT_FIELD"] = $p_typ["TABLE_CLASSEMENT_FIELD"][0]["value"]; $typ["AUTORISATION_WHERE"] = $p_typ["AUTORISATION_WHERE"][0]["value"]; $_SESSION["classementGen_types"][$p_typ["NAME"]] = $typ; } }
function report_to_rtf($xml = "") { //Parse le fichier dans un tableau $param = _parser_text_no_function_($xml, "REPORT"); $this->intro = $param['INTRO']; $this->notes = $param['NOTES'][0]['NOTE']; $this->generate_RTF(); }
function workflow($obj_name, $workflow_name = '') { global $include_path; $this->object_name = $obj_name; $file = $include_path . "/demandes/workflow.xml"; $file_subst = $include_path . "/demandes/workflow_subst.xml"; if (file_exists($file_subst)) { $xml = file_get_contents($file_subst, "r"); } else { $xml = file_get_contents($file, "r") or die("Can't find XML file {$file}"); } //Parse le fichier dans un tableau $param = _parser_text_no_function_($xml, "STRUCTURE"); //Liste des états généraux (nom=>libellé) for ($i = 0; $i < count($param['STATES'][0]['STATE']); $i++) { $this->states_com[$param['STATES'][0]['STATE'][$i]['NAME']] = $param['STATES'][0]['STATE'][$i]['COMMENT']; } //Chargement de l'objet for ($i = 0; $i < count($param['OBJECTS']); $i++) { for ($j = 0; $j < count($param['OBJECTS'][$i]['OBJECT']); $j++) { $nom = $param['OBJECTS'][$i]['OBJECT'][$j]['NAME']; if ($nom == $this->object_name) { $this->object = $param['OBJECTS'][$i]['OBJECT'][$j]; } } } //Chargement des attributs de l'objet //Etats for ($i = 0; $i < count($this->object['STATES'][0]['STATE']); $i++) { $this->object_states_by_id[$this->object['STATES'][0]['STATE'][$i]['ID']] = $this->object['STATES'][0]['STATE'][$i]['NAME']; $this->object_states[$this->object['STATES'][0]['STATE'][$i]['NAME']]['ID'] = $this->object['STATES'][0]['STATE'][$i]['ID']; $this->object_states[$this->object['STATES'][0]['STATE'][$i]['NAME']]['DEFAULT'] = $this->object['STATES'][0]['STATE'][$i]['DEFAULT']; $this->object_states[$this->object['STATES'][0]['STATE'][$i]['NAME']]['IMAGE'] = $this->object['STATES'][0]['STATE'][$i]['IMAGE']; $this->object_states[$this->object['STATES'][0]['STATE'][$i]['NAME']]['COMMENT'] = $this->getStateCommentById($this->object['STATES'][0]['STATE'][$i]['ID']); } //Types for ($i = 0; $i < count($this->object['TYPES'][0]['TYPE']); $i++) { $this->object_types_by_id[$this->object['TYPES'][0]['TYPE'][$i]['ID']] = $this->object['TYPES'][0]['TYPE'][$i]['NAME']; $this->object_types[$this->object['TYPES'][0]['TYPE'][$i]['NAME']]['ID'] = $this->object['TYPES'][0]['TYPE'][$i]['ID']; $this->object_types[$this->object['TYPES'][0]['TYPE'][$i]['NAME']]['DEFAULT'] = $this->object['TYPES'][0]['TYPE'][$i]['DEFAULT']; $this->object_types[$this->object['TYPES'][0]['TYPE'][$i]['NAME']]['IMAGE'] = $this->object['TYPES'][0]['TYPE'][$i]['IMAGE']; $this->object_types[$this->object['TYPES'][0]['TYPE'][$i]['NAME']]['COMMENT'] = $this->object['TYPES'][0]['TYPE'][$i]['COMMENT']; } //Workflow for ($i = 0; $i < count($this->object['WORKFLOW']); $i++) { if ($this->object['WORKFLOW'][$i]['NAME'] == $workflow_name) { $this->object_workflow = $this->object['WORKFLOW'][$i]; } } //Transitions possibles for ($i = 0; $i < count($this->object_workflow['SOURCE']); $i++) { $cibles = array(); for ($j = 0; $j < count($this->object_workflow['SOURCE'][$i]['TARGET']); $j++) { $cibles[] = $this->object_workflow['SOURCE'][$i]['TARGET'][$j]['NAME']; } $this->object_transitions[$this->object_workflow['SOURCE'][$i]['NAME']] = $cibles; } }
function loadMapping() { global $class_path; $xmlFile = $class_path . "/synchro_rdf.xml"; $fp = fopen($xmlFile, "r"); if ($fp) { $xml = fread($fp, filesize($xmlFile)); fclose($fp); } $mapping = _parser_text_no_function_($xml, "MAPPING"); foreach ($mapping['OBJECT'] as $object) { $target = $object['TARGET']; $targetList = explode(",", $target); $arrayName = $object['TYPE'] . "Mapping"; if ($object['TYPE'] == 'entite') { $arrayFields = array(); foreach ($object['RDFFIELD'] as $field) { $detail = array(); foreach ($field['FIELD'] as $fieldBis) { $detail[$fieldBis['CODE_CHAMP'] . "_" . $fieldBis['CODE_SS_CHAMP'] . "_" . $fieldBis['ORDRE']] = 1; } $arrayFields[$field['NAME']] = array('function' => $field['FUNCTION'], 'lang' => $field['LANG'], 'distinct' => $field['DISTINCT'], 'detail' => $detail); } foreach ($targetList as $target) { $this->entiteMapping[$target][$object['NAME']] = array('uniqueVar' => $object['UNIQUEVAR'], 'definition' => $object['DEFINITIONTRIPLET'][0], 'fields' => $arrayFields, 'links' => $object['LINK'], 'authors' => $object['AUTHORS']); } } else { $this->{$arrayName} = $object; } } //Deuxième passe pour les mêmes entités mais en cas particuliers foreach ($mapping['OBJECTBIS'] as $object) { $target = $object['TARGET']; $targetList = explode(",", $target); $arrayName = $object['TYPE'] . "Mapping"; if ($object['TYPE'] == 'entite') { $arrayFields = array(); foreach ($object['RDFFIELD'] as $field) { $detail = array(); foreach ($field['FIELD'] as $fieldBis) { $detail[$fieldBis['CODE_CHAMP'] . "_" . $fieldBis['CODE_SS_CHAMP'] . "_" . $fieldBis['ORDRE']] = 1; } $arrayFields[$field['NAME']] = array('function' => $field['FUNCTION'], 'lang' => $field['LANG'], 'distinct' => $field['DISTINCT'], 'detail' => $detail); } foreach ($targetList as $target) { $this->entiteMapping[$target][$object['NAME']] = array('uniqueVar' => $object['UNIQUEVAR'], 'definition' => $object['DEFINITIONTRIPLET'][0], 'fields' => $arrayFields, 'links' => $object['LINK'], 'authors' => $object['AUTHORS']); } } else { $this->{$arrayName} = $object; } } return; }
function loadTbChampBase() { global $champ_base, $include_path, $msg; if (!count($champ_base)) { $file = $include_path . "/indexation/notices/champs_base_subst.xml"; if (!file_exists($file)) { $file = $include_path . "/indexation/notices/champs_base.xml"; } $fp = fopen($file, "r"); if ($fp) { $xml = fread($fp, filesize($file)); } fclose($fp); $champ_base = _parser_text_no_function_($xml, "INDEXATION"); } if (!count($this->tbChampBase)) { foreach ($champ_base["FIELD"] as $k => $v) { if (isset($v["TABLE"][0]["TABLEFIELD"])) { foreach ($v["TABLE"][0]["TABLEFIELD"] as $k2 => $v2) { if (isset($v2["NAME"])) { if (isset($v2["ID"])) { $this->tbChampBase[(int) $v["ID"] . "_" . (int) $v2["ID"]] = $msg[$v2["NAME"]]; } else { $this->tbChampBase[(int) $v["ID"] . "_0"] = $msg[$v2["NAME"]]; } } else { if (isset($v2["ID"])) { $this->tbChampBase[(int) $v["ID"] . "_" . (int) $v2["ID"]] = $msg[$v["NAME"]]; } else { $this->tbChampBase[(int) $v["ID"] . "_0"] = $msg[$v["NAME"]]; } } if (isset($v2["ID"])) { if (!trim($this->tbChampBase[(int) $v["ID"] . "_" . (int) $v2["ID"]])) { $this->tbChampBase[(int) $v["ID"] . "_" . (int) $v2["ID"]] = "___champ sans libellé___"; } } else { if (!trim($this->tbChampBase[(int) $v["ID"] . "_0"])) { $this->tbChampBase[(int) $v["ID"] . "_0"] = "___champ sans libellé___"; } } } } if (isset($v["ISBD"])) { $tmp = $v["ISBD"][0]; $this->tbChampBase[(int) $v["ID"] . "_" . (int) $tmp["ID"]] = $msg[$tmp["NAME"] . "_" . $tmp["CLASS_NAME"]]; if (!trim($this->tbChampBase[(int) $v["ID"] . "_" . (int) $tmp["ID"]])) { $this->tbChampBase[(int) $v["ID"] . "_" . (int) $tmp["ID"]] = "___champ sans libellé___"; } } } } }
function get_catalog() { if (!count($this->catalog)) { //Lecture des différents formats de conversion possibles global $base_path; if (file_exists("{$base_path}/admin/convert/imports/catalog_subst.xml")) { $fic_catal = "{$base_path}/admin/convert/imports/catalog_subst.xml"; } else { $fic_catal = "{$base_path}/admin/convert/imports/catalog.xml"; } $this->catalog = _parser_text_no_function_(file_get_contents($fic_catal), "CATALOG"); } return $this->catalog; }
function fetch_data() { global $include_path; $this->info = array(); $nomfichier = $include_path . "/harvest/harvest_fields.xml"; if (file_exists($nomfichier)) { $fp = fopen($nomfichier, "r"); if ($fp) { //un fichier est ouvert donc on le lit $xml = fread($fp, filesize($nomfichier)); //on le ferme fclose($fp); $param = _parser_text_no_function_($xml, "HARVEST"); $this->fields = $param["FIELD"]; } } $this->fields_id = array(); $i = 0; foreach ($this->fields as $key => $field) { $this->fields_id[$this->fields[$key]["ID"]] = $field; } if (!$this->id) { return; } $req = "select * from harvest_profil_import where id_harvest_profil_import=" . $this->id; $resultat = mysql_query($req); if (mysql_num_rows($resultat)) { $r = mysql_fetch_object($resultat); $this->info['id'] = $r->id_harvest_profil_import; $this->info['name'] = $r->harvest_profil_import_name; } $this->info['fields'] = array(); $req = "select * from harvest_profil_import_field where num_harvest_profil_import=" . $this->id . " order by harvest_profil_import_field_order"; $resultat = mysql_query($req); if (mysql_num_rows($resultat)) { while ($r = mysql_fetch_object($resultat)) { $this->info['fields'][$r->harvest_profil_import_field_xml_id]['id'] = $r->harvest_profil_import_field_xml_id; $this->info['fields'][$r->harvest_profil_import_field_xml_id]['xml'] = $r->harvest_profil_import_field_xml_id; $this->info['fields'][$r->harvest_profil_import_field_xml_id]['flagtodo'] = $r->harvest_profil_import_field_flag; } } if ($this->info['num_harvest']) { $this->info['harvest'] = new harvest($this->info['num_harvest']); } //printr($this->info); }
function fields_array() { global $include_path, $msg; global $dbh, $champ_base; if (!count($champ_base)) { $file = $include_path . "/indexation/notices/champs_base_subst.xml"; if (!file_exists($file)) { $file = $include_path . "/indexation/notices/champs_base.xml"; } $fp = fopen($file, "r"); if ($fp) { $xml = fread($fp, filesize($file)); } fclose($fp); $champ_base = _parser_text_no_function_($xml, "INDEXATION"); } return $champ_base; }
/** * On parse le fichier xml des modes d'affichage. */ private function analyse() { global $include_path; if (!is_array($this->modes) || !count($this->modes)) { if (file_exists($include_path . "/records/" . $this->filename . "_subst.xml")) { $filepath = $include_path . "/records/" . $this->filename . "_subst.xml"; } else { if (file_exists($include_path . "/records/" . $this->filename . ".xml")) { $filepath = $include_path . "/records/" . $this->filename . ".xml"; } else { $filepath = $include_path . "/records/display_modes.xml"; } } $fp = fopen($filepath, "r"); $xml = fread($fp, filesize($filepath)); fclose($fp); $this->modes = _parser_text_no_function_($xml, "MODES"); } }
function parse_catalog($catalog) { global $base_path, $lang; //Construction du tableau des connecteurs disponbibles $xml = file_get_contents($catalog); $param = _parser_text_no_function_($xml, "CATALOG"); for ($i = 0; $i < count($param["ITEM"]); $i++) { $item = $param["ITEM"][$i]; $t = array(); if ($item["ACTIVE"] == "0") { continue; } $t["PATH"] = $item["PATH"]; //Parse du manifest $xml_manifest = file_get_contents($base_path . "/admin/opac/opac_view/filters/" . $item["PATH"] . "/manifest.xml"); $manifest = _parser_text_no_function_($xml_manifest, "MANIFEST"); $t["NAME"] = $manifest["NAME"][0]["value"]; $t["AUTHOR"] = $manifest["AUTHOR"][0]["value"]; $t["ORG"] = $manifest["ORG"][0]["value"]; $t["DATE"] = $manifest["DATE"][0]["value"]; $t["STATUS"] = $manifest["STATUS"][0]["value"]; //Commentaires $comment = array(); for ($j = 0; $j < count($manifest["COMMENT"]); $j++) { if ($manifest["COMMENT"][$j]["lang"] == $lang) { $comment = $manifest["COMMENT"][$j]["value"]; break; } else { if (!$manifest["COMMENT"][$j]["lang"]) { $c_default = $manifest["COMMENT"][$j]["value"]; } } } if ($j == count($manifest["COMMENT"])) { $comment = $c_default; } $t["COMMENT"] = $comment; $this->catalog[$item["ID"]] = $t; $this->msg[$item["ID"]] = $this->get_messages("/admin/opac/opac_view/filters/" . $item["PATH"]); } }
static function get_info_categ($record) { global $include_path, $tabl_categ_has_recovered, $tabl_categ_recovered, $tabl_categ_recovery; $tabl_categ_recovered = array(); if (!isset($tabl_categ_has_recovered)) { $tabl_categ_has_recovered = array(); $tabl_categ_recovery = array(); if (file_exists($include_path . "/category_auto/import_category.xml")) { $tabl_categ_recovery = _parser_text_no_function_(file_get_contents($include_path . "/category_auto/import_category.xml"), "AUTHORITY"); } foreach ($tabl_categ_recovery as $root) { foreach ($root as $thes) { foreach ($thes["CATEGORY"] as $root_field) { foreach ($root_field["FIELD"] as $field_val) { $name_field = $field_val["CODE"]; if ($field_val["AUTHORITY_NUMBER"]) { $tmp = array(); $tmp["field"] = $name_field; $tmp["subfield"] = $field_val["AUTHORITY_NUMBER"]; $tabl_categ_has_recovered[] = $tmp; } if ($field_val["ORDER"] == "import") { $tmp = array(); $tmp["field"] = $name_field; $tmp["subfield"] = ""; $tabl_categ_has_recovered[] = $tmp; } else { category_auto::browse_subfields($field_val["SUBFIELD"], $name_field, $tabl_categ_has_recovered); } } } } } } if (count($tabl_categ_has_recovered)) { foreach ($tabl_categ_has_recovered as $value) { $tabl_categ_recovered[$value["field"] . $value["subfield"]] = $record->get_subfield_array_array($value["field"], $value["subfield"]); } } }
function convert_txt_prisme($notice, $s, $islast, $isfirst, $param_path) { global $charset; $r_ = "+++"; $notice = "<?xml version='1.0' encoding='{$charset}' ?>" . $notice; $nt = _parser_text_no_function_($notice, "NOTICE"); if ($nt["TY"][0]["value"] == "CHAPEAU") { $r['VALID'] = false; $r['ERROR'] = "Notice " . $nt["REF"][0]["value"] . " - Ignorée, c'est une notice chapeau !"; $r['DATA'] = ""; return $r; } if (!$nt["OP"][0]["value"]) { $nt["OP"][0]["value"] = $s["OP"][0]["value"]; } $r_ .= $nt["REF"][0]["value"] . ";;" . $nt["OP"][0]["value"] . ";;" . $nt["DS"][0]["value"] . ";;" . $nt["TY"][0]["value"] . ";;" . $nt["URL"][0]["value"] . ";;"; $r_ .= $nt["GEN"][0]["value"] . ";;" . $nt["AU"][0]["value"] . ";;" . $nt["AUCO"][0]["value"] . ";;" . $nt["AS"][0]["value"] . ";;"; $r_ .= $nt["DIST"][0]["value"] . ";;" . $nt["TI"][0]["value"] . ";;" . $nt["TN"][0]["value"] . ";;" . $nt["COL"][0]["value"] . ";;"; if ($nt["TY"][0]["value"] == "REVUE") { if (!$nt["TP"][0]["value"]) { $r['VALID'] = false; $r['ERROR'] = "Notice " . $nt["REF"][0]["value"] . " - " . $nt["TIT"][0]["value"] . " : Article sans titre de périodique"; $r['DATA'] = ""; return $r; } else { $r_ .= $nt["TP"][0]["value"] . ";;"; } } else { $r_ .= ";;"; } $r_ .= $nt["SO"][0]["value"] . ";;" . $nt["ED"][0]["value"] . ";;" . $nt["ISBN"][0]["value"] . ";;" . $nt["DP"][0]["value"] . ";;"; $r_ .= $nt["DATRI"][0]["value"] . ";;" . $nt["ND"][0]["value"] . ";;"; $r_ .= $nt["NO"][0]["value"] . ";;" . $nt["GO"][0]["value"] . ";;" . $nt["HI"][0]["value"] . ";;" . $nt["DENP"][0]["value"] . ";;"; $r_ .= $nt["DE"][0]["value"] . ";;" . $nt["CD"][0]["value"] . ";;" . $nt["RESU"][0]["value"] . ";;"; $r['VALID'] = true; $r['ERROR'] = ""; $r['DATA'] = $r_; return $r; }
function parameters_subst($fichier, $id) { if (!file_exists($fichier)) { return; } $file_content = file_get_contents($fichier); $parsed_file = _parser_text_no_function_($file_content); if (!isset($parsed_file["PARAMETERS_LIST"][0]["PARAMETERS"])) { return; } foreach ($parsed_file["PARAMETERS_LIST"][0]["PARAMETERS"] as $aparamlist) { if ($aparamlist['ID'] != $id) { continue; } if (!isset($aparamlist["PARAMETER"])) { continue; } foreach ($aparamlist["PARAMETER"] as $aparam) { $this->values[$aparam["NAME"]] = $aparam["value"]; } } }
public function __construct($xml_filepath, $table_prefix) { $this->table_prefix = $table_prefix; //recuperation du fichier xml de configuration if (!count($this->xml_indexation)) { if (!file_exists($xml_filepath)) { return false; } $subst_file = str_replace(".xml", "_subst.xml", $xml_filepath); if (file_exists($subst_file)) { $file = $subst_file; } else { $file = $xml_filepath; } $fp = fopen($file, "r"); if ($fp) { $xml = fread($fp, filesize($file)); } fclose($fp); $champ_base = _parser_text_no_function_($xml, "INDEXATION"); } $this->xml_indexation = $champ_base; }
function parse_catalog($filename) { global $base_path, $type_task_id; $xml = file_get_contents($filename); $param = _parser_text_no_function_($xml, "CATALOG"); foreach ($param["ACTION"] as $anitem) { $this->types_taches[] = new tache($anitem); } }
function load_isbn_ranges() { global $include_path, $base_path, $charset; $array_isbn_ranges = array(); $xmlFile = $include_path . "/notice/isbn_ranges.xml"; // Gestion de fichier subst $xmlFile_subst = substr($xmlFile, 0, -4) . "_subst.xml"; if (file_exists($xmlFile_subst)) { $xmlFile = $xmlFile_subst; } $fileInfo = pathinfo($xmlFile); $tempFile = $base_path . "/temp/XML" . preg_replace("/[^a-z0-9]/i", "", $fileInfo['dirname'] . $fileInfo['filename'] . $charset) . ".tmp"; if (!file_exists($tempFile) || filemtime($xmlFile) > filemtime($tempFile)) { //Le fichier XML original a-t-il été modifié ultérieurement ? //on va re-générer le pseudo-cache if (file_exists($tempFile)) { unlink($tempFile); } //Parse le fichier dans un tableau $fp = fopen($xmlFile, "r") or die("Can't find XML file {$xmlFile}"); $xml = fread($fp, filesize($xmlFile)); fclose($fp); $param = _parser_text_no_function_($xml, "RANGES"); //Récupération des éléments for ($i = 0; $i < count($param["PREFIX"]); $i++) { for ($j = 0; $j < count($param["PREFIX"][$i]["ZONE"]); $j++) { for ($k = 0; $k < count($param["PREFIX"][$i]["ZONE"][$j]["RANGE"]); $k++) { $array_isbn_ranges[$param["PREFIX"][$i]["ID"]][$param["PREFIX"][$i]["ZONE"][$j]["ID"]][] = $param["PREFIX"][$i]["ZONE"][$j]["RANGE"][$k]["value"]; } } } $tmp = fopen($tempFile, "wb"); fwrite($tmp, serialize($array_isbn_ranges)); fclose($tmp); } else { if (file_exists($tempFile)) { $tmp = fopen($tempFile, "r"); $array_isbn_ranges = unserialize(fread($tmp, filesize($tempFile))); fclose($tmp); } } return $array_isbn_ranges; }
function parse_search_file($fichier_xml, $full_path = '') { global $include_path; global $msg; if (!$full_path) { if ($fichier_xml != "") { if (file_exists($include_path . "/search_queries/" . $fichier_xml . "_subst.xml")) { $fp = fopen($include_path . "/search_queries/" . $fichier_xml . "_subst.xml", "r") or die("Can't find XML file"); $size = filesize($include_path . "/search_queries/" . $fichier_xml . "_subst.xml"); } else { $fp = fopen($include_path . "/search_queries/" . $fichier_xml . ".xml", "r") or die("Can't find XML file"); $size = filesize($include_path . "/search_queries/" . $fichier_xml . ".xml"); } } else { if (file_exists($include_path . "/search_queries/search_fields_subst.xml")) { $fp = fopen($include_path . "/search_queries/search_fields_subst.xml", "r") or die("Can't find XML file"); $size = filesize($include_path . "/search_queries/search_fields_subst.xml"); } else { $fp = fopen($include_path . "/search_queries/search_fields.xml", "r") or die("Can't find XML file"); $size = filesize($include_path . "/search_queries/search_fields.xml"); } } } else { if (file_exists($full_path . $fichier_xml . "_subst.xml")) { $fp = fopen($full_path . $fichier_xml . "_subst.xml", "r") or die("Can't find XML file"); $size = filesize($full_path . $fichier_xml . "_subst.xml"); } else { $fp = fopen($full_path . $fichier_xml . ".xml", "r") or die("Can't find XML file"); $size = filesize($full_path . $fichier_xml . ".xml"); } } $xml = fread($fp, $size); fclose($fp); $param = _parser_text_no_function_($xml, "PMBFIELDS"); //Lecture parametre memory_engine_allowed if ($param['MEMORYENGINEALLOWED'][0]['value'] && $param['MEMORYENGINEALLOWED'][0]['value'] == 'yes') { $this->memory_engine_allowed = true; } //Lecture des operateurs for ($i = 0; $i < count($param["OPERATORS"][0]["OPERATOR"]); $i++) { $operator_ = $param["OPERATORS"][0]["OPERATOR"][$i]; if (substr($operator_["value"], 0, 4) == "msg:") { $this->operators[$operator_["NAME"]] = $msg[substr($operator_["value"], 4, strlen($operator_["value"]) - 4)]; } else { $this->operators[$operator_["NAME"]] = $operator_["value"]; } if ($operator_["EMPTYALLOWED"] == "yes") { $this->op_empty[$operator_["NAME"]] = true; } else { $this->op_empty[$operator_["NAME"]] = false; } } //Lecture des champs fixes for ($i = 0; $i < count($param["FIXEDFIELDS"][0]["FIELD"]); $i++) { $t = array(); $ff = $param["FIXEDFIELDS"][0]["FIELD"][$i]; if (substr($ff["TITLE"], 0, 4) == "msg:") { $t["TITLE"] = $msg[substr($ff["TITLE"], 4, strlen($ff["TITLE"]) - 4)]; } else { $t["TITLE"] = $ff["TITLE"]; } $t["ID"] = $ff["ID"]; $t["NOTDISPLAYCOL"] = $ff["NOTDISPLAYCOL"]; $t["UNIMARCFIELD"] = $ff["UNIMARCFIELD"]; $t["INPUT_TYPE"] = $ff["INPUT"][0]["TYPE"]; $t["INPUT_OPTIONS"] = $ff["INPUT"][0]; if (substr($ff["SEPARATOR"], 0, 4) == "msg:") { $t["SEPARATOR"] = $msg[substr($ff["SEPARATOR"], 4, strlen($ff["SEPARATOR"]) - 4)]; } else { $t["SEPARATOR"] = $ff["SEPARATOR"]; } //Visibilite $t["VISIBLE"] = $ff["VISIBLE"] == "no" ? false : true; //Moteur memory $t['MEMORYENGINEFORBIDDEN'] = $ff['MEMORYENGINEFORBIDDEN'] == 'yes' ? true : false; //Variables for ($j = 0; $j < count($ff["VARIABLE"]); $j++) { $v = array(); $vv = $ff["VARIABLE"][$j]; $v["NAME"] = $vv["NAME"]; $v["TYPE"] = $vv["TYPE"]; if (substr($vv["COMMENT"], 0, 4) == "msg:") { $v["COMMENT"] = $msg[substr($vv["COMMENT"], 4, strlen($vv["COMMENT"]) - 4)]; } else { $v["COMMENT"] = $vv["COMMENT"]; } //Recherche des options reset($vv); while (list($key, $val) = each($vv)) { if (is_array($val)) { $v["OPTIONS"][$key] = $val; } } $t["VAR"][] = $v; } if (!isset($ff["VISIBILITY"])) { $t["VISIBILITY"] = true; } else { if ($ff["VISIBILITY"] == "yes") { $t["VISIBILITY"] = true; } else { $t["VISIBILITY"] = false; } } for ($j = 0; $j < count($ff["QUERY"]); $j++) { $q = array(); $q["OPERATOR"] = $ff["QUERY"][$j]["FOR"]; if ($ff["QUERY"][$j]["MULTIPLE"] == "yes" || $ff["QUERY"][$j]["CONDITIONAL"] == "yes") { if ($ff["QUERY"][$j]["MULTIPLE"] == "yes") { $element = "PART"; } else { $element = "VAR"; } for ($k = 0; $k < count($ff["QUERY"][$j][$element]); $k++) { $pquery = $ff["QUERY"][$j][$element][$k]; if ($element == "VAR") { $q[$k]["CONDITIONAL"]["name"] = $pquery["NAME"]; $q[$k]["CONDITIONAL"]["value"] = $pquery["VALUE"][0]["value"]; } if ($pquery["MULTIPLEWORDS"] == "yes") { $q[$k]["MULTIPLE_WORDS"] = true; } else { $q[$k]["MULTIPLE_WORDS"] = false; } if ($pquery["REGDIACRIT"] == "yes") { $q[$k]["REGDIACRIT"] = true; } else { $q[$k]["REGDIACRIT"] = false; } if ($pquery["KEEP_EMPTYWORD"] == "yes") { $q[$k]["KEEP_EMPTYWORD"] = true; } else { $q[$k]["KEEP_EMPTYWORD"] = false; } if ($pquery["REPEAT"]) { $q[$k]["REPEAT"]["NAME"] = $pquery["REPEAT"][0]["NAME"]; $q[$k]["REPEAT"]["ON"] = $pquery["REPEAT"][0]["ON"]; $q[$k]["REPEAT"]["SEPARATOR"] = $pquery["REPEAT"][0]["SEPARATOR"]; $q[$k]["REPEAT"]["OPERATOR"] = $pquery["REPEAT"][0]["OPERATOR"]; $q[$k]["REPEAT"]["ORDERTERM"] = $pquery["REPEAT"][0]["ORDERTERM"]; } if ($pquery["BOOLEANSEARCH"] == "yes") { $q[$k]["BOOLEAN"] = true; if ($pquery["BOOLEAN"]) { for ($z = 0; $z < count($pquery["BOOLEAN"]); $z++) { $q[$k]["TABLE"][$z] = $pquery["BOOLEAN"][$z]["TABLE"][0]["value"]; $q[$k]["INDEX_L"][$z] = $pquery["BOOLEAN"][$z]["INDEX_L"][0]["value"]; $q[$k]["INDEX_I"][$z] = $pquery["BOOLEAN"][$z]["INDEX_I"][0]["value"]; $q[$k]["ID_FIELD"][$z] = $pquery["BOOLEAN"][$z]["ID_FIELD"][0]["value"]; if ($pquery["BOOLEAN"][$z]["KEEP_EMPTY_WORDS"][0]["value"] == "yes") { $q[$k]["KEEP_EMPTY_WORDS"][$z] = 1; $q[$k]["KEEP_EMPTY_WORDS_FOR_CHECK"] = 1; } if ($pquery["BOOLEAN"][$z]["FULLTEXT"][0]["value"] == "yes") { $q[$k]["FULLTEXT"][$z] = 1; } } } else { $q[$k]["TABLE"] = $pquery["TABLE"][0]["value"]; $q[$k]["INDEX_L"] = $pquery["INDEX_L"][0]["value"]; $q[$k]["INDEX_I"] = $pquery["INDEX_I"][0]["value"]; $q[$k]["ID_FIELD"] = $pquery["ID_FIELD"][0]["value"]; if ($pquery["KEEP_EMPTY_WORDS"][0]["value"] == "yes") { $q[$k]["KEEP_EMPTY_WORDS"] = 1; $q[$k]["KEEP_EMPTY_WORDS_FOR_CHECK"] = 1; } if ($pquery["FULLTEXT"][0]["value"] == "yes") { $q[$k]["FULLTEXT"] = 1; } } } else { $q[$k]["BOOLEAN"] = false; } if ($pquery["ISBNSEARCH"] == "yes") { $q[$k]["ISBN"] = true; } else { $q[$k]["ISBN"] = false; } if ($pquery["DETECTDATE"]) { $q[$k]["DETECTDATE"] = $pquery["DETECTDATE"]; } else { $q[$k]["DETECTDATE"] = false; } $q[$k]["MAIN"] = $pquery["MAIN"][0]["value"]; $q[$k]["MULTIPLE_TERM"] = $pquery["MULTIPLETERM"][0]["value"]; $q[$k]["MULTIPLE_OPERATOR"] = $pquery["MULTIPLEOPERATOR"][0]["value"]; } $t["QUERIES"][] = $q; $t["QUERIES_INDEX"][$q["OPERATOR"]] = count($t["QUERIES"]) - 1; } else { if ($ff["QUERY"][$j]["MULTIPLEWORDS"] == "yes") { $q[0]["MULTIPLE_WORDS"] = true; } else { $q[0]["MULTIPLE_WORDS"] = false; } if ($ff["QUERY"][$j]["REGDIACRIT"] == "yes") { $q[0]["REGDIACRIT"] = true; } else { $q[0]["REGDIACRIT"] = false; } if ($ff["QUERY"][$j]["KEEP_EMPTYWORD"] == "yes") { $q[0]["KEEP_EMPTYWORD"] = true; } else { $q[0]["KEEP_EMPTYWORD"] = false; } if ($ff["QUERY"][$j]["REPEAT"]) { $q[0]["REPEAT"]["NAME"] = $ff["QUERY"][$j]["REPEAT"][0]["NAME"]; $q[0]["REPEAT"]["ON"] = $ff["QUERY"][$j]["REPEAT"][0]["ON"]; $q[0]["REPEAT"]["SEPARATOR"] = $ff["QUERY"][$j]["REPEAT"][0]["SEPARATOR"]; $q[0]["REPEAT"]["OPERATOR"] = $ff["QUERY"][$j]["REPEAT"][0]["OPERATOR"]; $q[0]["REPEAT"]["ORDERTERM"] = $ff["QUERY"][$j]["REPEAT"][0]["ORDERTERM"]; } if ($ff["QUERY"][$j]["BOOLEANSEARCH"] == "yes") { $q[0]["BOOLEAN"] = true; if ($ff["QUERY"][$j]["BOOLEAN"]) { for ($z = 0; $z < count($ff["QUERY"][$j]["BOOLEAN"]); $z++) { $q[0]["TABLE"][$z] = $ff["QUERY"][$j]["BOOLEAN"][$z]["TABLE"][0]["value"]; $q[0]["INDEX_L"][$z] = $ff["QUERY"][$j]["BOOLEAN"][$z]["INDEX_L"][0]["value"]; $q[0]["INDEX_I"][$z] = $ff["QUERY"][$j]["BOOLEAN"][$z]["INDEX_I"][0]["value"]; $q[0]["ID_FIELD"][$z] = $ff["QUERY"][$j]["BOOLEAN"][$z]["ID_FIELD"][0]["value"]; if ($ff["QUERY"][$j]["BOOLEAN"][$z]["KEEP_EMPTY_WORDS"][0]["value"] == "yes") { $q[0]["KEEP_EMPTY_WORDS"][$z] = 1; $q[0]["KEEP_EMPTY_WORDS_FOR_CHECK"] = 1; } } } else { $q[0]["TABLE"] = $ff["QUERY"][$j]["TABLE"][0]["value"]; $q[0]["INDEX_L"] = $ff["QUERY"][$j]["INDEX_L"][0]["value"]; $q[0]["INDEX_I"] = $ff["QUERY"][$j]["INDEX_I"][0]["value"]; $q[0]["ID_FIELD"] = $ff["QUERY"][$j]["ID_FIELD"][0]["value"]; if ($ff["QUERY"][$j]["KEEP_EMPTY_WORDS"][0]["value"] == "yes") { $q[0]["KEEP_EMPTY_WORDS"] = 1; $q[0]["KEEP_EMPTY_WORDS_FOR_CHECK"] = 1; } } } else { $q[0]["BOOLEAN"] = false; } //prise en compte ou non du paramétrage du stemming if ($ff["QUERY"][$j]['STEMMING'] == "no") { $q[0]["STEMMING"] = false; } else { $q[0]["STEMMING"] = true; } //modif arnaud pour notices_mots_global_index.. if ($ff["QUERY"][$j]['WORDSEARCH'] == "yes") { $q[0]["WORD"] = true; $q[0]['CLASS'] = $ff["QUERY"][$j]['CLASS'][0]['value']; $q[0]['FOLDER'] = $ff["QUERY"][$j]['CLASS'][0]['FOLDER']; $q[0]['FIELDS'] = $ff["QUERY"][$j]['CLASS'][0]['FIELDS']; } else { $q[0]["WORD"] = false; } //fin modif arnaud if ($ff["QUERY"][$j]["ISBNSEARCH"] == "yes") { $q[0]["ISBN"] = true; } else { $q[0]["ISBN"] = false; } if ($ff["QUERY"][$j]["DETECTDATE"]) { $q[0]["DETECTDATE"] = $ff["QUERY"][$j]["DETECTDATE"]; } else { $q[0]["DETECTDATE"] = false; } $q[0]["MAIN"] = $ff["QUERY"][$j]["MAIN"][0]["value"]; $q[0]["MULTIPLE_TERM"] = $ff["QUERY"][$j]["MULTIPLETERM"][0]["value"]; $q[0]["MULTIPLE_OPERATOR"] = $ff["QUERY"][$j]["MULTIPLEOPERATOR"][0]["value"]; $t["QUERIES"][] = $q; $t["QUERIES_INDEX"][$q["OPERATOR"]] = count($t["QUERIES"]) - 1; } } // recuperation des visibilites parametrees for ($j = 0; $j < count($ff["VAR"]); $j++) { $q = array(); $q["NAME"] = $ff["VAR"][$j]["NAME"]; if ($ff["VAR"][$j]["VISIBILITY"] == "yes") { $q["VISIBILITY"] = true; } else { $q["VISIBILITY"] = false; } for ($k = 0; $k < count($ff["VAR"][$j]["VALUE"]); $k++) { $v = array(); if ($ff["VAR"][$j]["VALUE"][$k]["VISIBILITY"] == "yes") { $v[$ff["VAR"][$j]["VALUE"][$k]["value"]] = true; } else { $v[$ff["VAR"][$j]["VALUE"][$k]["value"]] = false; } } // fin for <value ... $q["VALUE"] = $v; $t["VARVIS"][] = $q; } // fin for $this->fixedfields[$ff["ID"]] = $t; } //Lecture des champs dynamiques if ($param["DYNAMICFIELDS"][0]["VISIBLE"] == "no") { $this->dynamics_not_visible = true; } if (!$param["DYNAMICFIELDS"][0]["FIELDTYPE"]) { //Pour le cas de fichiers subst basés sur l'ancienne version $tmp = $param["DYNAMICFIELDS"][0]["FIELD"]; unset($param["DYNAMICFIELDS"]); $param["DYNAMICFIELDS"][0]["FIELDTYPE"][0]["PREFIX"] = "d"; $param["DYNAMICFIELDS"][0]["FIELDTYPE"][0]["TYPE"] = "notices"; $param["DYNAMICFIELDS"][0]["FIELDTYPE"][0]["FIELD"] = $tmp; unset($tmp); } for ($h = 0; $h < count($param["DYNAMICFIELDS"][0]["FIELDTYPE"]); $h++) { $champType = array(); $ft = $param["DYNAMICFIELDS"][0]["FIELDTYPE"][$h]; $champType["TYPE"] = $ft["TYPE"]; for ($i = 0; $i < count($ft["FIELD"]); $i++) { $t = array(); $ff = $ft["FIELD"][$i]; $t["DATATYPE"] = $ff["DATATYPE"]; $t["NOTDISPLAYCOL"] = $ff["NOTDISPLAYCOL"]; //Moteur memory $t['MEMORYENGINEFORBIDDEN'] = $ff['MEMORYENGINEFORBIDDEN'] == 'yes' ? true : false; $q = array(); for ($j = 0; $j < count($ff["QUERY"]); $j++) { $q["OPERATOR"] = $ff["QUERY"][$j]["FOR"]; if ($ff["QUERY"][$j]["MULTIPLEWORDS"] == "yes") { $q["MULTIPLE_WORDS"] = true; } else { $q["MULTIPLE_WORDS"] = false; } if ($ff["QUERY"][$j]["REGDIACRIT"] == "yes") { $q["REGDIACRIT"] = true; } else { $q["REGDIACRIT"] = false; } if ($ff["QUERY"][$j]["KEEP_EMPTYWORD"] == "yes") { $q["KEEP_EMPTYWORD"] = true; } else { $q["KEEP_EMPTYWORD"] = false; } if ($ff["QUERY"][$j]["DEFAULT_OPERATOR"]) { $q["DEFAULT_OPERATOR"] = $ff["QUERY"][$j]["DEFAULT_OPERATOR"]; } $q["NOT_ALLOWED_FOR"] = array(); $naf = $ff["QUERY"][$j]["NOTALLOWEDFOR"]; if ($naf) { $naf_ = explode(",", $naf); $q["NOT_ALLOWED_FOR"] = $naf_; } //modif arnaud pour notices_mots_global_index.. if ($ff["QUERY"][$j]['WORDSEARCH'] == "yes") { $q["WORD"] = true; $q['CLASS'] = $ff["QUERY"][$j]['CLASS'][0]['value']; } else { $q["WORD"] = false; } if ($ff["QUERY"][$j]['SEARCHABLEONLY'] == "yes") { $q["SEARCHABLEONLY"] = true; } else { $q["SEARCHABLEONLY"] = false; } //fin modif arnaud $q["MAIN"] = $ff["QUERY"][$j]["MAIN"][0]["value"]; $q["MULTIPLE_TERM"] = $ff["QUERY"][$j]["MULTIPLETERM"][0]["value"]; $q["MULTIPLE_OPERATOR"] = $ff["QUERY"][$j]["MULTIPLEOPERATOR"][0]["value"]; $t["QUERIES"][] = $q; $t["QUERIES_INDEX"][$q["OPERATOR"]] = count($t["QUERIES"]) - 1; } $champType["FIELD"][$ff["ID"]] = $t; } $this->dynamicfields[$ft["PREFIX"]] = $champType; } //Lecture des champs speciaux if ($param["SPECIALFIELDS"][0]["VISIBLE"] == "no") { $this->specials_not_visible = true; } for ($i = 0; $i < count($param["SPECIALFIELDS"][0]["FIELD"]); $i++) { $t = array(); $sf = $param["SPECIALFIELDS"][0]["FIELD"][$i]; if (substr($sf["TITLE"], 0, 4) == "msg:") { $t["TITLE"] = $msg[substr($sf["TITLE"], 4, strlen($sf["TITLE"]) - 4)]; } else { $t["TITLE"] = $sf["TITLE"]; } $t["NOTDISPLAYCOL"] = $sf["NOTDISPLAYCOL"]; $t["UNIMARCFIELD"] = $sf["UNIMARCFIELD"]; if (substr($sf["SEPARATOR"], 0, 4) == "msg:") { $t["SEPARATOR"] = $msg[substr($sf["SEPARATOR"], 4, strlen($sf["SEPARATOR"]) - 4)]; } else { $t["SEPARATOR"] = $sf["SEPARATOR"]; } $t["TYPE"] = $sf["TYPE"]; if ($sf["VISIBLE"] != "no") { $t['VISIBLE'] = true; } else { $t['VISIBLE'] = false; } $t["DELNOTALLOWED"] = $sf["DELNOTALLOWED"] == "yes" ? true : false; $this->specialfields[$sf["ID"]] = $t; } if (count($this->specialfields) != 0) { if (file_exists($include_path . "/search_queries/specials/catalog_subst.xml")) { $nom_fichier = $include_path . "/search_queries/specials/catalog_subst.xml"; } else { $nom_fichier = $include_path . "/search_queries/specials/catalog.xml"; } $parametres = file_get_contents($nom_fichier); $this->tableau_speciaux = _parser_text_no_function_($parametres, "SPECIALFIELDS"); } $this->keyName = $param["KEYNAME"][0]["value"]; if (!$this->keyName) { $this->keyName = "notice_id"; } }
function diffuser() { global $dbh; global $msg, $charset, $base_path, $opac_connexion_phrase, $pmb_mail_delay; global $PMBusernom; global $PMBuserprenom; global $PMBuseremail; if (!$this->id_bannette) { return $msg['dsi_ban_no_access'] . "<br />"; } // impossible d'accéder à cette bannette if (!$this->nb_notices && $this->diffusion_email) { return $msg['dsi_ban_empty'] . "<br />"; } // On demande à diffuser le contenu et la bannette vide : pas question d'envoyer du vide mysql_set_wait_timeout(3600); $this->construit_diff(); $texte_base = $this->texte_diffuse; if ($this->export_contenu) { $fic_params = $base_path . "/admin/convert/imports/" . $this->typeexport . "/params.xml"; $temppar = file_get_contents($fic_params); $params = _parser_text_no_function_($temppar, "PARAMS"); if ($params["OUTPUT"][0]["SUFFIX"]) { $ext = $params["OUTPUT"][0]["SUFFIX"]; } else { $ext = "fic"; } $pieces_jointes[0]["nomfichier"] = $this->prefixe_fichier . today() . "." . $ext; $pieces_jointes[0]["contenu"] = $this->export_contenu; } $nb_dest = 0; $nb_echec = 0; $nb_no_email = 0; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; $requete = "select id_empr, empr_cb, empr_mail, empr_nom, empr_prenom, empr_login, empr_password, if(empr_sexe=2,'" . $msg["civilite_madame"] . "',"; $requete .= "if(empr_sexe=1,'" . $msg["civilite_monsieur"] . "','" . $msg["civilite_unknown"] . "')) as empr_sexe, empr_adr1, empr_adr2, empr_cp, empr_ville,"; $requete .= "empr_pays, empr_tel1, empr_tel2, date_format(empr_date_adhesion, '" . $msg["format_date"] . "') as aff_empr_date_adhesion, date_format(empr_date_expiration, '" . $msg["format_date"] . "') as aff_empr_date_expiration,"; $requete .= "statut_libelle, allow_dsi, allow_dsi_priv, proprio_bannette, bannette_mail from empr, empr_statut, bannette_abon, bannettes "; $requete .= "where num_bannette='" . $this->id_bannette . "' and num_empr=id_empr and empr_statut=idstatut and num_bannette=id_bannette "; $requete .= "order by empr_nom, empr_prenom "; $res = pmb_mysql_query($requete, $dbh); while ($empr = pmb_mysql_fetch_object($res)) { $emaildest = $empr->empr_mail; if ($empr->bannette_mail && $emaildest) { $destinataires = explode(";", $emaildest); $found = 0; foreach ($destinataires as $mail) { if ($mail == $empr->bannette_mail) { $found = 1; break; } } if ($found) { $emaildest = $empr->bannette_mail; } } $texte = $texte_base; if ($emaildest) { if (!$empr->allow_dsi && !$empr->proprio_bannette || !$empr->allow_dsi_priv && $empr->proprio_bannette) { //si la dsi n'est pas autorisée pour ce lecteur, affichage de l'info mais pas d'envoi $nb_echec++; $echec_email .= "- " . $empr->empr_nom . " " . $empr->empr_prenom . " (" . $msg["statut_empr"] . "' " . $empr->statut_libelle . "')<br />"; } else { //function mailpmb($to_nom="", $to_mail, $obj="", $corps="", $from_name="", $from_mail, $headers, $copie_CC="", $copie_BCC="", $faire_nl2br=0, $pieces_jointes=array()) { $dates = time(); $login = $empr->empr_login; $code = md5($opac_connexion_phrase . $login . $dates); $texte = str_replace('!!code!!', $code, $texte); $texte = str_replace('!!login!!', $login, $texte); $texte = str_replace('!!empr_login!!', $login, $texte); $texte = str_replace('!!date_conex!!', $dates, $texte); $texte = str_replace('!!empr_name!!', $empr->empr_nom, $texte); $texte = str_replace('!!empr_first_name!!', $empr->empr_prenom, $texte); $texte = str_replace('!!empr_sexe!!', $empr->empr_sexe, $texte); $texte = str_replace('!!empr_cb!!', $empr->empr_cb, $texte); $texte = str_replace('!!empr_mail!!', $empr->empr_mail, $texte); if (strpos($texte, "!!empr_name_and_adress!!")) { $texte = str_replace("!!empr_name_and_adress!!", nl2br($this->m_lecteur_adresse($empr)), $texte); } if (strpos($texte, "!!empr_all_information!!")) { $texte = str_replace("!!empr_all_information!!", nl2br($this->m_lecteur_info($empr)), $texte); } $res_envoi = @mailpmb($empr->empr_prenom . " " . $empr->empr_nom, $emaildest, $this->comment_public, $texte, $PMBuserprenom . " " . $PMBusernom, $PMBuseremail, $headers, "", "", 0, $pieces_jointes); if ($pmb_mail_delay * 1) { sleep((int) $pmb_mail_delay * 1 / 1000); } if ($res_envoi) { $nb_dest++; } else { $nb_echec++; $echec_email .= "- " . $empr->empr_nom . " " . $empr->empr_prenom . "<br />"; } } } else { $nb_no_email++; $no_email .= "- " . $empr->empr_nom . " " . $empr->empr_prenom . "<br />"; } } // remplissage du panier avec le contenu de la bannette if ($this->num_panier) { $temp_requete = "delete from caddie_content where caddie_id='" . $this->num_panier . "'"; pmb_mysql_query($temp_requete, $dbh); $temp_requete = "insert into caddie_content (caddie_id, object_id) (select " . $this->num_panier . ", num_notice from bannette_contenu where num_bannette=" . $this->id_bannette . ")"; pmb_mysql_query($temp_requete, $dbh) or die(pmb_mysql_error() . $temp_requete); } /* A commenter pour tests */ $temp_requete = "update bannettes set date_last_envoi=sysdate() where id_bannette='" . $this->id_bannette . "' "; $res = pmb_mysql_query($temp_requete, $dbh); $res_envoi = $msg["dsi_dif_res_dif"] . "<ul><li>" . $msg["dsi_dif_res_dif_mail_ok"] . ": {$nb_dest} </li>"; if ($nb_echec) { $res_envoi .= "<li>" . $msg["dsi_dif_res_dif_mail_echec"] . ": {$nb_echec} <blockquote>{$echec_email}</blockquote></li>"; } if ($nb_no_email) { $res_envoi .= "<li>" . $msg["dsi_dif_res_dif_no_mail"] . ": {$nb_no_email} <blockquote>{$no_email}</blockquote></li>"; } $res_envoi .= "</ul>"; if ($nb_echec || $nb_no_email) { $res_envoi .= "<script>openPopUp('./print_dsi.php?id_bannette={$this->id_bannette}', 'Impression de DSI', 500, 400, -2, -2, 'toolbar=no, infobar=no, resizable=yes, scrollbars=yes')</script>"; } return $res_envoi; }
function maj_entrepot($source_id, $callback_progress = "", $recover = false, $recover_env = "") { global $dbh, $base_path, $file_in, $suffix, $converted, $origine, $charset, $outputtype; //Allons chercher plein d'informations utiles et amusantes $params = $this->get_source_params($source_id); $this->fetch_global_properties(); if ($params["PARAMETERS"]) { //Affichage du formulaire avec $params["PARAMETERS"] $vars = unserialize($params["PARAMETERS"]); foreach ($vars as $key => $val) { global ${$key}; ${$key} = $val; } } if (!isset($xslt_exemplaire)) { $xslt_exemplaire = ""; } $file_type = "iso_2709"; //Récupérons le nom du fichier if ($converted) { //Fichier converti $f = explode(".", $file_in); if (count($f) > 1) { unset($f[count($f) - 1]); } $final_file = implode(".", $f) . "." . $suffix . "~"; $final_file = "{$base_path}/temp/" . $final_file; $file_type = $outputtype; } else { $final_file = "{$base_path}/temp/" . $file_in; $file_type = $outputtype; } /* * ISO-2709 * */ if ($file_type == "iso_2709") { //Chargeons ces notices dans la base $this->loadfile_in_table_unimarc($final_file, $origine); $import_marc_count = "SELECT count(*) FROM import_marc"; $count_total = pmb_mysql_result(pmb_mysql_query($import_marc_count, $dbh), 0, 0); if (!$count_total) { return 0; } $count_lu = 0; $latest_percent = floor(100 * $count_lu / $count_total); //Et c'est parti $import_sql = "SELECT id_import, notice FROM import_marc WHERE origine = " . $origine; $res = pmb_mysql_query($import_sql); while ($row = pmb_mysql_fetch_assoc($res)) { $xmlunimarc = new xml_unimarc(); $nxml = $xmlunimarc->iso2709toXML_notice($row["notice"]); $xmlunimarc->notices_xml_[0] = '<?xml version="1.0" encoding="' . $charset . '"?>' . $xmlunimarc->notices_xml_[0]; if ($xslt_exemplaire) { $xmlunimarc->notices_xml_[0] = $this->apply_xsl_to_xml($xmlunimarc->notices_xml_[0], $xslt_exemplaire["content"]); } if ($nxml == 1) { $params = _parser_text_no_function_($xmlunimarc->notices_xml_[0], "NOTICE"); $this->rec_record($params, $source_id, 0); $count_lu++; } $sql_delete = "DELETE FROM import_marc WHERE id_import = " . $row['id_import']; @pmb_mysql_query($sql_delete); if (floor(100 * $count_lu / $count_total) > $latest_percent) { //Mise à jour de source_sync pour reprise en cas d'erreur /* $envt["current_origine"]=$origine; $envt["already_read_count"]=$count_lu; $requete="update source_sync set env='".addslashes(serialize($envt))."' where source_id=".$source_id; pmb_mysql_query($requete);*/ //Inform call_user_func($callback_progress, $count_lu / $count_total, $count_lu, $count_total); // $callback_progress($count_lu / $count_total, $count_lu, $count_total); $latest_percent = floor(100 * $count_lu / $count_total); flush(); ob_flush(); } } } else { if ($file_type == "xml") { //Chargeons ces notices dans la base $this->loadfile_in_table_xml($final_file, $origine); $import_marc_count = "SELECT count(*) FROM import_marc"; $count_total = pmb_mysql_result(pmb_mysql_query($import_marc_count, $dbh), 0, 0); if (!$count_total) { return 0; } $count_lu = 0; $latest_percent = floor(100 * $count_lu / $count_total); //Et c'est parti $import_sql = "SELECT id_import, notice FROM import_marc WHERE origine = " . $origine; $res = pmb_mysql_query($import_sql); while ($row = pmb_mysql_fetch_assoc($res)) { $xmlunimarc = '<?xml version="1.0" encoding="' . $charset . '"?>' . $row["notice"]; if ($xslt_exemplaire) { $xmlunimarc = $this->apply_xsl_to_xml($xmlunimarc, $xslt_exemplaire["content"]); } $params = _parser_text_no_function_($xmlunimarc, "NOTICE"); $this->rec_record($params, $source_id, 0); $count_lu++; $sql_delete = "DELETE FROM import_marc WHERE id_import = " . $row['id_import']; @pmb_mysql_query($sql_delete); if (floor(100 * $count_lu / $count_total) > $latest_percent) { //Mise à jour de source_sync pour reprise en cas d'erreur /* $envt["current_origine"]=$origine; $envt["already_read_count"]=$count_lu; $requete="update source_sync set env='".addslashes(serialize($envt))."' where source_id=".$source_id; pmb_mysql_query($requete);*/ //Inform call_user_func($callback_progress, $count_lu / $count_total, $count_lu, $count_total); // $callback_progress($count_lu / $count_total, $count_lu, $count_total); $latest_percent = floor(100 * $count_lu / $count_total); flush(); ob_flush(); } } } } return $count_lu; }
function connecteurs_out() { global $base_path; $filename = $base_path . "/admin/connecteurs/out/catalog.xml"; $xml = file_get_contents($filename); $param = _parser_text_no_function_($xml, "CATALOG"); foreach ($param["ITEM"] as $anitem) { $this->connectors[] = new connecteur_out($anitem["ID"], $anitem["PATH"]); } }
function show_list_sug($id_bibli = 0) { global $dbh, $base_path; global $msg, $charset; global $sug_map; global $sug_search_form, $sug_list_form, $filtre_src, $user_txt, $user_id, $user_statut; global $nb_per_page; global $class_path; global $user_input, $statut, $num_categ, $page, $nbr_lignes, $last_param; global $script, $bt_chk, $bt_imp, $bt_exporter; global $acquisition_sugg_categ; global $acquisition_sugg_localises, $sugg_location_id; global $deflt_docs_location; if ($acquisition_sugg_localises) { $sugg_location_id = (string) $sugg_location_id == "" ? $deflt_docs_location : $sugg_location_id; } // nombre de références par pages if (!$nb_per_page) { $nb_per_page = 10; } //Affichage form de recherche $titre = htmlentities($msg['recherche'] . ' : ' . $msg['acquisition_sug'], ENT_QUOTES, $charset); $action = "./acquisition.php?categ=sug&action=list&id_bibli=" . $id_bibli . "&user_input=&nb_per_page=" . $nb_per_page; $bouton_add = "<input class='bouton' type='button' value='" . $msg['acquisition_ajout_sug'] . "' onClick=\"document.location='./acquisition.php?categ=sug&sub=todo&action=modif&id_bibli=" . $id_bibli . "&sugg_location_id={$sugg_location_id}';\" />"; $lien_last_sug = ""; $sug_search_form = str_replace('!!form_title!!', $titre, $sug_search_form); $sug_search_form = str_replace('!!action!!', $action, $sug_search_form); $sug_search_form = str_replace('<!-- sel_state -->', $sug_map->getStateSelector(), $sug_search_form); $sug_search_form = str_replace('<!-- bouton_add -->', $bouton_add, $sug_search_form); $sug_search_form = str_replace('<!-- lien_last -->', $lien_last_sug, $sug_search_form); //Selecteur de localisation $list_locs = ''; if ($acquisition_sugg_localises) { if ($sugg_location_id) { $temp_location = $sugg_location_id; } else { $temp_location = 0; } $locs = new docs_location(); $list_locs = $locs->gen_combo_box_sugg($temp_location, 1, "submit();"); } $sug_search_form = str_replace('<!-- sel_location -->', $list_locs, $sug_search_form); //Selecteur de categories if ($acquisition_sugg_categ != '1') { $sel_categ = ""; } else { $tab_categ = suggestions_categ::getCategList(); $sel_categ = "<select class='saisie-25em' id='num_categ' name='num_categ' onchange=\"submit();\">"; $sel_categ .= "<option value='-1'>" . htmlentities($msg['acquisition_sug_tous'], ENT_QUOTES, $charset) . "</option>"; foreach ($tab_categ as $id_categ => $lib_categ) { $sel_categ .= "<option value='" . $id_categ . "' > "; $sel_categ .= htmlentities($lib_categ, ENT_QUOTES, $charset) . "</option>"; } $sel_categ .= "</select>"; } $sug_search_form = str_replace('<!-- sel_categ -->', $sel_categ, $sug_search_form); //Affichage du filtre par source $req = "select * from suggestions_source order by libelle_source"; $res = pmb_mysql_query($req, $dbh); $selected = ""; $option = "<option value='0'>" . htmlentities($msg['acquisition_sugg_all_sources'], ENT_QUOTES, $charset) . "</option>"; while ($src = pmb_mysql_fetch_object($res)) { $src->id_source == $filtre_src ? $selected = "selected" : ($selected = ""); $option .= "<option value='" . $src->id_source . "' {$selected}>" . htmlentities($src->libelle_source, ENT_QUOTES, $charset) . "</option>"; } $selecteur = " <select id='filtre_src' name='filtre_src' onchange=\"this.form.submit();\">" . $option . "</select>"; $sug_search_form = str_replace('!!sug_filtre_src!!', $selecteur, $sug_search_form); $user_name = $user_txt; if (!$user_txt && $user_id) { $req = "select concat(empr_nom,', ',empr_prenom) as nom from empr where id_empr='" . $user_id . "'"; $res = pmb_mysql_query($req, $dbh); $empr = pmb_mysql_fetch_object($res); $user_name = $empr->nom; } $sug_search_form = str_replace('!!user_txt!!', htmlentities($user_name, ENT_QUOTES, $charset), $sug_search_form); $sug_search_form = str_replace('!!user_id!!', htmlentities($user_id, ENT_QUOTES, $charset), $sug_search_form); $sug_search_form = str_replace('!!user_statut!!', htmlentities($user_statut, ENT_QUOTES, $charset), $sug_search_form); $sug_search_form = str_replace('!!user_input!!', htmlentities($user_input, ENT_QUOTES, $charset), $sug_search_form); print $sug_search_form; //Affiche par defaut toutes les categories de suggestions if ($acquisition_sugg_categ != '1') { $num_categ = "-1"; } else { if (!$num_categ) { $num_categ = '-1'; } print "<script type='text/javascript' >document.forms['search'].elements['num_categ'].value = '" . $num_categ . "';</script>"; } if (!$statut) { $statut = getSessionSugState(); //Recuperation du statut courant } else { setSessionSugState($statut); } print "<script type='text/javascript' >document.forms['search'].elements['statut'].value = '" . $statut . "';document.forms['search'].elements['user_input'].focus();\n\tdocument.forms['search'].elements['user_input'].select();</script>"; //Prise en compte du formulaire de recherche $mask = $sug_map->getMask_FILED(); // traitement de la saisie utilisateur require_once $class_path . "/analyse_query.class.php"; //comptage if (!$nbr_lignes) { if (!$user_input) { $nbr_lignes = suggestions::getNbSuggestions($id_bibli, $statut, $num_categ, $mask, 0, $sugg_location_id, '', $filtre_src, $user_id, $user_statut); } else { $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0); if ($aq->error) { error_message($msg["searcher_syntax_error"], sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message)); exit; } $nbr_lignes = suggestions::getNbSuggestions($id_bibli, $statut, $num_categ, $mask, $aq, $sugg_location_id, $user_input, $filtre_src, $user_id, $user_statut); } } else { $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0); } if (!$page) { $page = 1; } $debut = ($page - 1) * $nb_per_page; if ($nbr_lignes) { $url_base = "acquisition.php?categ=sug&action=list&id_bibli={$id_bibli}&user_input=" . rawurlencode(stripslashes($user_input)) . "&statut={$statut}&num_categ={$num_categ}&sugg_location_id={$sugg_location_id}&filtre_src={$filtre_src}&user_id={$user_id}&user_statut={$user_statut}"; //affichage if (!$user_input) { $q = suggestions::listSuggestions($id_bibli, $statut, $num_categ, $mask, $debut, $nb_per_page, 0, '', $sugg_location_id, '', $filtre_src, $user_id, $user_statut); } else { $q = suggestions::listSuggestions($id_bibli, $statut, $num_categ, $mask, $debut, $nb_per_page, $aq, '', $sugg_location_id, $user_input, $filtre_src, $user_id, $user_statut); } $res = pmb_mysql_query($q, $dbh); //Affichage liste des suggestions $nbr = pmb_mysql_num_rows($res); $aff_row = ""; $parity = 1; for ($i = 0; $i < $nbr; $i++) { $row = pmb_mysql_fetch_object($res); //recuperation origine $lib_orig = ""; $typ_orig = "0"; $q = suggestions_origine::listOccurences($row->id_suggestion, '1'); $list_orig = pmb_mysql_query($q, $dbh); if (pmb_mysql_num_rows($list_orig)) { $row_orig = pmb_mysql_fetch_object($list_orig); $orig = $row_orig->origine; $typ_orig = $row_orig->type_origine; } //Récupération du nom du créateur de la suggestion $idempr = 0; switch ($typ_orig) { default: case '0': $requete_user = "******" . $orig . "' limit 1 "; $res_user = pmb_mysql_query($requete_user, $dbh); $row_user = pmb_mysql_fetch_row($res_user); $lib_orig = $row_user[1]; if ($row_user[2]) { $lib_orig .= ", " . $row_user[2]; } break; case '1': $requete_empr = "SELECT id_empr, empr_nom, empr_prenom, empr_adr1 FROM empr where id_empr = '" . $orig . "' limit 1 "; $res_empr = pmb_mysql_query($requete_empr, $dbh); $row_empr = pmb_mysql_fetch_row($res_empr); $lib_orig = $row_empr[1]; if ($row_empr[2]) { $lib_orig .= ", " . $row_empr[2]; } $idempr = $row_empr[0]; break; case '2': $lib_orig = $orig; break; } $lib_statut = $sug_map->getHtmlComment($row->statut); $col2 = ""; if (trim($row->code) != "") { $col2 = htmlentities(trim($row->code), ENT_QUOTES, $charset) . "<br />"; } $col2 .= htmlentities(trim($row->titre), ENT_QUOTES, $charset); $col3 = ""; $col30 = ""; $col31 = ""; if (trim($row->auteur) != "") { $col30 = htmlentities(trim($row->auteur), ENT_QUOTES, $charset); } if (trim($row->editeur) != "") { $col31 = "[" . htmlentities(trim($row->editeur), ENT_QUOTES, $charset) . "]"; } $col3 = $col30; if ($col3 != "" && $col31 != "") { $col3 .= "<br />"; } $col3 .= $col31; if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript_l1 = "onmouseover=\"this.className='surbrillance';this.parentNode.rows[this.rowIndex+1].className='surbrillance';\" onmouseout=\"this.className='" . $pair_impair . "';this.parentNode.rows[this.rowIndex+1].className='" . $pair_impair . "'\" "; $tr_javascript_l2 = "onmouseover=\"this.className='surbrillance';this.parentNode.rows[this.rowIndex-1].className='surbrillance';\" onmouseout=\"this.className='" . $pair_impair . "';this.parentNode.rows[this.rowIndex-1].className='" . $pair_impair . "'\" "; $dn_javascript = "onmousedown=\"document.location='./acquisition.php?categ=sug&action=modif&id_bibli=" . $id_bibli . "&id_sug=" . $row->id_suggestion . "' \" "; if ($idempr) { $link_empr = "<a href='circ.php?categ=pret&id_empr={$idempr}'>"; $link_empr_fin = "</a>"; } else { $link_empr = ""; $link_empr_fin = ""; } $aff_row .= "<tr class='" . $pair_impair . "' " . $tr_javascript_l1 . " style='cursor: pointer' >\n\t\t\t\t\t\t<td " . $dn_javascript . " >" . formatdate($row->date_creation) . "<br />{$link_empr}" . htmlentities($lib_orig, ENT_QUOTES, $charset) . "{$link_empr_fin}</td>\n\t\t\t\t\t\t<td " . $dn_javascript . " >" . $col2 . "</td>\n\t\t\t\t\t\t<td " . $dn_javascript . " >" . $col3 . "</td>\n\t\t\t\t\t\t<td " . $dn_javascript . " >" . htmlentities($row->nb, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t\t<td " . $dn_javascript . " >" . htmlentities($row->prix, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t\t<td " . $dn_javascript . " >{$lib_statut}</td>"; if (!$row->num_notice) { $aff_row .= "<td " . $dn_javascript . " ></td>"; } else { $req_ana = "select analysis_bulletin as bull , analysis_notice as noti from analysis where analysis_notice ='" . $row->num_notice . "'"; $res_ana = pmb_mysql_query($req_ana, $dbh); $num_rows_ana = pmb_mysql_num_rows($res_ana); if ($num_rows_ana) { $ana = pmb_mysql_fetch_object($res_ana); $url_view = "catalog.php?categ=serials&sub=bulletinage&action=view&bul_id={$ana->bull}&art_to_show=" . $ana->noti; } else { $url_view = "./catalog.php?categ=isbd&id=" . $row->num_notice; } $aff_row .= "<td style='text-align:center;'><a href=\"" . $url_view . "\"><img border=\"0\" align=\"middle\" title=\"" . $msg['acquisition_sug_view_not'] . "\" alt=\"" . $msg['acquisition_sug_view_not'] . "\" src=\"./images/notice.gif\" /></a></td>"; } $sug_src = new suggestion_source($row->sugg_source); if ($acquisition_sugg_categ == '1') { $categ = new suggestions_categ($row->num_categ); $aff_row .= "<td " . $dn_javascript . " >" . htmlentities($categ->libelle_categ, ENT_QUOTES, $charset) . "<br />" . htmlentities($sug_src->libelle_source, ENT_QUOTES, $charset) . "</td>"; $colspan = '10'; } else { $aff_row .= "<td " . $dn_javascript . " >" . htmlentities($sug_src->libelle_source, ENT_QUOTES, $charset) . "</td>"; $colspan = '9'; } $sug = new suggestions($row->id_suggestion); $img_pj = "<a href=\"{$base_path}/explnum_doc.php?explnumdoc_id=" . $sug->get_explnum('id') . "\" target=\"_LINK_\"><img src='{$base_path}/images/globe_orange.png' /></a>"; $img_import = "<a href=\"{$base_path}/acquisition.php?categ=sug&sub=import&explnumdoc_id=" . $sug->get_explnum('id') . " \"><img src='{$base_path}/images/upload.gif' /></a>"; $aff_row .= "<td align='center'><i>" . ($sug->get_explnum('id') ? "{$img_pj} {$img_import}" : '') . "</i></td>"; $aff_row .= "<td ><input type='checkbox' id='chk[" . $row->id_suggestion . "]' name='chk[]' value='" . $row->id_suggestion . "' /></td>\n\t\t\t\t\t</tr>"; $aff_row .= "\t\t<tr class='" . $pair_impair . "' " . $tr_javascript_l2 . " style='cursor: pointer' >\n\t\t\t\t\t\t<td colspan='" . $colspan . "' " . $dn_javascript . " ><i>" . htmlentities($row->commentaires, ENT_QUOTES, $charset) . "</i></td>\n\t\t\t\t\t</tr>"; } $sug_list_form = str_replace('<!-- sug_list -->', $aff_row, $sug_list_form); //Affichage des boutons //Bouton Imprimer $imp = "openPopUp('./pdf.php?pdfdoc=listsug&user_input=" . urlencode(stripslashes($user_input)) . "&statut=" . $statut . "&num_categ=" . $num_categ . "&sugg_location_id=" . $sugg_location_id . "' ,'print_PDF', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');"; $bt_imp = str_replace('!!imp!!', $imp, $bt_imp); $sug_list_form = str_replace('<!-- bt_imp -->', $bt_imp, $sug_list_form); //Génération de la liste des conversions possibles $catalog = _parser_text_no_function_(file_get_contents($base_path . "/admin/convert/imports/catalog.xml"), "CATALOG"); $list_export = "<select name='export_list'>"; for ($i = 0; $i < count($catalog["ITEM"]); $i++) { $item = $catalog["ITEM"][$i]; if ($item["EXPORT"] == "yes") { $list_export .= "<option value='" . $i . "'>" . htmlentities($item["EXPORTNAME"], ENT_QUOTES, $charset) . "</option>\n"; } } $list_export .= "</select>"; $bt_exporter = str_replace("<!-- list_export -->", $list_export, $bt_exporter); //Lien vers la page suivante $link_export = "document.sug_list_form.action='acquisition.php?categ=sug&sub=export'; document.sug_list_form.submit();"; $bt_exporter = str_replace("!!exp!!", $link_export, $bt_exporter); $sug_list_form = str_replace('<!-- bt_exporter -->', $bt_exporter, $sug_list_form); //Bouton Sélectionner $sug_list_form = str_replace('<!-- bt_chk -->', $bt_chk, $sug_list_form); //Liste Boutons $button_list = $sug_map->getButtonList($statut); $sug_list_form = str_replace('<!-- bt_list -->', $button_list, $sug_list_form); //Bouton Reprendre $bt_todo = $sug_map->getButtonList_TODO($statut); $sug_list_form = str_replace('<!-- bt_todo -->', $bt_todo, $sug_list_form); if ($acquisition_sugg_categ == '1') { //Selecteur Affecter a une categorie $to_categ = $sug_map->getCategModifier($statut, $num_categ, $nb_per_page); } else { $to_categ = ""; } $sug_list_form = str_replace('<!-- to_categ -->', $to_categ, $sug_list_form); //Bouton Supprimer $button_sup = $sug_map->getButtonList_DELETED($statut); $sug_list_form = str_replace('<!-- bt_sup -->', $button_sup, $sug_list_form); //JavaScript $script_list = $sug_map->getScriptList($statut, $num_categ, $nb_per_page); $script = str_replace('<!-- script_list -->', $script_list, $script); $sug_list_form = str_replace('<!-- script -->', $script, $sug_list_form); //Barre de navigation if (!$last_param) { $nav_bar = aff_pagination($url_base, $nbr_lignes, $nb_per_page, $page, 10, true, true); } else { $nav_bar = ""; } $sug_list_form = str_replace('<!-- nav_bar -->', $nav_bar, $sug_list_form); print $sug_list_form; } else { // la requête n'a produit aucun résultat error_message($msg['acquisition_sug_rech'], str_replace('!!sug_cle!!', stripslashes($user_input), $msg['acquisition_sug_rech_error']), 0, './categ=sug&sub=todo&action=list&id_bibli=' . $id_bibli); } }
public function maj_indexation($datatype = 'all') { global $include_path; global $dbh, $champ_base; //recuperation du fichier xml de configuration if (!count($champ_base)) { $file = $include_path . "/indexation/editorial_content/" . $this->type . "_subst.xml"; if (!file_exists($file)) { $file = $include_path . "/indexation/editorial_content/" . $this->type . ".xml"; } $fp = fopen($file, "r"); if ($fp) { $xml = fread($fp, filesize($file)); } fclose($fp); $champ_base = _parser_text_no_function_($xml, "INDEXATION"); } $tableau = $champ_base; //analyse des donnees des tables $temp_not = array(); $temp_not['t'][0][0] = $tableau['REFERENCE'][0][value]; $temp_ext = array(); $temp_marc = array(); $champ_trouve = false; $tab_code_champ = array(); $tab_languages = array(); $tab_keep_empty = array(); $tab_pp = array(); for ($i = 0; $i < count($tableau['FIELD']); $i++) { //pour chacun des champs decrits //recuperation de la liste des informations a mettre a jour if ($datatype == 'all' || $datatype == $tableau['FIELD'][$i]['DATATYPE']) { //conservation des mots vides if ($tableau['FIELD'][$i]['KEEPEMPTYWORD'] == "yes") { $tab_keep_empty[] = $tableau['FIELD'][$i]['ID']; } //champ perso if ($tableau['FIELD'][$i]['DATATYPE'] == "custom_field") { $tab_pp[$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i]['TABLE'][0]['value']; } else { if ($tableau['FIELD'][$i]['EXTERNAL'] == "yes") { //champ externe à la table notice //Stockage de la structure pour un accès plus facile $temp_ext[$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i]; } else { //champ de la table notice $temp_not['f'][0][$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value']; $tab_code_champ[0][$tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value']] = array('champ' => $tableau['FIELD'][$i]['ID'], 'ss_champ' => 0, 'pond' => $tableau['FIELD'][$i]['POND'], 'no_words' => $tableau['FIELD'][$i]['DATATYPE'] == "marclist" ? true : false); if ($tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['MARCTYPE']) { $tab_code_champ[0][$tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value']]['marctype'] = $tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['MARCTYPE']; } } } $champ_trouve = true; } } if ($champ_trouve) { $tab_req = array(); //Recherche des champs directs if ($datatype == 'all') { $tab_req[0]["rqt"] = "select " . implode(',', $temp_not['f'][0]) . " from " . $temp_not['t'][0][0]; $tab_req[0]["rqt"] .= " where " . $tableau['REFERENCEKEY'][0][value] . "='" . $this->id . "'"; $tab_req[0]["table"] = $temp_not['t'][0][0]; } foreach ($temp_ext as $k => $v) { //Construction de la requete //Champs pour le select $select = array(); //on harmonise les fichiers XML décrivant des requetes... for ($i = 0; $i < count($v["TABLE"]); $i++) { $table = $v['TABLE'][$i]; $select = array(); for ($j = 0; $j < count($table['TABLEFIELD']); $j++) { $select[] = ($table['ALIAS'] ? $table['ALIAS'] . "." : "") . $table['TABLEFIELD'][$j]["value"]; if ($table['LANGUAGE']) { $select[] = $table['LANGUAGE'][0]['value']; $tab_languages[$k] = $table['LANGUAGE'][0]['value']; } $field_name = $table['TABLEFIELD'][$j]["value"]; if (strpos($table['TABLEFIELD'][$j]["value"], ".") !== false) { $field_name = substr($table['TABLEFIELD'][$j]["value"], strpos($table['TABLEFIELD'][$j]["value"], ".") + 1); } $tab_code_champ[$v['ID']][$field_name] = array('champ' => $v['ID'], 'ss_champ' => $table['TABLEFIELD'][$j]["ID"], 'pond' => $table['TABLEFIELD'][$j]['POND'], 'no_words' => $tableau['FIELD'][$i]['DATATYPE'] == "marclist" ? true : false); if ($v['TABLEFIELD'][$j]['marclist']) { $tab_code_champ[$v['ID']][$v['TABLEFIELD'][$j]["value"]]['marctype'] = $v['TABLEFIELD'][$j]['marctype']; } } $query = "select " . implode(",", $select) . " from " . $tableau['REFERENCE'][0]['value']; $jointure = ""; for ($j = 0; $j < count($table['LINK']); $j++) { $link = $table['LINK'][$j]; if ($link["TABLE"][0]['ALIAS']) { $alias = $link["TABLE"][0]['ALIAS']; } else { $alias = $link["TABLE"][0]['value']; } switch ($link["TYPE"]) { case "n1": if ($link["TABLEKEY"][0]['value']) { $jointure .= " JOIN " . $link["TABLE"][0]['value'] . ($link["TABLE"][0]['value'] != $alias ? " AS " . $alias : ""); if ($link["EXTERNALTABLE"][0]['value']) { $jointure .= " ON " . $link["EXTERNALTABLE"][0]['value'] . "." . $link["EXTERNALFIELD"][0]['value']; } else { $jointure .= " ON " . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value']; } $jointure .= "=" . $alias . "." . $link["TABLEKEY"][0]['value']; } else { $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : ""); $jointure .= " ON " . $tableau['REFERENCE'][0]['value'] . "." . $tableau['REFERENCEKEY'][0]['value']; $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value']; } break; case "1n": $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : ""); $jointure .= " ON (" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $table["TABLEKEY"][0]['value']; $jointure .= "=" . $tableau['REFERENCE'][0]['value'] . "." . $link["REFERENCEFIELD"][0]['value'] . ") "; break; case "nn": $jointure .= " JOIN " . $link["TABLE"][0]['value'] . ($link["TABLE"][0]['value'] != $alias ? " AS " . $alias : ""); $jointure .= " ON (" . $tableau['REFERENCE'][0]['value'] . "." . $tableau['REFERENCEKEY'][0]['value']; $jointure .= "=" . $alias . "." . $link["REFERENCEFIELD"][0]['value'] . ") "; if ($link["TABLEKEY"][0]['value']) { $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : ""); $jointure .= " ON (" . $alias . "." . $link["TABLEKEY"][0]['value']; $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value'] . ") "; } else { $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : ""); $jointure .= " ON (" . $alias . "." . $link["EXTERNALFIELD"][0]['value']; $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $table["TABLEKEY"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value'] . ") "; } break; } } if ($table['LANGUAGE']) { $tab_req_lang[$k] = "select " . $table['LANGUAGE'][0]['value'] . " from "; } $query .= $jointure . " where " . $temp_not['t'][0][0] . "." . $tableau['REFERENCEKEY'][0][value] . "=" . $this->id; if ($table['LANGUAGE']) { $tab_req_lang[$k] .= $jointure . " where " . $temp_not['t'][0][0] . "." . $tableau['REFERENCEKEY'][0][value] . "=" . $this->id; } $tab_req[$k]["new_rqt"]['rqt'][] = $query; } $tab_req[$k]["rqt"] = implode(" union ", $tab_req[$k]["new_rqt"]['rqt']); } //qu'est-ce qu'on efface? if ($datatype == "all") { $req_del = "delete from cms_editorial_words_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "'"; pmb_mysql_query($req_del, $dbh); //la table pour les recherche exacte $req_del = "delete from cms_editorial_fields_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "'"; pmb_mysql_query($req_del, $dbh); } else { foreach ($tab_code_champ as $subfields) { foreach ($subfields as $subfield) { $req_del = "delete from cms_editorial_words_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $subfield['champ'] . "'"; pmb_mysql_query($req_del, $dbh); //la table pour les recherche exacte $req_del = "delete from cms_editorial_fields_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $subfield['champ'] . "'"; pmb_mysql_query($req_del, $dbh); break; } } //Les champs perso if (count($tab_pp)) { foreach ($tab_pp as $id) { $req_del = "delete from cms_editorial_words_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $id . "' "; pmb_mysql_query($req_del, $dbh); //la table pour les recherche exacte $req_del = "delete from cms_editorial_fields_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $id . "' "; pmb_mysql_query($req_del, $dbh); } } } //qu'est-ce qu'on met a jour ? $tab_insert = array(); $tab_field_insert = array(); foreach ($tab_req as $k => $v) { $r = pmb_mysql_query($v["rqt"], $dbh); $tab_mots = array(); $tab_fields = array(); if (pmb_mysql_num_rows($r)) { while ($tab_row = pmb_mysql_fetch_array($r, MYSQL_ASSOC)) { if (isset($tab_row[$tab_languages[$k]])) { $lang = $tab_row[$tab_languages[$k]]; unset($tab_row[$tab_languages[$k]]); } else { $lang = ""; } foreach ($tab_row as $nom_champ => $liste_mots) { if ($tab_code_champ[$k][$nom_champ]['marctype']) { $marclist = new marc_list($tab_code_champ[$k][$nom_champ]['marctype']); $liste_mots = $marclist->table[$liste_mots]; } if ($liste_mots != '') { $liste_mots = strip_tags($liste_mots); $tab_tmp = array(); if (!in_array($k, $tab_keep_empty)) { $tab_tmp = explode(' ', strip_empty_words($liste_mots)); } else { $tab_tmp = explode(' ', strip_empty_chars(clean_string($liste_mots))); } // if($lang!="") $tab_tmp[]=$lang; //la table pour les recherche exacte if (!$tab_fields[$nom_champ]) { $tab_fields[$nom_champ] = array(); } $tab_fields[$nom_champ][] = array('value' => trim($liste_mots), 'lang' => $lang); if (!$tab_code_champ[$k][$nom_champ]['no_words']) { foreach ($tab_tmp as $mot) { if (trim($mot)) { $tab_mots[$nom_champ][$mot] = $lang; } } } } } } } foreach ($tab_mots as $nom_champ => $tab) { $pos = 1; foreach ($tab as $mot => $lang) { //on cherche le mot dans la table de mot... $num_word = 0; $query = "select id_word from words where word = '" . $mot . "' and lang = '" . $lang . "'"; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $num_word = pmb_mysql_result($result, 0, 0); } else { $dmeta = new DoubleMetaPhone($mot); $stemming = new stemming($mot); $element_to_update = ""; if ($dmeta->primary || $dmeta->secondary) { $element_to_update .= "\n\t\t\t\t\t\t\t\tdouble_metaphone = '" . $dmeta->primary . " " . $dmeta->secondary . "'"; } if ($element_to_update) { $element_to_update .= ","; } $element_to_update .= "stem = '" . $stemming->stem . "'"; $query = "insert into words set word = '" . $mot . "', lang = '" . $langage . "'" . ($element_to_update ? ", " . $element_to_update : ""); pmb_mysql_query($query); $num_word = pmb_mysql_insert_id(); } if ($num_word != 0) { $tab_insert[] = "(" . $this->id . ",'" . $this->type . "'," . $tab_code_champ[$k][$nom_champ]['champ'] . "," . $tab_code_champ[$k][$nom_champ]['ss_champ'] . "," . $num_word . "," . $tab_code_champ[$k][$nom_champ]['pond'] . ",{$pos})"; $pos++; } } } //la table pour les recherche exacte foreach ($tab_fields as $nom_champ => $tab) { foreach ($tab as $order => $values) { //$tab_field_insert[]="(".$this->id.",".$tab_code_champ[$v["table"]][$nom_champ][0].",".$tab_code_champ[$v["table"]][$nom_champ][1].",".$order.",'".addslashes($values['value'])."','".addslashes($values['lang'])."',".$tab_code_champ[$v["table"]][$nom_champ][2].")"; $tab_field_insert[] = "(" . $this->id . ",'" . $this->type . "'," . $tab_code_champ[$k][$nom_champ]['champ'] . "," . $tab_code_champ[$k][$nom_champ]['ss_champ'] . "," . $order . ",'" . addslashes($values['value']) . "','" . addslashes($values['lang']) . "'," . $tab_code_champ[$k][$nom_champ]['pond'] . ")"; } } } //Les champs perso if (count($tab_pp)) { foreach ($tab_pp as $code_champ => $table) { $p_perso = new cms_editorial_parametres_perso($this->num_type); $data = $p_perso->get_fields_recherche_mot($this->id); $j = 0; foreach ($data as $code_ss_champ => $value) { $tab_mots = array(); $tab_tmp = explode(' ', strip_empty_words($value)); //la table pour les recherche exacte $tab_field_insert[] = "(" . $this->id . ",'" . $this->type . "'," . $code_champ . "," . $code_ss_champ . "," . $j . ",'" . addslashes(trim($value)) . "',''," . $p_perso->get_pond($code_ss_champ) . ")"; $j++; foreach ($tab_tmp as $mot) { if (trim($mot)) { $tab_mots[$mot] = ""; } } $pos = 1; foreach ($tab_mots as $mot => $lang) { //on cherche le mot dans la table de mot... $query = "select id_word from words where word = '" . $mot . "' and lang = '" . $lang . "'"; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $num_word = pmb_mysql_result($result, 0, 0); } else { $query = "insert into words set word = '" . $mot . "', lang = '" . $lang . "'"; pmb_mysql_query($query); $num_word = pmb_mysql_insert_id(); } $tab_insert[] = "(" . $this->id . ",'" . $this->type . "'," . $code_champ . "," . $code_ss_champ . "," . $num_word . "," . $p_perso->get_pond($code_ss_champ) . ",{$pos})"; $pos++; } } } } $req_insert = "insert into cms_editorial_words_global_index(num_obj,type,code_champ,code_ss_champ,num_word,pond,position) values " . implode(',', $tab_insert); pmb_mysql_query($req_insert, $dbh); //la table pour les recherche exacte $req_insert = "insert into cms_editorial_fields_global_index(num_obj,type,code_champ,code_ss_champ,ordre,value,lang,pond) values " . implode(',', $tab_field_insert); pmb_mysql_query($req_insert, $dbh); } }
/** * Parse le fichier xml */ private function parse_file() { global $base_path, $include_path; global $msg; if (!$this->xml_file) { $this->xml_file = "display_tabs"; } if (!$this->full_path) { $filepath = $include_path . "/authorities/" . $this->xml_file . "_subst.xml"; if (!file_exists($filepath)) { $filepath = $include_path . "/authorities/" . $this->xml_file . ".xml"; } } else { $filepath = $this->full_path . $this->xml_file . "_subst.xml"; if (!file_exists($filepath)) { $filepath = $this->full_path . $this->xml_file . ".xml"; } } $fileInfo = pathinfo($filepath); $tempFile = $base_path . "/temp/XML" . preg_replace("/[^a-z0-9]/i", "", $fileInfo['dirname'] . $fileInfo['filename'] . $charset) . ".tmp"; $dejaParse = false; if (file_exists($tempFile)) { //Le fichier XML original a-t-il été modifié ultérieurement ? if (filemtime($filepath) > filemtime($tempFile)) { //on va re-générer le pseudo-cache unlink($tempFile); } else { $dejaParse = true; } } if ($dejaParse) { $tmp = fopen($tempFile, "r"); $cache = unserialize(fread($tmp, filesize($tempFile))); fclose($tmp); if (count($cache) == 1) { $this->tabs = $cache[0]; } else { //SOUCIS de cache... unlink($tempFile); $this->parse_search_file(); } } else { $fp = fopen($filepath, "r") or die("Can't find XML file"); $size = filesize($filepath); $xml = fread($fp, $size); fclose($fp); $tabs = _parser_text_no_function_($xml, "PMBTABS"); $this->tabs = array(); //Lecture des onglets foreach ($tabs['TAB'] as $tab) { $current_tab = new elements_list_tab($tab['NAME'], get_msg_to_display($tab['LABEL']), $tab['CONTENTTYPE']); if ($tab['CONTENTTYPE'] == 'authorities') { // Si on a affaire à un onlget d'autorité, on regarde s'il est spécialisé dans un type d'autorité if ($tab['AUTHORITYTYPE'][0]['value'] && defined($tab['AUTHORITYTYPE'][0]['value'])) { $current_tab->set_content_authority_type(constant($tab['AUTHORITYTYPE'][0]['value'])); } } // on récupère les éléments de requête if ($tab['QUERY'][0]) { $query_elements = $this->parse_query_elements($tab['QUERY'][0]); $current_tab->set_query_elements($query_elements); } // on récupère le callable if ($tab['CALLABLE'][0]) { $callable = $this->parse_callable($tab['CALLABLE'][0]); $current_tab->set_callable($callable); } // on récupère les filtres if ($tab['FILTERS'][0]['FILTER']) { $filters = $this->parse_filters($tab['FILTERS'][0]['FILTER']); $current_tab->set_filters($filters); } $this->tabs[$tab['FOR']][] = $current_tab; } $tmp = fopen($tempFile, "wb"); fwrite($tmp, serialize(array($this->tabs))); fclose($tmp); } }
function amazon($connector_path = "") { parent::connector($connector_path); $xml = file_get_contents($connector_path . "/profil.xml"); $this->profile = _parser_text_no_function_($xml, "AWSCONFIG"); }
function createNewTask($id_tache, $id_type_tache, $id_planificateur) { global $base_path; if (!$id_tache) { throw new Exception("Missing parameter: id_tache"); } if (file_exists($base_path . "/admin/planificateur/catalog_subst.xml")) { $filename = $base_path . "/admin/planificateur/catalog_subst.xml"; } else { $filename = $base_path . "/admin/planificateur/catalog.xml"; } $xml = file_get_contents($filename); $param = _parser_text_no_function_($xml, "CATALOG"); foreach ($param["ACTION"] as $anitem) { if ($id_type_tache == $anitem["ID"]) { require_once $base_path . "/admin/planificateur/" . $anitem["NAME"] . "/" . $anitem["NAME"] . ".class.php"; $obj_type = new $anitem["NAME"]($id_tache); $obj_type->calcul_execution($id_planificateur); $obj_type->insertOfTask($id_planificateur); } } }
self.close(); </script> <?php } else { ?> <h3><?php echo $msg[procs_options_param] . $name; ?> </h3><hr /> <?php if (!$options) { $options = "<OPTIONS></OPTIONS>"; } $param = _parser_text_no_function_("<?xml version='1.0' encoding='" . $charset . "'?>\n" . $options, "OPTIONS"); if ($param["FOR"] != "url") { $param = array(); $param["FOR"] = "url"; } //Formulaire ?> <form class='form-<?php echo $current_module; ?> ' name="formulaire" action="options_url.php" method="post"> <h3><?php echo $type_list_empr[$type]; ?>
function search($source_id, $query, $search_id) { global $base_path, $charset, $include_path; //global $url,$z3950_base,$z3950_login,$z3950_password,$z3950_max_notices,$z3950_format,$z3950_port,$z3950_convert,$z3950_profil; $this->error = false; $this->error_message = ""; $params = $this->get_source_params($source_id); $this->fetch_global_properties(); if ($params["PARAMETERS"]) { //Affichage du formulaire avec $params["PARAMETERS"] $vars = unserialize($params["PARAMETERS"]); foreach ($vars as $key => $val) { global ${$key}; ${$key} = $val; } } if (!($z3950_max_notices * 1)) { $z3950_max_notices = 100; } //Tranformation de la recherche en requete rpn bib1 $rpn = $this->parse_query($query); $zurl = $url . ($z3950_port ? ":" . $z3950_port : "") . ($z3950_base ? "/" . $z3950_base : ""); $opts = array(); if ($z3950_login) { $opts["user"] = $z3950_login; } if ($z3950_password) { $opts["password"] = $z3950_password; } $opts["piggyback"] = false; $yaz_id = yaz_connect($zurl, $opts); yaz_element($yaz_id, "F"); yaz_range($yaz_id, 1, $z3950_max_notices); yaz_syntax($yaz_id, strtolower($z3950_format)); yaz_search($yaz_id, "rpn", $rpn . " "); $opts_wait = array("timeout" => $params["TIMEOUT"]); yaz_wait($opts_wait); if (yaz_error($yaz_id)) { $this->error = true; $this->error_message = yaz_error($yaz_id); } else { $n_results = yaz_hits($yaz_id); if ($n_results > $z3950_max_notices) { $n_results = $z3950_max_notices; } $convert_order = $this->get_convert_order($z3950_convert); for ($k = 1; $k <= $n_results; $k++) { $notice = yaz_record($yaz_id, $k, "raw"); //Conversion de la notice if ($z3950_convert) { $export = new convert($notice, $convert_order); if (!$export->error) { $cnotice = $export->output_notice; } else { $cnotice = ""; } } else { $cnotice = $notice; } if ($cnotice) { //Conversion de la notice en XML $xmlunimarc = new xml_unimarc(); $nxml = $xmlunimarc->iso2709toXML_notice($cnotice); if ($xmlunimarc->is_utf8) { $rcharset = "utf-8"; } else { $rcharset = $charset; } $xmlunimarc->notices_xml_[0] = '<?xml version="1.0" encoding="' . $rcharset . '"?>' . $xmlunimarc->notices_xml_[0]; if ($xslt_exemplaire) { $xmlunimarc->notices_xml_[0] = $this->apply_xsl_to_xml($xmlunimarc->notices_xml_[0], $xslt_exemplaire["content"]); } // print_r($xmlunimarc->notices_xml_[0]); if ($nxml >= 1) { $params = _parser_text_no_function_($xmlunimarc->notices_xml_[0], "NOTICE"); $this->rec_record($params, $source_id, $search_id); } } } } }