Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: MOD youtube  (Read 7095 times)

0 Members and 1 Guest are viewing this topic.

vinyols

  • Coppermine newbie
  • Offline Offline
  • Posts: 17
MOD youtube
« on: December 07, 2008, 12:11:01 am »

Necesito ayuda para configurar correctamente el mod. he eseguido las siguientes intrucciones:


Edita upload.php, agregá este código al principio del archivo, luego de los comentarios de los desarrolladores:

Code:

if (!function_exists('file_put_contents')) {
   function file_put_contents($n,$d) {
      $f=@fopen($n,"w");
      if (!$f) {
         return false;
      } else {
         fwrite($f,$d);
         fclose($f);
         return true;
      }
   }
}



Luego buscá:
Code:

       // Add the control device.
            $form_array[] = array('control', 'phase_1', 4);


Antes de eso, agrega:
Code:

 // Youtube
           if (USER_ID) {
               $form_array[] = 'Youtube uploads';
                $form_array[] = array('', 'YT_array[]', 0, 256, 3);
                $form_array[] = 'Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx';
   }


Busca:
Code:

//Now we must prepare the inital form for adding the pictures to the database, and we must move them to their final location.


Y antes de eso agrega:
Code:

  // youtube
   
   $YT_array = count($_POST['YT_array']);

   if ($YT_array) {
       $YT_failure_array = array();

       for ($counter = 0; $counter < $YT_array; $counter++) {

          // Create the failure ordinal for ordering the report of failed uploads.

         $failure_cardinal = $counter + 1;

         $failure_ordinal = ''.$failure_cardinal.'. ';
           
         $YT_URI = $_POST['YT_array'][$counter];

         if (!$YT_URI) continue;
         

         if (preg_match('/youtube\.com\/watch\?v=(.*)/', $YT_URI, $matches)){

            $vid = $matches[1];
                     
            $xurl = "http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=xxxxxxxxxxx&video_id=$vid";
                     
            $xdata = file_get_contents($xurl);

            file_put_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml", $xdata);

            // todo: parse the xml properly
            if (preg_match('/<thumbnail_url>(.*)<\/thumbnail_url>/', $xdata, $xmatches)){
            
               $thumbnail = $xmatches[1];
               
               $rh = fopen($thumbnail, 'rb');
               $wh = fopen($CONFIG['fullpath'] . "edit/yt_$vid.jpg", 'wb');
   
   
                   while (!feof($rh)) fwrite($wh, fread($rh, 1024));
   
               fclose($rh);
               fclose($wh);
        
               $escrow_array[] = array('actual_name'=>"youtube_$vid.jpg", 'temporary_name'=> "yt_$vid.jpg");
            
            } else {
               $YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> $xdata);
            }
             
             } else {
                 $YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> 'Failed to find video');
             }
         }
     }


En esa sección del código debes reemplazar "xxxxxxxxxxx" con tu ID de developer the youtube.

Luego, buscá:
Code:

  $zip_error_count = count($zip_failure_array);


Y agregá en la linea de abajo:
Code:

  $YT_error_count = count($YT_failure_array);


Busca:
Code:

    // Create error report if we have errors.
    if (($file_error_count + $URI_error_count + $zip_error_count) > 0) {


Y reemplazalo por:
Code:

   // Create error report if we have errors.
    if (($file_error_count + $URI_error_count + $zip_error_count + $YT_error_count) > 0) {


Busca:
Code:

             // Close the error report table.
        endtable()


Antes de eso, colocá:
Code:

                // Look for YT upload errors.
        if ($YT_error_count > 0) {

            // There are URI upload errors. Generate the section label.
            form_label("YT errors:");
            echo "<tr><td>URI</td><td>Error message</td></tr>";

            // Cycle through the file upload errors.
            for ($i=0; $i < $YT_error_count; $i++) {

                // Print the error ordinal, file name, and error code.
                echo "<tr><td>{$YT_failure_array[$i]['failure_ordinal']} {$YT_failure_array[$i]['URI_name']}</td><td>{$YT_failure_array[$i]['error_code']}</td></tr>";

            }

        }



Busca:
Code:

                $form_array = array(
        sprintf($lang_upload_php['max_fsize'], $CONFIG['max_upl_size']),
        array($lang_upload_php['album'], 'album', 2),
        array('MAX_FILE_SIZE', $max_file_size, 4),
        array($lang_upload_php['picture'], 'userpicture', 1, 1),
        array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
        array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
        array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
        array('event', 'picture', 4)
        );


Y reemplazalo por:
Code:

  if (preg_match('/^youtube_(.*)\.jpg$/', $file_set[0], $ytmatches)){

         $vid = $ytmatches[1];

   $xdata = file_get_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml");


            // todo: parse the xml properly
            preg_match('/<description>(.*)<\/description>/', $xdata, $xmatches);
            $description = substr($xmatches[1], 0, $CONFIG['max_img_desc_length']);
   
            // todo: parse the xml properly
            preg_match('/<tags>(.*)<\/tags>/', $xdata, $xmatches);
            $keywords = $xmatches[1];
                     
            // todo: parse the xml properly
            preg_match('/<title>(.*)<\/title>/', $xdata, $xmatches);
            $title = substr($xmatches[1], 0, 255);


                $form_array = array(
        array($lang_upload_php['album'], 'album', 2),
        array($lang_upload_php['pic_title'], 'title', 0, 255, 1, $title),
        array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length'], $description),
        array($lang_upload_php['keywords'], 'keywords', 0, 255, 1, $keywords),
          array('control', 'phase_2', 4),
          array('unique_ID', $_POST['unique_ID'], 4),
        );
       
   
    } else {

                $form_array = array(
        sprintf($lang_upload_php['max_fsize'], $CONFIG['max_upl_size']),
        array($lang_upload_php['album'], 'album', 2),
        array('MAX_FILE_SIZE', $max_file_size, 4),
        array($lang_upload_php['picture'], 'userpicture', 1, 1),
        array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
        array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
        array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
        array('event', 'picture', 4)
        );

}


Cerrá el archivo y guardalo. Ahora, abrí theme.php,

Busca:
Code:

 if (isset($image_size['reduced'])) {


Y reemplazalo por:
Code:

   if (preg_match('/^youtube_(.*)\.jpg$/', $CURRENT_PIC_DATA['filename'], $ytmatches)){
       
          $vid = $ytmatches[1];
            $pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
       
       } elseif (isset($image_size['reduced'])) {


Cerra el archivo y guardalo.

*Si no encuentras (isset ($ image_size [ 'reducido'])) (theme.php en el archivo, abra el archivo theme.php (coppermine_carpeta/themes/sample/theme.php) y copiar / pegar l theme_html_picture toda la función ()


El problema es que la interface de instertar archivo se repite constantemente. Agradeceria cualquier ayuda (para un proyecto sin animo de lucro)
Logged

Fabricio Ferrero

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 1996
  • From San Juan, Argentina, to the World!
    • http://fabricioferrero.com/
Re: MOD youtube
« Reply #1 on: December 07, 2008, 12:24:38 am »

1 - Te dije en el otro post, antes de postear:    
¿Quieres respuesta a tu problema? LEER SI O SI


2 - ¿En que momento pensaste que quería recibir un mensaje privado tuyo? Este punto es muy estricto, los que hacemos soporte odiamos los mensajes privados. Y además, odiamos que no nos hagan caso. Te dije en el otro post que no envies mensajes privados, que el soporte es público hacia todos.

Los mensajes fueron:

Youtube.has probado tu el tuto que has escrito o simplemente lo has copiado sin probralo????

Si es asi y lo has probado podrias ehcharme una mano . Si tu respuesta es negativa creo que todavia esta abierto  el hilo.



Y también:

En ningun momento quiero parecer despectibo. Perdona si lo ha parecido

Yo no solicité mensajes privados.
Logged
Read Docs and Search the Forum before posting. - Soporte en español
--*--
Fabricio Ferrero's Website

Catching up! :)

vinyols

  • Coppermine newbie
  • Offline Offline
  • Posts: 17
Re: MOD youtube
« Reply #2 on: December 07, 2008, 12:43:44 am »

Supongo que aqui se viene a hablar de los problemas en el coppermine.

Si tienes algo que hablar fuera de esto lo normal es que lo hagas por privado. No que intentes hacer quedar a la gente como estupidos o algo parecido. Eres un moderador actua como tal.

Si envie el privado fue para intentar resolver problemas con el MOD debido a que cerraste el hilo sin poder ampliar la documentacion o la informacion.
Y tener que doblar un post sobre un mismo tema.

Supongo que los foros son para poder hablar con personas que hayan probado el codigo y expandir el tema, luego si quieres  de un tema explotado puedes sacar una biblia en post cerrado.

Entiende que las personas ecrivamos en los Posts, ya que todos los Posts son para realizar comentarios SIEMPRE relacionados con el coppermine.

Si alguien ha probado el MOD y le ha funcionado perfectamente teniendo el incoveniente del theme.php por favor que comete
Logged

vinyols

  • Coppermine newbie
  • Offline Offline
  • Posts: 17
Re: MOD youtube
« Reply #3 on: December 07, 2008, 06:04:15 pm »

Pensava que el error estava en la modificacio del theme.php pero noes asi,

 sigo teneiendo un error a la hora de subir videosyoutube esta es la respuesat de la aplicacion

:
YT errors:
URI   Error message
1. http://www.youtube.com/watch?v=VfU-I6imiJA

Tal cual no sale ningun error en lineas ni nada parecido.


GRacias a todos por la ayuda !!!!!

Puedew alguien que le funcione indicar o guiar a este aprendiz de cppermine
Logged

vinyols

  • Coppermine newbie
  • Offline Offline
  • Posts: 17
Re: MOD youtube
« Reply #4 on: December 07, 2008, 06:40:37 pm »

Pensava que el error estava en la modificacio del theme.php pero noes asi,

 sigo teneiendo un error a la hora de subir videosyoutube esta es la respuesat de la aplicacion

:
YT errors:
URI   Error message
1. http://www.youtube.com/watch?v=VfU-I6imiJA

Tal cual no sale ningun error en lineas ni nada parecido.


GRacias a todos por la ayuda !!!!!

Puedew alguien que le funcione indicar o guiar a este aprendiz de cppermine

Despues de leer y leer en mi penoso ingles todo el foro de discusion abierto en copperine se ha llegado a la convclusion que algunos themes pueden dar error.

Por ahoar seguiremos probando y ampliando este gran avance. aunque supongo que esta muy proximo un nuevo lanzamiento el cual todos esperamos anisos.
Logged

Fabricio Ferrero

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 1996
  • From San Juan, Argentina, to the World!
    • http://fabricioferrero.com/
Re: MOD youtube
« Reply #5 on: December 30, 2008, 03:16:53 am »

Si, de hecho, falta alrededor de 1 mes para el mismo. Aguarda y serás recompenzado ;)
Logged
Read Docs and Search the Forum before posting. - Soporte en español
--*--
Fabricio Ferrero's Website

Catching up! :)
Pages: [1]   Go Up
 

Page created in 0.029 seconds with 18 queries.