Changeset 3683


Ignore:
Timestamp:
Jul 26, 2009, 5:56:37 PM (11 years ago)
Author:
grum
Message:

Update AMM 2.1.0 - big resolved
Bug referenced in french forum (post:107877 a topic:14374)

Location:
extensions/AMenuManager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMenuManager/amm_pip.class.inc.php

    r3681 r3683  
    7575      Add a new random picture section
    7676    */
    77     if ( ($block = $menu->get_block( 'mbAMM_randompict' ) ) != null )
     77    if ( ( ($block = $menu->get_block( 'mbAMM_randompict' ) ) != null ) && ($user['nb_total_images'] > 0) )
    7878    {
    7979      $block->set_title(  base64_decode($this->my_config['amm_randompicture_title'][$user['language']]) );
     
    176176  private function ajax_amm_get_random_picture()
    177177  {
     178    global $user;
     179
    178180    $local_tpl = new Template(AMM_PATH."menu_templates/", "");
    179181    $local_tpl->set_filename('body_page',
     
    181183
    182184      $sql="SELECT i.id as image_id, i.file as image_file, i.comment, i.path, i.tn_ext, c.id as catid, c.name, c.permalink, RAND() as rndvalue, i.name as imgname
    183 FROM ".CATEGORIES_TABLE." c, ".IMAGES_TABLE." i, ".IMAGE_CATEGORY_TABLE." ic
    184 WHERE c.status='public'
    185   AND c.id = ic.category_id
    186   AND ic.image_id = i.id
    187 ORDER BY rndvalue
    188 LIMIT 0,1
    189 ";
    190 
     185            FROM ".CATEGORIES_TABLE." c, ".IMAGES_TABLE." i, ".IMAGE_CATEGORY_TABLE." ic
     186            WHERE c.id = ic.category_id
     187              AND ic.image_id = i.id
     188              AND i.level <= ".$user['level']." ";
     189      if($user['forbidden_categories']!="")
     190      {
     191        $sql.=" AND c.id NOT IN (".$user['forbidden_categories'].") ";
     192      }
     193
     194      $sql.=" ORDER BY rndvalue
     195            LIMIT 0,1";
    191196
    192197
  • extensions/AMenuManager/main.inc.php

    r3682 r3683  
    2424| 2.0.0b  | 2008/07/27 | * initial release with own blocks classes
    2525| 2.0.0   | 2008/10/23 | * first release for piwigo's blocks classes
    26 | 2.1.0   | 2009/07/26 | * add of a functionality : random image can be changed
     26| 2.1.0   | 2009/07/26 | * add a functionality : random image can be changed
    2727|         |            |   every x seconds (from 0.5 to 60)
    28 |         |            |
     28|         |            | * bug resolved : random image block is displayed only
     29|         |            |   if user have accessibility to more than 0 images
     30|         |            |   random images are choosen in the accessible images for
     31|         |            |   a user (permission + level)
     32|         |            |   (cf. post:107877 on french forum)
     33|         |            |   (cf. topic:14374 on french forum)
    2934|         |            |
    3035|         |            |
Note: See TracChangeset for help on using the changeset viewer.