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

Last change on this file since 12153 was 12153, checked in by Zaphod, 13 years ago

version 1.5.0

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