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

Last change on this file since 13245 was 12961, checked in by Zaphod, 12 years ago
File size: 3.3 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
[9960]31add_event_handler('loc_begin_page_header', 'set_config_values');
32
33function set_config_values()
34{
[12321]35        global $template, $stripped;
36        $template->assign( 'stripped', $stripped );
[9960]37}
38       
[7989]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{
[12547]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'];
[7989]65}
66
[12321]67if (isset($stripped['imagePreload']) && ($user['theme'] == 'stripped')) {
[12153]68        add_event_handler('loc_end_picture', 'assign_next_images_url');
[12321]69}
[12153]70
[12321]71function assign_next_images_url()
72{
73        global $page, $template, $conf, $stripped;
[12153]74
[12321]75        $nb_image =$stripped['imagePreloadNb'];
76        $nb_max = $page['last_rank'] - $page['current_rank'];
77        $nb_image = min ($nb_image, $nb_max);
[12153]78
[12321]79        if ($nb_image < 1) return;
[12153]80
[12321]81        for ($n = 1; $n <= $nb_image; $n++) {
82                $pagenext[$n] = $page['items'][ $page['current_rank'] + $n ];
83        }
[12153]84
[12321]85        $picturenext = array();
86        $idnext = array();
[12153]87
[12321]88        for ($n = 1; $n <= $nb_image; $n++) {
89                array_push($idnext, $pagenext[$n]);
90        }
91
92        $query = '
93        SELECT *
94          FROM '.IMAGES_TABLE.'
95          WHERE id IN ('.implode(',', $idnext).')
96        ;';
97
98        $result = pwg_query($query);
99
100        while ($rownext = pwg_db_fetch_assoc($result))
101        {
[12153]102                for ($n = 1; $n <= $nb_image; $n++) {
[12321]103                        if (isset($pagenext[$n]) and $rownext['id'] == $pagenext[$n]) {$in = $n;}
[12153]104                }
105
[12321]106                $picturenext[$in] = $rownext;
107                $picturenext[$in]['is_picture'] = false;
[12153]108
[12321]109                if (in_array(get_extension($rownext['file']), $conf['picture_ext']))
[12153]110                {
[12321]111                        $picturenext[$in]['is_picture'] = true;
[12153]112                }
113
[12321]114                $picturenext[$in]['image_url'] = get_image_url( $picturenext[$in] );
115        }
[12153]116
[12321]117        for ($n = 1; $n <= $nb_image; $n++) {
118                if (isset($picturenext[$n]['image_url'])) { $image_next[$n] = $picturenext[$n]['image_url']; }
[12153]119        }
[12321]120 
121  $template->assign('U_IMGNEXT', $image_next );
[12153]122
123}
124
[12321]125
[7989]126?>
Note: See TracBrowser for help on using the repository browser.