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