1 | <?php |
---|
2 | /* |
---|
3 | * Plugin Name: CoolIris-Piclens |
---|
4 | * Version: 0.3.4 |
---|
5 | * Description: Cooliris/Piclens activation |
---|
6 | * Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=234 |
---|
7 | * Author: Tiico |
---|
8 | * Author URI: |
---|
9 | * */ |
---|
10 | /********* Fichier generate_rss.php *********/ |
---|
11 | |
---|
12 | $debug = false; |
---|
13 | |
---|
14 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
15 | |
---|
16 | include (PICLENS_INC_PATH.'config_extendeddesc.inc.php'); // Parametres pour extended description. |
---|
17 | |
---|
18 | // recuperation du parametre pour le mode no recursif (forçage de la non recursivite) |
---|
19 | if (isset($_GET['norecurs'])) |
---|
20 | { |
---|
21 | $obj->my_config['piclens_recursive'] = false; |
---|
22 | } |
---|
23 | |
---|
24 | |
---|
25 | // extensions video |
---|
26 | $py_addext = array("gvideo", "dm", "ytube", "wideo", "vimeo", "flv"); |
---|
27 | $video_ext_piclens = array("flv"); |
---|
28 | |
---|
29 | // Vérification présence et activation plugin SecureImages ET si actif, vérification d'activation de compatibilité |
---|
30 | $plugins_SecureImage_only = (get_db_plugins('active','secureImages') ? true : false ); |
---|
31 | $plugins_SecureImage = ($plugins_SecureImage_only && ($obj->my_config['piclens_secureimage']) ? true : false ); |
---|
32 | // Verification presence et activation plugin ExtendedDescription |
---|
33 | $plugins_ExtendedDesc = (get_db_plugins('active','ExtendedDescription') && ($obj->my_config['piclens_extendeddesc']) ? true : false ); |
---|
34 | |
---|
35 | |
---|
36 | // Vérification d'activation du plugin (page administration) OU activation de piclensWall |
---|
37 | if ($obj->my_config['piclens_active'] OR $obj->my_config['piclens_wall'] OR (!$obj->my_config['piclens_wall'] AND get_db_plugins('active','PWG_Stuffs'))) |
---|
38 | { |
---|
39 | //-------------------------------------------------------------- initialization |
---|
40 | |
---|
41 | // Mode des miniatures et des images normales dans piclens (avec et sans plugin secureimage) |
---|
42 | $thumb_secure = array('', '&thumb=1', ''); // correspondant a 1-->'miniature' et 2-->'normal' |
---|
43 | $normal_secure = array('', '&thumb=1', '', '&highdef=1'); // correspondant a 1-->'miniature' et 2-->'normal' et 3 --> High |
---|
44 | $order_list = array('', $conf['order_by_inside_category'], 'ORDER BY date_creation', 'ORDER BY date_available', 'ORDER BY average_rate', 'ORDER BY hit', 'ORDER BY file', 'ORDER BY id', 'ORDER BY RAND()', 'ORDER BY category_id'); |
---|
45 | $order_sort = array('', '', ' ASC', ' DESC'); |
---|
46 | |
---|
47 | // Extensions a prendre en compte |
---|
48 | $tn_ext_is_null = false; |
---|
49 | $type_ext = $obj->my_config['included_file_types']; |
---|
50 | foreach($type_ext as $i => $value) |
---|
51 | { |
---|
52 | if ($value == '!NULL!') $tn_ext_is_null = true; |
---|
53 | $type_ext[$i] = '"'.($value == '!NULL!' ? 'NULL' : $value).'"'; |
---|
54 | } |
---|
55 | |
---|
56 | // Categories a prendre en compte pour le mur |
---|
57 | $piclenswall_cat = (isset($obj->my_config['piclens_wall_categories']) ? $obj->my_config['piclens_wall_categories'] : array()); |
---|
58 | |
---|
59 | // Seulement sur une page type 'categorie' |
---|
60 | if (isset($page['section'])) |
---|
61 | { |
---|
62 | $cat = array(); |
---|
63 | $pictures = array(); |
---|
64 | |
---|
65 | $forbidden = get_sql_condition_FandF( |
---|
66 | array |
---|
67 | ( |
---|
68 | 'forbidden_categories' => 'category_id', |
---|
69 | 'visible_categories' => 'category_id', |
---|
70 | 'visible_images' => 'id' |
---|
71 | ), |
---|
72 | 'AND' |
---|
73 | ); |
---|
74 | |
---|
75 | // Images recentes |
---|
76 | if (($page['section']) == 'recent_pics') |
---|
77 | { |
---|
78 | if ( !isset($page['super_order_by']) ) |
---|
79 | { |
---|
80 | $conf['order_by'] = str_replace( |
---|
81 | 'ORDER BY ', |
---|
82 | 'ORDER BY date_available DESC,', |
---|
83 | $conf['order_by'] |
---|
84 | ); |
---|
85 | } |
---|
86 | // $cat need to bo not null... |
---|
87 | array_push($cat, "1"); |
---|
88 | |
---|
89 | $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, |
---|
90 | img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, |
---|
91 | img.level ' |
---|
92 | .' FROM ' . IMAGES_TABLE.' AS img' |
---|
93 | .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' |
---|
94 | .' WHERE |
---|
95 | img.date_available >= SUBDATE( |
---|
96 | CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY) ' |
---|
97 | .$forbidden |
---|
98 | .' '.$conf['order_by'].';'; |
---|
99 | } |
---|
100 | // Plus vues |
---|
101 | elseif ($page['section'] == 'recent_cats') |
---|
102 | { |
---|
103 | // $cat need to bo not null... |
---|
104 | array_push($cat, "1"); |
---|
105 | |
---|
106 | $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, |
---|
107 | img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, |
---|
108 | img.level, ic.category_id, cat.name AS catname, cat.comment AS catcomment, cat.rank, cat.status, |
---|
109 | cat.visible, cat.uppercats, cat.permalink, cat.dir ' |
---|
110 | .' FROM ' . IMAGES_TABLE.' AS img' |
---|
111 | .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' |
---|
112 | .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' |
---|
113 | .' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON cat.id = cat_id and user_id = '.$user['id'] |
---|
114 | .' WHERE date_last >= SUBDATE( |
---|
115 | CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY |
---|
116 | ) |
---|
117 | '.get_sql_condition_FandF |
---|
118 | ( |
---|
119 | array('visible_categories' => 'id',), |
---|
120 | 'AND' |
---|
121 | ).' |
---|
122 | ;'; |
---|
123 | } |
---|
124 | |
---|
125 | // Plus vues |
---|
126 | elseif ($page['section'] == 'most_visited') |
---|
127 | { |
---|
128 | // $cat need to bo not null... |
---|
129 | array_push($cat, "1"); |
---|
130 | $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, |
---|
131 | img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, |
---|
132 | img.level, ic.category_id, cat.name AS catname, cat.comment AS catcomment, cat.rank, cat.status, |
---|
133 | cat.visible, cat.uppercats, cat.permalink, cat.dir ' |
---|
134 | .' FROM ' . IMAGES_TABLE.' AS img' |
---|
135 | .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' |
---|
136 | .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' |
---|
137 | .' WHERE img.hit > 0 ' |
---|
138 | .$forbidden |
---|
139 | .' ORDER BY hit DESC, file ASC' |
---|
140 | .' LIMIT 0, '.$conf['top_number'].';'; |
---|
141 | |
---|
142 | } |
---|
143 | // mieux notees |
---|
144 | elseif ($page['section'] == 'best_rated') |
---|
145 | { |
---|
146 | // $cat need to bo not null... |
---|
147 | array_push($cat, "1"); |
---|
148 | |
---|
149 | $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, |
---|
150 | img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, |
---|
151 | img.level ' |
---|
152 | .' FROM ' . IMAGES_TABLE.' AS img' |
---|
153 | .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' |
---|
154 | .' WHERE img.average_rate IS NOT NULL ' |
---|
155 | .$forbidden |
---|
156 | .' ORDER BY average_rate DESC, id ASC' |
---|
157 | .' LIMIT 0, '.$conf['top_number'].';'; |
---|
158 | } |
---|
159 | elseif ($page['section'] == 'favorites') |
---|
160 | { |
---|
161 | check_user_favorites(); |
---|
162 | // $cat need to bo not null... |
---|
163 | array_push($cat, "1"); |
---|
164 | |
---|
165 | $query = 'SELECT img.id, img.file, img.date_available, img.date_creation, img.tn_ext, img.name, |
---|
166 | img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, |
---|
167 | img.level, ' |
---|
168 | .' FROM '.FAVORITES_TABLE.' AS fav ' |
---|
169 | .' INNER JOIN '.IMAGES_TABLE.' AS img ON fav.image_id = img.id' |
---|
170 | .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' |
---|
171 | .' WHERE user_id = '.$user['id'] |
---|
172 | .' '.get_sql_condition_FandF |
---|
173 | ( |
---|
174 | array('visible_images' => 'id'), |
---|
175 | 'AND' |
---|
176 | ) |
---|
177 | .' '.$conf['order_by'].';'; |
---|
178 | } |
---|
179 | |
---|
180 | // Gestion des tags |
---|
181 | elseif (($page['section']) == 'tags') |
---|
182 | { |
---|
183 | // $row = get_image_ids_for_tags($page['tags_id']); |
---|
184 | // $cat need to bo not null... |
---|
185 | array_push($cat, "1"); |
---|
186 | $query = 'SELECT DISTINCT(tag.image_id) , img.id, img.file, img.date_available, img.date_creation, img.tn_ext, img.name, |
---|
187 | img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, |
---|
188 | img.level , ic.category_id, cat.name AS catname, cat.comment AS catcomment, cat.rank, cat.status, |
---|
189 | cat.visible, cat.uppercats, cat.permalink, cat.dir ' |
---|
190 | .' FROM '.IMAGE_TAG_TABLE.' AS tag '."\n" |
---|
191 | .' INNER JOIN '.IMAGES_TABLE.' AS img ON tag.image_id = img.id' |
---|
192 | .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' |
---|
193 | .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' |
---|
194 | .' WHERE tag.tag_id IN ('.implode(',', $page['tag_ids']).') ' |
---|
195 | .$forbidden |
---|
196 | .' '.$conf['order_by'].';'; |
---|
197 | } |
---|
198 | |
---|
199 | |
---|
200 | elseif (($page['section']) == 'categories') |
---|
201 | { |
---|
202 | // Accueil |
---|
203 | if(empty($page['category'])) |
---|
204 | { |
---|
205 | // Page accueil |
---|
206 | // Vérification d'activation du plugin (page administration) |
---|
207 | // ou flux pour piclenswall et configuration specifique |
---|
208 | if ($obj->my_config['piclens_gallerie_active'] || $piclenswallfeed) |
---|
209 | { |
---|
210 | // Categories de premier niveau |
---|
211 | $query = 'SELECT id,name,permalink FROM ' . CATEGORIES_TABLE |
---|
212 | .' WHERE id_uppercat is NULL'; |
---|
213 | |
---|
214 | $result = pwg_query($query); |
---|
215 | |
---|
216 | while ($row = mysql_fetch_assoc($result)) |
---|
217 | { |
---|
218 | if (!(in_array($row['id'], explode(',', $user['forbidden_categories'])))) |
---|
219 | { |
---|
220 | array_push($cat, $row['id']); |
---|
221 | |
---|
222 | } |
---|
223 | } |
---|
224 | // Type = avec recursiite |
---|
225 | // Si parametrage specifique pour le mur 3D, recursivite sur les categories |
---|
226 | if (($piclenswallfeed) || (( $obj->my_config['piclens_gallerie_type'])-1)) |
---|
227 | { |
---|
228 | // recuperation des sous-categories (tous niveaux) de la categorie en cours. |
---|
229 | $subcat= get_subcat_ids($cat); |
---|
230 | |
---|
231 | // Verification droits des sous-categories |
---|
232 | foreach($subcat as $sscat) |
---|
233 | { |
---|
234 | if (!(in_array($sscat, explode(',', $user['forbidden_categories'])))) |
---|
235 | array_push($cat, $sscat); |
---|
236 | } |
---|
237 | } |
---|
238 | |
---|
239 | // selection uniquement des categories a afficher (si flux pour le mur ET parametre mur = specifique) |
---|
240 | if ($piclenswallfeed) |
---|
241 | { |
---|
242 | foreach($cat as $i => $wcat) |
---|
243 | { |
---|
244 | if (!in_array($wcat, $piclenswall_cat)) |
---|
245 | unset($cat[$i]); |
---|
246 | } |
---|
247 | } |
---|
248 | |
---|
249 | $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, |
---|
250 | img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, |
---|
251 | img.level, ic.category_id, cat.name AS catname, cat.comment AS catcomment, cat.rank, cat.status, |
---|
252 | cat.visible, cat.uppercats, cat.permalink, cat.dir ' |
---|
253 | .' FROM ' . IMAGES_TABLE.' AS img' |
---|
254 | .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' |
---|
255 | .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' |
---|
256 | .' WHERE ic.category_id IN ('.implode(',', $cat).')' |
---|
257 | .(sizeof($obj->my_config['included_file_types']) ? ' AND (img.tn_ext IN ('.implode(',', $type_ext).')' : '') |
---|
258 | .($tn_ext_is_null ? ' OR img.tn_ext IS NULL)' : (sizeof($obj->my_config['included_file_types']) ? ')' : '')) |
---|
259 | // Verif droits (niveaux) de l'utilisateur sur les images |
---|
260 | .' AND img.level <='.$user['level'].' ' |
---|
261 | // Choix du critere de tri d'affichage |
---|
262 | .$order_list[ $obj->my_config['piclens_order'] ] |
---|
263 | .$order_sort[ $obj->my_config['piclens_sort'] ]; |
---|
264 | |
---|
265 | |
---|
266 | } |
---|
267 | } |
---|
268 | |
---|
269 | // Page category |
---|
270 | elseif (isset($page['category'])) |
---|
271 | { |
---|
272 | check_restrictions($page['category']['id']); |
---|
273 | |
---|
274 | // Flux pour le mur 3D et mur en mode "specifique" |
---|
275 | if ($piclenswallfeed) |
---|
276 | { |
---|
277 | $selectionID = $page['category']['id']; |
---|
278 | // categorie parametre pour etre affichee dans le mur |
---|
279 | if (in_array($selectionID, $piclenswall_cat)) |
---|
280 | array_push($cat, $selectionID); |
---|
281 | |
---|
282 | // recuperation des sous-categories (tous niveaux) de la categorie en cours. |
---|
283 | $subcat= get_subcat_ids(array($selectionID)); |
---|
284 | |
---|
285 | // Verification ajout des sous-categories qui peuvent être affichees (parametrees dans mur 3D) et des drois des sous categories |
---|
286 | foreach($subcat as $sscat) |
---|
287 | { |
---|
288 | if ((in_array($sscat, $piclenswall_cat)) && (!(in_array($sscat, explode(',', $user['forbidden_categories']))))) |
---|
289 | array_push($cat, $sscat); |
---|
290 | } |
---|
291 | |
---|
292 | } |
---|
293 | // Piclens (et mur 3D avec meme parametrage que piclens) : paramétrage "commun" |
---|
294 | else |
---|
295 | { |
---|
296 | // recherche de toutes les photos de la categorie (incluant les photos des sous-categories si necessaire) |
---|
297 | $selectionID = $page['category']['id']; |
---|
298 | |
---|
299 | array_push($cat, $selectionID); |
---|
300 | |
---|
301 | // Si recursivite activee |
---|
302 | if ($obj->my_config['piclens_recursive']) |
---|
303 | { |
---|
304 | // recuperation des sous-categories (tous niveaux) de la categorie en cours. |
---|
305 | $subcat= get_subcat_ids(array($selectionID)); |
---|
306 | |
---|
307 | // Verification droits des sous-categories |
---|
308 | foreach($subcat as $sscat) |
---|
309 | { |
---|
310 | if (!(in_array($sscat, explode(',', $user['forbidden_categories'])))) |
---|
311 | array_push($cat, $sscat); |
---|
312 | } |
---|
313 | |
---|
314 | } |
---|
315 | } |
---|
316 | |
---|
317 | $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, |
---|
318 | img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, |
---|
319 | img.level, ic.category_id, cat.name AS catname, cat.comment AS catcomment, cat.rank, cat.status, |
---|
320 | cat.visible, cat.uppercats, cat.permalink, cat.dir ' |
---|
321 | .' FROM ' . IMAGES_TABLE.' AS img' |
---|
322 | .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' |
---|
323 | .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' |
---|
324 | .' WHERE ic.category_id IN ('.implode(',', $cat).')' |
---|
325 | .(sizeof($obj->my_config['included_file_types']) ? ' AND (img.tn_ext IN ('.implode(',', $type_ext).')' : '') |
---|
326 | .($tn_ext_is_null ? ' OR img.tn_ext IS NULL)' : (sizeof($obj->my_config['included_file_types']) ? ')' : '')) |
---|
327 | // Verif droits (niveaux) de l'utilisateur sur les images |
---|
328 | .' AND img.level <='.$user['level'].' ' |
---|
329 | // Choix du critere de tri d'affichage |
---|
330 | .$order_list[ $obj->my_config['piclens_order_cat'] ] |
---|
331 | .$order_sort[ $obj->my_config['piclens_sort_cat'] ]; |
---|
332 | |
---|
333 | } |
---|
334 | } |
---|
335 | |
---|
336 | if ($debug) echo $query; |
---|
337 | |
---|
338 | // Si au moins une image récupérée (une catégorie ou une image présente) |
---|
339 | if (count($cat)!=0) |
---|
340 | { |
---|
341 | $result = pwg_query($query); |
---|
342 | |
---|
343 | while ($row = mysql_fetch_assoc($result)) |
---|
344 | { |
---|
345 | // Plugin Extended Description present et active |
---|
346 | // suppression des categories et images pour lesquelles un <!--hidden--> est present |
---|
347 | if (!$plugins_ExtendedDesc |
---|
348 | OR ($plugins_ExtendedDesc |
---|
349 | && !(substr_count($row['name'], $piclens_extdesc_hidden)) |
---|
350 | && ((isset($row['catname']) ? !(substr_count($row['catname'], $piclens_extdesc_hidden)) : true)) |
---|
351 | )) |
---|
352 | { |
---|
353 | // Suppression des doublons (même path) |
---|
354 | if ($obj->my_config['piclens_exclude_double']) |
---|
355 | { |
---|
356 | $double = false; |
---|
357 | foreach ($pictures as $key => $values) |
---|
358 | // même path |
---|
359 | if ($row['path'] == $values['path']) |
---|
360 | $double=true; |
---|
361 | |
---|
362 | // pas de double trouvé |
---|
363 | if (!$double) |
---|
364 | array_push($pictures, $row); |
---|
365 | } |
---|
366 | else |
---|
367 | array_push($pictures, $row); |
---|
368 | } |
---|
369 | } |
---|
370 | } |
---|
371 | // Fin requetes recherches photos |
---|
372 | |
---|
373 | |
---|
374 | // Creation du fichier xml (flux rss) |
---|
375 | // It's a rss file |
---|
376 | header("Content-Type: application/xml; charset=UTF-8"); |
---|
377 | echo '<?xml version="1.0" encoding="utf-8" standalone="yes"?>'; |
---|
378 | echo "\n"; |
---|
379 | echo '<rss version="2.0" '."\n" |
---|
380 | .'xmlns:media="http://search.yahoo.com/mrss/" '."\n" |
---|
381 | .'xmlns:atom="http://www.w3.org/2005/Atom">'; |
---|
382 | echo "\n"; |
---|
383 | echo '<channel>'; |
---|
384 | echo "\n"; |
---|
385 | |
---|
386 | // <!-- <title>test Page</title> --> |
---|
387 | echo '<link>'.$obj->root_site_piclens.'</link>'; |
---|
388 | echo "\n"; |
---|
389 | echo '<description>Flux RSS pour cooliris</description>'; |
---|
390 | echo "\n"; |
---|
391 | echo '<language>fr</language>'; |
---|
392 | echo "\n"; |
---|
393 | |
---|
394 | // Version du plugin Piclens |
---|
395 | $db_plugins = get_db_plugins('', 'piclens'); |
---|
396 | if (!empty($db_plugins)) |
---|
397 | $piclens_version = $db_plugins[0]['version']; |
---|
398 | else |
---|
399 | $piclens_version = 'N/A'; |
---|
400 | |
---|
401 | echo '<generator>Piwigo Cooliris Plugin v.'.$piclens_version.'</generator>'; |
---|
402 | echo "\n"; |
---|
403 | |
---|
404 | // Icone de la gallerie dans le flux RSS |
---|
405 | echo "\n"; |
---|
406 | echo '<atom:icon>'.$obj->root_site_piclens.'template-common/favicon.ico</atom:icon>'; |
---|
407 | echo "\n"; |
---|
408 | |
---|
409 | // Pour chacune des images, preparation du flux xml |
---|
410 | foreach ($pictures as $row) |
---|
411 | { |
---|
412 | // Mode de l'image parametre |
---|
413 | $piclens_normal = $obj->my_config['piclens_normal']; |
---|
414 | |
---|
415 | // si parametrage high et high absente ou utilisateur non habilite, affichage version normale |
---|
416 | if (($piclens_normal == 3) && (!($row['has_high']) || !$user['enabled_high'])) |
---|
417 | $piclens_normal = 2; // Normal uniquement pour l'image en cours |
---|
418 | |
---|
419 | // Get thumbnail url |
---|
420 | if ($plugins_SecureImage) // SecureImage installe et actif |
---|
421 | { |
---|
422 | $link_url = $obj->root_site_piclens.'plugins/secureImages/getFile.php?image_id='.$row['id']; |
---|
423 | |
---|
424 | $thumbnail_url = $obj->root_site_piclens.'plugins/secureImages/getFile.php?image_id='.$row['id'] |
---|
425 | .$thumb_secure[$obj->my_config['piclens_thumb'] ]; |
---|
426 | $content_url = $obj->root_site_piclens.'plugins/secureImages/getFile.php?image_id='.$row['id'] |
---|
427 | .$normal_secure[$piclens_normal ]; |
---|
428 | } |
---|
429 | else // SecureImage non installe ou non actif |
---|
430 | { |
---|
431 | $link_url = $obj->root_site_piclens.$row['path']; |
---|
432 | |
---|
433 | if ( ($obj->my_config['piclens_thumb']) == 2) // Normal |
---|
434 | $thumbnail_url = (url_is_remote($row['path']) ? $row['path']: embellish_url($obj->root_site_piclens.$row['path'])); |
---|
435 | else |
---|
436 | { |
---|
437 | if ($plugins_SecureImage_only) // Plugin secureimage active mais configuration compatibilite piclens-secureimage desactivee |
---|
438 | { |
---|
439 | $path=get_thumbnail_location($row); |
---|
440 | $thumbnail_url = ( url_is_remote($path) ? $path : embellish_url($obj->root_site_piclens.$path) ); |
---|
441 | } |
---|
442 | else // Plugin secureimage desactive |
---|
443 | { |
---|
444 | $thumbnail_url = embellish_url($obj->root_site_piclens.get_thumbnail_location($row)); |
---|
445 | } |
---|
446 | } |
---|
447 | |
---|
448 | switch ($piclens_normal) |
---|
449 | { |
---|
450 | case 1 : // miniature |
---|
451 | if ($plugins_SecureImage_only) // Plugin secureimage active mais configuration compatibilite piclens-secureimage desactivee |
---|
452 | { |
---|
453 | $path=get_thumbnail_location($row); |
---|
454 | $content_url = ( url_is_remote($path) ? $path : embellish_url($obj->root_site_piclens.$path) ); |
---|
455 | } |
---|
456 | else // Plugin secureimage desactive |
---|
457 | { |
---|
458 | $content_url = embellish_url($obj->root_site_piclens.get_thumbnail_location($row));; |
---|
459 | } |
---|
460 | break; |
---|
461 | case 2 : // normal |
---|
462 | $content_url = (url_is_remote($row['path']) ? $row['path']: embellish_url($obj->root_site_piclens.$row['path'])); |
---|
463 | break; |
---|
464 | case 3 : |
---|
465 | $content_url = (url_is_remote($row['path']) ? dirname($row['path']).'/pwg_high/'.basename($row['path']) |
---|
466 | : embellish_url( $obj->root_site_piclens. dirname($row['path']).'/pwg_high/'.basename($row['path'])) |
---|
467 | ); |
---|
468 | break; |
---|
469 | default : // normal |
---|
470 | $content_url = (url_is_remote($row['path']) ? $row['path'] : embellish_url($obj->root_site_piclens.$row['path'])); |
---|
471 | break; |
---|
472 | } |
---|
473 | } |
---|
474 | |
---|
475 | // link on picture.php page |
---|
476 | set_make_full_url(); |
---|
477 | if ( isset($row['category_id']) & isset($row['catname']) ) |
---|
478 | { |
---|
479 | $url = duplicate_picture_url( |
---|
480 | array( |
---|
481 | 'image_id' => $row['id'], |
---|
482 | 'image_file' => $row['file'], |
---|
483 | 'category' => array( |
---|
484 | 'id' => $row['category_id'], |
---|
485 | 'name' => $row['catname'], |
---|
486 | 'permalink' => '' |
---|
487 | ) |
---|
488 | ), |
---|
489 | array('start') |
---|
490 | ); |
---|
491 | } |
---|
492 | else |
---|
493 | { |
---|
494 | $url = duplicate_picture_url( |
---|
495 | array( |
---|
496 | 'image_id' => $row['id'], |
---|
497 | 'image_file' => $row['file'] |
---|
498 | ), |
---|
499 | array('start') |
---|
500 | ); |
---|
501 | } |
---|
502 | unset_make_full_url(); |
---|
503 | |
---|
504 | // HTTPS Patch : If needed NO_https can easily be set in your config_local thru LocalFiles Editor |
---|
505 | if (isset($conf['NO_https']) and $conf['NO_https'] and strncasecmp($url, 'https://', 8) == 0 ) |
---|
506 | $url = 'http://' . substr($url, 8); |
---|
507 | |
---|
508 | // Show rss item for a picture |
---|
509 | echo "<item>\n"; |
---|
510 | |
---|
511 | |
---|
512 | |
---|
513 | echo "<title><![CDATA[" |
---|
514 | .parse($obj->my_config['piclens_rss_name'], $row, $plugins_ExtendedDesc) |
---|
515 | ."]]></title>\n"; |
---|
516 | |
---|
517 | |
---|
518 | echo '<media:description type="html"><![CDATA[' |
---|
519 | .parse($obj->my_config['piclens_rss_desc'], $row, $plugins_ExtendedDesc) |
---|
520 | .']]> </media:description>'; |
---|
521 | |
---|
522 | /* |
---|
523 | // Extended description for the comment and category name |
---|
524 | if ($plugins_ExtendedDesc) // Extended description compatibility |
---|
525 | { |
---|
526 | if (isset($row['catname'])) |
---|
527 | $row['catname'] = trigger_event('render_element_description',$row['catname']); |
---|
528 | if (isset($row['comment'])) |
---|
529 | $row['comment'] = trigger_event('render_element_description',$row['comment']); |
---|
530 | } |
---|
531 | |
---|
532 | |
---|
533 | // Titre de l'image dans Piclens |
---|
534 | switch($obj->my_config['piclens_name_image']) |
---|
535 | { |
---|
536 | case 2 : |
---|
537 | // format nom fichier |
---|
538 | echo "<title><![CDATA[" |
---|
539 | .(($obj->my_config['piclens_cat_view'] && isset ($row['catname'])) ? $row['catname']." - " : "") |
---|
540 | . $row['file'] . "]]></title>\n"; |
---|
541 | break; |
---|
542 | case 3 : |
---|
543 | // format nom de la photo |
---|
544 | if (isset($row['name'])) |
---|
545 | echo "<title><![CDATA[" |
---|
546 | .(($obj->my_config['piclens_cat_view'] && isset ($row['catname'])) ? $row['catname']." - " : "") |
---|
547 | .$row['name']."]]></title>\n"; |
---|
548 | else |
---|
549 | echo "<title><![CDATA[" |
---|
550 | .(($obj->my_config['piclens_cat_view'] && isset ($row['catname'])) ? $row['catname']." - " : "") |
---|
551 | . $row['file'] . "]]></title>\n"; |
---|
552 | break; |
---|
553 | default : |
---|
554 | // format nom fichier : taille |
---|
555 | echo "<title><![CDATA[" |
---|
556 | .(($obj->my_config['piclens_cat_view'] && isset ($row['catname'])) ? $row['catname']." - " : "") |
---|
557 | . get_thumbnail_title($row) . "]]></title>\n"; |
---|
558 | break; |
---|
559 | } |
---|
560 | |
---|
561 | // Description (nom de vignette) present |
---|
562 | switch($obj->my_config['piclens_name_desc']) |
---|
563 | { |
---|
564 | case 2 : |
---|
565 | if (isset($row['name'])) |
---|
566 | echo '<media:description type="html"><![CDATA['.$row['name'].']]> </media:description>'; |
---|
567 | break; |
---|
568 | case 3 : |
---|
569 | if (isset($row['comment'])) |
---|
570 | echo '<media:description type="html"><![CDATA['.$row['comment'].']]> </media:description>'; |
---|
571 | break; |
---|
572 | default : |
---|
573 | break; |
---|
574 | } |
---|
575 | */ |
---|
576 | echo "\n"; |
---|
577 | |
---|
578 | // link |
---|
579 | echo "<link>" . $url . "</link>\n"; |
---|
580 | |
---|
581 | echo "<guid isPermaLink=\"false\">\"" . $row['id'] . "\"</guid>\n"; |
---|
582 | |
---|
583 | |
---|
584 | echo "<media:thumbnail url=\"" . $thumbnail_url . "\" />\n"; |
---|
585 | |
---|
586 | $extension = explode(".", $row['file']); |
---|
587 | $extension = $extension[sizeof($extension)-1]; |
---|
588 | |
---|
589 | // Fichiers video (Charlies content) |
---|
590 | if ((in_array($extension, $video_ext_piclens))) |
---|
591 | { |
---|
592 | if ($obj->my_config['piclens_video']) // activation des videos |
---|
593 | { |
---|
594 | switch ($extension) |
---|
595 | { |
---|
596 | case "flv": |
---|
597 | echo "<media:content type=\"video/x-flv\" url=\"".$content_url."\"/>\n"; |
---|
598 | break; |
---|
599 | } |
---|
600 | } |
---|
601 | else |
---|
602 | { |
---|
603 | echo "<media:content url=\"" . $thumbnail_url . "\" />\n"; |
---|
604 | } |
---|
605 | } |
---|
606 | // Fichiers video (PY Gvideo) |
---|
607 | elseif ((in_array($extension, $py_addext))) |
---|
608 | { |
---|
609 | if ($obj->my_config['piclens_video']) // activation des videos |
---|
610 | { |
---|
611 | // Si impossibilite de lire le fichier! |
---|
612 | if( false == ($idvideo = file_get_contents(PHPWG_ROOT_PATH.$row['path']))) |
---|
613 | { |
---|
614 | echo "<media:content url=\"" . $thumbnail_url . "\" />\n"; |
---|
615 | } |
---|
616 | else |
---|
617 | { |
---|
618 | $sp = explode("/", $idvideo); |
---|
619 | switch ($extension) |
---|
620 | { |
---|
621 | case "dm" : |
---|
622 | echo "<enclosure url=\"http://www.dailymotion.com/swf/".$sp[0]."\" type=\"application/x-shockwave-flash\" />\n"; |
---|
623 | break; |
---|
624 | case "ytube": |
---|
625 | echo "<enclosure url=\"http://youtube.com/v/".$sp[0].".swf\" type=\"application/x-shockwave-flash\" />\n"; |
---|
626 | break; |
---|
627 | case "wideo": |
---|
628 | echo "<enclosure url=\"http://www.kewego.com/swf/p3/epix.swf?language_code=fr&playerKey=0df9b773a15b&skinKey=7109c4112f57&sig=".$sp[0]."\" type=\"application/x-shockwave-flash\" />\n"; |
---|
629 | break; |
---|
630 | case "gvideo": |
---|
631 | echo "<enclosure url=\"http://video.google.com/googleplayer.swf?docid=".$sp[0]."\" type=\"application/x-shockwave-flash\" />\n"; |
---|
632 | break; |
---|
633 | case "vimeo": |
---|
634 | echo "<enclosure url=\"http://vimeo.com/moogaloop.swf?clip_id=".$sp[0]."\" type=\"application/x-shockwave-flash\" />\n"; |
---|
635 | break; |
---|
636 | } |
---|
637 | } |
---|
638 | } |
---|
639 | else |
---|
640 | { |
---|
641 | echo "<media:content url=\"" . $thumbnail_url . "\" />\n"; |
---|
642 | } |
---|
643 | } |
---|
644 | // Images (standard) |
---|
645 | else |
---|
646 | echo "<media:content url=\"" . $content_url . "\" />\n"; |
---|
647 | |
---|
648 | echo "</item>\n"; |
---|
649 | echo "\n"; |
---|
650 | } |
---|
651 | echo "</channel>\n"; |
---|
652 | echo "</rss>"; |
---|
653 | } |
---|
654 | |
---|
655 | } |
---|
656 | |
---|
657 | |
---|
658 | function parse($data, $row, $plugins_ExtendedDesc = false) |
---|
659 | { |
---|
660 | include (PICLENS_PATH.'include/config_param.inc.php'); |
---|
661 | |
---|
662 | $patterns = array(); |
---|
663 | $replacements = array(); |
---|
664 | foreach ($piclens_parse as $key => $value) |
---|
665 | { |
---|
666 | array_push($patterns, $key); |
---|
667 | array_push($replacements, $value); |
---|
668 | } |
---|
669 | |
---|
670 | return str_replace($patterns, $replacements, $data); |
---|
671 | } |
---|
672 | |
---|
673 | |
---|
674 | |
---|
675 | ?> |
---|