[3298] | 1 | <?php |
---|
| 2 | |
---|
[5735] | 3 | global $page, $conf, $template, $user; |
---|
[3298] | 4 | |
---|
| 5 | include_once(LIGHTBOX_PATH.'functions.inc.php'); |
---|
| 6 | $params = unserialize($conf['lightbox']); |
---|
| 7 | $conf['lightbox_rel'] = isset($conf['lightbox_rel']) ? ++$conf['lightbox_rel'] : 0; |
---|
| 8 | |
---|
[6373] | 9 | switch ($user['theme']) |
---|
[5735] | 10 | { |
---|
| 11 | case 'simple': |
---|
| 12 | $selector = '#thumbnails a'; |
---|
| 13 | break; |
---|
| 14 | |
---|
| 15 | default: |
---|
| 16 | $selector = '.thumbnails a'; |
---|
| 17 | break; |
---|
| 18 | } |
---|
| 19 | |
---|
[6373] | 20 | $template->func_known_script(array('id'=>'jquery', 'src'=>get_root_url().'themes/default/js/jquery.packed.js'), $smarty); |
---|
| 21 | $template->func_known_script(array('id'=>'colorbox', 'src'=>get_root_url().'plugins/lightbox/js/jquery.colorbox-min.js'), $smarty); |
---|
[3298] | 22 | $template->block_html_head('', ' |
---|
[4621] | 23 | <link rel="stylesheet" href="'.get_root_url().'plugins/lightbox/theme/'.$params['theme'].'/colorbox.css" type="text/css" media="screen"> |
---|
[3298] | 24 | <script type="text/javascript"> |
---|
| 25 | $(document).ready(function(){ |
---|
[5735] | 26 | $("'.$selector.'").attr("href", function () { |
---|
[3298] | 27 | return this.name; |
---|
| 28 | }); |
---|
[5735] | 29 | $("'.$selector.'").colorbox({ |
---|
[4621] | 30 | current: "", |
---|
[3298] | 31 | transition: "'.$params['transition'].'", |
---|
[4621] | 32 | speed: "'.$params['transition_speed'].'", |
---|
[3298] | 33 | initialWidth: "'.(!empty($params['initial_width']) ? $params['initial_width'] : $config_default['initial_width']).'", |
---|
| 34 | initialHeight: "'.(!empty($params['initial_height']) ? $params['initial_height'] : $config_default['initial_height']).'", |
---|
[4621] | 35 | width: '.(!empty($params['fixed_width']) ? '"'.$params['fixed_width'].'"' : 'false').', |
---|
| 36 | height: '.(!empty($params['fixed_height']) ? '"'.$params['fixed_height'].'"' : 'false').' |
---|
[3298] | 37 | }, |
---|
[4621] | 38 | function() { |
---|
[3298] | 39 | $.post("'.get_root_url().'plugins/lightbox/save_history.php", { |
---|
[4621] | 40 | imgid: this.id, |
---|
[3298] | 41 | catid: "'.@$page['category']['id'].'", |
---|
| 42 | section: "'.@$page['section'].'", |
---|
| 43 | tagids: "'.@implode(',', @$page['tag_ids']).'" |
---|
| 44 | }); |
---|
| 45 | }); |
---|
| 46 | }); |
---|
| 47 | </script>', $smarty, $repeat); |
---|
| 48 | |
---|
| 49 | foreach($tpl_thumbnails_var as $key => $tpl_var) |
---|
| 50 | { |
---|
| 51 | // Image URL for lightbox |
---|
| 52 | if ($newurl = get_lightbox_url($pictures[$key])) |
---|
| 53 | { |
---|
| 54 | $tpl_thumbnails_var[$key]['URL'] .= '" id="img-'.$pictures[$key]['id'].'" name="'.$newurl; |
---|
| 55 | } |
---|
| 56 | else |
---|
| 57 | { |
---|
| 58 | continue; |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | // Title display |
---|
| 62 | if ($params['display_name']) |
---|
| 63 | { |
---|
| 64 | $tpl_thumbnails_var[$key]['URL'] .= '" title="'.get_lightbox_title($pictures[$key], $params['name_link']); |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | // Arrows display |
---|
| 68 | if ($params['display_arrows']) |
---|
| 69 | { |
---|
| 70 | $tpl_thumbnails_var[$key]['URL'] .= '" rel="colorbox'.$conf['lightbox_rel']; |
---|
| 71 | } |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | // Add all items from category |
---|
| 75 | if ($params['display_arrows'] and $params['all_cat'] and !empty($page['navigation_bar'])) |
---|
| 76 | { |
---|
| 77 | $rank_of = array_flip($page['items']); |
---|
| 78 | if ($page['start'] > 0) |
---|
| 79 | { |
---|
| 80 | $selection = array_slice($page['items'], 0, $page['start']); |
---|
| 81 | $template->concat('PLUGIN_INDEX_CONTENT_BEGIN', get_lightbox_extra_pictures($selection, $rank_of, $params['name_link'])); |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | if (count($page['items']) > $page['start'] + $page['nb_image_page']) |
---|
| 85 | { |
---|
| 86 | $selection = array_slice($page['items'], $page['start'] + $page['nb_image_page']); |
---|
| 87 | $template->concat('PLUGIN_INDEX_CONTENT_END', get_lightbox_extra_pictures($selection, $rank_of, $params['name_link'])); |
---|
| 88 | } |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | ?> |
---|