/** * Performa a QR operation to get series and instances from a given study */ function dicomQRStudy($pacs, $study_IUID) { // Nivel Q/R | | -P | -S | -I // Problema: Algun campo extra lo pide en la subquery de instancias, pero no en la query principal de series $extraFields = '-r 00080060 -r 0008103E -r 00200011 -r 00201209'; // (0008,0060) Modality // (0008,103E) Series Description // Solo se envia en las subquery // (0020,0011) Series Number // (0020,1209) Number of Series Related Instances // Solo se envia en las subquery $command = 'LANG=' . $pacs->getLocale() . ' ' . PATH_BASE_DCM4CHE2 . 'dcmqr -device ' . AETITLE_GATEWAY . ' -I ' . $pacs->getDicomServer() . " -q 0020000D={$study_IUID} {$extraFields}"; $outputRes = array(); exec($command, $outputRes); if (DEBUG_LEVEL >= DEBUG_DUMP) { echo "<pre>"; print_r($outputRes); echo "</pre>"; } processResponse($outputRes, $pacs->encoding); }
if ($cmd_data[$commands[$i]['ID']] != $commands[$i]['RENDER_DATA']) { $cmd_data[$commands[$i]['ID']] = $commands[$i]['RENDER_DATA']; $changed_data[] = array('TYPE' => 'data', 'ID' => $commands[$i]['ID'], 'DATA' => $commands[$i]['RENDER_DATA']); } } $total = count($changed_data); for ($i = 0; $i < $total; $i++) { $changed_data[$i]['DATA'] = str_replace("\n", ' ', $changed_data[$i]['DATA']); $changed_data[$i]['DATA'] = str_replace("\r", '', $changed_data[$i]['DATA']); $changed_data[$i]['DATA'] = preg_replace("/<!--(.+?)-->/is", '', $changed_data[$i]['DATA']); $in = 'serial:' . serialize($changed_data[$i]) . "\n"; echo date('Y-m-d H:i:s') . ' ' . $i . 'Sending: ' . $in; socket_write($socket, $in, strlen($in)); echo "OK.\n"; $out = socket_read($socket, 2048, PHP_NORMAL_READ); processResponse($out); } } if (file_exists('./reboot') || isset($_GET['onetime'])) { socket_close($socket); $db->Disconnect(); exit; } } echo date('Y-m-d H:i:s') . ' Closing socket...'; socket_close($socket); echo "OK.\n\n"; } /** * Summary of processResponse * @param mixed $out Out param
$postBinding = false; $params = $_GET; } } else { if ($_SERVER['REQUEST_METHOD'] == 'POST') { // NOTE - Logout POST binding untested at current time!!! error_log("SingleLogoutService.php: POST binding"); if (empty($_POST['SAMLResponse'])) { echo "<p>Unable to process the submission.<br />No SAMLResponse in posted data</p>"; exit; } else { $postBinding = true; $params = $_POST; } } } $RelayStateURL = $params["RelayState"]; error_log("RelayState = " . $RelayStateURL); if ($token = processResponse($params, FALSE, $postBinding, "SAMLResponse")) { $status = getLogoutResponseStatus($token); error_log("Status = " . $status); if ($status == SAML2_STATUS_SUCCESS) { spi_sessionhandling_clearUserId(); header("Location: " . $RelayStateURL); } else { echo "<p>IdP reported error processing single logout.<br />" . $status . "</p><pre>"; print_r($samlResponse); echo "</pre>"; exit; } }
/** * Download file using fsockopen * * @since 3.0 * @param type $sourceFile * @param type $fileout */ function download_fsockopen($sourceFile, $fileout = null) { // parse URL $aUrl = parse_url($sourceFile); $host = $aUrl['host']; if ('localhost' == strtolower($host)) { $host = '127.0.0.1'; } $link = $aUrl['path'] . (isset($aUrl['query']) ? '?' . $aUrl['query'] : ''); if (empty($link)) { $link .= '/'; } $fp = @fsockopen($host, 80, $errno, $errstr, 30); if (!$fp) { } else { $out = "GET {$link} HTTP/1.1\r\n"; $out .= "Host: {$host}\r\n"; $out .= "Connection: Close\r\n\r\n"; $out .= "\r\n"; fwrite($fp, $out); $contents = ''; while (!feof($fp)) { $contents .= fgets($fp, 1024); } // check redirections ? // if (redirections) then do request again $aResult = processResponse($contents); $headers = processHeaders($aResult['headers']); $location = @$headers['location']; if (isset($location) && $location != "") { $aUrl = parse_url($headers['location']); $host = $aUrl['host']; if ('localhost' == strtolower($host)) { $host = '127.0.0.1'; } $requestPath = $aUrl['path'] . (isset($aUrl['query']) ? '?' . $aUrl['query'] : ''); if (empty($requestPath)) { $requestPath .= '/'; } download_fsockopen($host, $requestPath, $fileout); } else { $body = $aResult['body']; $transferEncoding = @$headers['transfer-encoding']; if ($transferEncoding == 'chunked') { $body = http_chunked_decode($aResult['body']); } if ($fileout != null) { $ff = @fopen($fileout, 'w+'); fwrite($ff, $body); fclose($ff); } else { return $body; } } fclose($fp); } }
function errorSuccess($message = '', $object = null) { return processResponse($message, true, $object); }
require_once 'spi/namemapping/' . $LIGHTBULB_CONFIG['spi-namemapping'] . '.php'; function getDefaultSPEntityID($spmeta) { foreach ($spmeta as $key => $value) { return $value['issuer']; } } if (empty($_GET['SAMLRequest'])) { echo '<p>Unable to process the submission.<br /> No SAMLRequest in the redirect</p>'; } else { error_log("Entering LogoutListener"); $RelayStateURL = $_GET["RelayState"]; error_log("RelayState = " . $RelayStateURL); //echo $samlRequest; $domrequest = processResponse($_GET, false, false, "SAMLRequest"); # echo "domrequest: " . $domrequest; $issuer = getIssuerFromRequest($domrequest); //echo "Issuer: " . $issuer; $requestid = getLogoutRequestID($domrequest); //echo "Request ID : [" . $requestid . "]"; $destination = $idpMetadata[$issuer]['SingleLogOutUrl']; # Clear the current session! We are logging out.. Good bye... spi_sessionhandling_clearUserId(); /* echo "SP entity id: " . $spMetadata[1]['issuer'] . ":"; echo '<pre>'; print_r($spMetadata); echo '</pre>'; */ $id = randomhex(42);
/** * Download file using fsockopen * * @since 3.0 * @param type $sourceFile * @param type $fileout */ function download_fsockopen($sourceFile, $fileout = null, $post_data = null) { // parse URL $aUrl = parse_url($sourceFile); $host = $aUrl['host']; if ('localhost' == strtolower($host)) { $host = '127.0.0.1'; } $link = $aUrl['path'] . (isset($aUrl['query']) ? '?' . $aUrl['query'] : ''); if (empty($link)) { $link .= '/'; } $fp = @fsockopen($host, 80, $errno, $errstr, 30); if (!$fp) { return false; } else { $ua = @$_SERVER['HTTP_USER_AGENT'] . ' Osclass (v.' . osc_version() . ')'; $out = ($post_data != null && is_array($post_data) ? "POST" : "GET") . " {$link} HTTP/1.1\r\n"; $out .= "Host: {$host}\r\n"; $out .= "User-Agent: {$ua}\r\n"; $out .= "Connection: Close\r\n\r\n"; $out .= "\r\n"; if ($post_data != null && is_array($post_data)) { $out .= http_build_query($post_data); } fwrite($fp, $out); $contents = ''; while (!feof($fp)) { $contents .= fgets($fp, 1024); } fclose($fp); // check redirections ? // if (redirections) then do request again $aResult = processResponse($contents); $headers = processHeaders($aResult['headers']); $location = @$headers['location']; if (isset($location) && $location != "") { $aUrl = parse_url($headers['location']); $host = $aUrl['host']; if ('localhost' == strtolower($host)) { $host = '127.0.0.1'; } $requestPath = $aUrl['path'] . (isset($aUrl['query']) ? '?' . $aUrl['query'] : ''); if (empty($requestPath)) { $requestPath .= '/'; } download_fsockopen($host, $requestPath, $fileout); } else { $body = $aResult['body']; $transferEncoding = @$headers['transfer-encoding']; if ($transferEncoding == 'chunked') { $body = http_chunked_decode($aResult['body']); } if ($fileout != null) { $ff = @fopen($fileout, 'w+'); if ($ff !== FALSE) { fwrite($ff, $body); fclose($ff); return true; } else { return false; } } else { return $body; } } } }
* "Portions Copyrighted [year] [name of copyright owner]" * * $Id: AssertionConsumerService.php,v 1.2 2007/06/11 17:33:13 superpat7 Exp $ * * Copyright 2006 Sun Microsystems Inc. All Rights Reserved */ require_once 'config/config.php'; require_once 'lib/saml-lib.php'; require_once 'spi/sessionhandling/' . $LIGHTBULB_CONFIG['spi-sessionhandling'] . '.php'; require_once 'spi/namemapping/' . $LIGHTBULB_CONFIG['spi-namemapping'] . '.php'; if (empty($_POST['SAMLResponse'])) { echo '<p>Unable to process the submission.<br /> No SAMLResponse in posted data</p>'; } else { error_log("Entering sp.php"); if ($token = processResponse($_POST)) { $nameId = getNameID($token); if (isset($nameId)) { error_log("NameQualifier = " . $nameId["NameQualifier"]); error_log("SPNameQualifier = " . $nameId["SPNameQualifier"]); error_log("NameID = " . $nameId["NameID"]); $localID = spi_namemapping_nameIdToLocalId($nameId["NameQualifier"], $nameId["SPNameQualifier"], $nameId["NameID"]); if (isset($localID) && $localID != "") { error_log("NameID successfull federation. Now set User ID = " . $localID); // User is sucessfully mapped to a local ID spi_sessionhandling_setNameID($nameId["NameID"]); spi_sessionhandling_setUserID($localID); spi_sessionhandling_setResponse($token); } else { // User is not mapped to a local ID. The user is still authenticated, but further steps may be needed // in order to proceed. The service will probably do one of two things, either auto-generate a new account or