Subversion Repositories Web Services

Compare Revisions

Ignore whitespace Rev 117962 → Rev 117964

/OpenSearch/trunk/server.php
File deleted
/OpenSearch/trunk/dcterms_os.xsd
File deleted
/OpenSearch/trunk/soap.xsd
File deleted
/OpenSearch/trunk/dkabm_types.xsd
File deleted
/OpenSearch/trunk/xml/request/6.sorting.xml
File deleted
/OpenSearch/trunk/xml/request/3.simple_facet.xml
File deleted
/OpenSearch/trunk/xml/request/info.html
File deleted
/OpenSearch/trunk/xml/request/7.rank.xml
File deleted
/OpenSearch/trunk/xml/request/5.relations.xml
File deleted
/OpenSearch/trunk/xml/request/2.cql_search.xml
File deleted
/OpenSearch/trunk/xml/request/17.relations_uri.xml
File deleted
/OpenSearch/trunk/xml/request/15.get_object_relations.xml
File deleted
/OpenSearch/trunk/xml/request/1.simple_search.xml
File deleted
/OpenSearch/trunk/xml/request/9.user_defined_rank.xml
File deleted
/OpenSearch/trunk/xml/request/11.user_defined_boost_and_rank.xml
File deleted
/OpenSearch/trunk/xml/request/10.user_defined_boost.xml
File deleted
Property changes:
Deleted: svn:mergeinfo
## -0,0 +0,0 ##
Index: OpenSearch/trunk/xml/request/18.info.xml
===================================================================
--- OpenSearch/trunk/xml/request/18.info.xml (revision 117962)
+++ OpenSearch/trunk/xml/request/18.info.xml (nonexistent)
@@ -1,9 +0,0 @@
-
-
-
-
- 100200
- test
-
-
-
Index: OpenSearch/trunk/xml/request/12.get_object_dkabm.xml
===================================================================
--- OpenSearch/trunk/xml/request/12.get_object_dkabm.xml (revision 117962)
+++ OpenSearch/trunk/xml/request/12.get_object_dkabm.xml (nonexistent)
@@ -1,11 +0,0 @@
-
-
-
-
- 100200
- test
- 870970-basis:28540167
- dkabm
-
-
-
Index: OpenSearch/trunk/xml/request/16.relations_type.xml
===================================================================
--- OpenSearch/trunk/xml/request/16.relations_type.xml (revision 117962)
+++ OpenSearch/trunk/xml/request/16.relations_type.xml (nonexistent)
@@ -1,13 +0,0 @@
-
-
-
-
- menneskehavn
- 100200
- test
- type
- 1
- 10
-
-
-
Index: OpenSearch/trunk/xml/request/13.get_object_docbook.xml
===================================================================
--- OpenSearch/trunk/xml/request/13.get_object_docbook.xml (revision 117962)
+++ OpenSearch/trunk/xml/request/13.get_object_docbook.xml (nonexistent)
@@ -1,11 +0,0 @@
-
-
-
-
- 100200
- test
- 150016:clod00
- docbook
-
-
-
Index: OpenSearch/trunk/xml/request/4.several_facets.xml
===================================================================
--- OpenSearch/trunk/xml/request/4.several_facets.xml (revision 117962)
+++ OpenSearch/trunk/xml/request/4.several_facets.xml (nonexistent)
@@ -1,19 +0,0 @@
-
-
-
-
- danmark
- 100200
- test
-
- 10
- count
- 1
- facet.creator
- facet.type
-
- 1
- 1
-
-
-
Index: OpenSearch/trunk/xml/request/14.get_object_marcxchange.xml
===================================================================
--- OpenSearch/trunk/xml/request/14.get_object_marcxchange.xml (revision 117962)
+++ OpenSearch/trunk/xml/request/14.get_object_marcxchange.xml (nonexistent)
@@ -1,11 +0,0 @@
-
-
-
-
- 100200
- test
- 870970-basis:28540167
- marcxchange
-
-
-
Index: OpenSearch/trunk/fedora_rel.html
===================================================================
--- OpenSearch/trunk/fedora_rel.html (revision 117962)
+++ OpenSearch/trunk/fedora_rel.html (nonexistent)
@@ -1,63 +0,0 @@
-
-
- Find fedora relationer og tilhørende poster
-
-
-
-
-
-
-
-
-
- FedoraUrl:
-
-
-
- __FEDORA_URL_OPTIONS__
-
-
-
-
-
- Pid:
-
-
-
-
-
-
-
-
- Find posten
-
-
-
-
-
- __CONTENT__
-
-
Index: OpenSearch/trunk/dkdcplus.xsd
===================================================================
--- OpenSearch/trunk/dkdcplus.xsd (revision 117962)
+++ OpenSearch/trunk/dkdcplus.xsd (nonexistent)
@@ -1,1394 +0,0 @@
-
-
-
-
- XML Schema for the dkdcplus namespace.
- Updated 2011-09-01 by DBC A/S.
-
- XML Schema for the dkdcplus namespace.
- Updated 2008-11-19 by Leif Andresen.
-
- Created 2005-11-13 by Per M. Hansen, Index Data.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Skuespiller
- Actor
-
-
-
-
-
-
-
-
-
-
-
- Forfatter til efterord, efterskrift etc.
- Author of afterword, colophon etc.
-
-
-
-
-
-
-
-
-
-
-
- Animator
- Animator
-
-
-
-
-
-
-
-
-
-
-
- Forfatter til forlæg
- Bibliographic antecedent
-
-
-
-
-
-
-
-
-
-
-
- Arrangør
- Arranger
-
-
-
-
-
-
-
-
-
-
-
- Kunstner
- Artist
-
-
-
-
-
-
-
-
-
-
-
- Dialogforfatter
- Author of dialog
-
-
-
-
-
-
-
-
-
-
-
- Forfatter til forord, introduktion etc.
- Author of introduction, etc.
-
-
-
-
-
-
-
-
-
-
-
- Manuskriptforfatter
- Author of screenplay
-
-
-
-
-
-
-
-
-
-
-
- Forfatter
- Author
-
-
-
-
-
-
-
-
-
-
-
- Idemager
- Conceptor
-
-
-
-
-
-
-
-
-
-
-
- Koreograf
- Choreographer
-
-
-
-
-
-
-
-
-
-
-
- På vegne af
- Client
-
-
-
-
-
-
-
-
-
-
-
- Kalligraf
- Calligrapher
-
-
-
-
-
-
-
-
-
-
-
- Kommentator
- Commentator
-
-
-
-
-
-
-
-
-
-
-
- Komponist
- Composer
-
-
-
-
-
-
-
-
-
-
-
- Dirigent
- Conductor
-
-
-
-
-
-
-
-
-
-
-
- Filmfotograf
- Cinematographer
-
-
-
-
-
-
-
-
-
-
-
- Udgiver
- Compiler
-
-
-
-
-
-
-
-
-
-
-
- Skaber
- Creator
-
-
-
-
-
-
-
-
-
-
-
- Bidragyder
- Contributor
-
-
-
-
-
-
-
-
-
-
-
- Korttegner
- Cartographer
-
-
-
-
-
-
-
-
-
-
-
- Ansvarlig institution
-
-
-
-
-
-
-
-
-
-
-
- Bearbejder
-
-
-
-
-
-
-
-
-
-
-
- Designer
-
-
-
-
-
-
-
-
-
-
-
- Ophav til figurer
-
-
-
-
-
-
-
-
-
-
-
- Farvelægger
-
-
-
-
-
-
-
-
-
-
-
- Indlæser
-
-
-
-
-
-
-
-
-
-
-
- Medredaktør
-
-
-
-
-
-
-
-
-
-
-
- Medforfatter
-
-
-
-
-
-
-
-
-
-
-
- Ophav til mønstre
-
-
-
-
-
-
-
-
-
-
-
- Ophav til opskrifter
-
-
-
-
-
-
-
-
-
-
-
- Referent
-
-
-
-
-
-
-
-
-
-
-
- Forfatter til mindre tekstdele
-
-
-
-
-
-
-
-
-
-
-
- Danser
- Dancer
-
-
-
-
-
-
-
-
-
-
-
- Tegner
- Draftsman
-
-
-
-
-
-
-
-
-
-
-
- Instruktør
- Director
-
-
-
-
-
-
-
-
-
-
-
- Festskriftsmodtager
- Dedicatee
-
-
-
-
-
-
-
-
-
-
-
- Redaktør
- Editor
-
-
-
-
-
-
-
-
-
-
-
- Illustrator
- Illustrator
-
-
-
-
-
-
-
-
-
-
-
- Udvikler
- Inventor
-
-
-
-
-
-
-
-
-
-
-
- Instrumentalist
- Instrumentalist
-
-
-
-
-
-
-
-
-
-
-
- Interviewede
- Interviwee
-
-
-
-
-
-
-
-
-
-
-
- Interviewer
- Interviewer
-
-
-
-
-
-
-
-
-
-
-
- Librettist
- Librettist
-
-
-
-
-
-
-
-
-
-
-
- Litograf
- Lithographer
-
-
-
-
-
-
-
-
-
-
-
- Forfatter til sangtekst
- Lyricist
-
-
-
-
-
-
-
-
-
-
-
- Musiker
- Musician
-
-
-
-
-
-
-
-
-
-
-
- Fortæller
- Narrator
-
-
-
-
-
-
-
-
-
-
-
- Mødearrangør
- Organizer of meeting
-
-
-
-
-
-
-
-
-
-
-
- Udefineret funktion
- Other
-
-
-
-
-
-
-
-
-
-
-
- Fotograf
- Photographer
-
-
-
-
-
-
-
-
-
-
-
- Performer
- Performer
-
-
-
-
-
-
-
-
-
-
-
- Programmør
- Programmer
-
-
-
-
-
-
-
-
-
-
-
- Producer
- Producer
-
-
-
-
-
-
-
-
-
-
-
- Tekniker
- Recording engineer
-
-
-
-
-
-
-
-
-
-
-
- Researcher
- Researcher
-
-
-
-
-
-
-
-
-
-
-
- Anmelder
- Reviewer
-
-
-
-
-
-
-
-
-
-
-
- Skulptør
- Sculptor
-
-
-
-
-
-
-
-
-
-
-
- Sanger
- Singer
-
-
-
-
-
-
-
-
-
-
-
- Kunstnerisk fortæller
- Storyteller
-
-
-
-
-
-
-
-
-
-
-
- Oversætter
- Translator
-
-
-
-
-
-
-
-
-
-
-
- Træskærer
- Woodcutter
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: OpenSearch/trunk/includes/ws_search_func.phpi
===================================================================
--- OpenSearch/trunk/includes/ws_search_func.phpi (revision 117962)
+++ OpenSearch/trunk/includes/ws_search_func.phpi (nonexistent)
@@ -1,117 +0,0 @@
-
-
-define("MAX_STEP", 10);
-$CCL_PATH = "./";
-
-require('targets.phpi');
-require('cql_func.phpi');
-require('search_func.phpi');
-
-function backend_search($cql, $schema, $start, $step) {
- global $TARGET;
-
- $xml_head = '' . "\n";
-// $rec_head = '
-//xmlns:vip="http://webservice.bibliotek.dbc.dk/bibliotek/meta/"
-//xmlns:xsi="http://www.w3.org/2001/XMLSchma-instance"
-//xsi:schemaLocation="http://webservice.bibliotek.dbc.dk/bibliotek/meta/ http://webservice.bibliotek.dbc.dk/dc.xsd"
-//xmlns:dc="http://purl.org/dc/elements/1.1/"
-//xmlns:dcterms="http://purl.org/dc/terms" >';
- //$rec_head = '';
- $ccl = cql_to_ccl($cql);
- if ($_REQUEST["debug"]) { echo "\nCQL: "; print_r($cql); }
- if ($_REQUEST["debug"]) { echo "\nCCL: "; print_r($ccl); echo "\n"; }
-
- if ( !is_array($ccl)) {
- $ret['diags'][][1] = "No search found";
- } else {
- if (isset($ccl["error"])) {
- $ret['diags'][][1] = $ccl["error"];
- } else {
- if (empty($start)) $start = 1;
- if (!isset($step)) $step = 1;
- $search = $TARGET["dfa"];
- //$search["format"] = "ws_dc";
- $search["format"] = $schema;
- $search["ccl"] = utf8_decode($ccl["ccl"]);
- $search["start"] = $start;
- $search["step"] = min($step, MAX_STEP);
- Zsearch($search);
- //if ($_REQUEST["debug"]) { echo "\nSEARCH: "; print_r($search); }
- if ($search["error"])
- $ret['diags'][][1] = $search["error"];
- else {
- $ret['records']['set']['noRecords'] = 0;
- $ret['records']['set']['noRecords'] = $search["hits"];
- $ret['records']['set']['schema'] = $schema;
- $ret['records']['record']= array();
- //$step = min($step, $search["hits"] - $start + 1);
- if ($search["step"])
- if (isset($search["records"]) && is_array($search["records"]))
- foreach ($search["records"] as $key => $rec) {
- //$ret['records']['set']['noRecords']++; // antal poster returneret erstattet af hits ovenfor
- //$tmp_rec = $rec["record"];
- //echo "\n" . $rec["record"]; flush();
- //$tmp_rec = str_replace('', '', $tmp_rec);
- //$ret['records']['record'][$key] = array( "xml" => $xml_head . str_replace('', $rec_head, $tmp_rec), "position" => $key);
- $ret['records']['record'][$key] = array( "xml" => $xml_head . my_utf8_encode($rec["record"]), "position" => $key);
- }
- else
- $ret['diags'][][1] = "No records found";
- }
- }
- }
-
- if ($_REQUEST["debug"]) { echo "\nRET: "; print_r($ret); }
- if ($_REQUEST["debug"]) flush();
- return($ret);
-}
-
-function snabela2utf8($s) {
- return preg_replace("/@([0-9a-fA-F]{4}|[uU][0-9a-fA-F]{2})/e", '_snabela2utf8(strtolower("\\1"))', $s);
-}
-function _snabela2utf8($s) {
- if ($s[0] == "u")
- switch ($ss = substr($s, 1, 2)) {
- case "a7" : $s = "02b9"; break;
- case "ae" : $s = "02be"; break;
- case "b0" : $s = "02bf"; break;
- case "b7" : $s = "02ba"; break;
- case "e0" : $s = "0309"; break;
- case "eb" : $s = "fe20"; break;
- case "ec" : $s = "fe21"; break;
- case "f7" : $s = "0326"; break;
- case "f8" : $s = "031c"; break;
- case "f9" : $s = "032e"; break;
- case "fa" : $s = "fe22"; break;
- case "fb" : $s = "fe23"; break;
- default: return "Undefined($ss)";
- }
- return(dec2utf8(hexdec($s)));
-}
-function dec2utf8 ($data) {
- if ($data > 127) {
- $i = 5;
- while (($i--) > 0) {
- if ($data != ($a = $data % ($p = pow(64, $i)))) {
- $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p));
- for ($i; $i > 0; $i--)
- $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p));
- break;
- }
- }
- } else
- $ret = chr($data);
- return $ret;
-}
-
-function my_utf8_encode($txt) {
- //$ret = preg_replace('~�*([0-9]+);~e', 'chr(\\1)', $txt);
-//echo "\nret: " . $ret;
- $from = array("@", "@");
- $to = array("aa", "Aa");
- return( snabela2utf8(utf8_encode(str_replace($from,$to,$txt))) );
-}
-function load_lang_tab($t) {
-}
-?>
Index: OpenSearch/trunk/includes/search_func.phpi
===================================================================
--- OpenSearch/trunk/includes/search_func.phpi (revision 117962)
+++ OpenSearch/trunk/includes/search_func.phpi (nonexistent)
@@ -1,1074 +0,0 @@
-
-/*
- * search elementer:
- * host: ztarget for sgningen, fx. z3950.dbc.dk:2100
- * database: basen der skal sges i, fx. danbib
- * filter: ????????????
- * format: format posterme skal vises i. Bruges typisk istedet for element og syntax
- * Henviser til formats, hvori syntax og element er specificeret.
- * formats: array af format => syntax/element, fx. array("F1" => "xml/line");
- * syntax: syntax hvis ikke format bruges
- * element: element-set-name hvis ikke format bruges
- * raw_record: subs_rec skippes hvis den er sat
- * sort: evt. sortering
- * sort_max: max antal poster der sorteres
- * vis_max: max antal poster der vises
- * start: evt. startpos
- * step: evt. antal poster ved search eller linier ved scan
- * ccl: ccl-sgningen
- * cclfields: navn p ccl-2-rpn fil for sgninger
- * scanfields: navn p ccl-2-rpn fil for scan
- * stopords_liste: navn p tekstfil med stopord // bruges ikke
- * rpn: rpn reprsentationen af ccl-sgningen - er normalt tom ved kald
- * xml: xml-post ifm. xmlupdate
- * authentication: user/group/password for brugeren/basen
- * share_authentication: user/group/password
- * er dette sat bruges det som authentication og ovenstende sendes med i otherinfo
- * Bruges til at dele z-forbindelser mellem brugere
- * persistent - skal der ventes p svar. Indtil videre kun test
- * piggyback: boolean
- * timeout: timeout i sekunder
- * proxy: hvis proxy anvendes
- * proxy_cookie: hvis proxy anvendes
- * schema: OID til schema til present
- * illapdu: apdu til bestilling
- * results:
- * hits: antal hits
- * record: array med returnerede poster
- * stopord: array med stopord fjernet fra ccl
- * targetReference: bestillingsnummer
- * xmlresult: resultat fra xmlupdate
- * error: fejl
- */
-
-//require_once('targets.php');
-//require_once('spellcheck_func.phpi');
-//require_once("xml_func.phpi");
-
-/*
- * Public
- * ======
- */
-
-// turns search query into google query
-// (in the future either by terms or ccl translation)
-
-
-function verbose()
-{
-}
-
-function get_google_query(&$set, $site_name) {
-
- if($site_name=="google") {
- $template_url=getext($site_name."_url");
- } else {
- $template_url=getext("google_".$site_name."_url");
- }
- if (!strpos(" ".$template_url, "http"))
- $template_url = HTTP . $template_url;
-
- if(isset($set["origin"]) && $set["origin"]=="linkme") {
- $q_a=explode("=",$set["user_ccl"]);
- $query=trim($q_a[1]);
- } else {
- $terms_array=extract_fields_terms($set);
- $query=$terms_array["query"];
- }
-
- $query=preg_replace("/[()]/","",$query);
- $query=preg_replace("/ eller /"," OR ",$query);
- $query=preg_replace("/ og /"," ",$query);
-
- $query=utf8_decode($query);
-
- $query=urlencode($query);
-
- $return_url=str_replace("$1",$query,$template_url);
-
- return $return_url;
-}
-
-
-// Removes noise and returns string with terms seperated by space, phrases are put in quotes.
-function extract_fields_terms($set) {
-
- $phrases=array("ldb", "ldf", "lds", "lem", "lfc", "lfo", "lht", "lke", "lme", "lmn", "lpo", "lrc", "lrf", "lri", "lse", "lti", "ltj", "lts");
- $i=0;
-
- // look for keys containing term
- foreach($set as $k => $v) {
- #echo $k.$v."
";
- if(preg_match('/^term[0-9]{1}/', $k, $matches) && !empty($v)) {
-
- $term=$v;
- $term_id=$k;
- $match_num=preg_replace("/[a-zA-Z]/","",$matches[0]);
-
- // see if field value is in phrases
- $field_id="field".$match_num;
- $field=trim($set[$field_id]);
-
- if(in_array($field, $phrases)) {
- // if yes, we quoted it
- $term="\"".$term."\"";
- }
-
- ####$term=preg_replace("/[a-z]{2,20}\=/"," ",$term);
-
- // semi ccl parsing
- if(preg_match("/=/", $term)) {
- $tmp_term=preg_replace("/ ikke | eller | og /","#SPLIT_SEPERATOR#",$term);
- $fieldterm_explode=explode("#SPLIT_SEPERATOR#", $tmp_term);
-
- foreach($fieldterm_explode as $k=>$v) {
- $term_explode=explode("=", $v);
- $f=trim($term_explode[0]);
- $t=trim($term_explode[1]);
- $t=utf8_encode($t);
- $array[$field_id][$term_id]=$t;
- $array[$i][$field_id]=$f;
- $array[$i][$term_id]=$t;
- }
- } // end semi ccl parse
-
- if(!empty($field)) {
- $term=utf8_encode($term);
- $array[$i][$field_id]=$field;
- $array[$i][$term_id]=$term;
- }
- $query.=$term." ";
- }
- }
-
- $array["query"]=trim($query);
-
- #echo "
"; print_r($array); exit();
-
- return $array;
-}
-
-/* ccl funcs */
-function term_explode(&$term) {
- if (gettype($term) != "array")
- return($term);
- else {
- $ret = "";
- foreach ($term as $t) {
- if ($t && !empty($ret)) $ret .= " eller ";
- $ret .= trim($t);
- }
- if ($ret && count($term) > 1) $ret = "(" . $ret . ")";
- return($ret);
- }
-}
-
-
-// Returns num of hits on given search query.
-function get_search_hit($query) {
- global $TARGET, $DEFAULT_TARGET;
-
- if(!empty($target)) {
- $search = $TARGET[$target];
- } else {
- $search = $TARGET[$DEFAULT_TARGET[0]];
- }
-
- $search["rpn"] = "";
- $search["ccl"] = $query;
- $search["step"] = 0;
- Zsearch($search);
-
- return $search["hits"];
-}
-
-
-function collect_url_vars($request) {
- return(collect_url($request, CCL_TERMS, CCL_FIELDS, CCL_OPS));
-}
-function collect_url_limit_vars($request) {
- return(collect_url($request, LIMIT_TERMS, LIMIT_FIELDS, array()));
-}
-function collect_url($request, $terms, $fields, $ops) {
- $ret = "";
- $a_trm = explode(" ", $terms);
- $a_fld = explode(" ", $fields);
- $a_op = explode(" ", $ops);
- foreach ($a_trm as $idx => $term)
- if (!empty($request[$term])) {
- $op = $a_op[$idx];
- if (!empty($request[$op])) $ret .= "&" . $op . "=" . urlencode($request[$op]);
- $field = $a_fld[$idx];
- if (!empty($request[$field])) $ret .= "&" . $field . "=" . urlencode($request[$field]);
- if (is_array($request[$term])) {
- foreach ($request[$term] as $term_item)
- if (!empty($term_item))
- $ret .= "&" . urlencode($term."[]") . "=" . urlencode($term_item);
- }
- else
- $ret .= "&" . $term . "=" . urlencode($request[$term]);
- }
-
- return($ret);
-}
-
-function collect_term_vars($request, $form_based=TRUE) {
- return(collect_term($request,$form_based,CCL_TERMS,CCL_FIELDS,CCL_OPS));
-}
-function collect_term_term_vars($request, $form_based=TRUE) {
- return(collect_term($request,$form_based,TERM_TERMS,TERM_FIELDS,TERM_OPS));
-}
-function collect_term_limit_vars($request, $form_based=TRUE) {
- return(collect_term($request,$form_based,LIMIT_TERMS,LIMIT_FIELDS,array()));
-}
-function collect_term($request, $form_based=TRUE, $terms, $fields, $ops) {
-//if (IS_FVS) { echo $ops . "
" . $terms; }
- $ret = "";
- $a_trm = explode(" ", $terms);
- $a_fld = explode(" ", $fields);
- $a_op = explode(" ", $ops);
-
- foreach ($a_trm as $idx => $term) {
- if ($form_based && is_numeric($term[strlen($term)-1]))
- $t = escape_bool(term_explode($request[$term]));
- else
- $t = term_explode($request[$term]);
-
- if(isset($_REQUEST["utf8_content"]) && $_REQUEST["utf8_content"]==1)
- $t = utf8_decode($t);
- else
- $t = FixUtf8($t);
-
- $f = $request[$a_fld[$idx]];
- if ($t != "")
- $ret .= (empty($ret) ? "" : " " . $o ." ") . prefix($f) . $t;
- if ($o = $request[$a_op[$idx]]) ; else $o = "og";
- }
- return(trim(stripslashes($ret)));
-}
-
-function prefix($f) {
- switch($f) {
- case "year_lt": return("\xe5r<");
- case "year_le": return("\xe5r<=");
- case "year_eq": return("\xe5r=");
- case "year_ge": return("\xe5r>=");
- case "year_gt": return("\xe5r>");
- case "materiale": return("ma=");
- case "kategori": return("kat=");
- case "sprog": return("sp=");
- case "": return ("");
- default: return("$f=");
- }
-}
-
-function FixUtf8($t) {
-static $iso, $uft8;
- if (empty($iso))
- for ($i = 160; $i < 255; $i++) {
- $iso[] = chr($i);
- $utf8[] = utf8_encode(chr($i));
- }
- return(str_replace($utf8, $iso, $t));
-}
-
-function filter_stopord(&$search) {
-static $STOP_LIST;
- if (empty($search["stopords_liste"])) return;
-
- if (is_null($STOP_LIST))
- $STOP_LIST = load_lang_tab($search["stopords_liste"]);
- $ccl = $search["ccl"];
- if (is_array($STOP_LIST))
- foreach ($STOP_LIST as $key => $val) {
- $match_patt = "(^|[ =\(])($key)([ \)]|$)";
- if (eregi($match_patt, $ccl)) {
- $search["stopord"][ $key ] = $key;
- $ccl = eregi_replace($match_patt, '\\1 \\3', $ccl);
- }
- }
- $search["ccl"] = trim($ccl);
-}
-
-function escape_bool($term) {
- $bools = array ("og", "eller", "ikke", "and", "or", "not");
- for ($i = 0; $i < count($bools); $i++)
- $term = eregi_replace("(^|[^[:alnum:]])($bools[$i])([^[:alnum:]]|$)", "\\1'\\2'\\3",$term);
- $chars = array ();
- for ($i = 0; $i < count($chars); $i++)
- $term = eregi_replace("($chars[$i])", "'\\1'",$term);
- return($term);
-}
-
-function set_from_history($request, &$history) {
- $set = $request["set"];
- if (!is_array($set)) return($history[$set]);
- if (count($set) == 1) return($history[$set[0]]);
-
- $op = $request["set_op"];
- if (empty($op)) $op = "og";
- foreach ($set as $s) {
- if (!empty($ccl)) $ccl .= " " . $op . " ";
- $ccl .= "(" . $history[$s]["ccl"] . ")";
- }
- $req = array("term1" => $ccl, "origin" => "kommando");
- return($req);
-}
-
-function set_history(&$history, $request, $searches) {
- $first_tgt = key($searches);
- if (empty($searches[$first_tgt]["ccl"])) return(0);
- if (!empty($searches[$first_tgt]["error"])) return(0);
-
- $hist_id = $first_id = 0;
- foreach ($history as $hist_id => $hist) {
- if ( $hist["ccl"] == $searches[$first_tgt]["ccl"] &&
- $hist["target"] == $request["target"] &&
- ($hist["delbase"] == $request["delbase"] || empty($request["delbase"])) )
- return($hist_id);
- if (empty($first_id)) $first_id = $hist_id;
- }
-
- $hist_id++;
- $a_par = explode(" ", "origin target delbase " . CCL_TERMS . " " . CCL_FIELDS . " " . CCL_OPS);
- foreach ($a_par as $par)
- if (!empty($request[$par]))
- $history[$hist_id][$par] = (is_scalar($request[$par]) && $_REQUEST["utf8_content"]==1 ? utf8_decode($request[$par]) : $request[$par]);
- $history[$hist_id]["ccl"] = $searches[$first_tgt]["ccl"];
- $history[$hist_id]["user_ccl"] = $searches[$first_tgt]["user_ccl"];
- if (count($searches) == 1)
- $history[$hist_id]["hits"] = $searches[$first_tgt]["hits"];
-
- if (count($history) > MAX_HISTORY)
- unset($history[$first_id]);
-
- return($hist_id);
-}
-
-/* single target funcs */
-function Zsearch(&$search) {
- $searches[] = &$search;
- nZsearch($searches);
-}
-
-function Zpresent(&$search) {
- $searches[] = &$search;
- nZpresent($searches);
-}
-
-function Zscan(&$search) {
- $searches[] = &$search;
- nZscan($searches);
-}
-
-function Zitemorder(&$search) {
- $searches[] = &$search;
- nZitemorder($searches);
-}
-
-function Zclose(&$search) {
- $searches[] = &$search;
- nZclose($searches);
-}
-
-function Zxmlupdate(&$search) {
- private_Zxmlupdate($search);
- private_wait_n_time($search, "xmlupdate");
- private_Zxmlresult($search);
-}
-
-function Zpoll(&$search) {
- $searches[] = &$search;
- nZpoll($searches);
-}
-
-/* multi target funcs */
-function nZsearch(&$searches) {
- foreach ($searches as $key => $search)
- private_Zsearch($searches[$key]);
- private_wait_n_time($searches, "search");
-
- foreach ($searches as $key => $search)
- private_Zhits_and_sort($searches[$key]);
- private_wait_n_time($searches, "sort");
-
- foreach ($searches as $key => $search)
- private_Zpresent($searches[$key]);
- private_wait_n_time($searches, "present");
-
- $present_retries = PRESENT_RETRIES;
- while ($present_retries) {
- $present_error = FALSE;
- foreach ($searches as $key => $search)
- if (empty($search["error"])) {
- private_Zerror($searches[$key]);
- // generate random error
- // if (rand(1,2) == 1) $searches[$key]["error"] = "random error";
- if ($searches[$key]["error"]) $present_error = TRUE;
- }
- if ($present_error) {
- foreach ($searches as $key => $search)
- if ($search["error"]) {
- verbose(ERROR, "REpresent() error:" . $search["error"] .
- " addinfo:" . $search["addinfo"] .
- " host:" . $search["host"] .
- " database:" . $search["database"] .
- " auth:" . $search["authentication"] .
- " format:" . $search["format"] .
- " syntax:" . $search["syntax"] .
- " element:" . $search["element"] .
- " sort:" . $search["sort"] .
- " start:" . $search["start"] .
- " step:" . $search["step"] .
- " ccl:" . $search["ccl"] .
- " rpn:" . $search["rpn"]);
- unset($searches[$key]["error"]);
- private_Zpresent($searches[$key]);
- }
- $present_retries--;
- } else
- $present_retries = 0;
- }
-
- foreach ($searches as $key => $search)
- private_Zrecord($searches[$key]);
-
- foreach ($searches as $key => $search)
- private_Zcertificate($searches[$key]);
-}
-
-function nZpresent(&$searches) {
- foreach ($searches as $key => $search)
- private_Zpresent($searches[$key]);
- private_wait_n_time($searches, "present");
-
- foreach ($searches as $key => $search)
- private_Zrecord($searches[$key]);
-}
-
-function nZscan(&$searches) {
- foreach ($searches as $key => $search)
- private_Zscan($searches[$key]);
- private_wait_n_time($searches, "scan");
-
- foreach ($searches as $key => $search)
- private_Zscan_result($searches[$key]);
-}
-
-function nZitemorder(&$searches) {
- foreach ($searches as $key => $search)
- private_Zitemorder($searches[$key]);
- private_wait_n_time($searches, "itemorder");
-
- foreach ($searches as $key => $search)
- private_Zitemorder_result($searches[$key]);
-}
-
-function nZclose(&$searches) {
- foreach ($searches as $key => $search)
- if (yaz_close($search["id"])) unset($searches[$key]["id"]);
-}
-
-function nZxmlupdate(&$searches) {
- foreach ($searches as $key => $search)
- private_Zxmlupdate($searches[$key]);
- private_wait_n_time($searches, "xmlupdate");
-
- foreach ($searches as $key => $search)
- private_Zxmlresult($searches[$key]);
-}
-
-function nZpoll(&$searches) {
- foreach ($searches as $key => $search)
- private_Zpoll($searches[$key]);
-}
-
-/*
- * Private
- * =======
- */
-
-/* search
- */
-function private_Zsearch(&$search) {
- if (is_resource(private_Zconnect($search))) {
- if (!$search["rpn"]) {
- if (!private_ccl2rpn($search, "cclfields")) {
- return FALSE;
- }
- if ($search["filter"])
- $search["database"] = $search["filter"];
- }
- yaz_database($search["id"], $search["database"]);
- yaz_sort($search["id"], "");
- yaz_range($search["id"], 1, 0);
- yaz_search($search["id"],"rpn",$search["rpn"]);
- verbose(Z3950, "Zsearch() host:" . $search["host"] .
- " database:" . $search["database"] .
- " auth:" . $search["authentication"] .
- " format:" . $search["format"] .
- " syntax:" . $search["syntax"] .
- " element:" . $search["element"] .
- " sort:" . $search["sort"] .
- " start:" . $search["start"] .
- " step:" . $search["step"] .
- " ip:" . $_SERVER["REMOTE_ADDR"] .
- " ccl:" . $search["ccl"] .
- " rpn:" . $search["rpn"]);
- } else {
- $search["error"] = "Connect failed";
- }
-}
-
-function private_Zhits_and_sort(&$search) {
- private_Zerror($search); // fetch errror from search
- if ($search["id"] && empty($search["error"])) {
- $search["hits"] = yaz_hits($search["id"]);
- if ($search["sort"] && (int) $search["sort_max"] >= (int) $search["hits"])
- yaz_sort($search["id"], $search["sort"]);
- }
-}
-
-function private_Zpresent(&$search) {
-
- if ($search["id"] && empty($search["error"])) {
- if ($search["sort"])
- if ((int) $search["sort_max"] < (int) $search["hits"])
- $search["sort_error"] = 230;
- else
- $search["sort_error"] = yaz_error($search["id"]); // fecth error from sort
- else
- private_Zerror($search);
-
- if ($search["vis_max"]
- && (int) $search["vis_max"] < (int) $search["hits"]) {
- $search["errno"] = "31";
- $search["error"] = errno_2_text($search["errno"], "Resources exhausted - no results available");
- } else {
- if (isset($search["fallback_format_max"])
- && (int) $search["fallback_format_max"] < (int) $search["hits"]
- && isset($search["fallback_format"][ $search["format"] ])) {
- $search["fallback_from_format"] = $search["format"];
- $search["format"] = $search["fallback_format"][ $search["format"] ];
- $search["fallback_format_text"] = TRUE;
- }
- if (isset($search["format_mapping"][ $search["format"] ]))
- $search["format"] = $search["format_mapping"][ $search["format"] ];
- if (isset($search["format"])
- && (empty($search["syntax"]) || empty($search["element"])))
- list($search["syntax"], $search["element"]) = explode("/", $search["formats"][strtolower($search["format"])]);
- if ($search["bibkode"] && empty($search["no_bib_id_split"]))
- $search["element"] .= ":" . $search["bibkode"];
- if (empty($search["cache_records"]) || !is_file($search["cache_records"] . "_" . $search["database"])) {
- yaz_syntax($search["id"], $search["syntax"]);
- yaz_element($search["id"], $search["element"]);
- if (empty($search["start"])) $search["start"] = 1;
- $step = min($search["step"], $search["hits"]-$search["start"]+1);
- yaz_range($search["id"], intval($search["start"]), intval($step));
- if (isset($search["schema"]))
- yaz_schema($search["id"],$search["schema"]);
- yaz_present($search["id"]);
- }
- }
- }
-}
-
-function private_Zrecord(&$search) {
- private_Zerror($search);
- if ($search["id"] && $search["step"] && empty($search["error"])) {
- $cache_file_name = $search["cache_records"] . "_" . $search["database"];
- if ($search["cache_records"] && is_file($cache_file_name)) {
- $search["records"] = cache_2_records($cache_file_name);
- } else {
- $end = min($search["start"] + $search["step"] - 1, $search["hits"]);
- for ($r = $search["start"]; $r <= $end; $r++) {
- $search["records"][$r]["record"] = yaz_record($search["id"], $r, "raw");
- if (empty($search["raw_record"]))
- private_subs_rec($search["records"][$r]["record"], $search["target"], $search["cdata"], $search["record_sub"], $search["limit_url_vars"]);
- $search["records"][$r]["error"] = yaz_error($search["id"]);
- }
- if ($search["cache_records"])
- records_2_cache($cache_file_name, $search["records"]);
- }
- }
-}
-
-function cache_2_records($fname) {
-global $stopur;
- if (is_object($stopur)) $stopur->start("from_cache");
- if ($fp = @ fopen($fname, "r")) {
- $ret = unserialize(fread($fp, filesize($fname)));
- fclose($fp);
- if (is_object($stopur)) $stopur->stop("from_cache");
- return $ret;
- }
- if (is_object($stopur)) $stopur->stop("from_cache");
- return FALSE;
-}
-function records_2_cache($fname, &$recs) {
-global $stopur;
- if (is_object($stopur)) $stopur->start("to_cache");
- if ($fp = @ fopen($fname, "w")) {
- fwrite($fp, serialize($recs));
- fclose($fp);
- if (is_object($stopur)) $stopur->stop("to_cache");
- return TRUE;
- }
- if (is_object($stopur)) $stopur->stop("to_cache");
- return FALSE;
-}
-function private_Zcertificate(&$search) {
- if ($search["id"] && empty($search["error"]) && isset($search["get_option"])) {
- $opt = $search["get_option"];
- $search[$opt] = yaz_get_option($search["id"], $opt);
- }
-}
-
-/* scan
- */
-function private_Zscan(&$search) {
- if (is_resource(private_Zconnect($search))) {
- if (!$search["rpn"]) {
- $search["ccl"] = escape_bool($search["ccl"]);
- if (!private_ccl2rpn($search, "scanfields")) {
- unset($search["error"]);
- if (!private_ccl2rpn($search, "cclfields"))
- return FALSE;
- }
- if ($search["filter"])
- $search["database"] = $search["filter"];
- }
- yaz_database($search["id"], $search["database"]);
- $flags["number"] = $search[ "step" ];
- yaz_scan($search["id"], "rpn", $search["rpn"], $flags);
- verbose(Z3950, "Zscan() host:" . $search["host"] .
- " database:" . $search["database"] .
- " auth:" . $search["authentication"] .
- " scan_step:" . $search["scan_step"] .
- " ccl:" . $search["ccl"] .
- " rpn:" . $search["rpn"]);
- } else {
- $search["error"] = "Connect failed";
- }
-}
-
-function private_Zscan_result(&$search) {
- private_Zerror($search); // fetch errror from scan
- if ($search["id"] && empty($search["error"])) {
- $search["records"] = yaz_scan_result($search["id"], $result_options);
- }
-}
-
-/* item order
- */
-function private_Zitemorder(&$search) {
- if (is_resource(private_Zconnect($search))) {
- yaz_itemorder($search["id"], $search["illapdu"]);
- verbose(Z3950, "Zitemorder() host:" . $search["host"] .
- " database:" . $search["database"] .
- " auth:" . $search["authentication"]);
-
- } else {
- $search["error"] = "Connect failed";
- }
-}
-
-function private_Zitemorder_result(&$search) {
- private_Zerror($search); // fetch errror from itemorder
- if ($search["id"] && empty($search["error"])) {
- $ar = yaz_es_result($search["id"]);
- $search["targetReference"] = $ar["targetReference"];
- }
-}
-
-/* extended services
- */
-function private_Zxmlupdate(&$search) {
- if (is_resource(private_Zconnect($search))) {
- $args = array("doc" => '' . $search["xml"]);
- yaz_es($search["id"], "xmlupdate", $args);
- verbose(Z3950, "Zxmlupdate() host:" . $search["host"]);
- } else {
- $search["error"] = "Connect failed";
- }
-}
-function private_Zxmlresult(&$search) {
- private_Zerror($search);
- if ($search["id"] && empty($search["error"])) {
- $ar = yaz_es_result($search["id"]);
- $search["xmlresult"] = $ar["xmlUpdateDoc"];
- }
-}
-
-/* Async poll - test kode, virker ikke
- */
-function private_Zpoll(&$search) {
- $opts["event"] = TRUE;
- $id = yaz_wait($opts);
- if ($id) {
- switch($opts[eventcode]) {
- case ZOOM_EVENT_CONNECT: echo "connect"; break;
- case ZOOM_EVENT_SEND_DATA: echo "send data"; break;
- case ZOOM_EVENT_RECV_DATA: echo "recv data"; break;
- case ZOOM_EVENT_TIMEOUT: echo "timeout"; break;
- case ZOOM_EVENT_UNKNOWN: echo "unknown"; break;
- case ZOOM_EVENT_SEND_APDU: echo "send apdu"; break;
- case ZOOM_EVENT_RECV_APDU: echo "recv apdu"; break;
- case ZOOM_EVENT_RECV_SEARCH: echo "recv search"; break;
- case ZOOM_EVENT_RECV_RECORD: echo "recv record"; break;
- default: echo "UNKNOWN"; break;
- }
- echo " for id: " . $id . " - \n";
- }
-}
-
-/* connect
- * Som default sendes user/group/password som yaz_connect parametre - ved ip-login cleares user/group/password
- * ved share_authentication sendes user/group/password i otherinfo0 med yaz_connect sttes fra share_authentication - ved ip-login ?
- */
-function private_Zconnect(&$search) {
- if (empty($search["id"])) {
- $Zopt = array ();
- if (defined("DEFAULT_SHARE_AUTHENTICATION") && empty($search["remote_target"])) {
- list($Zopt["user"], $Zopt["group"], $Zopt["password"]) = explode("/", DEFAULT_SHARE_AUTHENTICATION);
- $Zopt[ "otherInfo1" ] = "1.2.840.10003.10.1000.105.1:" . $search["authentication"];
- } else {
- list($Zopt["user"], $Zopt["group"], $Zopt["password"]) = explode("/", $search["authentication"]);
- }
- if (isset($_SERVER["REMOTE_ADDR"])) $Zopt[ "otherInfo0" ] = "1.2.840.10003.10.1000.81.3:" . $_SERVER["REMOTE_ADDR"];
- if (isset($search["yaz_cookie"])) $Zopt["cookie"] = $search["yaz_cookie"];
- if (isset($search["yaz_proxy"])) $Zopt["proxy"] = $search["yaz_proxy"];
- if (isset($search["charset"])) $Zopt["charset"] = $search["charset"];
- $Zopt["piggyback"] = (isset($search["piggyback"]) ? $search["piggyback"] : TRUE);
- $Zopt["persistent"] = (isset($search["persistent"]) ? $search["persistent"] : TRUE);
- if (isset($search["preferredMessageSize"])) $Zopt["preferredMessageSize"] = $search["preferredMessageSize"];
- if (isset($search["maximumRecordSize"])) $Zopt["maximumRecordSize"] = $search["maximumRecordSize"];
-
- $search["connect_options"] = $Zopt;
-
- $tgt_db = $search["host"];
- if ($search["database"]) $tgt_db .= "/" . $search["database"];
- $search["id"] = yaz_connect($tgt_db, $search["connect_options"]);
- }
- return($search["id"]);
-}
-
-/* wait og start/stop timer
- */
-function private_wait_n_time(&$searches, $timer) {
-global $stopur, $SESSION;
-
- $max = 20;
- $allow_user_break = TRUE;
- $event = FALSE;
- if ($searches["host"]) {
- $max = max($max, $searches["timeout"]);
- $allow_user_break = $allow_user_break && $searches["allow_user_break"];
- } else
- foreach ($searches as $key => $search) {
- $max = max($max, $search["timeout"]);
- $allow_user_break = $allow_user_break && $search["allow_user_break"];
- $event = $event || !$search["connect_options"]["persistent"];
- }
-
- if (is_object($stopur)) $stopur->start($timer);
- $opt = array("timeout" => $max, "event" => $event);
-
- // close session temporaily to avoid hanging...
- if ($allow_user_break && !$event)
- session_write_close();
-
- yaz_wait($opt);
-
- // restart session
- if ($allow_user_break && !$event) {
- session_start();
- $SESSION = &$_SESSION["SESSION"];
- }
-
- if (is_object($stopur)) $stopur->stop($timer);
-}
-
-/* error
- */
-function private_Zerror(&$search) {
-//static $Z_ERROR_TAB;
- if ($search["id"] && empty($search["error"])) {
- if ($search["error"] = yaz_error($search["id"])) {
- $search["errno"] = yaz_errno($search[ "id" ]);
- $search["addinfo"] = yaz_addinfo($search[ "id" ]);
- $search["error"] = errno_2_text($search["errno"], $search["error"]);
- //if (!isset($Z_ERROR_TAB)) $Z_ERROR_TAB = load_lang_tab("z_errors");
- //if (isset($Z_ERROR_TAB[$search["errno"]]))
- //$search["error"] = $Z_ERROR_TAB[$search["errno"]];
- //else
- //$search["error"] .= " (" . $search["errno"] . ")";
- }
- }
-}
-
-function errno_2_text($no, $txt) {
-static $Z_ERROR_TAB;
- if (!isset($Z_ERROR_TAB))
- if (function_exists("load_lang_tab"))
- $Z_ERROR_TAB = load_lang_tab("z_errors");
- else
- $Z_ERROR_TAB = array();
- if (isset($Z_ERROR_TAB[$no]))
- return($Z_ERROR_TAB[$no]);
- else
- return($txt . " (" . $no . ")");
-}
-
-/* ccl parse
- */
-function private_ccl2rpn(&$search, $zop) {
-static $CCL_ERROR_TAB;
-
-
-
- if (private_load_attrset($search, $zop)) {
- filter_stopord($search);
- if (yaz_ccl_parse($search["id"], $search["ccl"], $result)) {
- $search["rpn"] = $result["rpn"];
-
-
- } else {
- $pos = $result["errorpos"] + 1 . "s";
- $search["errno"] = $result["errorcode"];
- $search["addinfo"] = $result["errorstring"];
- $search["error"] = "ccl-error";
- if (!isset($CCL_ERROR_TAB)) $CCL_ERROR_TAB = load_lang_tab("ccl_errors");
- if (isset($CCL_ERROR_TAB[$result["errorcode"]]))
- $search["ccl_error"] = sprintf("%s
%'-$pos   %s", strip_tags($search["ccl"]), "^", $CCL_ERROR_TAB[$result["errorcode"]]);
- else
- $search["ccl_error"] = sprintf("%s
%'-$pos   %s (%d)", htmlentities($search["ccl"]), "^", $result["errorstring"], $result["errorcode"]);
- }
- }
- return(empty($search["error"]));
-}
-
-/* load ccl2rpn file
- *
- * u=use r=relation p=position s=structure t=truncation c=completeness
- */
-define ("DBC1", "1.2.840.10003.3.1000.105.1");
-function private_load_attrset(&$search, $zop) {
- global $CCL_PATH, $init_attr_set, $dup_attr;
-
-
-
- if ($search[$zop]) {
- if (substr($search[$zop], 0, 5) == "Z3950") {
- $ccl_fn = private_z3959_load_attrset($search, substr($search[$zop], 5));
- } else {
-
- // pjo; changed path for testpurposes
- // echo "TESTHESETESTN";
- $ccl_fn="includes/".$search[$zop];
-
- // $ccl_fn = $CCL_PATH . '/' . $search[$zop];
- }
-
-
- if ($ccl_fn && $fp = @ fopen($ccl_fn, "r")) {
- $attr_set = $init_attr_set;
- while ( ! feof($fp) ) {
- list($line) = explode("#", fgets($fp, 9999), 2);
- if (trim($line)) {
- $line = str_replace("DBC1", DBC1, $line);
- list($attr_code, $attr_val) = explode(" ", $line, 2);
- $attr_set[ $attr_code ] = $attr_val;
- while (isset($dup_attr[ $attr_code ])) {
- $attr_set[ $dup_attr[ $attr_code ] ] = $attr_val;
- $attr_code = $dup_attr[ $attr_code ];
- }
- }
- }
- fclose($fp);
- yaz_ccl_conf($search["id"], $attr_set);
- } else {
- $search["error"] = "Kan ikke bne ccl2rpn-fil";
- verbose(ERROR, "ccl2rpn load error: " . $ccl_fn . " host:" . $search["host"] . " database:" . $search["database"]);
- }
- } else {
- $search["error"] = "Der er ikke angivet en ccl2rpn-fil";
- }
- return(empty($search["error"]));
-}
-
-/* load ccl2rpn file from a z3950 connection
- *
- */
-function private_z3959_load_attrset(&$search, $rpn) {
-//global WEB_CACHE_PATH;
-
-
-
- $fn = WEB_CACHE_PATH . $search["database"] . "_ccl2prn_" . date("YmdH");
- if (is_file($fn))
- return($fn);
-
- global $TARGET;
-
- $z_attr = $TARGET["ccl2rpn"];
- $z_attr["rpn"] = trim($rpn);
- Zsearch($z_attr);
- //print_r($z_attr);
-
- if (empty($z_attr["hits"]) ||
- empty($z_attr["records"][1]["record"]) ||
- $z_attr["error"] ||
- $z_attr["records"][1]["error"])
- return(FALSE);
-
- // remove old files
- exec("rm " . WEB_CACHE_PATH . $search["database"] . "_ccl2prn_??????????");
-
- if ($fp = @ fopen($fn, "w")) {
- fwrite($fp, $z_attr["records"][1]["record"]);
- fclose($fp);
- } else
- return(FALSE);
-
- return($fn);
-}
-
-/* subs_rec
- *
- * Hjlper poster til at blive xml og udfylder place-holdere
- */
-function private_subs_rec(&$rec, $target="", $cdata="", $record_sub="", $link_url_vars="") {
- global $CDATA, $RECORD_SUB;
-
- if (!$target) $target = "";
- if (!$cdata) $cdata = "";
- if (!$record_sub) $record_sub = "";
- if (!$link_url_vars) $link_url_vars = "";
-
-// mark lines as CDATA to cope with ,
- if (!is_array($cdata)) $cdata = $CDATA;
- if (is_array($cdata))
- foreach ($cdata as $cd) {
- $rec = eregi_replace("(<$cd(>| [^>]*>))", "\\1
- $rec = eregi_replace("()", "]]>\\1", $rec);
- }
-
-// @hex to hmtl-entity (@nnnn -> &#nnnn;)
- $rec = eregi_replace("@([0-9abcdef]{4})", "&#x\\1;", $rec);
-
- $rec = eregi_replace("(target=_TARGET_)([^>]*)(&anmeldelse=)", "target[]=$target\\2\\3", $rec);
-
- if (!is_array($record_sub)) $record_sub = $RECORD_SUB;
- if (is_array($record_sub))
- foreach ($record_sub as $rec_sub)
- switch ($rec_sub["type"]) {
- case "eval":
- $help = $rec_sub["to"];
- eval("\$help = \"$help\";");
- $rec = eregi_replace($rec_sub["from"], $help, $rec);
- break;
- case "getext":
- $to = Getext($rec_sub["to"]);
- if ($to)
- $rec = eregi_replace($rec_sub["from"], $to, $rec);
- break;
- default:
- $rec = eregi_replace($rec_sub["from"], $rec_sub["to"], $rec);
- }
-}
-
-function private_microtime_float() {
- list($usec, $sec) = explode(" ", microtime());
- return ((float)$usec + (float)$sec);
-}
-
-function make_ccl_sub() {
- global $CCL_SUB, $CCL_SUB_FILES, $CCL_SUB_PREFIXES, $user_ccl, $set;
-
- $ccl_sub_tab = load_lang_tab("ccl_sub");
- $CCL_SUB = array();
- foreach ($ccl_sub_tab as $key => $val)
- $CCL_SUB[] = array("match" => $key, "replace" => $val);
-
- if (getext("cclsub_brugerselect")) {
- $CCL_SUB_FILES[] = "sogning_brugerselect";
- $CCL_SUB_PREFIXES[] = getext("cclsub_brugerselect");
- }
- $CCL_SUB = ExpandFromFile($CCL_SUB, $CCL_SUB_FILES, $CCL_SUB_PREFIXES);
- if ($set["origin"] != "kommando")
- $user_ccl = str_replace($CCL_SUB['match'],$CCL_SUB['replace'], $user_ccl);
-}
-
-function EFF_trim($s) {
- return(ereg_replace("^[ \-]*", "", str_replace(' ','',strip_tags(strtolower($s)))));
-}
-function ExpandFromFile($CCL_SUB, $files, $prefixes) {
-global $LINGO;
-
- $CCL_SUB_CACHE = CCL_SUB_CACHE . ".$LINGO";
- // hent CCL_SUB fra /tmp eller opret/opdater.
- if ( !is_file($CCL_SUB_CACHE) || date("Ymd", filemtime($CCL_SUB_CACHE)) < date("Ymd") ) { // ikke oprettet eller en dag gammel.
-
- while (list($key,$name) = each($files)) {
- $tab = load_lang_tab($name);
- while (list($key2,$val2) = each($tab)) {
- if ( !is_array($val2) ) {
- if ( !empty($val2) ) {
- $CCL_SUB[] = array ("match" => $val2, "replace" => $prefixes[$key].'='.EFF_trim($key2) );
- }
- } else {
- while (list($key3,$val3) = each($val2)) {
- if ( !is_array($val3) ) {
- if ( !empty($val3) ) {
- $prefix = ( $prefixes[$key] == 'instrumenter' ) ? $key2.': ' : $prefixes[$key].'=';
- if ( substr($val3,0,3) == 'og ' ) $prefix = 'og '.$prefix; // instrumenter:genrer
- if ( substr($val3,0,5) == 'ikke ' ) $prefix = 'og '.$prefix; // sic! -"-
- $CCL_SUB[] = array ("match" => $val3, "replace" => $prefix.EFF_trim($key3) );
- }
- }
- }
- }
- }
- }
-
- usort($CCL_SUB,"cmp_size"); reset($CCL_SUB);
-
- $fp = fopen($CCL_SUB_CACHE, 'w');
- if ( $fp ) {
- fwrite( $fp, serialize($CCL_SUB) );
- fclose($fp);
- }
-
- clearstatcache();
-
- } else {
-
- $filesize = filesize($CCL_SUB_CACHE);
- $fp = fopen($CCL_SUB_CACHE,"r");
- if ( $fp ) {
- $file = fread( $fp,$filesize );
- fclose( $fp );
- }
- $CCL_SUB = unserialize($file);
-
- }
-
- //while (list($key,$val) = each($CCL_SUB)) {
-
- foreach ($CCL_SUB as $val) {
- $sr["match"][] = $val['match'];
- $sr["replace"][] = $val['replace'];
- }
-
- return $sr;
-
-}
-
-function get_num_hits() {
- global $set, $searches;
- $tg=$set["target"][0];
- return $searches[$tg]["hits"];
-}
-
-?>
Index: OpenSearch/trunk/includes/targets.php
===================================================================
--- OpenSearch/trunk/includes/targets.php (revision 117962)
+++ OpenSearch/trunk/includes/targets.php (nonexistent)
@@ -1,56 +0,0 @@
-
-define("DANBIB_NEP","saba.dbc.dk:21040");
-define("DEFAULT_HOST", "lakitre.dbc.dk:2105");
-//define("DANBIB_NEP", "lakitre.dbc.dk:21040");
-
-//global $TARGET; // aht wget
-
-$TARGET["dfa"] = array (
- "host" => DEFAULT_HOST,
- "database" => 'dfa',
- "piggyback" => false,
- "raw_record" => true,
- "authentication" => "webgr/dfa/hundepine",
- "fors_name" => "bibliotek.dk",
- "cclfields" => 'danbib.ccl2rpn',
- // "format" => 1,
- "formats" => array("dc" => "xml/ws_dc",
- "marcx" => "xml/marcxchange",
- "abm" => "xml/abm_xml"),
- "start" => 1,
- "step" => 1,
- "filter" => "",
- "sort" => "",
- "sort_default" => "aar",
- "sort_max" => 100000,
- //"vis_max" => 1000000,
- "timeout" => 30
-);
-
-$TARGET["danbib"] = array (
- "host" => DANBIB_NEP,
- "database" => 'danbibv3',
- "piggyback" => false,
- "raw_record" => true,
- "authentication" => "webgr/dfa/hundepine",
- "fors_name" => "bibliotek.dk",
- "cclfields" => 'danbib.ccl2rpn',
- "format" => 1,
- "formats" => array("abm" => "xml/abm_xml"),
- "start" => 1,
- "step" => 1,
- "filter" => "",
- "sort" => "",
- "sort_default" => "aar",
- "sort_max" => 100000,
- //"vis_max" => 1000000,
- "timeout" => 30
-);
-
-
-
-
-
-
-
-?>
Index: OpenSearch/trunk/includes/danbib.ccl2rpn
===================================================================
--- OpenSearch/trunk/includes/danbib.ccl2rpn (revision 117962)
+++ OpenSearch/trunk/includes/danbib.ccl2rpn (nonexistent)
@@ -1,102 +0,0 @@
-# 10/10-2005 indsat htitel i DBC1 u=2 til kombinatorisk sgning fra kasser med 'and'
-# 12/9-2005 Rettet DBC1 1=4 til BIB1 1=1011 (op) og DBC1 1=3 til BIB1 1=1012 (aj)
-# 11/7-2005 indsat DAN1 1=2 (ke, lke), 1=3 (db, ldb), 1=4 (df, ldf), 1=5 (ds, lds), 1=10 (dk), 1=11 (ok) aht emnehierarki
-# 16/12-2004 indsat sgekoderne bo (652w (m+v) - DBC1 1=141), mm og lmm (666mnpl - DBC1 1=142)
-# 9/12-2004 rettet n1c til n50
-# 27/10-2004 indsat n1c (DBC1 1=140) til sdi-overvgning
-# 24/11-2003 indsat lme, me og mo kopieret fra DanBib til musiksgesiden
-# I alle "boks"sgninger undtagen forfatter, er struktur sat til 2, da flere ord altid skal AND'es 20/11-2002 BDM
-# Tilrettet til DfA 18/11-2002 BDM
-# Subset of bib-1 attributes map to CCL qualifiers
-# $Id: danbib.ccl2rpn,v 1.2 2006-03-27 08:36:25 fvs Exp $
-#
-ti BIB1,u=4 r=3 p=3 s=pw t=l,r c=1 #kun til kommandosgning
-lti BIB1,u=4 r=3 p=1 s=1 t=r c=3
-se BIB1,u=5 r=3 p=3 s=pw t=l,r c=1
-lse BIB1,u=5 r=3 p=1 s=1 t=r c=3
-lid BIB1,u=12 r=3 p=3 s=103 t=l,r c=1
-em BIB1,u=21 r=3 p=3 s=pw t=l,r c=1
-emne BIB1,u=21 r=3 p=3 s=2 t=l,r c=1 #sgning fra tekstbokse med 'and'-sgning
-lem BIB1,u=21 r=3 p=1 s=1 t=r c=3
-aar BIB1,u=31 r=o p=3 s=4 t=l,r c=1
-r BIB1,u=31 r=o p=3 s=4 t=l,r c=1
-r_fr BIB1,u=31 r=1 p=3 s=4 t=l,r c=1 #fra tekstbokse
-r_lig BIB1,u=31 r=3 p=3 s=4 t=l,r c=1 #fra tekstbokse
-r_efter BIB1,u=31 r=5 p=3 s=4 t=l,r c=1 #fra tekstbokse
-spr BIB1,u=54 r=3 p=3 s=2 t=l,r c=1
-sp BIB1,u=54 r=3 p=3 s=2 t=l,r c=1
-owner_id BIB1,u=56 r=3 p=3 s=2 t=l,r c=1
-lok BIB1,u=56 r=3 p=3 s=2 t=l,r c=1
-pu BIB1,u=59 r=3 p=3 s=pw t=l,r c=1
-no BIB1,u=63 r=3 p=3 s=pw t=l,r c=1
-mp_id BIB1,u=1001 r=3 p=3 s=2 t=l,r c=1
-kat BIB1,u=1001 r=3 p=3 s=2 t=l,r c=1
-forfatter BIB1,u=1003 r=3 p=3 s=102 t=l,r c=1 #Til tekstboksene. I target er s=102 defineret som uordnet
-fo BIB1,u=1003 r=3 p=3 s=101 t=r c=1 #Afviger fra Praksisregler, da uden *c
-lfo BIB1,u=1003 r=3 p=1 s=101 t=r c=2 #Afviger fra Praksisregler, da uden *c
-is BIB1,u=1007 r=3 p=3 s=1 t=l,r c=1
-op BIB1,u=1011 r=3 p=3 s=2 t=l,r c=1
-aj BIB1,u=1012 r=3 p=3 s=2 t=l,r c=1
-default_id BIB1,u=1016 r=3 p=3 s=pw t=l,r c=1
-fritekst BIB1,u=1016 r=3 p=3 s=2 t=l,r c=1 #sgning fra tekstbokse med 'and'-sgning
-fl BIB1,u=1018 r=3 p=3 s=pw t=l,r c=1
-mk BIB1,u=1031 r=3 p=3 s=2 t=l,r c=1
-ma BIB1,u=1031 r=3 p=3 s=2 t=l,r c=1
-mat BIB1,u=1031 r=3 p=3 s=2 t=l,r c=1
-vp BIB1,u=1033 r=3 p=3 s=pw t=l,r c=1
-vrt BIB1,u=1033 r=3 p=3 s=2 t=l,r c=1 #sgning fra tekstbokse med 'and'-sgning
-cl BIB1,u=1040 r=3 p=3 s=pw t=l,r c=1
-ou BIB1,u=1095 r=3 p=3 s=pw t=l,r c=1
-ke DAN1,u=2 r=3 p=3 s=pw t=l,r c=1
-lke DAN1,u=2 r=3 p=1 s=1 t=r c=3
-db DAN1,u=3 r=3 p=3 s=pw t=l,r c=1
-ldb DAN1,u=3 r=3 p=1 s=1 t=r c=3
-df DAN1,u=4 r=3 p=3 s=pw t=l,r c=1
-ldf DAN1,u=4 r=3 p=1 s=1 t=r c=3
-ds DAN1,u=5 r=3 p=3 s=pw t=l,r c=1
-lds DAN1,u=5 r=3 p=1 s=1 t=r c=3
-me DAN1,u=6 r=3 p=3 s=pw t=l,r c=1
-lme DAN1,u=6 r=3 p=1 s=1 t=r c=3
-person DAN1,u=9 r=3 p=3 s=102 t=l,r c=1 #Til tekstboksene. I target er s=102 defineret som uordnet
-po DAN1,u=9 r=3 p=3 s=pw t=l,r c=1
-lpo DAN1,u=9 r=3 p=1 s=1 t=r c=2
-dk DAN1,u=10 r=3 p=3 s=pw t=l,r c=1
-ok DAN1,u=11 r=3 p=3 s=pw t=l,r c=1
-kk DAN1,u=14 r=3 p=3 s=pw t=l,r c=1
-ix DAN1,u=15 r=3 p=3 s=pw t=l,r c=1
-nm DAN1,u=16 r=3 p=3 s=pw t=l,r c=1
-bs DAN1,u=21 r=3 p=3 s=pw t=l,r c=1
-mo DAN1,u=24 r=3 p=3 s=pw t=l,r c=1
-fb DAN1,u=26 r=3 p=3 s=pw t=l,r c=1
-ts DAN1,u=27 r=3 p=3 s=pw t=l,r c=1
-lts DAN1,u=27 r=3 p=1 s=1 t=r c=3
-a DBC1,u=1 r=o p=3 s=4 t=l,r c=1
-ht DBC1,u=2 r=3 p=3 s=pw t=l,r c=1
-htitel DBC1,u=2 r=3 p=3 s=2 t=l,r c=1 #sgning p htitel fra tekstbokse med 'and'-sgning
-lht DBC1,u=2 r=3 p=1 s=1 t=r c=3
-#aj DBC1,u=3 r=3 p=3 s=2 t=l,r c=1
-#op DBC1,u=4 r=3 p=3 s=2 t=l,r c=1
-ln DBC1,u=6 r=3 p=3 s=2 t=l,r c=1
-rc DBC1,u=8 r=3 p=3 s=pw t=l,r c=1
-lrc DBC1,u=8 r=3 p=1 s=1 t=r c=2
-rf DBC1,u=9 r=3 p=3 s=pw t=l,r c=1
-lrf DBC1,u=9 r=3 p=1 s=1 t=r c=2
-ri DBC1,u=10 r=3 p=3 s=pw t=l,r c=1
-lri DBC1,u=10 r=3 p=1 s=1 t=r c=3
-ns DBC1,u=14 r=3 p=3 s=2 t=l,r c=1
-#u=16-41 kun brugt i dels ac- og acinfo-baserne:
-#u=42-44 kun brugt i integra:
-#u=45-51 kun brugt i lektorbasen:
-xd DBC1,u=53 r=3 p=3 s=103 t=l,r c=1
-#u=56-61 kun brugt i dk5-basen:
-ld DBC1,u=62 r=3 p=3 s=103 t=l,r c=1
-#u=63-64 kun brugt i dfa-basen:
-lfc DBC1,u=63 r=3 p=1 s=101 t=r c=2 #fo-register MED *c til videreklik i DfA
-tj DBC1,u=64 r=3 p=3 s=pw t=l,r c=1 #titelregister uden felt 526
-titel DBC1,u=64 r=3 p=3 s=2 t=l,r c=1 #sgning p titel fra tekstbokse med 'and'-sgning
-ltj DBC1,u=64 r=3 p=1 s=1 t=r c=3
-#u=140-142 kun brugt i dfa-basen:
-n50 DBC1,u=140 r=3 p=3 s=2 t=l,r c=1
-bo DBC1,u=141 r=3 p=3 s=2 t=l,r c=1
-mm DBC1,u=142 r=3 p=3 s=pw t=l,r c=1
-lmm DBC1,u=142 r=3 p=1 s=1 t=r c=3
Index: OpenSearch/trunk/includes/cql.php
===================================================================
--- OpenSearch/trunk/includes/cql.php (revision 117962)
+++ OpenSearch/trunk/includes/cql.php (nonexistent)
@@ -1,438 +0,0 @@
-
-/*
- Copyright (C) 2004 Index Data Aps, www.indexdata.dk
-
- This file is part of SRW/PHP
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 dated June, 1991.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- A copy of the GNU General Public License is also available at
- . You may also obtain
- it by writing to the Free Software Foundation, Inc., 59 Temple
- Place - Suite 330, Boston, MA 02111-1307, USA.
-
- $Id: cql.php,v 1.1 2005-12-22 10:38:14 fvs Exp $
-*/
-require_once("diagset.php");
-
-class CQL_parser {
- // public
- public $error;
-
- function CQL_parser(&$srw_response) {
- if (is_object($srw_response))
- $this->r_srw_response = &$srw_response;
- }
-
- function define_prefix($prefix, $title, $uri) {
- $this->std_prefixes = $this->add_prefix($this->std_prefixes, $prefix, $title, $uri);
- }
-
- function parse($query) {
- $this->qs = $query;
- $this->ql = strlen($query);
- $this->qi = 0;
- $this->look = TRUE;
- $this->move();
- $this->tree = $this->cqlQuery("cql.serverChoice", "scr", $this->std_prefixes, array());
- if ($this->look != FALSE)
- $this->add_diagnostic(10, "$this->qi");
-
- return $this->parse_ok;
- }
-
- function result() {
- return $this->tree;
- }
-
- function result2xml($ar) {
- return $this->tree2xml_r($ar, 0);
- }
-
- // private
- var $r_srw_response;
- //handle to SRW_response object
- var $qs;
- // query string
- var $ql;
- // query string length
- var $qi;
- // position in qs when parsing
- var $look;
- // last seen token
- var $val;
- // attribute value for token
- var $lval;
- // lower case of value when string
- var $tree = array();
- var $std_prefixes = array();
- var $debug_level = 0;
- // debug level, from 0 to 3
- var $diags = '';
- // diagnostics array to be passed to SRW-response
- var $parse_ok = TRUE;
- // cql parsing went ok
- // pjo added var jump
- var $jump;
-
- function move() {
- // first step is to skip blanks from begging of string
- while ($this->qi < $this->ql && strchr(" \t\r\n", $this->qs[$this->qi]))
- $this->qi++;
- // pjo testing
- //if ($this->qi == $this->ql)
- if ($this->qi >= $this->ql) {
- $this->look = FALSE;
- return;
- }
- // now skip ()/><=
- $c = $this->qs[$this->qi];
- if (strchr("()/", $c)) {
- $this->look = $c;
- $this->qi++;
- }
- elseif (strchr("<>=", $c)) {
- $this->look = $c;
- $this->qi++;
- while ($this->qi < $this->ql && strchr("<>=", $this->qs[$this->qi])) {
- $this->look .= $this->qs[$this->qi];
- $this->qi++;
- }
- }
- // if quoted string -> add to stringvalue untill next quote is met
- elseif (strchr("\"' ", $c)) {
- $this->look = 'q';
- $mark = $c;
- $this->qi++;
- $this->val = '';
- while ($this->qi < $this->ql && $this->qs[$this->qi] != $mark) {
- if ($this->qs[$this->qi] == '\\' && $this->qi < $this->ql - 1)
- $this->qi++;
- $this->val .= $this->qs[$this->qi];
- $this->qi++;
- }
- $this->lval = strtolower($this->val);
- if ($this->qi < $this->ql)
- $this->qi++;
- }
- // pjo 15-09-10. added elseif; remove this piece of code if you wish to use old code
- elseif ($this->jump) {
- $this->look = 's';
- $this->val = $this->jump;
- $this->lval = strtolower($this->val);
- $this->qi += strlen($this->jump);
- unset($this->jump);
- }
- // if none of above -> read string untill stop: ()/<>= \t\r\n is met.
- else {
- $this->look = 's';
- $start_q = $this->qi;
- // pjo 15-09-10. removed ' ' (blank) from stoplist and added stop() function instead
- // use original stopchars if desired: ()/<>= \t\r\n and remove && !$this->stop() from end of while loop
- while ($this->qi < $this->ql && !strchr("()/<>=\t\r\n", $this->qs[$this->qi]) && !$this->stop())
- $this->qi++;
-
- $this->val = substr($this->qs, $start_q, $this->qi - $start_q);
- $this->lval = strtolower($this->val);
-
- //echo "VAL: ".$this->val."\n";
- }
- }
-
- // pjo 15-09-10. added stop function as replacement for stopping on blanks
- function stop() {
- if ($this->look() != " ")
- return false;
-
- $stoppers = array('and', 'or', 'not', 'prox');
-
- foreach ($stoppers as $key => $val) {
- $stop1 = ' ' . $val . ' ';
- $stop2 = ' ' . $val . '(';
-
- if ($this->look(strlen($val) + 2) == $stop1 || $this->look(strlen($val) + 2) == $stop2) {
- $this->jump = $val;
- //echo "STOP: ".$val.": jump:".$this->jump."\n";
- return true;
- }
- }
-
- return false;
- }
-
- // pjo 15-09-10. return a substring of querystring from current index and given number of chars forward
- function look($count = 1) {
- $ret = substr($this->qs, $this->qi, $count);
-
- return $ret;
- }
-
- function modifiers($context) {
- $ar = array();
- while ($this->look == '/') {
- $this->move();
- if ($this->look != 's' && $this->look != 'q') {
- $this->add_diagnostic(10, "$this->qi");
- return $ar;
- }
- $name = $this->lval;
- $this->move();
- if (strchr("<>=", $this->look[0])) {
- $rel = $this->look;
- $this->move();
- if ($this->look != 's' && $this->look != 'q') {
- $this->add_diagnostic(10, "$this->qi");
- return $ar;
- }
- $ar[$name] = array('value' => $this->lval, 'relation' => $rel);
- $this->move();
- }
- else
- $ar[$name] = TRUE;
- }
- return $ar;
- }
-
- function cqlQuery($field, $relation, $context, $modifiers) {
- $left = $this->searchClause($field, $relation, $context, $modifiers);
- while ($this->look == 's' && ($this->lval == 'and' || $this->lval == 'or' || $this->lval == 'not' || $this->lval == 'prox')) {
- $op = $this->lval;
- $this->move();
- $mod = $this->modifiers($context);
- $right = $this->searchClause($field, $relation, $context, $modifiers);
- $left = array('type' => 'boolean', 'op' => $op, 'modifiers' => $mod, 'left' => $left, 'right' => $right);
- }
- return $left;
- }
-
- function searchClause($field, $relation, $context, $modifiers) {
- if ($this->look == '(') {
- $this->move();
- $b = $this->cqlQuery($field, $relation, $context, $modifiers);
- if ($this->look == ')') {
- $this->move();
- }
- else {
- $this->add_diagnostic(13, "$this->qi");
- }
- return $b;
- }
- elseif ($this->look == 's' || $this->look == 'q') {
- $first = $this->val;
- // dont know if field or term yet
- $this->move();
-
- if ($this->look == 'q' || ($this->look == 's' && $this->lval != 'and' && $this->lval != 'or' && $this->lval != 'not' && $this->lval != 'prox')) {
- $rel = $this->val;
- // string relation
- $this->move();
- return $this->searchClause($first, $rel, $context, $this->modifiers($context));
- }
- elseif (strchr("<>=", $this->look[0])) {
- $rel = $this->look;
- // other relation <, = ,etc
- $this->move();
- return $this->searchClause($first, $rel, $context, $this->modifiers($context));
- }
- else {
- // it's a search term
- $pos = strpos($field, '.');
- if ($pos == FALSE)
- $pre = '';
- else {
- $pre = substr($field, 0, $pos);
- $field = substr($field, $pos + 1, 100);
- }
- $uri = '';
- for ($i = 0; $i < sizeof($context); $i++) {
- if ($context[$i]['prefix'] == $pre)
- $uri = $context[$i]['uri'];
- }
-
- $pos = strpos($relation, '.');
- if ($pos == FALSE)
- $pre = 'cql';
- else {
- $pre = substr($relation, 0, $pos);
- $relation = substr($relation, $pos + 1, 100);
- }
- $reluri = '';
- for ($i = 0; $i < sizeof($context); $i++) {
- if ($context[$i]['prefix'] == $pre)
- $reluri = $context[$i]['uri'];
- }
- return array('type' => 'searchClause',
- 'field' => $field,
- 'fielduri' => $uri,
- 'relation' => $relation,
- 'relationuri' => $reluri,
- 'modifiers' => $modifiers,
- 'term' => $first);
- }
- }
- elseif ($this->look == '>') {
- $this->move();
- if ($this->look != 's' && $this->look != 'q')
- return array();
- $first = $this->lval;
- $this->move();
- if ($this->look == '=') {
- $this->move();
- if ($this->look != 's' && $this->look != 'q')
- return array();
- $context = $this->add_prefix($context, $first, '', $this->lval);
- $this->move();
- return $this->cqlQuery($field, $relation, $context, $modifiers);
- }
- else {
- $context = $this->add_prefix($context, '', '', $first);
- return $this->cqlQuery($field, $relation, $context, $modifiers);
- }
- }
- else {
- $this->add_diagnostic(10, "$this->qi");
- }
- }
-
- function add_prefix($ar, $prefix, $title, $uri) {
- if (!is_array($ar))
- $ar = array();
- for ($i = 0; $i < sizeof($ar); $i++)
- if ($ar[$i]['prefix'] == $prefix)
- break;
- $ar[$i] = array('prefix' => $prefix, 'title' => $title, 'uri' => $uri);
- return $ar;
- }
-
- function tree2xml_modifiers($ar, $level) {
- if (sizeof($ar) == 0) {
- return "";
- }
- $s = str_repeat(' ', $level);
- $s .= "\n";
-
- $k = array_keys($ar);
-
- foreach ($k as $no => $key) {
- $s .= str_repeat(' ', $level + 1);
- $s .= "\n";
-
- $s .= str_repeat(' ', $level + 2);
- $s .= '' . htmlspecialchars($key) . "
-
- if (isset($ar[$key]['relation'])) {
- $s .= str_repeat(' ', $level + 2);
- $s .= '' . htmlspecialchars($ar[$key]['relation']) . "\n";
- }
- if (isset($ar[$key]['value'])) {
- $s .= str_repeat(' ', $level + 2);
- $s .= '' . htmlspecialchars($ar[$key]['value']) . "\n";
- }
- $s .= str_repeat(' ', $level + 1);
- $s .= "\n";
- }
- $s .= str_repeat(' ', $level);
- $s .= "\n";
- return $s;
- }
-
- function tree2xml_indent($level) {
- return str_repeat(' ', $level * 2);
- }
-
- function tree2xml_r($ar, $level) {
- $s = '';
- if (!isset($ar['type'])) {
- return $s;
- }
- if ($ar['type'] == 'searchClause') {
- $s .= $this->tree2xml_indent($level);
- $s .= "\n";
-
-
- if (strlen($ar['fielduri'])) {
- $s .= $this->tree2xml_indent($level + 1);
- $s .= "\n";
- $s .= $this->tree2xml_indent($level + 2);
- $s .= "\n";
- $s .= $this->tree2xml_indent($level + 3);
- $s .= "" . $ar['fielduri'] . "\n";
- $s .= $this->tree2xml_indent($level + 2);
- $s .= "\n";
- $s .= $this->tree2xml_indent($level + 1);
- $s .= "\n";
- }
- $s .= $this->tree2xml_indent($level + 1);
- $s .= '' . htmlspecialchars($ar['field']) . "\n";
-
- $s .= $this->tree2xml_indent($level + 1);
- $s .= "\n";
- if (strlen($ar['relationuri'])) {
- $s .= $this->tree2xml_indent($level + 2);
- $s .= '' . $ar['relationuri'] . "\n";
- }
- $s .= $this->tree2xml_indent($level + 2);
- $s .= "" . htmlspecialchars($ar['relation']) . "\n";
- $s .= $this->tree2xml_modifiers($ar['modifiers'], $level + 3);
-
- $s .= $this->tree2xml_indent($level + 1);
- $s .= "\n";
-
- $s .= $this->tree2xml_indent($level + 1);
- $s .= '' . htmlspecialchars($ar['term']) . "\n";
-
- $s .= $this->tree2xml_indent($level);
- $s .= "\n";
- }
- elseif ($ar['type'] == 'boolean') {
- $s .= $this->tree2xml_indent($level);
- $s .= "\n";
-
- $s .= $this->tree2xml_indent($level + 1);
- $s .= "\n";
-
- $s .= $this->tree2xml_indent($level + 2);
- $s .= "" . htmlspecialchars($ar['op']) . "\n";
-
- $s .= $this->tree2xml_modifiers($ar['modifiers'], $level + 2);
-
- $s .= $this->tree2xml_indent($level + 1);
- $s .= "\n";
-
- $s .= $this->tree2xml_indent($level + 1);
- $s .= "\n";
- $s .= $this->tree2xml_r($ar['left'], $level + 2);
- $s .= $this->tree2xml_indent($level + 1);
- $s .= "\n";
-
- $s .= $this->tree2xml_indent($level + 1);
- $s .= "\n";
- $s .= $this->tree2xml_r($ar['right'], $level + 2);
- $s .= $this->tree2xml_indent($level + 1);
- $s .= "\n";
-
- $s .= $this->tree2xml_indent($level);
- $s .= "\n";
- }
- return $s;
- }
-
- function debug($level, $string) {
- $this->r_srw_response->debug($level, $string);
- }
-
- function add_diagnostic($id, $string) {
- $this->parse_ok = FALSE;
- $this->error = srw_diag_message($id) . "; errno: " . $string;
- //echo $string;
- //$this->r_srw_response->add_diagnostic($id, $string);
- }
-}
-
Index: OpenSearch/trunk/includes/diagset.php
===================================================================
--- OpenSearch/trunk/includes/diagset.php (revision 117962)
+++ OpenSearch/trunk/includes/diagset.php (nonexistent)
@@ -1,136 +0,0 @@
-
-/*
- Copyright (C) 2004 Index Data Aps, www.indexdata.dk
-
- This file is part of SRW/PHP
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 dated June, 1991.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- A copy of the GNU General Public License is also available at
- . You may also obtain
- it by writing to the Free Software Foundation, Inc., 59 Temple
- Place - Suite 330, Boston, MA 02111-1307, USA.
-
- $Id: diagset.php,v 1.1 2005-12-22 10:38:14 fvs Exp $
-*/
-
-/*
- * Official list at:
- * http://www.loc.gov/z3950/agency/zing/srw/diagnostics-list.html
- * Depricated ones marked with 'dep'
- */
-function srw_diag_message($id)
-{
- $message = array (
- 1 => "Permanent system error",
- 2 => "System temporarily unavailable",
- 3 => "Authentication error",
- 4 => "Unsupported operation",
- 5 => "Unsupported version",
- 6 => "Unsupported parameter value",
- 7 => "Mandatory parameter not supplied",
- 8 => "Unsupported parameter",
-/* Diagnostics Relating to CQL */
- 10 => "Query syntax error",
- 11 => "Unsupported query type",
- 12 => "Too many characters in query",
- 13 => "Invalid or unsupported use of parentheses",
- 14 => "Invalid or unsupported use of quotes",
- 15 => "Unsupported context set",
- 16 => "Unsupported index",
- 17 => "Unsupported combination of index and context set", /* dep */
- 18 => "Unsupported combination of indexes",
- 19 => "Unsupported relation",
- 20 => "Unsupported relation modifier",
- 21 => "Unsupported combination of relation modifers",
- 22 => "Unsupported combination of relation and index",
- 23 => "Too many characters in term",
- 24 => "Unsupported combination of relation and term",
- 25 => "Special characters not quoted in term", /* dep */
- 26 => "Non special character escaped in term",
- 27 => "Empty term unsupported",
- 28 => "Masking character not supported",
- 29 => "Masked words too short",
- 30 => "Too many masking characters in term",
- 31 => "Anchoring character not supported",
- 32 => "Anchoring character in unsupported position",
- 33 => "Combination of proximity/adjacency and masking characters not supported",
- 34 => "Combination of proximity/adjacency and anchoring characters not supported",
- 35 => "Terms only exclusion stopwords",
- 36 => "Term in invalid format for index or relation",
- 37 => "Unsupported boolean operator",
- 38 => "Too many boolean operators in query",
- 39 => "Proximity not supported",
- 40 => "Unsupported proximity relation",
- 41 => "Unsupported proximity distance",
- 42 => "Unsupported proximity unit",
- 43 => "Unsupported proximity ordering",
- 44 => "Unsupported combination of proximity modifiers",
- 45 => "Prefix assigned to multiple identifiers", /* dep */
- 46 => "Unsupported boolean modifier",
- 47 => "Cannot process query; reason unknown",
- 48 => "Query feature unsupported",
- 49 => "Masking character in unsupported position",
-/* Diagnostics Relating to Result Sets */
- 50 => "Result sets not supported",
- 51 => "Result set does not exist",
- 52 => "Result set temporarily unavailable",
- 53 => "Result sets only supported for retrieval",
- 54 => "Retrieval may only occur from an existing result set", /* dep */
- 55 => "Combination of result sets with search terms not supported",
- 56 => "Only combination of single result set with search terms supported", /* dep */
- 57 => "Result set created but no records available", /* dep */
- 58 => "Result set created with unpredictable partial results available",
- 59 => "Result set created with valid partial results available",
- 60 => "Result set no created: too many records retrieved",
-/* Diagnostics Relating to Records */
- 61 => "First record position out of range",
- 62 => "Negative number of records requested", /* dep */
- 63 => "System error in retrieving records", /* dep */
- 64 => "Record temporarily unavailable",
- 65 => "Record does not exist",
- 66 => "Unknown schema for retrieval",
- 67 => "Record not available in this schema",
- 68 => "Not authorised to send record",
- 69 => "Not authorised to send record in this schema",
- 70 => "Record too large to send",
- 71 => "Unsupported record packing",
- 72 => "XPath retrieval unsupported",
- 73 => "XPath expression contains unsupported feature",
- 74 => "Unable to evaluate XPath expression",
-/* Diagnostics Relating to Sorting */
- 80 => "Sort not supported",
- 81 => "Unsupported sort type", /* dep */
- 82 => "Unsupported sort sequence",
- 83 => "Too many records to sort",
- 84 => "Too many sort keys to sort",
- 85 => "Duplicate sort keys", /* dep */
- 86 => "Cannot sort: incompatible record formats",
- 87 => "Unsupported schema for sort",
- 88 => "Unsupported path for sort",
- 89 => "Path unsupported for schema",
- 90 => "Unsupported direction value",
- 91 => "Unsupported case value",
- 92 => "Unsupported missing value action",
-/* Diagnostics Relating to Explain */
- 100 => "Explain not supported", /* dep */ /* use 4 */
- 101 => "Explain request type not supported (SOAP vs GET)", /* dep */
- 102 => "Explain record temporarily unavailable", /* dep */ /* use 64 */
-/* Diagnostics Relating to Stylesheets */
- 110 => "Stylesheets not supported",
- 111 => "Unsupported stylesheet",
-/* Diagnostics relating to Scan */
- 120 => "Response position out of range",
- 121 => "Too many terms requested"
- );
-
- return $message[$id];
-}
-
Index: OpenSearch/trunk/marcxchange-1-1.xsd
===================================================================
--- OpenSearch/trunk/marcxchange-1-1.xsd (revision 117962)
+++ OpenSearch/trunk/marcxchange-1-1.xsd (nonexistent)
@@ -1,141 +0,0 @@
-
-
-
-
- MarcXchange: The general XML schema for MARC formatted records. Prepared by Tommy Schomacker - version 1.1 - July 2007.
- MarcXchange is made as a generalization (mainly by weakening restrictions) of the MARCXML schema for MARC21.
- MARCXML is made by Corey Keith from the Library of Congress.
-
-
- The schema supports XML markup of MARC records as specified in ISO 2701.
- ISO 2709 defines the following general structure: Record Label - Directory - Record Identifier - Reference Fields - Data Fields.
- In the schema the element "leader" is used for ISO 2709 Record Label,
- the element "control field" for ISO 2709 Record Identifier and Reference Fields,
- and the element "data field" for ISO 2709 Data Fields.
- The schema has no counterpart to ISO 2709 Directory.
-
-
- Extensions and elucidations:
- The schema allows the usage of "data fields" for all legal tags, including 001 to 009, 00A to 00Z and 00a to 00z.
- Subfield identifiers may consist of 8 bits characters from ISO 10646 BMP row 00 (Basic Latin and Latin-1 Supplement).
- Two attributes are introduced to specify the content of a record - "format" to specify the MARC format, "type" to specify the kind of record.
-
-
-
-
- collection is a top level container element for 0 or many records
-
-
-
-
- record is a top level container element for all of the field elements which compose the record
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ISO 2709 Record Label, 24 octets
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ISO 2709 Record Identifier and Reference Fields
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ISO 2709 data fields
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: OpenSearch/trunk/dcmitype.xsd
===================================================================
--- OpenSearch/trunk/dcmitype.xsd (revision 117962)
+++ OpenSearch/trunk/dcmitype.xsd (nonexistent)
@@ -1,42 +0,0 @@
-
-
-
-
- DCMI Type Vocabulary XML Schema
- XML Schema for http://purl.org/dc/dcmitype/ namespace
-
- Created 2008-02-11
-
- Created by
-
- Tim Cole (t-cole3@uiuc.edu)
- Tom Habing (thabing@uiuc.edu)
- Jane Hunter (jane@dstc.edu.au)
- Pete Johnston (p.johnston@ukoln.ac.uk),
- Carl Lagoze (lagoze@cs.cornell.edu)
-
- This schema defines a simpleType which enumerates
- the allowable values for the DCMI Type Vocabulary.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: OpenSearch/trunk/dkabm.xsd
===================================================================
--- OpenSearch/trunk/dkabm.xsd (revision 117962)
+++ OpenSearch/trunk/dkabm.xsd (nonexistent)
@@ -1,27 +0,0 @@
-
-
-
-
-
- DKABM. Bibliotek og Medier, 20-aug-2009.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: OpenSearch/trunk/docbook.xsd
===================================================================
--- OpenSearch/trunk/docbook.xsd (revision 117962)
+++ OpenSearch/trunk/docbook.xsd (nonexistent)
@@ -1,17458 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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