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

Last change on this file since 30259 was 29391, checked in by plg, 10 years ago

set colorscheme

File size: 4.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
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  'colorscheme' => 'white' == $stripped['themeStyle'] ? 'clear' : 'dark',
64);
65
66load_language('theme.lang', PHPWG_THEMES_PATH.'stripped/');
67
68pwg_set_session_var('show_metadata', true);
69
70// max number of thumbnails by page
71
72add_event_handler('loc_begin_index', 'modify_nb_thumbnail_page');
73function modify_nb_thumbnail_page()
74{
75        global $user, $page, $stripped;
76
77        if (!isset($stripped['maxThumb'])) { $stripped['maxThumb']=15;}
78        $user['nb_image_page']=$stripped['maxThumb'];
79        $page['nb_image_page']=$stripped['maxThumb'];
80}
81
82// Preload function
83
84if (isset($stripped['imagePreload']) && ($user['theme'] == 'stripped')) {
85        add_event_handler('loc_end_picture', 'assign_next_images_url');
86}
87
88function assign_next_images_url()
89{
90        global $page, $template, $conf, $stripped;
91
92        $nb_image =$stripped['imagePreloadNb'];
93        $nb_max = $page['last_rank'] - $page['current_rank'];
94        $nb_image = min ($nb_image, $nb_max);
95
96        if ($nb_image < 1) return;
97
98        for ($n = 1; $n <= $nb_image; $n++) {
99                $pagenext[$n] = $page['items'][ $page['current_rank'] + $n ];
100        }
101
102        $picturenext = array();
103        $idnext = array();
104
105        for ($n = 1; $n <= $nb_image; $n++) {
106                array_push($idnext, $pagenext[$n]);
107        }
108
109        $query = '
110        SELECT *
111          FROM '.IMAGES_TABLE.'
112          WHERE id IN ('.implode(',', $idnext).')
113        ;';
114
115        $result = pwg_query($query);
116
117        while ($rownext = pwg_db_fetch_assoc($result))
118        {
119                for ($n = 1; $n <= $nb_image; $n++) {
120                        if (isset($pagenext[$n]) and $rownext['id'] == $pagenext[$n]) {$in = $n;}
121                }
122
123                $picturenext[$in] = $rownext;
124
125                $derivative = new DerivativeImage($stripped['imageSize'], new SrcImage($rownext));
126                $picturenext[$in]['image_url'] = $derivative->get_url();
127        }
128
129        for ($n = 1; $n <= $nb_image; $n++) {
130                if (isset($picturenext[$n]['image_url'])) { $image_next[$n] = $picturenext[$n]['image_url']; }
131        }
132 
133  $template->assign('U_IMGNEXT', $image_next );
134
135}
136
137?>
Note: See TracBrowser for help on using the repository browser.