コード例 #1
0
<?php

/* $Id $ */
/**
 * @package Mediboard
 * @subpackage hl7
 * @version $Revision:$
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 */
CCanDo::checkRead();
// Envoi à la source créée 'HL7 v.2'
$exchange_source = CExchangeSource::get("hl7v2", "ftp");
$extension = $exchange_source->fileextension;
$ftp = new CFTP();
$ftp->init($exchange_source);
$ftp->connect();
if (!($list = $ftp->getListFiles($ftp->fileprefix))) {
    CAppUI::stepAjax("Le répertoire ne contient aucun fichier", UI_MSG_ERROR);
}
$messages = array();
foreach ($list as $filepath) {
    if (substr($filepath, -strlen($extension)) == $extension) {
        $filename = tempnam("", "hl7");
        $ftp->getFile($filepath, $filename);
        $hl7v2_reader = new CHL7v2Reader();
        $message = $hl7v2_reader->readFile($filename);
        if (!$message) {
            $message = new CHL7v2Message();
        }
        $message->filename = basename($filepath);
コード例 #2
0
 /**
  * Populate archive directory up to max_archives files
  * 
  * @param CFTP    $ftp        FTP connector
  * @param string  $basename   Base name for archive directory
  * @param boolean $compressed True if file is an archive
  *
  * @return int Current archive count
  */
 function archiveFile(CFTP $ftp, $basename, $compressed)
 {
     try {
         // Répertoire d'archivage
         $directory = $ftp->fileprefix . $basename;
         $datetime = $this->getDateTime();
         $ftp->createDirectory($directory);
         // Transmission de la copie
         $archive = "{$directory}/archive-{$datetime}" . ($compressed ? ".zip" : ".html");
         $file = $compressed ? $this->_file_compressed : $this->_file;
         $ftp->sendFile($file, $archive);
         // Rotation des fichiers
         $files = $ftp->getListFiles($directory);
         rsort($files);
         $list_files = array_slice($files, $this->max_archives);
         foreach ($list_files as $_file) {
             $ftp->delFile($directory . "/" . basename($_file));
         }
     } catch (CMbException $e) {
         $e->stepAjax();
     }
     return count($ftp->getListFiles($directory));
 }
コード例 #3
0
<?php

/* $Id: ajax_test_dsn.php 6069 2009-04-14 10:17:11Z phenxdesign $ */
/**
 * @package Mediboard
 * @subpackage system
 * @version $Revision: 6069 $
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 */
// Check params
if (null == ($exchange_source_name = CValue::get("exchange_source_name"))) {
    CAppUI::stepAjax("Aucun nom de source d'échange spécifié", UI_MSG_ERROR);
}
$exchange_source = CExchangeSource::get($exchange_source_name, "ftp", false, null, false);
$ftp = new CFTP();
$ftp->init($exchange_source);
try {
    $ftp->testSocket();
    CAppUI::stepAjax("CFTP-success-connection", E_USER_NOTICE, $ftp->hostname, $ftp->port);
    $ftp->connect();
    CAppUI::stepAjax("CFTP-success-authentification", E_USER_NOTICE, $ftp->username);
    if ($ftp->passif_mode) {
        CAppUI::stepAjax("CFTP-msg-passive_mode");
    }
    $sent_file = CAppUI::conf('root_dir') . "/offline.php";
    $remote_file = $ftp->fileprefix . "test.txt";
    $ftp->sendFile($sent_file, $remote_file);
    CAppUI::stepAjax("CFTP-success-transfer_out", E_USER_NOTICE, $sent_file, $remote_file);
    $get_file = "tmp/offline.php";
    $ftp->getFile($remote_file, $get_file);
コード例 #4
0
$code4 = $doc->addElement($prescripteur, "Code4", $idSantePratCode4->id400);
// Sauvegarde du fichier temporaire
$tmpPath = "tmp/dPlabo/export_prescription.xml";
CMbPath::forceDir(dirname($tmpPath));
$doc->save($tmpPath);
$doc->load($tmpPath);
// Validation du document
if (!$doc->schemaValidate()) {
    CAppUI::setMsg("Document de prescription non valide", UI_MSG_ERROR);
    redirect();
}
// Envoi de la prescription par sur un seveurFTP
// Envoi à la source créée 'PrescriptionLabo' (FTP)
$prescriptionlabo_source = CExchangeSource::get("prescriptionlabo", "ftp");
// Creation du FTP
$ftp = new CFTP();
$ftp->init($prescriptionlabo_source);
if (!$ftp->hostname) {
    CAppUI::setMsg("Le document n'a pas pu être envoyé, configuration FTP manquante", UI_MSG_ERROR);
    redirect();
}
// Transfert
$destination_basename = "Prescription-" . $mbPrescription->_id;
$file = "tmp/dPlabo/export_prescription.xml";
try {
    $ftp->connect();
    $ftp->sendFile($file, "{$destination_basename}.xml");
} catch (CMbException $e) {
    $e->stepAjax();
    $ftp->close();
    redirect();
コード例 #5
0
ファイル: CSourceFTP.class.php プロジェクト: fbone/mediboard4
 function isAuthentificate()
 {
     $ftp = new CFTP();
     $ftp->init($this);
     try {
         $ftp->connect();
     } catch (CMbException $e) {
         $this->_reachable = 0;
         $this->_message = $e->getMessage();
         return false;
     }
     $ftp->close();
     return true;
 }
コード例 #6
0
/**
 * Lecture des fichiers d'échanges Hprim21
 *
 * @category Hprim21
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License; see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id: httpreq_read_hprim_files.php 20512 2013-10-01 08:57:28Z lryo $
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
// Envoi à la source créée 'HPRIM21' (FTP)
$exchange_source = CExchangeSource::get("hprim21", "ftp");
$extension = $exchange_source->fileextension;
$ftp = new CFTP();
$ftp->init($exchange_source);
try {
    $ftp->connect();
} catch (CMbException $e) {
    CAppUI::stepAjax($e->getMessage(), UI_MSG_WARNING);
}
$list = array();
try {
    $list = $ftp->getListFiles($ftp->fileprefix);
} catch (CMbException $e) {
    CAppUI::stepAjax($e->getMessage(), UI_MSG_WARNING);
}
if (empty($list)) {
    CAppUI::stepAjax("Le répertoire ne contient aucun fichier", UI_MSG_ERROR);
}
コード例 #7
0
<?php

/* $Id: ajax_test_dsn.php 6069 2009-04-14 10:17:11Z phenxdesign $ */
/**
 * @package Mediboard
 * @subpackage system
 * @version $Revision: 6069 $
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 */
// Check params
if (null == ($exchange_source_name = CValue::get("exchange_source_name"))) {
    CAppUI::stepAjax("Aucun nom de source d'échange spécifié", UI_MSG_ERROR);
}
$exchange_source = CExchangeSource::get($exchange_source_name, "ftp", true, null, false);
$ftp = new CFTP();
$ftp->init($exchange_source);
try {
    $ftp->connect();
    CAppUI::stepAjax("Connecté au serveur {$ftp->hostname} et authentifié en tant que {$ftp->username}");
} catch (CMbException $e) {
    $e->stepAjax();
    return;
}
if ($ftp->passif_mode) {
    CAppUI::stepAjax("Activation du mode passif");
}
try {
    $files = $ftp->getListFiles($ftp->fileprefix, true);
} catch (CMbException $e) {
    $e->stepAjax();