Source for file verify.php

Documentation is available at verify.php

  1. <?php
  2. /**
  3. * Getting data from original specimen data provider
  4. * <br/><br/>
  5. @author Gabriele Droege, DNA Bank Network <contact@dnabank-network.org>
  6. @version 2.0
  7. @package Input
  8. @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org<br>The contents of this file are subject to the Mozilla Public License Version 1.1
  9. @filesource
  10. @license http://www.mozilla.org/MPL/ MPL
  11. */
  12.  
  13.     /********************************************************************************************
  14.     * increasing time for trying to connect to provider                                         *
  15.     *********************************************************************************************/
  16.     set_time_limit(1000);
  17.  
  18.  
  19.     $processor new XSLTProcessor
  20.     $xsl new DOMDocument;
  21.  
  22.     /********************************************************************************************
  23.     * loading xstl stylesheet, depending on required schema                                     *
  24.     *********************************************************************************************/
  25. if($ID_Schema == 1{
  26.  $xsl->load('../input/XSLT/en_ABCD1.2_Summary.xslt');
  27.  }
  28. if($ID_Schema == 2{
  29.  $xsl->load('../input/XSLT/en_ABCD2.0_Summary.xslt');
  30. }
  31. if($ID_Schema == OR $ID_Schema == 6{
  32.  $xsl->load('../input/XSLT/en_DarwinCore_UnitDetail.xslt');
  33. }
  34. if($ID_Schema == 4{
  35.  $xsl->load('../input/XSLT/en_ABCD2.05_Summary.xslt');
  36. }
  37.  
  38.  
  39.     /********************************************************************************************
  40.     * parsing the provider url and checking availability                                        *
  41.     *********************************************************************************************/
  42. $inf parse_url($Provider);
  43.  
  44.  $host $inf['host'];
  45.  
  46.  
  47.  $path $inf['path'];
  48.  if (isset($inf['query'])) $path .= '?'.$inf['query'];
  49.  
  50.  if (isset($inf['port'])) $port $inf['port'];
  51.  else $port 80;
  52. if($Provider)
  53. {
  54. error_reporting(E_ALL E_WARNING E_NOTICE);
  55. $fp @fsockopen($host$port$errno$error5);
  56. if(!$fp or !$hostecho "<span class='error'>Connection to provider failed! ";
  57. if($_GET['ID_DNA'!= ""$ProviderCheck trueecho "Show data from cache.</span>"}
  58. else echo "Please contact your administrator.</span>";  } }
  59. if($fp and $host{
  60.  
  61. if(!fopen($Provider,"r")) echo "<span class='error'>Provider url incorrect! ";
  62. if($_GET['ID_DNA'!= ""$ProviderCheck trueecho "Show data from cache.</span>"}
  63. else echo "Please contact your administrator.</span>";  } }
  64. if(fopen($Provider,"r")) {
  65.  
  66.     /********************************************************************************************
  67.     * $searchform != "true" means system currently uses the input form and not the edit form    *
  68.     * $variable5 see line 145                                                                   *
  69.     *********************************************************************************************/
  70.  
  71. if($searchform != "true" and $variable5 == ""{
  72.  
  73. if($ID_Schema == 3
  74.     /************************************************************************************************
  75.     * $ID_Schema == 3 means source is a DiGIR provider (see also tableschema                        *
  76.     * DiGIR makes use of DarwinCore data schema which has two elements for a UnitID/CatalogueNumber *
  77.     * CatalogueNumber and CatalogueNumberText, both or only one of them can be filled with content  *
  78.     * if CatalogueNumberText != '' -> use this one; if not use the other                            *
  79.     *************************************************************************************************/
  80.  
  81. $file1 $Provider.$QueryPart1.$Digir_Resource1.$QueryPart1_1.$Digir_Source1."%3C%2Fdestination%3E%0A%09%09%3Ctype%3Esearch%3C%2Ftype%3E%0A%09%09%3C%2Fheader%3E%0A%09%09%3Csearch%3E%0A%09%09%3Cfilter%3E+%3Cequals%3E+%3Cdarwin%3ACatalogNumberText%3E".$SpecimenNumber."%3C%2Fdarwin%3ACatalogNumberText%3E+%3C%2Fequals%3E+%3C%2Ffilter%3E%0A%09%09%3Crecords++start%3D%220%22+limit%3D%2210%22%3E%0A%09%09%3Cstructure+schemaLocation%3D%22http%3A%2F%2Fsearch.biocase.org%2Feurope%2Fstatic%2FdarwinObis.xsd%22%2F%3E%0A%09%09%3C%2Frecords%3E%0A%09%09%3Ccount%3Efalse%3C%2Fcount%3E%0A%09%09%3C%2Fsearch%3E%0A%09%09%3C%2Frequest%3E"
  82.  
  83.   $file2 $Provider.$QueryPart1.$Digir_Resource1.$QueryPart1_1.$Digir_Source1."%3C%2Fdestination%3E%0A%09%09%3Ctype%3Esearch%3C%2Ftype%3E%0A%09%09%3C%2Fheader%3E%0A%09%09%3Csearch%3E%0A%09%09%3Cfilter%3E+%3Cequals%3E+%3Cdarwin%3ACatalogNumber%3E".$SpecimenNumber."%3C%2Fdarwin%3ACatalogNumber%3E+%3C%2Fequals%3E+%3C%2Ffilter%3E%0A%09%09%3Crecords++start%3D%220%22+limit%3D%2210%22%3E%0A%09%09%3Cstructure+schemaLocation%3D%22http%3A%2F%2Fsearch.biocase.org%2Feurope%2Fstatic%2FdarwinObis.xsd%22%2F%3E%0A%09%09%3C%2Frecords%3E%0A%09%09%3Ccount%3Efalse%3C%2Fcount%3E%0A%09%09%3C%2Fsearch%3E%0A%09%09%3C%2Frequest%3E";
  84.  
  85.      
  86.      $xml new DOMDocument;
  87.      $xml->load($file1);
  88.      $CatNoText $xml->getElementsByTagName('CatalogNumberText');
  89.  
  90.      if($CatNoText->item(0)->nodeValue == $SpecimenNumber{  
  91.       $processor->setParameter('''formSpecimenNumber'$formSpecimenNumber);
  92.       $processor->importStyleSheet($xsl);
  93.       $xml1 new DOMDocument('1.0''UTF-8');
  94.       $xml1->load($file1);
  95.       $html $processor->transformToXML($xml1);
  96.       echo $html
  97.  }
  98.      if($CatNoText->item(0)->nodeValue != $SpecimenNumber
  99.      $processor->setParameter('''formSpecimenNumber'$formSpecimenNumber);
  100.      $processor->importStyleSheet($xsl);
  101.      $xml2 new DOMDocument('1.0''UTF-8');
  102.      $xml2->load($file2);
  103.      $html $processor->transformToXML($xml2);
  104.      echo $html;  
  105.      
  106.   }
  107.  }
  108.  
  109. if($ID_Schema != 3{
  110. $file $Provider.$QueryPart1.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2.$SpecimenNumber.$QueryPart2;
  111. // echo $file;
  112. $processor->setParameter('''searchform''');
  113. $processor->setParameter('''formSpecimenNumber'$formSpecimenNumber);
  114. $processor->importStyleSheet($xsl);
  115. $xml3 new DOMDocument('1.0''UTF-8');
  116. $xml3->load($file);
  117. $html $processor->transformToXML($xml3);
  118. echo $html;      }
  119.  
  120. //if($searchform != "true"  and $variable5 == "")     
  121.  
  122.      
  123.  if($searchform != "true" and $variable5 != ""{
  124.  
  125.     /**********************************************************************************************
  126.     * sometimes the user received more than one specimen record (by using *), than he/she has     *
  127.     * to select one; to be sure that during query process the right one is called some further    *
  128.     * help form elements are filled with content and are checked here                             *
  129.     * this parameters are filled during the xslt transformation  (see scripts in folder XSLT)     *
  130.     **********************************************************************************************/
  131.  
  132. if($ID_Schema == and $CatalogNoText == "True")
  133. {
  134. $file $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b."CatalogNumberText%3E".$SourceUnitID."%3C%2Fdarwin%3ACatalogNumberText".$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5;
  135.  
  136. if($ID_Schema == and $CatalogNoText != "True")
  137. {
  138. $file $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b."Cata
  139. logNumber%3E".$SourceUnitID."%3C%2Fdarwin%3ACatalogNumber".$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5;
  140.  
  141. else
  142. {
  143.  
  144. $file $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b.$SourceUnitID.$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5}
  145.  
  146. $processor->importStyleSheet($xsl);
  147. $processor->setParameter('''searchform''');
  148. $xml new DOMDocument('1.0''UTF-8');
  149. $xml->load($file);
  150. $html $processor->transformToXML($xml);
  151. echo $html;  
  152.  
  153.  
  154.  // if($searchform != "true" and $variable5 != "") { 
  155.  
  156.  
  157.  
  158.     /************************************************************************************************
  159.     * $searchform == "true" means system currently uses the edit/search form and not the input form *
  160.     ************************************************************************************************/
  161.     
  162.     
  163. if($searchform == "true")
  164. {
  165. if($ID_Schema == and $CatalogNoText == "True")
  166. {
  167. $file $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b."CatalogNumberText%3E".$SourceUnitID."%3C%2Fdarwin%3ACatalogNumberText".$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5;
  168.  
  169. if($ID_Schema == and $CatalogNoText != "True")
  170. {
  171. $file $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b."Cata
  172. logNumber%3E".$SourceUnitID."%3C%2Fdarwin%3ACatalogNumber".$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5;
  173.  
  174.  
  175. else
  176. {
  177. $file $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b.$SourceUnitID.$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5;
  178.  
  179. $processor->importStyleSheet($xsl);
  180. $processor->setParameter('''searchform''searchform');
  181. $xml3 new DOMDocument('1.0''UTF-8');
  182. $xml3->load($file);
  183. $html $processor->transformToXML($xml3);
  184. echo $html;     
  185.  
  186. }
  187.     
  188.   //if($searchform == "true")
  189.   
  190.   
  191.   //if(fopen($Provider,"r"))
  192.       
  193.   }
  194.  }
  195. ?>

Documentation generated on Tue, 29 Nov 2011 10:45:20 +0100 by phpDocumentor 1.4.3