Ejemplo n.º 1
0
function giveboundary($headers)
{
    writeTimeFile($_SESSION['idfile'] . "--Registry: Il boundary e' presente");
    if (preg_match('(boundary="[^\\t\\n\\r\\f\\v";]+")', $headers["Content-Type"])) {
        writeTimeFile($_SESSION['idfile'] . "--Registry: Ho trovato il boundary di tipo boundary=\"bvdwetrct637crtv\"");
        $content_type = stristr($headers["Content-Type"], 'boundary');
        $pre_boundary = substr($content_type, strpos($content_type, '"') + 1);
        $fine_boundary = strpos($pre_boundary, '"') + 1;
        //BOUNDARY ESATTO
        $boundary = '';
        $boundary = substr($pre_boundary, 0, $fine_boundary - 1);
        writeTimeFile($idfile . "--Registry: Il boundary " . $boundary);
    } else {
        if (preg_match('(boundary=[^\\t\\n\\r\\f\\v";]+[;])', $headers["Content-Type"])) {
            writeTimeFile($_SESSION['idfile'] . "--Registry: Ho trovato il boundary di tipo boundary=bvdwetrct637crtv;");
            $content_type = stristr($headers["Content-Type"], 'boundary');
            $pre_boundary = substr($content_type, strpos($content_type, '=') + 1);
            $fine_boundary = strpos($pre_boundary, ';');
            //BOUNDARY ESATTO
            $boundary = '';
            $boundary = substr($pre_boundary, 0, $fine_boundary);
            writeTimeFile($_SESSION['idfile'] . "--Registry: Il boundary " . $boundary);
        } else {
            //Qui devo riportare un errore perché viene dichiarato un boudary con un formato non conosciuto
            writeTimeFile($_SESSION['idfile'] . "--Registry: Il boundary non e' del tipo boundary=\"bvdwetrct637crtv\" o boundary=bvdwetrct637crtv;");
        }
    }
    return $boundary;
}
Ejemplo n.º 2
0
    $mtime = microtime();
    $mtime = explode(" ", $mtime);
    $mtime = $mtime[1] + $mtime[0];
    $endtime = $mtime;
    $totaltime = number_format($endtime - $starttime, 15);
    $STAT_QUERY = "INSERT INTO STATS (REPOSITORY,DATA,EXECUTION_TIME,OPERATION) VALUES ('" . $_SERVER['REMOTE_ADDR'] . "',CURRENT_TIMESTAMP,'{$totaltime}','STOREDQUERY-B')";
    $ris = query_exec2($STAT_QUERY, $connessione);
    writeSQLQueryService($ris . ": " . $STAT_QUERY);
}
######################################################################
#### METTO L'ebXML SU STRINGA
$ebXML_Response_SOAPED_string = makeSoapedSuccessStoredQueryResponse($Action, $MessageID, $ebXML_Response_string);
### SCRIVO LA RISPOSTA IN UN FILE
$file_input = $idfile . "-ebxmlResponseSOAP.xml";
writeTmpQueryFiles($ebXML_Response_SOAPED_string, $file_input, true);
writeTimeFile($idfile . "--StoredQuery: Creo file ebxmlResponseSOAP");
SendResponseFile($tmpQueryService_path . $file_input);
//SendResponse($ebXML_Response_SOAPED_string,"application/soap+xml",(string)filesize($tmpQueryService_path.$idfile."-ebxmlResponseSOAP.xml"));
// Clean tmp folder
$system = PHP_OS;
$windows = substr_count(strtoupper($system), "WIN");
if ($clean_cache == "O") {
    if ($windows > 0) {
        exec('del tmpQueryService\\' . $idfile . "* /q");
    } else {
        exec('rm -Rf ' . $tmpQueryService_path . $idfile . "*");
    }
}
unset($_SESSION['tmp_path']);
unset($_SESSION['idfile']);
unset($_SESSION['logActive']);
Ejemplo n.º 3
0
    require_once './lib/syslog.php';
    $syslog = new Syslog();
    // ATNA IMPORT per Register Document Set
    $eventOutcomeIndicator = "0";
    //EventOutcomeIndicator 0 OK 12 ERROR
    $registry_endpoint = $http_protocol . $ip_server . ":" . $port_server . $www_REG_path . "registry.php";
    $ip_repository = $_SERVER['REMOTE_ADDR'];
    $today = date("Y-m-d");
    $cur_hour = date("H:i:s");
    $datetime = $today . "T" . $cur_hour;
    $message_import = "<AuditMessage>\n\t<EventIdentification EventDateTime=\"{$datetime}\" EventActionCode=\"R\" EventOutcomeIndicator=\"0\">\n\t\t<EventID code=\"110106\" codeSystemName=\"DCM\" displayName=\"Import\"/>\n\t\t<EventTypeCode code=\"ITI-14\" codeSystemName=\"IHE Transactions\" displayName=\"Register Document Set\"/>\n\t</EventIdentification>\n\t<AuditSourceIdentification AuditSourceID=\"MARIS Registry\">\n\t\t<AuditSourceTypeCode code=\"4\" />\n\t</AuditSourceIdentification>\n\t<ActiveParticipant UserID=\"{$ip_repository}\" UserIsRequestor=\"true\">\n\t\t<RoleIDCode code=\"110153\" codeSystemName=\"DCM\" displayName=\"Source\"/>\n\t</ActiveParticipant>\n\t<ActiveParticipant UserID=\"{$registry_endpoint}\" UserIsRequestor=\"false\">\n\t\t<RoleIDCode code=\"110152\" codeSystemName=\"DCM\" displayName=\"Destination\"/>\n\t</ActiveParticipant>\n\t<ParticipantObjectIdentification ParticipantObjectID=\"" . htmlentities($XDSSubmissionSetPatientId) . "\" ParticipantObjectTypeCode=\"1\" ParticipantObjectTypeCodeRole=\"1\">\n\t\t<ParticipantObjectIDTypeCode code=\"2\"/>\n    \t</ParticipantObjectIdentification>\n\t<ParticipantObjectIdentification ParticipantObjectID=\"" . $SubmissionSetUniqueId_valid_array[3] . "\" ParticipantObjectTypeCode=\"2\" ParticipantObjectTypeCodeRole=\"20\">\n\t\t<ParticipantObjectIDTypeCode code=\"urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd\"/>\n\t</ParticipantObjectIdentification>\n\t</AuditMessage>";
    $logSyslog = $syslog->Send($ATNA_host, $ATNA_port, $message_import);
    if ($clean_cache != "O") {
        writeTmpFiles($message_import, $idfile . "-atna_import.xml");
    }
    writeTimeFile($idfile . "--Registry: Ho spedito i messaggi di ATNA");
}
//Statistiche
if ($statActive == "A") {
    //Parte per calcolare i tempi di esecuzione
    $mtime = microtime();
    $mtime = explode(" ", $mtime);
    $mtime = $mtime[1] + $mtime[0];
    $endtime = $mtime;
    $totaltime = number_format($endtime - $starttime, 15);
    $STAT_SUBMISSION = "INSERT INTO STATS (REPOSITORY,DATA,EXECUTION_TIME,OPERATION) VALUES ('" . $_SERVER['REMOTE_ADDR'] . "',CURRENT_TIMESTAMP,'{$totaltime}','SUBMISSION-A')";
    $ris = query_exec2($STAT_SUBMISSION, $connessione);
    writeSQLQuery($ris . ": " . $STAT_SUBMISSION);
}
disconnectDB($connessione);
unset($_SESSION['tmp_path']);
Ejemplo n.º 4
0
function giveboundary($headers)
{
    if (stripos($headers["Content-Type"], "boundary")) {
        writeTimeFile($_SESSION['idfile'] . "--Repository: Il boundary e' presente");
        if (preg_match('(boundary="[^\\t\\n\\r\\f\\v";]+")', $headers["Content-Type"])) {
            writeTimeFile($_SESSION['idfile'] . "--Repository: Ho trovato il boundary di tipo boundary=\"bvdwetrct637crtv\"");
            $content_type = stristr($headers["Content-Type"], 'boundary');
            $pre_boundary = substr($content_type, strpos($content_type, '"') + 1);
            $fine_boundary = strpos($pre_boundary, '"') + 1;
            //BOUNDARY ESATTO
            $boundary = '';
            $boundary = substr($pre_boundary, 0, $fine_boundary - 1);
            writeTimeFile($idfile . "--Repository: Il boundary " . $boundary);
        } else {
            if (preg_match('(boundary=[^\\t\\n\\r\\f\\v";]+[;])', $headers["Content-Type"])) {
                writeTimeFile($_SESSION['idfile'] . "--Repository: Ho trovato il boundary di tipo boundary=bvdwetrct637crtv;");
                $content_type = stristr($headers["Content-Type"], 'boundary');
                $pre_boundary = substr($content_type, strpos($content_type, '=') + 1);
                $fine_boundary = strpos($pre_boundary, ';');
                //BOUNDARY ESATTO
                $boundary = '';
                $boundary = substr($pre_boundary, 0, $fine_boundary);
                writeTimeFile($_SESSION['idfile'] . "--Repository: Il boundary " . $boundary);
            } else {
                writeTimeFile($_SESSION['idfile'] . "--Repository: Il boundary non e' del tipo boundary=\"bvdwetrct637crtv\" o boundary=bvdwetrct637crtv;");
            }
        }
        $MTOM = false;
    } else {
        writeTimeFile($_SESSION['idfile'] . "--Repository: non e' dichiarato il boundary");
        $MTOM = true;
        $boundary = "--boundary_per_MTOM";
    }
    $ret = array($boundary, $MTOM);
    return $ret;
}
Ejemplo n.º 5
0
# ------------------------------------------------------------------------------------
# MARIS XDS REPOSITORY
# Copyright (C) 2007 - 2010  MARiS Project
# Dpt. Medical and Diagnostic Sciences, University of Padova - csaccavini@rad.unipd.it
# This program is distributed under the terms and conditions of the GPL
# Contributor(s):
# A-thon srl <*****@*****.**>
# Alberto Castellini
# See the LICENSE files for details
# ------------------------------------------------------------------------------------
require_once "./config/REP_configuration.php";
if ($repository_status == "O") {
    $errorcode[] = "XDSRepositoryNotAvailable";
    $error_message[] = "Repository is down for maintenance";
    $status_response = makeSoapedFailureResponse($error_message, $errorcode);
    writeTimeFile($_SESSION['idfile'] . "--Repository: Repository is down");
    $file_input = $idfile . "-down_failure_response.xml";
    writeTmpFiles($status_response, $file_input, true);
    //SendResponseFile($tmp_path.$file_input);
    SendResponse($status_response);
    exit;
}
ob_start();
//Non stampa niente a monitor ma mette tutto su un buffer
$connessione = connectDB();
//ob_get_clean();//OKKIO FONDAMENTALE!!!!! Pulisco il buffer
//ob_end_flush();// Spedisco il contenuto del buffer
$token = $_GET["token"];
$get_token = "SELECT URI,MIMETYPE,CRYPT FROM DOCUMENTS WHERE KEY_PROG={$token}";
$res_token = query_select2($get_token, $connessione);
// Da verificare se si possono usare funzioni php al posto di java
Ejemplo n.º 6
0
function writeTmpFiles($log_text, $file_name, $mandatory = false)
{
    ### PATH COMPLETO AL FILE
    if (!isset($_SESSION['tmp_path'])) {
        $pathToFile = "./tmp/" . $file_name;
    } else {
        $pathToFile = $_SESSION['tmp_path'] . $file_name;
    }
    $writef = false;
    $nfile = 0;
    //Se il file è obbligatorio devo accertarmi che venga salvato
    if ($mandatory) {
        while (!$writef && $nfile < 10) {
            ### APERTURA DEL FILE IN FORMA TAIL ED IN SOLA SCRITTURA
            $handler_log = fopen($pathToFile, "wb+");
            if ($handler_log) {
                ## CASO DI DATO TIPO ARRAY
                if (is_array($log_text)) {
                    $txt = "";
                    ### IMPOSTA L'ARRAY NELLA FORMA [etichetta] = valore
                    foreach ($log_text as $element => $value) {
                        $txt = $txt . "{$element} = {$value}\n";
                    }
                    //END OF foreach
                    $log_text = $txt;
                }
                //END OF if(is_array($log_text))
                if (fwrite($handler_log, $log_text) === FALSE) {
                    sleep(1);
                    $nfile++;
                } else {
                    // Caso OK Riesce a aprire e scrivere il file correttamente
                    $writef = true;
                }
            } else {
                sleep(1);
                $nfile++;
            }
        }
        //Fine while
        #### CHIUDO L'HANDLER
        fclose($handler_log);
        if (!$writef) {
            $errorcode[] = "XDSRepositoryError";
            $error_message[] = "Repository can't create tmp file. ";
            $tmp_response = makeSoapedFailureResponse($error_message, $errorcode);
            writeTimeFile($_SESSION['idfile'] . "--Repository: Tmp File error");
            $file_input = $idfile . "-tmp_failure_response-" . $idfile;
            writeTmpFiles($tmp_response, $file_input);
            SendResponse($tmp_response);
            exit;
        }
    } else {
        $handler_log = fopen($pathToFile, "wb+");
        ## CASO DI DATO TIPO ARRAY
        if (is_array($log_text)) {
            $txt = "";
            ### IMPOSTA L'ARRAY NELLA FORMA [etichetta] = valore
            foreach ($log_text as $element => $value) {
                $txt = $txt . "{$element} = {$value}\n";
            }
            //END OF foreach
            $log_text = $txt;
        }
        //END OF if(is_array($log_text))
        fwrite($handler_log, $log_text);
        fclose($handler_log);
    }
    #### RITORNO IL PATH AL FILE SCRITTO
    return $pathToFile;
}
Ejemplo n.º 7
0
    $get_repUniqueId = "SELECT UNIQUEID FROM CONFIG_B";
    $res_repUniqueId = query_select($get_repUniqueId);
    if ($res_repUniqueId[0][0] == $DocumentRequests_array[$i][0]) {
        //se il repository unique id corrisponde alla richiesta
        $get_DocUniqueId = "SELECT XDSDOCUMENTENTRY_UNIQUEID,URI,MIMETYPE,CRYPT FROM DOCUMENTS WHERE XDSDOCUMENTENTRY_UNIQUEID='" . $DocumentRequests_array[$i][1] . "'";
        writeTimeFile($idfile . "--GetDocument Retrieve: {$get_DocUniqueId}");
        $res_DocUniqueId = query_select($get_DocUniqueId);
        if ($res_DocUniqueId[0][3] == "A") {
            $file[$i] = decrypt($keycrypt, file_get_contents("./" . $res_DocUniqueId[0][1], "r"));
        } else {
            $file[$i] = file_get_contents("./" . $res_DocUniqueId[0][1], "r");
        }
        $documento_encoded64[$i] = base64_encode($file[$i]);
        writeTimeFile($idfile . "--Repository Retrieve: File {$i}: " . $file[$i]);
    } else {
        writeTimeFile($idfile . "--GetDocument Retrieve: il repository UniqueId non corrisponde " . $res_repUniqueId[0][0] . " diverso da " . $DocumentRequests_array[$i][0]);
        //Devo gestire un errore
        $errorcode[] = "XDSRepositoryMetadataError";
        $error_message[] = "Repository.uniqueID '" . $res_repUniqueId[0][0] . "' is different form your submission '" . $DocumentRequests_array[$i][0] . "'";
        $repositoryUniqueId_response = makeSoapedFailureResponse($error_message, $errorcode, $Action);
        $file_input = $_SESSION['idfile'] . "-repositoryUniqueId_failure_response-" . $_SESSION['idfile'];
        writeTmpRetrieveFiles($repositoryUniqueId_response, $file_input);
        SendResponse($repositoryUniqueId_response);
    }
}
$boundary = md5(time());
$Content_ID = md5(time() + 1);
$messageID = md5(time() + 2);
$idDoc = array();
$SOAP_stringaxml = "<?xml version='1.0' encoding='UTF-8'?>" . CRLF . "<soapenv:Envelope xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\"\n    xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">\n    <soapenv:Header>\n        <wsa:Action>urn:ihe:iti:2007:RetrieveDocumentSetResponse</wsa:Action>\n        <wsa:RelatesTo>{$MessageID}</wsa:RelatesTo>\n    </soapenv:Header>";
$SOAP_stringaxml .= "\n    <soapenv:Body>\n        <xdsb:RetrieveDocumentSetResponse xmlns:xdsb=\"urn:ihe:iti:xds-b:2007\">\n            <rs:RegistryResponse xmlns:rs=\"urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0\"\n                status=\"urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success\"/>";
Ejemplo n.º 8
0
function connectDB()
{
    include './config/registry_oracle_db.php';
    //putenv("ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0");
    # open connection to db
    $conn = oci_connect($user_db, $password_db, $db);
    if (!$conn) {
        $errorcode = array();
        $error_message = array();
        $errorcode[] = "XDSRegistryError";
        $err = ocierror();
        $error_message[] = $err['message'];
        $database_error_response = makeSoapedFailureResponse($error_message, $errorcode);
        writeTimeFile($_SESSION['idfile'] . "--Registry: database_error_response");
        $file_input = $_SESSION['idfile'] . "-database_error_response.xml";
        writeTmpFiles($database_error_response, $file_input, true);
        SendResponseFile($_SESSION['tmp_path'] . $file_input);
        //SendResponse($database_error_response);
        exit;
    }
    return $conn;
}
Ejemplo n.º 9
0
 function set_protocol($protocol)
 {
     $this->protocol = $protocol;
     writeTimeFile("HTTP_client: Protocol" . $this->protocol);
 }
Ejemplo n.º 10
0
function controllaPayload($input)
{
    $errorcode = array();
    $error_message = array();
    $dom_ebXML = domxml_open_mem($input);
    $root_ebXML = $dom_ebXML->document_element();
    $dom_ebXML_node_array = $root_ebXML->get_elements_by_tagname("RegistryObjectList");
    $node = $dom_ebXML_node_array[0];
    $payload = $node->child_nodes();
    $isNotEmpty = count($payload) - 1;
    if (!$isNotEmpty) {
        $errorcode[] = "XDSMissingMetadata";
        $error_message[] = "No metadata";
        $empty_payload_response = makeSoapedFailureResponse($error_message, $errorcode);
        writeTimeFile($_SESSION['idfile'] . "--Registry: empty_payload_response");
        $file_input = $_SESSION['idfile'] . "-empty_payload_response.xml";
        writeTmpFiles($empty_payload_response, $file_input, true);
        SendResponseFile($_SESSION['tmp_path'] . $file_input);
        //SendResponse($empty_payload_response);
        exit;
    }
    return $isNotEmpty;
}
Ejemplo n.º 11
0
function controllaQuery($SQLQuery)
{
    $errorcode = array();
    $error_message = array();
    $isQueryAllowed = true;
    ###DEFAULT
    $queryError = "";
    $pos_1 = strpos(strtoupper($SQLQuery), "SELECT");
    $pos_2 = strpos(strtoupper($SQLQuery), "*");
    //$pos_3=strpos(strtoupper($SQLQuery),"%");
    //$pos_4=strpos(strtoupper($SQLQuery),"LIKE");
    ## Notate l'uso di ===
    ### Il == non avrebbe risposto come atteso
    ##### ACCETTO SOLO QUERY DEL TIPO:  SELECT eo.id  FROM....
    if (!($pos_1 === 0) || $pos_2) {
        $isQueryAllowed = false;
        $errorcode[] = "XDSSqlError";
        $error_message[] = "[ERROR: NOT PROPER QUERY] - YOU ARE NOT ALLOWED TO PERFORM THIS KIND OF QUERY TO THIS REGISTRY[  " . avoidHtmlEntitiesInterpretation($SQLQuery) . " ]";
        $query_not_allowed_response = makeSoapedFailureResponse($error_message, $errorcode);
        writeTimeFile($_SESSION['idfile'] . "--StoredQuery: Query NOT allowed");
        $file_input = $_SESSION['idfile'] . "-query_not_allowed.xml";
        writeTmpQueryFiles($query_not_allowed_response, $file_input, true);
        SendResponseFile($_SESSION['tmpQueryService_path'] . $file_input);
        //SendResponse($query_not_allowed_response);
        exit;
    } else {
        writeTimeFile($_SESSION['idfile'] . "--StoredQuery: Query allowed");
    }
    $ret = array($isQueryAllowed, $queryError);
    return $ret;
}
Ejemplo n.º 12
0
                $SQLSelectDOCID = "SELECT doc.id FROM ExtrinsicObject doc, ExternalIdentifier uniqId WHERE uniqId.registryobject = doc.id AND uniqId.identificationScheme = 'urn:uuid:2e82c1f6-a085-4c72-9da3-8640a32e42ab' AND uniqId.value = " . trim($Value[$SQI][1]);
                $DocUUID_arr = query_select($SQLSelectDOCID);
                $DocUUID = $DocUUID_arr[0][0];
            }
            if (strpos(strtoupper($Value[$SQI][0]), "ASSOCIATIONTYPES")) {
                $SQAssociation = $Value[$SQI][1];
                $pre_ass = "urn:oasis:names:tc:ebxml-regrep:AssociationType:";
                if (strpos($SQAssociation, $pre_ass)) {
                    $SQAssociation = str_replace($pre_ass, '', $SQAssociation);
                }
            }
        }
        // SQL Part1
        $SQLStoredQuery[0] = "SELECT DISTINCT a.id FROM Association a, ExtrinsicObject doc WHERE doc.id = '" . trim($DocUUID) . "' AND a.associationType IN " . trim($SQAssociation) . " AND (a.sourceObject = doc.id OR a.targetObject = doc.id)";
        $AssUUID_arr = query_select($SQLStoredQuery[0]);
        // SQL Part2
        $AssUUIDs = "'" . trim($AssUUID_arr[0][0]) . "'";
        for ($contaAss = 1; $contaAss < count($AssUUID_arr); $contaAss++) {
            $AssUUIDs .= ",'" . trim($AssUUID_arr[$contaAss][0]) . "'";
        }
        $SQLStoredQuery[1] = "SELECT DISTINCT doc.id FROM ExtrinsicObject doc, Association a WHERE a.id IN (" . $AssUUIDs . ") AND (doc.id = a.sourceObject OR doc.id = a.targetObject)";
        break;
}
$contaQuery = count($SQLStoredQuery);
fwrite($fp_Slot_val, $AdhocQuery_case . "\n\r");
for ($SQcount = 0; $SQcount < $contaQuery; $SQcount++) {
    fwrite($fp_Slot_val, $SQLStoredQuery[$SQcount] . "\n\r");
}
fclose($fp_Slot_val);
writeTimeFile($idfile . "--StoredQuery: Ho creato le query");
Ejemplo n.º 13
0
function connectDB()
{
    # IMPORT MYSQL PARAMETERS (NOTE: IT WORKS WITH ABSOLUTE PATH ONLY !!)
    include './config/registry_mysql_db.php';
    //ob_start();//OKKIO FONADAMENTALE!!!!!!!!!!
    # open connection to db
    $connessione = mysql_connect($ip_q, $user_db_q, $password_db_q);
    // or die("Connessione non riuscita: " . mysql_error());
    if (!$connessione) {
        $errorcode = array();
        $error_message = array();
        $errorcode[] = "XDSRegistryError";
        $error_message[] = mysql_error();
        $database_error_response = makeSoapedFailureResponse($error_message, $errorcode);
        writeTimeFile($_SESSION['idfile'] . "--Registry: database_error_response");
        $file_input = $_SESSION['idfile'] . "-database_error_response.xml";
        writeTmpFiles($database_error_response, $file_input, true);
        SendResponseFile($_SESSION['tmp_path'] . $file_input);
        //SendResponse($database_error_response,"text/xml");
        exit;
    }
    # open  db
    //mysql_select_db($db_name_q);
    return $connessione;
}
Ejemplo n.º 14
0
    ###### RICAVO LA QUERY IN FORMATO STRINGA ########
    //$SQLQuery = avoidHtmlEntitiesInterpretation(trim($node->get_content()));
    $SQLQuery = trim($node->get_content());
    //$SQLQuery = (trim($node->get_content()));
    //$SQLQuery = str_replace('&','&amp;',$SQLQuery);
    ###########################################################################
}
//END OF for ($i = 0;$i<count($SQLQuery_node_array);$i++)
//SCRIVO LA QUERY
//Mi connetto al DB
$connessione = connectDB();
###### CONTROLLO SQL RICEVUTA
$controllo_query_array = controllaQuery($SQLQuery);
###### CASO DI VALIDAZIONE SQL ===NON=== PASSATA
if (!$controllo_query_array[0]) {
    writeTimeFile($idfile . "--Query: SUPERATO IL VINCOLO DI VALIDAZIONE SU TIPO DI SQL + SCHEMAS");
}
########################################################################
### ORA DEVO ESEGUIRE LA QUERY SUL DB DEL XDS_REGISTRY_QUERY REGISTRY
################ RISPOSTA ALLA QUERY (ARRAY)
###METTO A POSTO EVENTUALI STRINGHE DI COMANDO
$SQLQuery_ESEGUITA = adjustQuery($SQLQuery);
#### IMPORTANTE!!!
###SCRIVO LA QUERY CHE EFFETTIVAMENTE LANCIO A DB
###### ESEGUO LA QUERY
$SQLResponse = query_select2($SQLQuery_ESEGUITA, $connessione);
####################################################
#### CONTROLLO COME PRIMA COSA CHE LA SQL ABBIA RISULTATO
if (empty($SQLResponse)) {
    #### STRINGA DI ERRORE
    $failure_response = "[EMPTY RESULT] - SQL QUERY[  " . avoidHtmlEntitiesInterpretation($SQLQuery) . " ] DID NOT GIVE ANY RESULTS IN THIS REGISTRY";
Ejemplo n.º 15
0
function giveboundary($headers)
{
    if (stripos($headers["Content-Type"], "boundary")) {
        writeTimeFile($_SESSION['idfile'] . "--Repository: Il boundary e' presente");
        if (preg_match('(boundary="[^\\t\\n\\r\\f\\v";]+")', $headers["Content-Type"])) {
            writeTimeFile($_SESSION['idfile'] . "--Repository: Ho trovato il boundary di tipo boundary=\"bvdwetrct637crtv\"");
            $content_type = stristr($headers["Content-Type"], 'boundary');
            $pre_boundary = substr($content_type, strpos($content_type, '"') + 1);
            $fine_boundary = strpos($pre_boundary, '"') + 1;
            //BOUNDARY ESATTO
            $boundary = '';
            $boundary = substr($pre_boundary, 0, $fine_boundary - 1);
            writeTimeFile($idfile . "--Repository: Il boundary " . $boundary);
        } else {
            if (preg_match('(boundary=[^\\t\\n\\r\\f\\v";]+[;])', $headers["Content-Type"])) {
                writeTimeFile($_SESSION['idfile'] . "--Repository: Ho trovato il boundary di tipo boundary=bvdwetrct637crtv;");
                $content_type = stristr($headers["Content-Type"], 'boundary');
                $pre_boundary = substr($content_type, strpos($content_type, '=') + 1);
                $fine_boundary = strpos($pre_boundary, ';');
                //BOUNDARY ESATTO
                $boundary = '';
                $boundary = substr($pre_boundary, 0, $fine_boundary);
                writeTimeFile($_SESSION['idfile'] . "--Repository: Il boundary " . $boundary);
            } else {
                $errorcode[] = "XDSRepositoryError";
                $error_message[] = "Repository can't recognize boundary. ";
                $folder_response = makeSoapedFailureResponse($error_message, $errorcode);
                writeTimeFile($_SESSION['idfile'] . "--Repository: Il boundary non e' del tipo boundary=\"bvdwetrct637crtv\" o boundary=bvdwetrct637crtv;");
                $file_input = $idfile . "-boundary_failure_response-" . $idfile;
                writeTmpFiles($folder_response, $file_input);
                SendResponse($folder_response);
                exit;
            }
        }
        $MTOM = false;
    } else {
        writeTimeFile($_SESSION['idfile'] . "--Repository: non e' dichiarato il boundary");
        $MTOM = true;
        //$boundary = "--boundary_per_MTOM";
    }
    $ret = array($boundary, $MTOM);
    return $ret;
}
Ejemplo n.º 16
0
$Storage_size = $res_config[0][5];
if ($Storage_number == '0') {
    $storage_directory = "./Submitted_Documents";
} else {
    $storage_directory = "./Submitted_Documents/disk-" . $Storage_number;
}
$spaziolibero = disk_free_space($storage_directory);
writeTimeFile($_SESSION['idfile'] . "--Repository: Spazio disponibile: {$spaziolibero}");
if ($spaziolibero < $Storage_size && $Storage_number != 0) {
    $Storage_number++;
    $storage_directory = "./Submitted_Documents/disk-" . $Storage_number;
    if (!is_dir($storage_directory) && strpos($_SERVER['PHP_SELF'], "repository.php")) {
        $errorcode[] = "XDSRepositoryError";
        $error_message[] = "Repository disk is FULL ";
        $File_response = makeSoapedFailureResponse($error_message, $errorcode);
        writeTimeFile($_SESSION['idfile'] . "--Repository: Disk error");
        $file_input = $idfile . "-disk_failure_response-" . $idfile;
        writeTmpFiles($File_response, $file_input);
        SendResponse($File_response);
        exit;
    }
    $updateconfig = "UPDATE CONFIG SET STORAGE = {$Storage_number}";
    $updateconfig_res = query_execute2($updateconfig, $connessione);
}
if ($Storage_number == '0') {
    $relative_docs_path = "./Submitted_Documents/" . date("Y") . "/" . date("m") . "/" . date("d") . "/";
    // come sopra
    $relative_docs_path_2 = "Submitted_Documents/" . date("Y") . "/" . date("m") . "/" . date("d") . "/";
    //PER COMPORRE L'URI
} else {
    $relative_docs_path = "./Submitted_Documents/disk-" . $Storage_number . "/" . date("Y") . "/" . date("m") . "/" . date("d") . "/";
Ejemplo n.º 17
0
function makeErrorFromRegistry($error, $message)
{
    //RESTITUISCE IL MESSAGGIO DI ERRORE
    $errorcode[] = "XDSRegistryError";
    $error_message[] = "Registry has returned errors";
    $failure_response = makeSoapedFailureResponse($error_message, $errorcode);
    writeTimeFile($_SESSION['idfile'] . "--Repository: Registry Error");
    $file_input = $_SESSION['idfile'] . "-Registry_Error-" . $_SESSION['idfile'];
    writeTmpFiles($failure_response, $file_input);
    SendResponse($failure_response);
    exit;
    //PULISCO IL BUFFER DI USCITA
    ob_get_clean();
    //OKKIO FONDAMENTALE!!!!!
}
Ejemplo n.º 18
0
function fill_Association_tables($dom, $RegistryPackage_id_array, $ExtrinsicObject_id_array, $simbolic_RegistryPackage_FOL_id_array, $connessione)
{
    writeTimeFile("Registry: sono entrato in fill_Association_tables");
    ##### RADICE DEL DOCUMENTO ebXML
    $root_ebXML = $dom->document_element();
    ##### ARRAY DEI NODI LeafRegistryObjectList
    $dom_ebXML_LeafRegistryObjectList_node_array = $root_ebXML->get_elements_by_tagname("LeafRegistryObjectList");
    ##### NODO LeafRegistryObjectList
    $dom_ebXML_LeafRegistryObjectList_node = $dom_ebXML_LeafRegistryObjectList_node_array[0];
    ##### TUTTI I NODI FIGLI DI LeafRegistryObjectList
    $dom_ebXML_LeafRegistryObjectList_child_nodes = $dom_ebXML_LeafRegistryObjectList_node->child_nodes();
    for ($i = 0; $i < count($dom_ebXML_LeafRegistryObjectList_child_nodes); $i++) {
        #### SINGOLO NODO
        $dom_ebXML_LeafRegistryObjectList_child_node = $dom_ebXML_LeafRegistryObjectList_child_nodes[$i];
        ##### tagname
        $dom_ebXML_LeafRegistryObjectList_child_node_tagname = $dom_ebXML_LeafRegistryObjectList_child_node->node_name();
        #### SOLO I NODI ASSOCIATION
        if ($dom_ebXML_LeafRegistryObjectList_child_node_tagname == 'Association') {
            $association_node = $dom_ebXML_LeafRegistryObjectList_child_node;
            $DB_array_association_attributes = array();
            $value_id = $association_node->get_attribute('id');
            if ($value_id == '' || isSimbolic($value_id)) {
                $value_id = "urn:uuid:" . idrandom();
            }
            #### PARENT
            $value_parent = $value_id;
            $value_accessControlPolicy = $association_node->get_attribute('accessControlPolicy');
            if ($value_accessControlPolicy == '') {
                $value_accessControlPolicy = "NULL";
            }
            $value_objectType = $association_node->get_attribute('objectType');
            if ($value_objectType == '') {
                $value_objectType = "Association";
            }
            $value_associationType = $association_node->get_attribute('associationType');
            if ($value_associationType == '') {
                $value_associationType = "NOT DECLARED";
            }
            $value_sourceObject = $association_node->get_attribute('sourceObject');
            //writeSQLQuery('Valore fuori dall if '.$value_sourceObject);
            if ($value_sourceObject == "") {
                $errorcode[] = "XDSRegistryError";
                $error_message[] = "The sourceObject in Association is empty. ";
                $folder_response = makeSoapedFailureResponse($error_message, $errorcode);
                writeTimeFile($_SESSION['idfile'] . "--Registry: targetObject error");
                $file_input = $idfile . "-sourceObject_failure_response.xml";
                writeTmpFiles($folder_response, $file_input, true);
                SendResponseFile($_SESSION['tmp_path'] . $file_input);
                //SendResponse($folder_response,"application/soap+xml",filesize($tmp_path.$idfile."-folder_failure_response.xml"));
                exit;
            }
            if (isSimbolic($value_sourceObject)) {
                $value_sourceObject_1 = $ExtrinsicObject_id_array[$value_sourceObject];
                $value_sourceObject_2 = $RegistryPackage_id_array[$value_sourceObject];
                if ($value_sourceObject_1 != "") {
                    $value_sourceObject = $value_sourceObject_1;
                } else {
                    $value_sourceObject = $value_sourceObject_2;
                }
            }
            //END OF if(isSimbolic($value_sourceObject))
            $value_targetObject = $association_node->get_attribute('targetObject');
            if ($value_targetObject == "") {
                $errorcode[] = "XDSRegistryError";
                $error_message[] = "The targetObject in Association is empty. ";
                $folder_response = makeSoapedFailureResponse($error_message, $errorcode);
                writeTimeFile($_SESSION['idfile'] . "--Registry: targetObject error");
                $file_input = $idfile . "-targetObject_failure_response.xml";
                writeTmpFiles($folder_response, $file_input, true);
                SendResponseFile($_SESSION['tmp_path'] . $file_input);
                //SendResponse($folder_response,"application/soap+xml",filesize($tmp_path.$idfile."-folder_failure_response.xml"));
                exit;
            }
            $simbolic_value_targetObject = $association_node->get_attribute('targetObject');
            if (isSimbolic($value_targetObject)) {
                $value_targetObject_1 = $ExtrinsicObject_id_array[$value_targetObject];
                $value_targetObject_2 = $RegistryPackage_id_array[$value_targetObject];
                if ($value_targetObject_1 != "") {
                    $value_targetObject = $value_targetObject_1;
                } else {
                    $value_targetObject = $value_targetObject_2;
                }
            }
            //END OF if(isSimbolic($simbolic_value_targetObject))
            $value_isConfirmedBySourceOwner = $association_node->get_attribute('isConfirmedBySourceOwner');
            if ($value_isConfirmedBySourceOwner == '') {
                $value_isConfirmedBySourceOwner = "0";
            }
            $value_isConfirmedByTargetOwner = $association_node->get_attribute('isConfirmedByTargetOwner');
            if ($value_isConfirmedByTargetOwner == '') {
                $value_isConfirmedByTargetOwner = "0";
            }
            $DB_array_association_attributes['id'] = $value_id;
            $DB_array_association_attributes['accessControlPolicy'] = $value_accessControlPolicy;
            $DB_array_association_attributes['objectType'] = $value_objectType;
            $DB_array_association_attributes['associationType'] = $value_associationType;
            $DB_array_association_attributes['sourceObject'] = $value_sourceObject;
            $DB_array_association_attributes['targetObject'] = $value_targetObject;
            $DB_array_association_attributes['isConfirmedBySourceOwner'] = $value_isConfirmedBySourceOwner;
            $DB_array_association_attributes['isConfirmedByTargetOwner'] = $value_isConfirmedByTargetOwner;
            $Association_folder = in_array($simbolic_value_targetObject, $simbolic_RegistryPackage_FOL_id_array);
            if (!$Association_folder) {
                ####### QUI ORA POSSO RIEMPIRE IL DB
                $INSERT_INTO_Association = "INSERT INTO Association (id,accessControlPolicy,objectType,associationType,sourceObject,targetObject,isConfirmedBySourceOwner,isConfirmedByTargetOwner) VALUES ('" . $DB_array_association_attributes['id'] . "','" . $DB_array_association_attributes['accessControlPolicy'] . "','" . $DB_array_association_attributes['objectType'] . "','" . $DB_array_association_attributes['associationType'] . "','" . $DB_array_association_attributes['sourceObject'] . "','" . $DB_array_association_attributes['targetObject'] . "','" . $DB_array_association_attributes['isConfirmedBySourceOwner'] . "','" . $DB_array_association_attributes['isConfirmedByTargetOwner'] . "')";
                $ris = query_exec2($INSERT_INTO_Association, $connessione);
                writeSQLQuery($ris . ": " . $INSERT_INTO_Association);
                #### NODI FIGLI DI ASSOCIATION
                $association_child_nodes = $association_node->child_nodes();
                if (!empty($association_child_nodes)) {
                    for ($j = 0; $j < count($association_child_nodes); $j++) {
                        #### SINGOLO NODO
                        $association_child_node = $association_child_nodes[$j];
                        ##### tagname
                        $association_child_node_tagname = $association_child_node->node_name();
                        #### SOLO I NODI SLOT
                        if ($association_child_node_tagname == 'Slot') {
                            $slot_node = $association_child_node;
                            $DB_array_slot_attributes = array();
                            $value_name = $slot_node->get_attribute('name');
                            if ($value_name == '') {
                                $value_name = "NOT DECLARED";
                            }
                            $value_slotType = $slot_node->get_attribute('slotType');
                            if ($value_slotType == '') {
                                $value_slotType = "NULL";
                            }
                            $DB_array_slot_attributes['name'] = $value_name;
                            $DB_array_slot_attributes['slotType'] = $value_slotType;
                            $DB_array_slot_attributes['value'] = '';
                            $DB_array_slot_attributes['parent'] = $value_parent;
                            #### NODI FIGLI DI SLOT
                            $slot_child_nodes = $slot_node->child_nodes();
                            for ($q = 0; $q < count($slot_child_nodes); $q++) {
                                $slot_child_node = $slot_child_nodes[$q];
                                $slot_child_node_tagname = $slot_child_node->node_name();
                                if ($slot_child_node_tagname == 'ValueList') {
                                    $valuelist_node = $slot_child_node;
                                    $valuelist_child_nodes = $valuelist_node->child_nodes();
                                    ## UN SOLO VALUE
                                    for ($r = 0; $r < count($valuelist_child_nodes); $r++) {
                                        $value_node = $valuelist_child_nodes[$r];
                                        $value_node_tagname = $value_node->node_name();
                                        if ($value_node_tagname == 'Value') {
                                            $value_value = $value_node->get_content();
                                            $DB_array_slot_attributes['value'] = $value_value;
                                            ##### SONO PRONTO A SCRIVERE NEL DB
                                            $INSERT_INTO_Slot = "INSERT INTO Slot (name,slotType,value,parent) VALUES ('" . trim($DB_array_slot_attributes['name']) . "','" . trim($DB_array_slot_attributes['slotType']) . "','" . trim(adjustString($DB_array_slot_attributes['value'])) . "','" . trim($DB_array_slot_attributes['parent']) . "')";
                                            $ris = query_exec2($INSERT_INTO_Slot, $connessione);
                                            writeSQLQuery($ris . ": " . $INSERT_INTO_Slot);
                                        }
                                    }
                                }
                            }
                        }
                        //END OF if($association_child_node_tagname=='Slot')
                    }
                }
                //END OF if(!empty($association_child_nodes))
            } else {
            }
            ########### CASI DI REPLACEMENT + ADDENDUM + TRANSFORMATION
            ##### CASO RPLC Accept Document Replace
            if ($value_associationType == "RPLC") {
                // devo verificare se il documento da sostituire è dentro ad un folder, se è dentro ad un folder devo creare una association Folder Document.
                $query_SELECT_RegistryPackage = "SELECT id from RegistryPackage where id IN (SELECT sourceObject from Association where targetObject = '{$value_targetObject}') and objectType = 'urn:uuid:d9d542f3-6cc4-48b6-8870-ea235fbc94c2'";
                $Association_folder_array = query_select2($query_SELECT_RegistryPackage, $connessione);
                writeSQLQuery($Association_folder_array . ": " . $query_SELECT_RegistryPackage);
                //Se trovo qualche RegistryPackage di tipo folder
                $conta_Folder = count($Association_folder_array);
                for ($i_Folder = 0; $i_Folder < $conta_Folder; $i_Folder++) {
                    $insert_Association_folderDoc = "INSERT INTO Association (id,objectType,associationType,sourceObject,targetObject) VALUES ('urn:uuid:" . idrandom() . "','Association','HasMember','" . $Association_folder_array[$i_Folder][0] . "','" . $value_sourceObject . "')";
                    $res_insert_Association = query_exec2($insert_Association_folderDoc, $connessione);
                    writeSQLQuery($res_insert_Association . ": " . $insert_Association_folderDoc);
                }
                // devo cambiare lo stato del documento a Deprecated
                $query_UPDATE_targetObject = "UPDATE ExtrinsicObject SET status = 'Deprecated' WHERE ExtrinsicObject.id = '{$value_targetObject}'";
                $ex = query_exec2($query_UPDATE_targetObject, $connessione);
                writeSQLQuery($ex . ": " . $query_UPDATE_targetObject);
            }
            //END OF if($value_associationType=="RPLC")
            ##### CASO XFRM_RPLC Accept Document Replace with Transformation
            if ($value_associationType == "XFRM_RPLC") {
                $query_UPDATE_targetObject = "UPDATE ExtrinsicObject SET status = 'Deprecated' WHERE ExtrinsicObject.id = '{$value_targetObject}'";
                $ex = query_exec2($query_UPDATE_targetObject, $connessione);
                writeSQLQuery($ex . ": " . $query_UPDATE_targetObject);
            }
            //END OF if($value_associationType=="XFRM_RPLC")
            ##### CASO XFRM Accept Document Transformation
            if ($value_associationType == "XFRM") {
                $query_UPDATE_targetObject = "UPDATE ExtrinsicObject SET status = 'Approved' WHERE ExtrinsicObject.id = '{$value_targetObject}'";
                $ex = query_exec2($query_UPDATE_targetObject, $connessione);
                writeSQLQuery($ex . ": " . $query_UPDATE_targetObject);
            }
            //END OF if($value_associationType=="XFRM")
            ##### CASO APND Accept Document Addendum
            if ($value_associationType == "APND") {
                $query_UPDATE_targetObject = "UPDATE ExtrinsicObject SET status = 'Approved' WHERE ExtrinsicObject.id = '{$value_targetObject}'";
                $ex = query_exec2($query_UPDATE_targetObject, $connessione);
                writeTimeFile("Registry: update status" . $query_UPDATE_targetObject);
            }
            //END OF if($value_associationType=="APND")
            ########### CASI DI GESTIONE FOLDER + SUBMISSIONSET
            if ($value_associationType == "HasMember") {
                ##### FIGLI DI ASSOCIATION
                $association_node_childs = $association_node->child_nodes();
                #### AGGIUNTA DI UN DOCUMENTO A FOLDER GIA' ESISTENTE
                if (!isSimbolic($value_sourceObject) && empty($association_node_childs)) {
                    #### APPURIAMO DI ESSERE NEL CASO FOLDER
                    $query_folder = "SELECT * FROM Slot WHERE Slot.name = 'lastUpdateTime' AND Slot.parent = '{$value_sourceObject}'";
                    $ris_folder = query_select2($query_folder, $connessione);
                    writeSQLQuery($ris_folder . ": " . $query_folder);
                    if (!empty($ris_folder[0])) {
                        #### ricavo data-ora correnti
                        $today = date("Ymd");
                        $cur_hour = date("His");
                        $datetime = $today . $cur_hour;
                        //$datetime = "CURRENT_TIMESTAMP";
                        ####UPDATE DI lastUpdateTime
                        $update_lastUpdateTime = "UPDATE Slot SET Slot.value = '{$datetime}' WHERE Slot.name = 'lastUpdateTime' AND Slot.parent = '{$value_sourceObject}'";
                        $ex = query_exec2($update_lastUpdateTime, $connessione);
                        writeSQLQuery($ex . ": " . $update_lastUpdateTime);
                    }
                    //END OF if(!empty($ris_folder))
                } else {
                    if (!isSimbolic($value_sourceObject) && !empty($association_node_childs)) {
                        for ($y = 0; $y < count($association_node_childs); $y++) {
                            ##### NODO SLOT
                            $slot_node = $association_node_childs[$y];
                            ##### RECUPERO TAGNAME
                            $slot_node_tagname = $slot_node->node_name();
                            if ($slot_node_tagname == "Slot") {
                                #### NAME ATTRIBUTE FOR SLOT
                                $slot_node_name = $slot_node->get_attribute('name');
                                #### NODI FIGLI DI SLOT
                                $slot_node_childs = $slot_node->child_nodes();
                                for ($x = 0; $x < count($slot_node_childs); $x++) {
                                    $slot_node_child = $slot_node_childs[$x];
                                    $slot_node_child_tagname = $slot_node_child->node_name();
                                    if ($slot_node_child_tagname == "ValueList") {
                                        $slot_node_childs_2 = $slot_node_child->child_nodes();
                                        for ($z = 0; $z < count($slot_node_childs_2); $z++) {
                                            $slot_node_child_2 = $slot_node_childs_2[$z];
                                            $slot_node_child_2_tagname = $slot_node_child_2->node_name();
                                            if ($slot_node_child_2_tagname == "Value") {
                                                $update_value = $slot_node_child_2->get_content();
                                            }
                                            //END OF if($slot_node_child_2_tagname=="Value")
                                        }
                                    }
                                    //END OF if($slot_node_child_tagname=="ValueList")
                                }
                                ####UPDATE DI SubmissionSetStatus Non va fatta ????? Deve rimanere Approved
                                $update_RegistryPackageStatus = "UPDATE RegistryPackage SET RegistryPackage.status = '{$update_value}' WHERE  RegistryPackage.id = '{$value_sourceObject}'";
                                //writeSQLQuery($ris.": ".$update_RegistryPackageStatus);
                                $selectIdAssociation = "SELECT id FROM Association WHERE Association.sourceObject = '{$value_sourceObject}'";
                                $ris_selectIdAssociation = query_select2($selectIdAssociation, $connessione);
                                writeSQLQuery($ris_selectIdAssociation . ": " . $selectIdAssociation);
                                $countID = count($ris_selectIdAssociation);
                                for ($risId = 0; $risId < $countID; $risId++) {
                                    //$update_SubmissionSetStatus="UPDATE Slot SET Slot.value = '$update_value' WHERE name ='$slot_node_name' AND  Slot.parent IN (SELECT id FROM Association WHERE Association.sourceObject = '$value_sourceObject')";
                                    $update_SubmissionSetStatus = "UPDATE Slot SET Slot.value = '{$update_value}' WHERE name ='{$slot_node_name}' AND  Slot.parent ='" . $ris_selectIdAssociation[$risId][0] . "'";
                                    //writeTimeFile("Registry: update Slot  ".$update_SubmissionSetStatus);
                                    $ex = query_exec2($update_SubmissionSetStatus, $connessione);
                                    writeSQLQuery($ex . ": " . $update_SubmissionSetStatus);
                                }
                            }
                            //END OF if($slot_node_tagname=="Slot")
                        }
                        //END OF for($y=0;$y<count($association_node_childs);$y++)
                    }
                }
                //END OF else if(!isSimbolic($value_sourceObject))
            }
            //END OF if($value_associationType=="HasMember")
        } else {
            continue;
        }
    }
    //END OF for($i=0;$i<count($dom_ebXML_LeafRegistryObjectList_child_nodes);$i++)
    writeTimeFile("Registry: esco da fill_Association_tables");
}
Ejemplo n.º 19
0
    $eventOutcomeIndicator = "0";
    //EventOutcomeIndicator 0 OK 12 ERROR
    $repository_endpoint = $_SERVER['PHP_SELF'];
    $ip_repository = $rep_host;
    $ip_source = $_SERVER['REMOTE_ADDR'];
    $today = date("Y-m-d");
    $cur_hour = date("H:i:s");
    $datetime = $today . "T" . $cur_hour;
    $message_import = "<AuditMessage>\n    <EventIdentification EventDateTime=\"{$datetime}\" EventActionCode=\"R\" EventOutcomeIndicator=\"0\">\n        <EventID code=\"110107\" codeSystemName=\"DCM\" displayName=\"Import\"/>\n        <EventTypeCode code=\"ITI-15\" codeSystemName=\"IHE Transactions\" displayName=\"Provide and Register Document Set\"/>\n    </EventIdentification>\n    <AuditSourceIdentification AuditSourceID=\"MARIS Repository\">\n        <AuditSourceTypeCode code=\"4\" />\n    </AuditSourceIdentification>\n    <ActiveParticipant UserID=\"{$ip_source}\" UserIsRequestor=\"true\">\n        <RoleIDCode code=\"110153\" codeSystemName=\"DCM\" displayName=\"Source\"/>\n    </ActiveParticipant>\n    <ActiveParticipant UserID=\"{$repository_endpoint}\" UserIsRequestor=\"false\">\n        <RoleIDCode code=\"110152\" codeSystemName=\"DCM\" displayName=\"Destination\"/>\n    </ActiveParticipant>\n    <ParticipantObjectIdentification ParticipantObjectID=\"{$submission_uniqueID}\" ParticipantObjectTypeCode=\"2\" ParticipantObjectTypeCodeRole=\"20\">\n        <ParticipantObjectIDTypeCode code=\"urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd\"/>\n    </ParticipantObjectIdentification>\n    </AuditMessage>";
    $logSyslog = $syslog->Send($ATNA_host, $ATNA_port, $message_import);
    // ATNA EXPORT per Register Document Set
    $eventOutcomeIndicator = "0";
    //EventOutcomeIndicator 0 OK 12 ERROR
    $message_export = "<AuditMessage>\n    <EventIdentification EventDateTime=\"{$datetime}\" EventActionCode=\"R\" EventOutcomeIndicator=\"{$eventOutcomeIndicator}\">\n        <EventID code=\"110106\" codeSystemName=\"DCM\" displayName=\"Export\"/>\n        <EventTypeCode code=\"ITI-14\" codeSystemName=\"IHE Transactions\" displayName=\"Register Document Set\"/>\n    </EventIdentification>\n    <AuditSourceIdentification AuditSourceID=\"MARIS Repository\">\n        <AuditSourceTypeCode code=\"4\" />\n    </AuditSourceIdentification>\n    <ActiveParticipant UserID=\"{$ip_repository}\" UserIsRequestor=\"true\">\n        <RoleIDCode code=\"110153\" codeSystemName=\"DCM\" displayName=\"Source\"/>\n    </ActiveParticipant>\n    <ActiveParticipant UserID=\"http://" . $reg_host . ":" . $reg_port . $reg_path . "\" UserIsRequestor=\"false\">\n        <RoleIDCode code=\"110152\" codeSystemName=\"DCM\" displayName=\"Destination\"/>\n    </ActiveParticipant>\n    <ParticipantObjectIdentification ParticipantObjectID=\"{$submission_uniqueID}\" ParticipantObjectTypeCode=\"2\" ParticipantObjectTypeCodeRole=\"20\">\n        <ParticipantObjectIDTypeCode code=\"urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd\"/>\n    </ParticipantObjectIdentification>\n    </AuditMessage>";
    $logSyslog = $syslog->Send($ATNA_host, $ATNA_port, $message_export);
    writeTimeFile($idfile . "--Repository: Ho spedito i messaggi di ATNA");
}
unset($_SESSION['tmp_path']);
unset($_SESSION['idfile']);
unset($_SESSION['logActive']);
unset($_SESSION['log_query_path']);
unset($_SESSION['tmp_retrieve_path']);
//PULISCO LA CACHE TEMPORANEA
if ($clean_cache == "A") {
    if ($windows > 0) {
        exec('del tmp\\' . $idfile . "* /q");
    } else {
        exec('rm -f ' . $tmp_path . $idfile . "*");
        //exec('rm -f '.$tmpQuery_path."*");
    }
}
Ejemplo n.º 20
0
function connectDB()
{
    # IMPORT MYSQL PARAMETERS (NOTE: IT WORKS WITH ABSOLUTE PATH ONLY !!)
    include './config/repository_mysql_db.php';
    # open connection to db
    $connessione = mysql_connect($ip, $user_db, $password_db);
    if (!$connessione) {
        $errorcode = array();
        $error_message = array();
        $errorcode[] = "XDSRepositoryError";
        $error_message[] = mysql_error();
        $database_error_response = makeSoapedFailureResponse($error_message, $errorcode);
        writeTimeFile($_SESSION['idfile'] . "--Repository: database_error_response");
        $file_input = $_SESSION['idfile'] . "-database_error_response-" . $_SESSION['idfile'];
        writeTmpFiles($database_error_response, $file_input);
        SendResponse($database_error_response);
        exit;
    }
    # open  db
    mysql_select_db($db_name);
    return $connessione;
}