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: movie_download immagini solo registrati  (Read 12658 times)

0 Members and 1 Guest are viewing this topic.

Aquilasfx

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
movie_download immagini solo registrati
« on: October 28, 2007, 07:44:42 pm »

Uso l'ultima versione del coppermine e la mod movie_download rivisitata per permettere il download delle immagini; se volessi far scaricare la foto solo ai registrati? Permettere la visualizzazione ma disabilitare il tasto destro. Quindi solo se registrati vedere link che permette il download? E' possibile?
« Last Edit: October 31, 2007, 11:53:33 pm by Lontano »
Logged

Davide Renda

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1427
  • aka "Lontano"
    • www.daviderenda.eu
Re: movie_download immagini solo registrati
« Reply #1 on: October 28, 2007, 09:38:10 pm »

Avendo io scarsissime conoscenze per la manipolazione del codice, ho chiesto nel thread di annuncio di questo plugin se qualcuno sa come fare ;-)
Ti tengo al corrente appena qualcuno ci aiuta. Se, per caso, qualcuno (italiano) con maggiori conoscenze sa come farlo... noi siamo qui!

Davide Renda

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1427
  • aka "Lontano"
    • www.daviderenda.eu
Re: movie_download immagini solo registrati
« Reply #2 on: October 28, 2007, 10:10:44 pm »

just_some_guy suggerisce di provare questo blocco di codice al plugin.

Code: [Select]
<?php

$result 
mysql_query("SELECT user_name FROM {$CONFIG['TABLE_USERS']} WHERE user_group = Registered AND uid = $uid");
if {
mysql_num_rows($result) == 0;

echo 
'Registered user function';

} else {

?>


Aggiungi anche un segno } alla fine del file prima di ?>

Facci sapere se funziona!

Aquilasfx

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Re: movie_download immagini solo registrati
« Reply #3 on: October 28, 2007, 10:53:37 pm »

just_some_guy suggerisce di provare questo blocco di codice al plugin.

Code: [Select]
<?php

$result 
mysql_query("SELECT user_name FROM {$CONFIG['TABLE_USERS']} WHERE user_group = Registered AND uid = $uid");
if {
mysql_num_rows($result) == 0;

echo 
'Registered user function';

} else {

?>


Aggiungi anche un segno } alla fine del file prima di ?>

Facci sapere se funziona!



Dove lo devo aggiungere? Dentro lo script codebase.php ?
Logged

Davide Renda

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1427
  • aka "Lontano"
    • www.daviderenda.eu
Re: movie_download immagini solo registrati
« Reply #4 on: October 29, 2007, 07:57:53 pm »

C'è una migliore soluzione proposta dallo stesso Stramm, autore del plugin.
Apri codebase.php e aggiungi
Code: [Select]
if(!USER_ID) return $pic_data;dopo
Code: [Select]
global $CONFIG;
L'ho provato sulla mia galleria e funziona ;-)

elvisq

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: movie_download immagini solo registrati
« Reply #5 on: October 30, 2007, 12:27:40 pm »

Uso l'ultima versione del coppermine e la mod movie_download rivisitata per permettere il download delle immagini; se volessi far scaricare la foto solo ai registrati? Permettere la visualizzazione ma disabilitare il tasto destro. Quindi solo se registrati vedere link che permette il download? E' possibile?

ciao dove trovo la mod movie_download?
Logged

Davide Renda

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1427
  • aka "Lontano"
    • www.daviderenda.eu
Re: movie_download immagini solo registrati
« Reply #6 on: October 30, 2007, 10:35:23 pm »

ciao dove trovo la mod movie_download?
Hai richiesto la stessa cosa QUI.

elvisq

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: movie_download immagini solo registrati
« Reply #7 on: October 31, 2007, 08:53:58 am »

Ciao,
ho scaricato il plugin... solo che non mi appare nessun pulsante con la scritta download...

ho cercato nel codebase.php questo
Code: [Select]
if(!USER_ID) return $pic_data;

ma non c'è

devo aggiungerlo io?

elvis
« Last Edit: October 31, 2007, 09:09:06 am by elvisq »
Logged

elvisq

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: movie_download immagini solo registrati
« Reply #8 on: October 31, 2007, 10:33:33 am »

ciao,

sono riuscito a far uscire la scritta però quando ci clicco sopra.. che sia un immagine o documento mi scarica un file picture senza estensione

dove sbaglio?

ecco i miei codice:

codebase.php

Code: [Select]
<?php

/**************************************************

  CPG Movie Download Link Plugin for Coppermine Photo Gallery

  *************************************************

  Copyright (c) 2006 Thomas Lange <stramm@gmx.net>

  *************************************************

  This program is free software; you can redistribute it and/or modify

  it under the terms of the GNU General Public License as published by

  the Free Software Foundation; either version 2 of the License, or

  (at your option) any later version.

  *************************************************

  Coppermine version: 1.4.10

  CPG Movie Download Link Plugin version: 1.1

  $Revision: 1.0 $

  $Author: stramm $

***************************************************/





if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');



$thisplugin->add_filter('file_data','download_link_add_data');



function 
download_link_add_data($pic_data){

global $CONFIG;



$fullsize_url get_pic_url($pic_data);

$mime_content cpg_get_type($pic_data['filename']);



if ($mime_content['content']=='movie') {

$download_link_data '      <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD VIDEO</a>';
        

}

if ($mime_content['content']=='document') {

$download_link_data '      <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD DOCUMENT</a>';
        

}
       
        if (
$mime_content['content']=='image') {

$download_link_data '      <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD IMMAGINE</a>';
        

}

$pic_data['html'] = $pic_data['html'].$download_link_data



return $pic_data

}

?>

down.php

Code: [Select]
<?php
/**************************************************
  CPG Movie Download Link Plugin for Coppermine Photo Gallery
  *************************************************
  Copyright (c) 2006 Thomas Lange <stramm@gmx.net>
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  *************************************************
  Coppermine version: 1.4.10
  CPG Movie Download Link Plugin version: 1.1
  $Revision: 1.0 $
  $Author: stramm $
***************************************************/

$link = isset($_REQUEST['link']) ? $_REQUEST['link'] : null;

header'Content-type: application/octet-stream' );
header'Content-Length: ' filesize$link ) );
header'Content-Disposition: attachment; filename="' basename$link ) . '"' );
readfile$link );

?>

configuration.php

Code: [Select]
<?php
$name
='Movie Download Link Plugin ';
$description='This plug-in displays a download link below a movie in intermediate view';
$author='Thomas Lange - Stramm <a href="mailto:stramm@gmx.net">stramm@gmx.net</a>)';
$version='1.0';
?>




grazie

elvis
Logged

Davide Renda

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1427
  • aka "Lontano"
    • www.daviderenda.eu
Re: movie_download immagini solo registrati
« Reply #9 on: October 31, 2007, 05:54:31 pm »

Ciao,
ho scaricato il plugin... solo che non mi appare nessun pulsante con la scritta download...

ho cercato nel codebase.php questo
Code: [Select]
if(!USER_ID) return $pic_data;

ma non c'è

devo aggiungerlo io?

elvis

Sì devi aggiungerlo tu.
Un link alla tua galleria per vedere cosa non funziona?

elvisq

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: movie_download immagini solo registrati
« Reply #10 on: October 31, 2007, 06:00:04 pm »

ecco qua il link.

http://www.elvisq.it/cpg1413/displayimage.php?album=6&pos=4

se io clicco sopra al link mi fa scaricare un file picture

help me!!
grazie

elvis
Logged

Davide Renda

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1427
  • aka "Lontano"
    • www.daviderenda.eu
Re: movie_download immagini solo registrati
« Reply #11 on: October 31, 2007, 06:15:02 pm »

Il codice corretto (quantomeno funziona sulla mia galleria!) dovrebbe essere il seguente (codebase.php)
Code: [Select]
<?php
/**************************************************
  CPG Movie Download Link Plugin for Coppermine Photo Gallery
  *************************************************
  Copyright (c) 2006 Thomas Lange <stramm@gmx.net>
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  *************************************************
  Coppermine version: 1.4.10
  CPG Movie Download Link Plugin version: 1.1
  $Revision: 1.0 $
  $Author: stramm $
***************************************************/


if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

$thisplugin->add_filter('file_data','download_link_add_data');

function 
download_link_add_data($pic_data){
global $CONFIG;

if(!
USER_ID) return $pic_data;

$fullsize_url get_pic_url($pic_data);
$mime_content cpg_get_type($pic_data['filename']);

if ($mime_content['content']=='movie') {
$download_link_data '      <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD VIDEO</a>';
        

}

if ($mime_content['content']=='document') {
$download_link_data '      <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD DOCUMENT</a>';
        
}

}

if ($mime_content['content']=='image') {
$download_link_data '      <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD DOCUMENT</a>';
       
        
$pic_data['html'] = $pic_data['html'].$download_link_data

return $pic_data
}

?>

elvisq

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: movie_download immagini solo registrati
« Reply #12 on: October 31, 2007, 11:40:00 pm »

il codice corretto è questo!!

Code: [Select]
<?php

/**************************************************

  CPG Movie Download Link Plugin for Coppermine Photo Gallery

  *************************************************

  Copyright (c) 2006 Thomas Lange <stramm@gmx.net>

  *************************************************

  This program is free software; you can redistribute it and/or modify

  it under the terms of the GNU General Public License as published by

  the Free Software Foundation; either version 2 of the License, or

  (at your option) any later version.

  *************************************************

  Coppermine version: 1.4.10

  CPG Movie Download Link Plugin version: 1.1

  $Revision: 1.0 $

  $Author: stramm $

***************************************************/





if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');



$thisplugin->add_filter('file_data','download_link_add_data');

function 
download_link_add_data($pic_data){

global $CONFIG;

if(!
USER_ID) return $pic_data;

$fullsize_url get_pic_url($pic_data);

$mime_content cpg_get_type($pic_data['filename']);

if ($mime_content['content']=='movie') {
$download_link_data '      <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD VIDEO</a>';
        

}

if ($mime_content['content']=='document') {
$download_link_data '      <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD DOCUMENT</a>';
        
}


if ($mime_content['content']=='image') {
$download_link_data '      <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD IMMAGINE</a>';
       
     }   
$pic_data['html'] = $pic_data['html'].$download_link_data

return $pic_data
}

?>

ciao a tutti!! :D ;) ;)
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 19 queries.