Ignore:
Timestamp:
Sep 13, 2011, 10:15:31 PM (13 years ago)
Author:
Zaphod
Message:

version 1.5.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/stripped/themeconf.inc.php

    r10930 r12153  
    1212// Need upgrade?
    1313
    14 global $conf;
     14global $conf, $user;
    1515
    1616if (!isset($conf['stripped']))
     
    5656}
    5757
     58$config = unserialize( $conf['stripped'] );
     59
     60if (isset($config['imagePreload']) && ($user['theme'] == 'stripped')) {
     61        add_event_handler('loc_end_picture', 'assign_next_images_url');
     62
     63        function assign_next_images_url()
     64        {
     65                global $page, $template, $conf;
     66
     67                $config = unserialize( $conf['stripped'] );
     68               
     69                $nb_image =$config['imagePreloadNb'];
     70                $nb_max = $page['last_rank'] - $page['current_rank'];
     71                $nb_image = min ($nb_image, $nb_max);
     72
     73                if ($nb_image < 1) return;
     74
     75                for ($n = 1; $n <= $nb_image; $n++) {
     76                        $pagenext[$n] = $page['items'][ $page['current_rank'] + $n ];
     77                }
     78
     79                $picturenext = array();
     80                $idnext = array();
     81
     82                for ($n = 1; $n <= $nb_image; $n++) {
     83                        array_push($idnext, $pagenext[$n]);
     84                }
     85
     86                $query = '
     87                SELECT *
     88                  FROM '.IMAGES_TABLE.'
     89                  WHERE id IN ('.implode(',', $idnext).')
     90                ;';
     91
     92                $result = pwg_query($query);
     93
     94                while ($rownext = pwg_db_fetch_assoc($result))
     95                {
     96                        for ($n = 1; $n <= $nb_image; $n++) {
     97                                if (isset($pagenext[$n]) and $rownext['id'] == $pagenext[$n]) {$in = $n;}
     98                        }
     99
     100                        $picturenext[$in] = $rownext;
     101                        $picturenext[$in]['is_picture'] = false;
     102
     103                        if (in_array(get_extension($rownext['file']), $conf['picture_ext']))
     104                        {
     105                                $picturenext[$in]['is_picture'] = true;
     106                        }
     107
     108                        $picturenext[$in]['image_url'] = get_image_url( $picturenext[$in] );
     109                }
     110
     111                for ($n = 1; $n <= $nb_image; $n++) {
     112                        if (isset($picturenext[$n]['image_url'])) { $image_next[$n] = $picturenext[$n]['image_url']; }
     113                }
     114         
     115          $template->assign('U_IMGNEXT', $image_next );
     116
     117        }
     118
     119}
     120
    58121?>
Note: See TracChangeset for help on using the changeset viewer.