source: extensions/piclens/admin/piclenswallconfig.php @ 3708

Last change on this file since 3708 was 3708, checked in by tiico, 15 years ago

Suppress render for comment and author
Add double select in piclenswall admin page + jquery
Add compatibility with wat.tv video and correct rdd feed to adapt with cooliris 1.11
Correct %I2 param for parser : without picture name, display picture file
Suppress slashes in "name" and "descriptions" parameters
Change version to 0.4.1

File size: 7.4 KB
Line 
1<?php
2/*
3 * Plugin Name: CoolIris-Piclens
4 * File :  piclenswallconfig.php 
5 */
6
7if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
8
9global $template, $page;
10 
11$pwgstuff_ok = get_db_plugins('active','PWG_Stuffs');
12$me = get_plugin_data($plugin_id);
13
14 $template->set_filenames( 
15                array('plugin_admin_content' => PICLENS_ROOT.'/admin/piclenswallconfig.tpl',
16                          'double_select' => 'double_select.tpl'
17                        ) );
18
19
20
21// Switch  on right side (=> )
22if ( isset($_POST['falsify']) and !is_adviser() 
23    and $_POST['from']=='wallcat'
24    and isset($_POST['cat_true']) and count($_POST['cat_true']) > 0) 
25{
26        foreach ($_POST['cat_true'] as $cat)
27                unset($me->my_config['piclens_wall_categories'][array_search($cat,$me->my_config['piclens_wall_categories'])]);
28
29        $me->save_config();
30
31}
32// Switch  on left side ( <=)
33if ( isset($_POST['trueify']) and !is_adviser() 
34    and $_POST['from']=='wallcat'
35    and isset($_POST['cat_false']) and count($_POST['cat_false']) > 0) 
36{
37
38        $query = '
39          SELECT id, name, uppercats, global_rank
40          FROM '.CATEGORIES_TABLE.
41          ' WHERE id IN ("'.implode('","', $_POST['cat_false']).'");';
42
43        $result = pwg_query($query);
44        $categories = array();
45        if (!empty($result))
46        {
47                while ($row = mysql_fetch_assoc($result))
48                        array_push($categories, $row);                 
49        }
50        usort($categories, 'global_rank_compare');
51
52        if (!empty($result))
53        {
54                foreach ($categories as $cat)
55                {
56                        array_push($me->my_config['piclens_wall_categories'], $cat['id']);
57                }
58        }
59
60        $me->save_config();
61}
62                       
63
64if (isset($_POST['submit'])) { 
65  $me->my_config['piclens_wall'] = isset($_POST['piclens_wall']);
66  $me->my_config['piclens_wall_title'] = $_POST['piclens_wall_title'];
67  $me->my_config['piclens_wall_height'] =   $_POST['piclens_wall_height'];
68
69  $me->my_config['piclens_wall_nav'] = isset($_POST['piclens_wall_nav']);
70  $me->my_config['piclens_wall_cat_nav_replace'] = isset($_POST['categories_nav']) ? 
71                          array_map("mysql_escape_string", $_POST['categories_nav']) :
72                          array(); 
73  $me->my_config['piclens_wall_specif'] =   $_POST['piclens_wall_specif'];
74  $me->my_config['piclens_wall_ontop'] = isset($_POST['piclens_wall_ontop']); 
75  $me->my_config['piclens_wall_oncat'] = isset($_POST['piclens_wall_oncat']); 
76
77  $me->my_config['piclens_wall_spec'] = isset($_POST['piclens_wall_spec']);
78  $me->my_config['piclens_wall_spec_recentpics'] = isset($_POST['piclens_wall_spec_recentpics']);
79  $me->my_config['piclens_wall_spec_recentcats'] = isset($_POST['piclens_wall_spec_recentcats']);
80  $me->my_config['piclens_wall_spec_mostvisited'] = isset($_POST['piclens_wall_spec_mostvisited']);
81  $me->my_config['piclens_wall_spec_bestrated'] = isset($_POST['piclens_wall_spec_bestrated']);
82  $me->my_config['piclens_wall_spec_favorites'] = isset($_POST['piclens_wall_spec_favorites']);
83  $me->my_config['piclens_wall_spec_tags'] = isset($_POST['piclens_wall_spec_tags']);
84
85  $me->my_config['piclens_wall_swflocal'] = isset($_POST['piclens_wall_swflocal']);
86 
87  if ($pwgstuff_ok && $me->my_config['piclens_wall'])
88  {
89        array_push($page['errors'], l10n('piclens_admin_saveERR4'));
90        $me->my_config['piclens_wall'] = false;
91  }
92
93  $me->save_config();
94  array_push($page['infos'], l10n('piclens_admin_saveOK'));
95       
96}
97
98
99// Copie fichier crossdomain a la racine
100$filename = $_SERVER['DOCUMENT_ROOT'].'/crossdomain.xml';
101// copie du fichier crossdomain.xml
102if (isset($_POST['crossdomain_copy']))
103{
104        include_once(PICLENS_ADMIN_PATH . '/piclens_copy.php');
105}
106
107$query = '
108  SELECT id,name,uppercats,global_rank
109  FROM '.CATEGORIES_TABLE.';';
110
111  display_select_cat_wrapper($query,
112    $me->my_config['piclens_wall_cat_nav_replace'],
113    'categories_nav',
114    true);
115       
116       
117// Test double select wall categories
118// Categories non prises en compte
119$query = '
120  SELECT id, name, uppercats, global_rank
121  FROM '.CATEGORIES_TABLE.
122  ' WHERE id not IN ("'.implode('","', $me->my_config['piclens_wall_categories']).'");';
123
124  $result = pwg_query($query);
125  $categories = array();
126if (!empty($result))
127{
128        while ($row = mysql_fetch_assoc($result))
129                array_push($categories, $row);
130}
131usort($categories, 'global_rank_compare');
132
133$tpl = array();
134if (!empty($result))
135{
136                foreach ($categories as $cat)
137        {
138                $tpl[$cat['id']] = get_cat_display_name_cache($cat['uppercats'],
139                                           null,
140                                           false);
141       
142        }
143}
144$template->assign( 'category_option_false', $tpl);
145$template->assign( 'category_option_false_selected', array());
146
147
148
149
150// Categories prises en compte
151
152$query = '
153  SELECT id, name, uppercats, global_rank
154  FROM '.CATEGORIES_TABLE.
155  ' WHERE id IN ("'.implode('","', $me->my_config['piclens_wall_categories']).'");';
156
157$result = pwg_query($query);
158  $categories = array();
159if (!empty($result))
160{
161        while ($row = mysql_fetch_assoc($result))
162                array_push($categories, $row);
163}
164usort($categories, 'global_rank_compare');
165$tpl2 = array();
166if (!empty($result))
167{
168                foreach ($categories as $cat)
169        {
170                $tpl2[$cat['id']] = get_cat_display_name_cache($cat['uppercats'],
171                                           null,
172                                           false);
173       
174        }
175}
176$template->assign( 'category_option_true', $tpl2);
177$template->assign( 'category_option_true_selected', array());
178
179
180$template->assign(Array(
181        'F_ACTION' => '',
182        'L_CAT_OPTIONS_TRUE' => l10n('SelectedCat'),
183        'L_CAT_OPTIONS_FALSE' => l10n('NonSelectedCat'),
184));
185
186
187$template->assign(array(
188        'PICLENS_COPY_CROSSDOMAIN'                                                      => file_exists($filename),
189        'PICLENS_PWGSTUFF'                                                                      => ($pwgstuff_ok ? 'disabled="disabled"' : ''),
190        'PICLENS_PWGSTUFF1'                                                                     => ($pwgstuff_ok ? l10n('piclens_label_pwgstuff1'): l10n('piclens_label_pwgstuff2')),
191        'PICLENS_WALL_ACTIVATED'                                                        => ($me->my_config['piclens_wall'] ? 'checked="checked"' : '' ),
192        $me->my_config['piclens_wall_specif'].'_CHECKED'        => 'checked="checked"',
193        'PICLENS_WALL_HEIGHT'                                                           => $me->my_config['piclens_wall_height'],
194        'CROSSDOMAIN_LNK'                                                                       => PICLENS_PATH.'crossdomain.xml',
195        'PICLENS_WALL_ONTOP'                                                            => ($me->my_config['piclens_wall_ontop'] ? 'checked="checked"' : '' ),
196        'PICLENS_WALL_ONCAT'                                                            => ($me->my_config['piclens_wall_oncat'] ? 'checked="checked"' : '' ),
197        'PICLENS_WALL_NAV'                                                                      => ($me->my_config['piclens_wall_nav'] ? 'checked="checked"' : '' ),
198        'PICLENS_WALL_TITLE'                                                            => $me->my_config['piclens_wall_title'],
199        'PICLENS_WALL_SPEC'                                                                     => ($me->my_config['piclens_wall_spec'] ? 'checked="checked"' : '' ),
200        'PICLENS_WALL_SPEC'                                                                     => ($me->my_config['piclens_wall_spec'] ? 'checked="checked"' : '' ),
201        'PICLENS_WALL_SPEC_RECENTPICS'                                          => ($me->my_config['piclens_wall_spec_recentpics'] ? 'checked="checked"' : '' ),
202        'PICLENS_WALL_SPEC_RECENTCATS'                                          => ($me->my_config['piclens_wall_spec_recentcats'] ? 'checked="checked"' : '' ),
203        'PICLENS_WALL_SPEC_MOSTVISITED'                                         => ($me->my_config['piclens_wall_spec_mostvisited'] ? 'checked="checked"' : '' ),
204        'PICLENS_WALL_SPEC_BESTRATED'                                           => ($me->my_config['piclens_wall_spec_bestrated'] ? 'checked="checked"' : '' ),
205        'PICLENS_WALL_SPEC_FAVORITES'                                           => ($me->my_config['piclens_wall_spec_favorites'] ? 'checked="checked"' : '' ),
206        'PICLENS_WALL_SPEC_TAGS'                                                        => ($me->my_config['piclens_wall_spec_tags'] ? 'checked="checked"' : '' ),
207        'PICLENS_WALL_SWFLOCAL'                                                         => ($me->my_config['piclens_wall_swflocal'] ? 'checked="checked"' : '' )
208        ));
209
210$template->assign_var_from_handle('DOUBLE_SELECT', 'double_select');
211$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
212
213?>
Note: See TracBrowser for help on using the repository browser.