コード例 #1
0
ファイル: start.php プロジェクト: exaflo/appli
/**
 * @param $pnIdUtilisateur
 * @param $chk
 */
function getFtp($pnIdUtilisateur, $chk)
{
    /*$headers = 'From: MonteurAuto<*****@*****.**>' . "\r\n" .
      'Reply-To: automation@exaprint.fr' . "\r\n" .
      'Content-Type: text/html; charset="iso-8859-1"' . "\r\n" .
      'X-Mailer: PHP/' . phpversion();*/
    $objSmartgang = new smartgang();
    $objSmartgang->logFile(basename(__FILE__), __FUNCTION__, "RUN", "");
    $objSmartgang->getConDbo();
    $data_planche = $objSmartgang->getDataPlancheReadyToSent($pnIdUtilisateur, $chk);
    if (is_array($data_planche) && count($data_planche) > 0) {
        foreach ($data_planche as $value) {
            $verif = null;
            $pnIdPlanche = $value->IDPlanche;
            $objSmartgang->logFile(basename(__FILE__), __FUNCTION__, "EXE", " : START EntreeFTP -> {$pnIdPlanche}");
            if (is_numeric($pnIdPlanche) && $pnIdPlanche > 0) {
                $verif = $objSmartgang->getVerifElement($data_planche);
                $objSmartgang->logFile(basename(__FILE__), __FUNCTION__, "EXE", " : {$pnIdPlanche} => Verif = {$verif}");
                /*if (preg_match('/2/',$verif)) {
                      mail('*****@*****.**', "$pnIdPlanche => Verif = $verif", "planche $pnIdPlanche => Verif = $verif", $headers);
                      mail('*****@*****.**', "$pnIdPlanche => Verif = $verif", "$pnIdPlanche => Verif = $verif", $headers);
                  }*/
                if (preg_match('/111/', $verif) && !preg_match('/2/', $verif)) {
                    $objSmartgang->getEstValide($pnIdPlanche);
                    $objSmartgang->getEntreeFtpXml($pnIdPlanche);
                    $objSmartgang->logFile(basename(__FILE__), __FUNCTION__, "END", "");
                } else {
                    $objSmartgang->logFile(basename(__FILE__), __FUNCTION__, "ERR", " : {$pnIdPlanche} => Verif = {$verif}");
                }
            }
        }
    } else {
        $objSmartgang->logFile(basename(__FILE__), __FUNCTION__, "ERR", " : {$data_planche}");
    }
}
コード例 #2
0
ファイル: send.php プロジェクト: exaflo/appli
//-- Load class exa
require_once '/var/www/appli/class/class.gang.php';
$objSmartgang = new smartgang();
$objSmartgang->logFile(basename(__FILE__), "script", "RUN", "entreeftp/send.php");
//-- define start time
$start = $objSmartgang->getmicrotime();
//-- conn to dbo
$conDbo = $objSmartgang->getConDbo();
if (isset($_SERVER['QUERY_STRING'])) {
    $qp = explode('&', $_SERVER['QUERY_STRING']);
} else {
    //pour récup des params via le terminal
    $qp = $_SERVER['argv'];
    //via le terminal, le premier élément est le nom du script => on dépile le 1er élément
    array_shift($qp);
}
if (isset($qp[0]) && $qp[0] > '0') {
    $pnIdPlanche = $qp[0];
    if (!$conDbo) {
        if (is_numeric($pnIdPlanche) && $pnIdPlanche > 0) {
            $objSmartgang->getEstValide($pnIdPlanche);
            //            $objSmartgang->getEntreeFTP($pnIdPlanche);
            $objSmartgang->getEntreeFtpXml($pnIdPlanche);
            echo $pnIdPlanche;
        }
    } else {
        $objSmartgang->logFile(basename(__FILE__), "script", "ERR", "conn dbo impossible");
    }
}
//-- define end time
$objSmartgang->logFile(basename(__FILE__), "script", "END", ": executed in " . round($objSmartgang->getmicrotime() - $start, 5) . "sec\n");