source: extensions/stripped/themeconf.inc.php @ 12925

Last change on this file since 12925 was 12547, checked in by Zaphod, 12 years ago

version 2.0.0

File size: 3.1 KB
Line 
1<?php
2/*
3Theme Name: stripped
4Version: Auto
5Description: stripped Theme
6Theme URI: http://piwigo.org/ext/extension_view.php?eid=471
7Author: Julien Capitaine (Zaphod on Piwigo forums)
8Author URI: http://www.audreyetjulien.fr/galerie
9*/
10
11global $conf, $user, $stripped;
12
13// Need upgrade?
14if (!isset($conf['stripped']))
15  include(PHPWG_THEMES_PATH.'stripped/admin/upgrade.inc.php');
16
17$stripped = array_merge( unserialize( $conf['stripped'] ), (array)$stripped );
18
19// Need upgrade from v1.x?
20if (!isset($stripped['themeStyle'])) {
21        include(PHPWG_THEMES_PATH.'stripped/admin/upgrade.inc.php');
22        $stripped = array_merge( unserialize( $conf['stripped'] ), (array)$stripped );
23}
24
25add_event_handler('loc_begin_page_header', 'set_config_values');
26
27function set_config_values()
28{
29        global $template, $stripped;
30        $template->assign( 'stripped', $stripped );
31}
32       
33$themeconf = array(
34  'parent' => 'default',
35  'load_parent_css' => false,
36  'load_parent_local_head' => false,
37  'name' => 'stripped',
38  'theme_dir' => 'stripped',
39  'icon_dir' => 'themes/stripped/icon',
40  'admin_icon_dir' => 'themes/default/icon/admin',
41  'mime_icon_dir' => 'themes/default/icon/mimetypes/',
42  'local_head' => 'local_head.tpl',
43);
44
45load_language('theme.lang', PHPWG_THEMES_PATH.'stripped/');
46
47pwg_set_session_var('show_metadata', true);
48
49// max number of thumbnails by page
50
51add_event_handler('loc_begin_index', 'modify_nb_thumbnail_page');
52function modify_nb_thumbnail_page()
53{
54        global $user, $page, $stripped;
55
56        if (!isset($stripped['maxThumb'])) { $stripped['maxThumb']=15;}
57        $user['nb_image_page']=$stripped['maxThumb'];
58        $page['nb_image_page']=$stripped['maxThumb'];
59}
60
61if (isset($stripped['imagePreload']) && ($user['theme'] == 'stripped')) {
62        add_event_handler('loc_end_picture', 'assign_next_images_url');
63}
64
65function assign_next_images_url()
66{
67        global $page, $template, $conf, $stripped;
68
69        $nb_image =$stripped['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?>
Note: See TracBrowser for help on using the repository browser.