Esempio n. 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;
}
Esempio n. 2
0
     $wallpaper->loadContent($contentId);
 } catch (Exception $e) {
     $log .= "loadContent: " . $e->getMessage() . "\n";
 }
 try {
     $content_download = FALSE;
     $wallpaper->setTag($catmig);
     // descargo contenido por FTP
     $log .= "\tdescargando contenido...\n";
     $ftpCon = new Ftp();
     $retries = 0;
     $conectado = $ftpCon->login_r(null, null, FTP_CONN_RETRIES);
     if ($conectado === TRUE) {
         $to = TMP_DIR_WP . "/" . $wallpaper->getContentFilename();
         $from = $wallpaper->getContent();
         $bajado = $ftpCon->bajar_r($from, $to, FTP_DOWN_RETRIES);
         if ($bajado === TRUE) {
             $log .= "\tdescargando preview (gif)...\n";
             $to = TMP_DIR_WP . "/preview_tmp.gif";
             $from = $wallpaper->getPreview();
             $bajado = $ftpCon->bajar_r($from, $to, FTP_DOWN_RETRIES);
             if ($bajado === TRUE) {
                 $origen_file = $to;
                 $destino_file = TMP_DIR_WP . "/" . $wallpaper->getPreviewFilename();
                 $width = 100;
                 $height = 100;
                 $background = FALSE;
                 $extension = ".gif";
                 crearImagen($to, $destino_file, $width, $height, $background, $extension);
                 unlink($origen_file);
                 $content_download = TRUE;
Esempio n. 3
0
 private function generateThumbnail()
 {
     $ftpCon = new Ftp(FTP_USA, FTP_USA_USR, FTP_USA_PWD);
     $connected = $ftpCon->login_r(null, null, FTP_CONN_RETRIES);
     if (!$connected) {
         return false;
     }
     $from = str_replace("%RESOLUTION%", PREVIEW_WIDTH . "x" . PREVIEW_HEIGHT, $this->getPreview());
     $from = str_replace("contenido", "netuy", $from);
     $from = "/www.wazzup.com.uy" . $from;
     $this->thumbnailFilename = "thumbnail" . str_replace(" ", "_", sanitizeString($this->title)) . ".gif";
     $tmp = $this->dirToWrite . "/" . $this->thumbnailFilename;
     //echo "thumb $from => $tmp";
     $bajado = $ftpCon->bajar_r($from, $tmp, FTP_DOWN_RETRIES);
     return $bajado;
 }
Esempio n. 4
0
function getFtpFiles($archivo)
{
    global $dirToWrite;
    $info = pathinfo($archivo);
    $toJad = $info['basename'];
    $toJar = str_replace(".jad", ".jar", $toJad);
    $ftpCon = new Ftp();
    $i = 0;
    $jad = str_replace("netuy", "contenido", $archivo);
    $jar = str_replace(".jad", ".jar", $jad);
    $conectado = $ftpCon->login_r(null, null, FTP_CONN_RETRIES);
    if ($conectado === TRUE) {
        $to = $tmpDir . "/" . $toJad;
        echo "descargando jad <b>{$jad}</b> => <b>{$to}</b>...<br/>";
        $bajado = $ftpCon->bajar_r($jad, $to, FTP_DOWN_RETRIES);
        if ($bajado === TRUE) {
            echo "jad Ok!<br/>";
            $to = $tmpDir . "/" . $toJar;
            echo "descargando jar {$jar} => {$to}...<br/>";
            $bajado = $ftpCon->bajar_r($jar, $to, FTP_DOWN_RETRIES);
            if ($bajado === TRUE) {
                echo "jar Ok!<br/>";
                $content_download = TRUE;
            } else {
                // jar no encontrado; intentando leer jar del jad
                $jadLines = file($toJad);
                $jarName = getJarNamefromJad($jadLines);
                $pathName = pathinfo($jar);
                $newJar = $pathName['dirname'] . "/" . $jarName;
                echo "jar {$jar} no encontrado...<br/>";
                echo "intentando {$newJar}...<br/>";
                $bajado = $ftpCon->bajar_r($newJar, $toJar, FTP_DOWN_RETRIES);
                if ($bajado === TRUE) {
                    echo "jar {$newJar} Ok!<br/>";
                    $content_download = TRUE;
                } else {
                    echo "ERROR: descargando el jar '{$newJar}' del ftp<br/>";
                    exit;
                }
            }
        } else {
            $log .= "jad {$jad} not found...<br/>";
            echo "ERROR: descargando el jad '{$jad}' del ftp<br/>";
            exit;
        }
        $bajado = FALSE;
    } else {
        echo "ERROR: no se puede conectar al ftp<br/>";
    }
    if ($content_download === TRUE) {
        return TRUE;
    } else {
        return FALSE;
    }
}
Esempio n. 5
0
 private function generateThumbnail()
 {
     $ftpCon = new Ftp(FTP_USA, FTP_USA_USR, FTP_USA_PWD);
     $connected = $ftpCon->login_r(null, null, FTP_CONN_RETRIES);
     if (!$connected) {
         return false;
     }
     $from = str_replace("%RESOLUTION%", PREVIEW_WIDTH . "x" . PREVIEW_HEIGHT, $this->getContent());
     $from = str_replace("contenido", "netuy", $from);
     //echo "Bajando FROM: $from";
     $tmp = $this->dirToWrite . "/thumbnail" . sanitizeString($this->title) . ".gif";
     $bajado = $ftpCon->bajar_r($from, $tmp, FTP_DOWN_RETRIES);
     return $bajado;
 }
Esempio n. 6
0
 $conectado = $ftpCon->login_r(null, null, FTP_CONN_RETRIES);
 if ($conectado === TRUE) {
     echo "+ connection Ok!";
     $download_errors = 0;
     foreach ($juegos as $archivo) {
         //				$modelId = $datos["idcel"];
         //				$archivo = getArchivo($dbc, $modelId, $contentId);
         $jad = str_replace("netuy", "contenido", $archivo);
         $jar = str_replace(".jad", ".jar", $jad);
         $info = pathinfo($jad);
         $toJadName = $info['basename'];
         $info = pathinfo($jar);
         $toJarName = $info['basename'];
         $to = $dirToWrite . "/" . $toJadName;
         echo "<li>descargando jad <b>{$jad}</b> => <b>{$to}</b>...</li>";
         $bajado = $ftpCon->bajar_r($jad, $to, FTP_DOWN_RETRIES);
         if ($bajado === TRUE) {
             echo "+ jad Ok!<br/>";
             $to = $dirToWrite . "/" . $toJarName;
             echo "<li>descargando jar <b>{$jar}</b> => <b>{$to}</b>...</li>";
             $bajado = $ftpCon->bajar_r($jar, $to, FTP_DOWN_RETRIES);
             if ($bajado === TRUE) {
                 echo "+jar Ok!<br/>";
                 $content_download = TRUE;
             } else {
                 // jar no encontrado; intentando leer jar del jad
                 $toJad = $dirToWrite . "/" . $toJadName;
                 $jadLines = file($toJad);
                 $jarName = getJarNamefromJad($jadLines);
                 $pathName = pathinfo($jar);
                 $newJar = $pathName['dirname'] . "/" . $jarName;
Esempio n. 7
0
 private function generateThumbnail()
 {
     $ftpCon = new Ftp(FTP_USA, FTP_USA_USR, FTP_USA_PWD);
     $connected = $ftpCon->login_r(null, null, FTP_CONN_RETRIES);
     if (!$connected) {
         return false;
     }
     $from = str_replace("contenido", "netuy", $this->prefixSearch);
     $from .= "/100x100/" . $this->idRange . "/" . $this->contentName . ".gif";
     $tmp = $this->dirToWrite . "/thumbnail" . sanitizeString($this->title) . ".gif";
     $bajado = $ftpCon->bajar_r($from, $tmp, FTP_DOWN_RETRIES);
     return $bajado;
 }