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

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

version 2.2.0.beta for Piwigo 2.4

File size: 3.3 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
25// Need upgrade from v2.x?
26if (!isset($stripped['paramVersion'])) {
27        include(PHPWG_THEMES_PATH.'stripped/admin/upgrade.inc.php');
28        $stripped = array_merge( unserialize( $conf['stripped'] ), (array)$stripped );
29}
30
31add_event_handler('loc_begin_page_header', 'set_config_values');
32
33function set_config_values()
34{
35        global $template, $stripped;
36        $template->assign( 'stripped', $stripped );
37}
38       
39$themeconf = array(
40  'parent' => 'default',
41  'load_parent_css' => false,
42  'load_parent_local_head' => false,
43  'name' => 'stripped',
44  'theme_dir' => 'stripped',
45  'icon_dir' => 'themes/stripped/icon',
46  'admin_icon_dir' => 'themes/default/icon/admin',
47  'mime_icon_dir' => 'themes/default/icon/mimetypes/',
48  'local_head' => 'local_head.tpl',
49);
50
51load_language('theme.lang', PHPWG_THEMES_PATH.'stripped/');
52
53pwg_set_session_var('show_metadata', true);
54
55// max number of thumbnails by page
56
57add_event_handler('loc_begin_index', 'modify_nb_thumbnail_page');
58function modify_nb_thumbnail_page()
59{
60        global $user, $page, $stripped;
61
62        if (!isset($stripped['maxThumb'])) { $stripped['maxThumb']=15;}
63        $user['nb_image_page']=$stripped['maxThumb'];
64        $page['nb_image_page']=$stripped['maxThumb'];
65}
66
67// Preload function
68
69if (isset($stripped['imagePreload']) && ($user['theme'] == 'stripped')) {
70        add_event_handler('loc_end_picture', 'assign_next_images_url');
71}
72
73function assign_next_images_url()
74{
75        global $page, $template, $conf, $stripped;
76
77        $nb_image =$stripped['imagePreloadNb'];
78        $nb_max = $page['last_rank'] - $page['current_rank'];
79        $nb_image = min ($nb_image, $nb_max);
80
81        if ($nb_image < 1) return;
82
83        for ($n = 1; $n <= $nb_image; $n++) {
84                $pagenext[$n] = $page['items'][ $page['current_rank'] + $n ];
85        }
86
87        $picturenext = array();
88        $idnext = array();
89
90        for ($n = 1; $n <= $nb_image; $n++) {
91                array_push($idnext, $pagenext[$n]);
92        }
93
94        $query = '
95        SELECT *
96          FROM '.IMAGES_TABLE.'
97          WHERE id IN ('.implode(',', $idnext).')
98        ;';
99
100        $result = pwg_query($query);
101
102        while ($rownext = pwg_db_fetch_assoc($result))
103        {
104                for ($n = 1; $n <= $nb_image; $n++) {
105                        if (isset($pagenext[$n]) and $rownext['id'] == $pagenext[$n]) {$in = $n;}
106                }
107
108                $picturenext[$in] = $rownext;
109                $picturenext[$in]['is_picture'] = false;
110
111                if (in_array(get_extension($rownext['file']), $conf['picture_ext']))
112                {
113                        $picturenext[$in]['is_picture'] = true;
114                }
115
116                $picturenext[$in]['image_url'] = ''; /*get_image_url( $picturenext[$in] );*/
117        }
118
119        for ($n = 1; $n <= $nb_image; $n++) {
120                if (isset($picturenext[$n]['image_url'])) { $image_next[$n] = $picturenext[$n]['image_url']; }
121        }
122 
123  $template->assign('U_IMGNEXT', $image_next );
124
125}
126
127?>
Note: See TracBrowser for help on using the repository browser.