Exemple #1
0
/**
 * 
 * @param type $from
 * @return type 
 */
function getFtpFiles($from)
{
    $info = pathinfo($from);
    $name = trim($info['basename']);
    $ftpCon = new Ftp(FTP_HOST, FTP_USER, FTP_PASS, FTP_PORT);
    $content_download = FALSE;
    $connected = $ftpCon->login_r(null, null, FTP_CONN_RETRIES);
    if ($connected === TRUE) {
        $to = TMP_QR_DIR . "/" . $name;
        $downloaded = $ftpCon->bajar_r($from, $to, FTP_CONN_RETRIES);
        if ($downloaded === TRUE) {
            $content_download = TRUE;
        } else {
            $content_download = FALSE;
        }
    } else {
        $content_download = FALSE;
    }
    $ftpCon->logout();
    return $content_download;
}
Exemple #2
0
             }
             if ($bajado === TRUE) {
                 $origen_file = $to;
                 $destino_file = $tmpDir . "/" . $video->getPreviewFilename();
                 $width = 100;
                 $height = 100;
                 $background = FALSE;
                 $extension = ".gif";
                 crearImagen($to, $destino_file, $width, $height, $background, $extension);
                 unlink($origen_file);
                 $content_download = TRUE;
             } else {
                 echo "ERROR: descargando el preview del ftp\n";
                 exit;
             }
             $ftpConUSA->logout();
         } else {
             echo "ERROR: descargando el contenido {$from} del ftp a {$to}\n";
             exit;
         }
     } else {
         echo "ERROR: no se puede loguear al ftp\n";
     }
     if ($content_download === TRUE) {
         // obtengo y genero el XML
         $xmlContent .= $video->genXML();
         $total++;
     } else {
         $log .= " ";
     }
 } catch (Exception $e) {
Exemple #3
0
function limpiarCagadas($newId)
{
    extract($GLOBALS);
    print "<h4>Borrando archivos:</h4>";
    foreach ($_SESSION['subidos'] as $k) {
        $auxSvr = split("@", $k);
        $file = $auxSvr[0];
        $srvr = $auxSvr[1];
        print "<h4>Borrando registros</h4>";
        print "borrando: {$file}<br />";
        $ftp = new Ftp($servers[$srvr][0], $servers[$srvr][1], $servers[$srvr][2]);
        if (!$ftp->login()) {
            die("no se logueó");
        }
        if (!$ftp->borrar($file)) {
            print "No se pudo borrar: {$file}<br />";
            error("No se pudo borrar: {$file}", true);
        }
    }
    $sql = " DELETE FROM contenidos where id={$newId} LIMIT 1; ";
    $result = mysql_query($sql, $db);
    if (!$result) {
        error("Error al borrar el contenido {$newId} -  sql: {$sql}", true);
    }
    print "contenido {$newId} eliminado!\n";
    $sql = " DELETE FROM contcol_whitelist where contenido={$newId} LIMIT 1; ";
    $result = mysql_query($sql, $db);
    if (!$result) {
        error("Error al borrar de witelist {$newId} -  sql: {$sql}", true);
    }
    print "contenido {$newId} eliminado de whitelist!\n";
    $ftp->logout();
}