Changeset 9504


Ignore:
Timestamp:
03/03/11 22:47:16 (9 years ago)
Author:
plg
Message:

let's make it simpler : a user uploaded photo with no admin moderation can be seen by anyone (level = 0)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/community/add_photos.php

    r9500 r9504  
    180180  else 
    181181  { 
    182     // we have to change the level. 
    183     // 
    184     // the level must equal the minimum level between : 
    185     // * the privacy level of the uploader 
    186     // * the minimum level for photos in the same album 
    187     $category_min_level = null; 
    188      
    189     $query = ' 
    190 SELECT 
    191     image_id, 
    192     level 
    193   FROM '.IMAGE_CATEGORY_TABLE.' AS ic 
    194     JOIN '.IMAGES_TABLE.' AS i ON ic.image_id = i.id 
    195   WHERE category_id = '.$category_id.' 
    196 ;'; 
    197     $result = pwg_query($query); 
    198     while ($row = pwg_db_fetch_assoc($result)) 
    199     { 
    200       if (in_array($row['image_id'], $image_ids)) 
    201       { 
    202         continue; 
    203       } 
    204  
    205       if (!isset($category_min_level)) 
    206       { 
    207         $category_min_level = $row['level']; 
    208       } 
    209  
    210       if ($row['level'] < $category_min_level) 
    211       { 
    212         $category_min_level = $row['level']; 
    213       } 
    214     } 
    215  
    216     if (!isset($category_min_level)) 
    217     { 
    218       $category_min_level = 0; 
    219     } 
    220  
    221     $level = min($category_min_level, $user['level']); 
    222  
     182    // the level of a user upload photo with no moderation is 0 
    223183    $query = ' 
    224184UPDATE '.IMAGES_TABLE.' 
    225   SET level = '.$level.' 
     185  SET level = 0 
    226186  WHERE id IN ('.implode(',', $image_ids).') 
    227187;'; 
Note: See TracChangeset for help on using the changeset viewer.