Ejemplo 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;
}
Ejemplo n.º 2
0
     $wallpaper->loadContent($contentId);
 } catch (Exception $e) {
     $log .= "loadContent: " . $e->getMessage() . "\n";
 }
 $wallpaper->setTag($catmig);
 $wallpaper->setSubTag($subcatmig);
 //$wallpaper->setKeywords($keywords[$i]);
 //$wallpaper->setShortDesc($shortDesc[$i]);
 // $wallpaper->setLongDesc($longDesc[$i]);
 try {
     $content_download = FALSE;
     // descargo contenido por FTP
     $log .= "\tdescargando contenido...\n";
     $ftpCon = new Ftp();
     $retries = 0;
     $conectado = $ftpCon->login_r(null, null, FTP_CONN_RETRIES);
     $todos = true;
     if ($conectado === TRUE) {
         $result = $wallpaper->downloadContent($ftpCon);
         foreach ($result as $size => $data) {
             $status = $data['status'];
             $__contentId = $data['id'];
             $todos = $todos && $status;
             $statusStr = $status ? "fue bajada correctamente" : "no fue encontrada";
             $statusColor = $status ? "black" : "red";
             $content_download = $content_download || $status;
             echo "<font color=\"{$statusColor}\">La imagen ({$__contentId}) con tama&ntilde;o {$size} {$statusStr} </font><br>\n";
         }
     } else {
         echo "ERROR: no se puede loguear al ftp\n";
     }
Ejemplo 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;
 }
Ejemplo 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;
    }
}
Ejemplo n.º 5
0
             //----------------------------------------------------------------------------
         } else {
             echo "({$contentId})  variants Ok! <br/>";
             $xmlToAdd .= $newCompatElement;
             $newAdded++;
         }
     } else {
         echo "({$contentId}) Contenido no descargado. Devices no agregados. Variant no generado.<br/>";
     }
     $i++;
 }
 $to = TMP_DIR_JG . "/preview_tmp.gif";
 $from = $game->getPreview();
 $log .= "\tdescargando preview {$from} > {$to}\n";
 $ftpConUSA = new Ftp("216.150.27.11", "wmast", "hulkverde");
 $connectUSA = $ftpConUSA->login_r(null, null, FTP_CONN_RETRIES);
 $bajado = $ftpConUSA->bajar_r($from, $to, FTP_DOWN_RETRIES);
 if ($bajado === TRUE) {
     $origen_file = $to;
     $destino_file = TMP_DIR_JG . "/" . $game->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 "({$contentId}) ERROR: descargando el preview del ftp\n";
     exit;
 }
Ejemplo n.º 6
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;
 }
Ejemplo 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;
 }