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: [solved] problème d'upload de visiteur dans les albums perso  (Read 6030 times)

0 Members and 1 Guest are viewing this topic.

neodragon

  • Coppermine newbie
  • Offline Offline
  • Posts: 12

Bonjour,

J'ai des utilisateurs qui ont une galerie perso avec plusieurs albums. Pour certains de ces albums ils veulent que d'autres utilisateurs d'un groupe précis ( exemple invité) puisssent voir et uploader des photos.

J'ai bien configuré la possibilité d'upload de photos pour le groupe invité, mais lorsque  les utilisateurs du groupe invité se loguent et cliquent sur le lien "uploader des images", lem essge d'erreur affiche "désolé, il n'existe aucun album pour le quel vous pouvez uploader" (un truc du genre).

Pourriez-vous me dire ce qui cloche?

Merci d'avance.
« Last Edit: April 08, 2005, 11:13:20 am by neodragon »
Logged

nol33t

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 244
  • Exploring Coppermine in every directions
    • tieum's pics
Re: problème d'upload de visiteur dans les albums perso
« Reply #1 on: April 04, 2005, 12:27:13 pm »

Bonjour,

dans "Propriétés de l'album" as tu coché Oui a  "Les visiteurs peuvent mettre des photos en ligne" ?

-matt-

neodragon

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: problème d'upload de visiteur dans les albums perso
« Reply #2 on: April 04, 2005, 12:40:56 pm »

Merci de répondre si vite.

Oui j'ai bien mis cette option sur oui, mais j'ai du le faire en tant qu'admin car le user à qui appartient l'album privé ne voit pas cette option (cf mon autre post).

C'est pour cela que je n'arrive pas à comprendre d'où vient le problème.
Logged

nol33t

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 244
  • Exploring Coppermine in every directions
    • tieum's pics
Re: problème d'upload de visiteur dans les albums perso
« Reply #3 on: April 04, 2005, 12:57:03 pm »

Si je ne m'abuse rien ne cloche, un user normal n'a effectivement pas le pouvoir de gérer qui a le droit d'uploader dans son/ses albums, c'est à un admin de rajouter ces droits..

neodragon

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: problème d'upload de visiteur dans les albums perso
« Reply #4 on: April 04, 2005, 01:02:54 pm »

Ok, ça répond alors à mon autre post.

Mais pour le post présent, en tant qu'admin j'ai donné les droits à l'album perso et au groupe "invité", pour que ce groupe puisse uploader des photos dans l'album perso d'un utilisateur du groupe "enregistré".

Cependant, lorsque qu'un membre de "invité" clique sur "uploader une image" il s'affiche "pas d'album pour lequel vous ayiez droit d'uploader".
Logged

neodragon

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: problème d'upload de visiteur dans les albums perso
« Reply #5 on: April 04, 2005, 03:51:27 pm »

Dans le fichier upload.php
j'ai trouvé cette ligne
Code: [Select]
$public_albums = mysql_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " AND uploads='YES' ORDER BY title");

En voyant la partie category < FIRST_USER_CAT, j'en déduis qu'il est à priori impossible pour un utilisateur d'un groupe A d'uploader dans l'album perso d'un utilisateur d'un groupe B. Je m'explique :

la ligne en question correspond à category < 10000, c'est à dire, toutes les catégories hors galeries des utilisateurs qui sont, elles, calculer comme cela 10000+id de l'utilisateur.

Donc un utilisateur ne peut uploader que dans les albums publics (comprendre avec un id < 10000) ou dans ses albums perso (la requete sql se trouve après celle que je viens de citer dans le fichier upload.php).

S'il vous plaît, dites moi que je me trompe !!! Cette gestion des droits me paraît frustante !
Logged

neodragon

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: problème d'upload de visiteur dans les albums perso
« Reply #6 on: April 05, 2005, 11:53:19 am »

Bonjour,

J'ai quelques nouvelles concernant ce problème.

J'ai modifier le fichier upload.php pour permettre à un utilisateur A d'uploader des photos dans l'album d'un autre utilisateur B. Cela sous-entendant que l'utilisateur B a permis au groupe de l'utilisateur A de voir ses photos et que l'administrateur a permis l'upload de fichier sur l'album de l'utilisateur B (" Les visiteurs peuvent mettre des photos en ligne"). J'ai appelé ce nouveau type de liste d'album "other_album" dans le code.

voici les trois modifications à apporter au fichier upload.php :

avant
Code: [Select]
    // Also pull the album lists into the function.
    global $user_albums_list, $public_albums_list;

après
Code: [Select]
    // Also pull the album lists into the function.
    global $user_albums_list, $public_albums_list, $other_albums_list;

juste en-dessous dans le fichier
avant
Code: [Select]
//Cylce through the User albums.
    foreach($user_albums_list as $album) {

        // Set $album_id to the actual album ID.
        $album_id = $album['aid'];

        //Query the database to determine the category the album belongs to.
        $vQuery = "SELECT category FROM " . $CONFIG['TABLE_ALBUMS'] . " WHERE aid='" . $album_id . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Query the database to get the category name.
        $vQuery = "SELECT name FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE cid='" . $vRes['category'] . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Create the option for the drop down list.
        echo '                <option value="' . $album['aid'] . '"' . ($album['aid'] == $sel_album ? ' selected' : '') . '>' . (($vRes['name']) ? '(' . $vRes['name'] . ') ' : '') . $album['title'] . "</option>\n";
    }

    //Cycle through the public albums.
    foreach($public_albums_list as $album) {

        // Set $album_id to the actual album ID.
        $album_id = $album['aid'];

        //Query the database to determine the category the album belongs to.
        $vQuery = "SELECT category FROM " . $CONFIG['TABLE_ALBUMS'] . " WHERE aid='" . $album_id . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Query the database to get the category name.
        $vQuery = "SELECT name FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE cid='" . $vRes['category'] . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Create the option for the drop down list.
        echo '                <option value="' . $album['aid'] . '"' . ($album['aid'] == $sel_album ? ' selected' : '') . '>' . (($vRes['name']) ? '(' . $vRes['name'] . ') ' : '') . $album['title'] . "</option>\n";
    }

après
Code: [Select]
//Cylce through the User albums.
    foreach($user_albums_list as $album) {

        // Set $album_id to the actual album ID.
        $album_id = $album['aid'];

        //Query the database to determine the category the album belongs to.
        $vQuery = "SELECT category FROM " . $CONFIG['TABLE_ALBUMS'] . " WHERE aid='" . $album_id . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Query the database to get the category name.
        $vQuery = "SELECT name FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE cid='" . $vRes['category'] . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Create the option for the drop down list.
        echo '                <option value="' . $album['aid'] . '"' . ($album['aid'] == $sel_album ? ' selected' : '') . '>' . (($vRes['name']) ? '(' . $vRes['name'] . ') ' : '') . $album['title'] . "</option>\n";
    }

    //Cycle through the public albums.
    foreach($public_albums_list as $album) {

        // Set $album_id to the actual album ID.
        $album_id = $album['aid'];

        //Query the database to determine the category the album belongs to.
        $vQuery = "SELECT category FROM " . $CONFIG['TABLE_ALBUMS'] . " WHERE aid='" . $album_id . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Query the database to get the category name.
        $vQuery = "SELECT name FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE cid='" . $vRes['category'] . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Create the option for the drop down list.
        echo '                <option value="' . $album['aid'] . '"' . ($album['aid'] == $sel_album ? ' selected' : '') . '>' . (($vRes['name']) ? '(' . $vRes['name'] . ') ' : '') . $album['title'] . "</option>\n";
    }

    //Cycle through the other albums.
    foreach($other_albums_list as $album) {

        // Set $album_id to the actual album ID.
        $album_id = $album['aid'];

        //Query the database to determine the category the album belongs to.
        $vQuery = "SELECT category FROM " . $CONFIG['TABLE_ALBUMS'] . " WHERE aid='" . $album_id . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Query the database to get the category name.
        $vQuery = "SELECT name FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE cid='" . $vRes['category'] . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Create the option for the drop down list.
        echo '                <option value="' . $album['aid'] . '"' . ($album['aid'] == $sel_album ? ' selected' : '') . '>' . (($vRes['name']) ? '(' . $vRes['name'] . ') ' : '') . $album['title'] . "</option>\n";
    }

Plus bas dans le fichier
avant
Code: [Select]
// Get public and private albums, and set maximum individual file size.

if (GALLERY_ADMIN_MODE) {
    $public_albums = mysql_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " ORDER BY title");
} else {
    $public_albums = mysql_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " AND uploads='YES' ORDER BY title");
}
if (mysql_num_rows($public_albums)) {
    $public_albums_list = db_fetch_rowset($public_albums);
} else {
    $public_albums_list = array();
}

if (USER_ID) {
    $user_albums = mysql_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category='" . (FIRST_USER_CAT + USER_ID) . "' ORDER BY title");
    if (mysql_num_rows($user_albums)) {
        $user_albums_list = db_fetch_rowset($user_albums);
    } else {
        $user_albums_list = array();
    }
} else {
    $user_albums_list = array();
}

if (!count($public_albums_list) && !count($user_albums_list)) {
    cpg_die (ERROR, $lang_upload_php['err_no_alb_uploadables'], __FILE__, __LINE__);
}

après
Code: [Select]
// Get public and private albums, and set maximum individual file size. Ajout de other albums, album visible et upload possible

if (GALLERY_ADMIN_MODE) {
    $public_albums = mysql_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " ORDER BY title");
} else {
    $public_albums = mysql_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " AND uploads='YES' ORDER BY title");
}
if (mysql_num_rows($public_albums)) {
    $public_albums_list = db_fetch_rowset($public_albums);
} else {
    $public_albums_list = array();
}

if (USER_ID) {
    $user_albums = mysql_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category='" . (FIRST_USER_CAT + USER_ID) . "' ORDER BY title");
    if (mysql_num_rows($user_albums)) {
        $user_albums_list = db_fetch_rowset($user_albums);
    } else {
        $user_albums_list = array();
    }
} else {
    $user_albums_list = array();
}

$other_albums = mysql_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE uploads='YES' AND visibility IN ".USER_GROUP_SET." ORDER BY title");
if (mysql_num_rows($other_albums)) {
    $other_albums_list = db_fetch_rowset($other_albums);
} else {
    $other_albums_list = array();
}

if (!count($public_albums_list) && !count($user_albums_list) && !count($other_albums_list)) {
    cpg_die (ERROR, $lang_upload_php['err_no_alb_uploadables'], __FILE__, __LINE__);
}

ATTENTION, si vous utilisez l'approbation de l'administrateur pour l'upload de photos pour le groupe de l'utilisateur A, il vous faudra aussi modifier les fichiers editOnePic.php et editpics.php et si vous utilisez la publication XP il faut aussi modifier le fichier xp_publish.php.

Voilà, si ça peut servir à des gens ... A moi ça va me servir  ;)
Logged

Pascal YAP

  • Moderator
  • Coppermine addict
  • ****
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 13833
  • Hello World :-)
    • CPG 1.5.x ExperiMental website

Bonjour neodragon,

Terrible  ;)

Quote
ATTENTION, si vous utilisez l'approbation de l'administrateur pour l'upload de photos pour le groupe de l'utilisateur A, il vous faudra aussi modifier les fichiers editOnePic.php et editpics.php   et si vous utilisez la publication XP il faut aussi modifier le fichier xp_publish.php.
Merci d'avoir précisé ces points non négligeables.

Quote
Voilà, si ça peut servir à des gens ... A moi ça va me servir
Je reste convaincu que si une unique personne est interressée (toi-même), il y a de grande chance pour que des milliers d'autres personnes le soient.

Good ((-;

PYAP
Logged
Pages: [1]   Go Up
 

Page created in 0.036 seconds with 19 queries.