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

Last change on this file since 26899 was 23538, checked in by flop25, 11 years ago

no more {php}
part2 end

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