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

Last change on this file since 14687 was 14687, checked in by Zaphod, 9 years ago

version 2.2.0.beta2 for Piwigo 2.4

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