/** * Magic method (do not call directly) * * @param string $name method name * @param array $args arguments * * @return mixed * * @throws Exception * @throws CMbException */ function __call($name, $args) { $name = strtolower($name); $silent = strncmp($name, 'try', 3) === 0; $function_name = $silent ? substr($name, 3) : $name; $function_name = '_' . (isset(self::$aliases[$function_name]) ? self::$aliases[$function_name] : $function_name); if (!method_exists($this, $function_name)) { throw new CMbException("CSourceSFTP-call-undefined-method", $name); } if ($function_name == "_init") { return call_user_func_array(array($this, $function_name), $args); } if (!$this->loggable) { try { return call_user_func_array(array($this, $function_name), $args); } catch (CMbException $fault) { throw $fault; } } $echange_ftp = new CExchangeFTP(); $echange_ftp->date_echange = CMbDT::dateTime(); $echange_ftp->emetteur = CAppUI::conf("mb_id"); $echange_ftp->destinataire = $this->hostname; $echange_ftp->function_name = $name; CApp::$chrono->stop(); $chrono = new Chronometer(); $chrono->start(); $output = null; try { $output = call_user_func_array(array($this, $function_name), $args); } catch (CMbException $fault) { $echange_ftp->date_echange = CMbDT::dateTime(); $echange_ftp->output = $fault->getMessage(); $echange_ftp->ftp_fault = 1; $echange_ftp->store(); CApp::$chrono->start(); throw $fault; } $chrono->stop(); CApp::$chrono->start(); // response time $echange_ftp->response_time = $chrono->total; // Truncate input and output before storing $args = array_map_recursive(array("CFTP", "truncate"), $args); $echange_ftp->input = serialize($args); if ($echange_ftp->ftp_fault != 1) { if ($function_name == "_getlistfiles") { // Truncate le tableau des fichiers reçus dans le cas où c'est > 100 $array_count = count($output); if ($array_count > 100) { $output = array_slice($output, 0, 100); $output["count"] = "{$array_count} files"; } } $echange_ftp->output = serialize(array_map_recursive(array("CSFTP", "truncate"), $output)); } $echange_ftp->store(); return $output; }
$function = CValue::getOrSession("function"); CValue::setSession("_date_min", $_date_min); CValue::setSession("_date_max", $_date_max); CValue::setSession("function", $function); // Chargement de l'échange FTP demandé $exchange_ftp = new CExchangeFTP(); $exchange_ftp->load($echange_ftp_id); if ($exchange_ftp->_id) { $exchange_ftp->loadRefs(); $exchange_ftp->input = unserialize($exchange_ftp->input); if ($exchange_ftp->ftp_fault != 1) { $exchange_ftp->output = unserialize($exchange_ftp->output); } } // Récupération de la liste des echanges SOAP $itemExchangeFTP = new CExchangeFTP(); $where = array(); if ($_date_min && $_date_max) { $exchange_ftp->_date_min = $_date_min; $exchange_ftp->_date_max = $_date_max; $where['date_echange'] = " BETWEEN '" . $_date_min . "' AND '" . $_date_max . "' "; } if ($function) { $where['function_name'] = " = '" . $function . "'"; } $total_exchange_ftp = 0; $echangesFTP = array(); if ($function && $_date_min && $_date_max) { $total_exchange_ftp = $itemExchangeFTP->countList($where); $order = "date_echange DESC"; $forceindex[] = "date_echange";
<?php /** * Download exchange * * @category Webservices * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ $echange_ftp_id = CValue::get("echange_ftp_id"); $echange_ftp = new CExchangeFTP(); $echange_ftp->load($echange_ftp_id); $input = print_r(unserialize($echange_ftp->input), true); if ($echange_ftp->ftp_fault == 1) { $output = print_r($echange_ftp->output, true); } else { $output = print_r(unserialize($echange_ftp->output), true); } $function_name = $echange_ftp->function_name; $content = "Date d'echange :\n{$echange_ftp->date_echange}\n\nTemps de reponse :\n{$echange_ftp->response_time} ms \n\nParametres :\n\n{$input}\nResultat :\n\n{$output}\n"; $echange = utf8_decode($content); header("Content-Disposition: attachment; filename={$function_name}-{$echange_ftp_id}.txt"); header("Content-Type: text/plain; charset=" . CApp::$encoding); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: post-check=0, pre-check=0", false); header("Content-Length: " . strlen($echange)); echo $echange;
<?php /** * View exchange FTP details * * @category Webservices * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ CCanDo::checkRead(); $exchange_ftp_id = CValue::get("exchange_ftp_id"); // Chargement de l'échange SOAP demandé $exchange_ftp = new CExchangeFTP(); $exchange_ftp->load($exchange_ftp_id); if ($exchange_ftp->_id) { $exchange_ftp->loadRefs(); $exchange_ftp->input = unserialize($exchange_ftp->input); if ($exchange_ftp->ftp_fault != 1) { $exchange_ftp->output = unserialize($exchange_ftp->output); } } // Création du template $smarty = new CSmartyDP(); $smarty->assign("exchange_ftp", $exchange_ftp); $smarty->display("inc_exchange_ftp_details.tpl");