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 ' |
---|
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 ' |
---|
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 | elseif (($page['section']) == 'categories') |
---|
181 | { |
---|
182 | // Accueil |
---|
183 | if(empty($page['category'])) |
---|
184 | { |
---|
185 | // Page accueil |
---|
186 | // Vérification d'activation du plugin (page administration) |
---|
187 | // ou flux pour piclenswall et configuration specifique |
---|
188 | if ($obj->my_config['piclens_gallerie_active'] || $piclenswallfeed) |
---|
189 | { |
---|
190 | // Categories de premier niveau |
---|
191 | $query = 'SELECT id,name,permalink FROM ' . CATEGORIES_TABLE |
---|
192 | .' WHERE id_uppercat is NULL'; |
---|
193 | |
---|
194 | $result = pwg_query($query); |
---|
195 | |
---|
196 | while ($row = mysql_fetch_assoc($result)) |
---|
197 | { |
---|
198 | if (!(in_array($row['id'], explode(',', $user['forbidden_categories'])))) |
---|
199 | { |
---|
200 | array_push($cat, $row['id']); |
---|
201 | |
---|
202 | } |
---|
203 | } |
---|
204 | // Type = avec recursiite |
---|
205 | // Si parametrage specifique pour le mur 3D, recursivite sur les categories |
---|
206 | if (($piclenswallfeed) || (( $obj->my_config['piclens_gallerie_type'])-1)) |
---|
207 | { |
---|
208 | // recuperation des sous-categories (tous niveaux) de la categorie en cours. |
---|
209 | $subcat= get_subcat_ids($cat); |
---|
210 | |
---|
211 | // Verification droits des sous-categories |
---|
212 | foreach($subcat as $sscat) |
---|
213 | { |
---|
214 | if (!(in_array($sscat, explode(',', $user['forbidden_categories'])))) |
---|
215 | array_push($cat, $sscat); |
---|
216 | } |
---|
217 | } |
---|
218 | |
---|
219 | // selection uniquement des categories a afficher (si flux pour le mur ET parametre mur = specifique) |
---|
220 | if ($piclenswallfeed) |
---|
221 | { |
---|
222 | foreach($cat as $i => $wcat) |
---|
223 | { |
---|
224 | if (!in_array($wcat, $piclenswall_cat)) |
---|
225 | unset($cat[$i]); |
---|
226 | } |
---|
227 | } |
---|
228 | |
---|
229 | $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, |
---|
230 | img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, |
---|
231 | img.level, ic.category_id, cat.name AS catname, cat.comment AS catcomment, cat.rank, cat.status, |
---|
232 | cat.visible, cat.uppercats, cat.permalink ' |
---|
233 | .' FROM ' . IMAGES_TABLE.' AS img' |
---|
234 | .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' |
---|
235 | .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' |
---|
236 | .' WHERE ic.category_id IN ('.implode(',', $cat).')' |
---|
237 | .(sizeof($obj->my_config['included_file_types']) ? ' AND (img.tn_ext IN ('.implode(',', $type_ext).')' : '') |
---|
238 | .($tn_ext_is_null ? ' OR img.tn_ext IS NULL)' : (sizeof($obj->my_config['included_file_types']) ? ')' : '')) |
---|
239 | // Verif droits (niveaux) de l'utilisateur sur les images |
---|
240 | .' AND img.level <='.$user['level'].' ' |
---|
241 | // Choix du critere de tri d'affichage |
---|
242 | .$order_list[ $obj->my_config['piclens_order'] ] |
---|
243 | .$order_sort[ $obj->my_config['piclens_sort'] ]; |
---|
244 | |
---|
245 | |
---|
246 | } |
---|
247 | } |
---|
248 | |
---|
249 | // Page category |
---|
250 | elseif (isset($page['category'])) |
---|
251 | { |
---|
252 | check_restrictions($page['category']['id']); |
---|
253 | |
---|
254 | // Flux pour le mur 3D et mur en mode "specifique" |
---|
255 | if ($piclenswallfeed) |
---|
256 | { |
---|
257 | $selectionID = $page['category']['id']; |
---|
258 | // categorie parametre pour etre affichee dans le mur |
---|
259 | if (in_array($selectionID, $piclenswall_cat)) |
---|
260 | array_push($cat, $selectionID); |
---|
261 | |
---|
262 | // recuperation des sous-categories (tous niveaux) de la categorie en cours. |
---|
263 | $subcat= get_subcat_ids(array($selectionID)); |
---|
264 | |
---|
265 | // Verification ajout des sous-categories qui peuvent être affichees (parametrees dans mur 3D) et des drois des sous categories |
---|
266 | foreach($subcat as $sscat) |
---|
267 | { |
---|
268 | if ((in_array($sscat, $piclenswall_cat)) && (!(in_array($sscat, explode(',', $user['forbidden_categories']))))) |
---|
269 | array_push($cat, $sscat); |
---|
270 | } |
---|
271 | |
---|
272 | } |
---|
273 | // Piclens (et mur 3D avec meme parametrage que piclens) : paramétrage "commun" |
---|
274 | else |
---|
275 | { |
---|
276 | // recherche de toutes les photos de la categorie (incluant les photos des sous-categories si necessaire) |
---|
277 | $selectionID = $page['category']['id']; |
---|
278 | |
---|
279 | array_push($cat, $selectionID); |
---|
280 | |
---|
281 | // Si recursivite activee |
---|
282 | if ($obj->my_config['piclens_recursive']) |
---|
283 | { |
---|
284 | // recuperation des sous-categories (tous niveaux) de la categorie en cours. |
---|
285 | $subcat= get_subcat_ids(array($selectionID)); |
---|
286 | |
---|
287 | // Verification droits des sous-categories |
---|
288 | foreach($subcat as $sscat) |
---|
289 | { |
---|
290 | if (!(in_array($sscat, explode(',', $user['forbidden_categories'])))) |
---|
291 | array_push($cat, $sscat); |
---|
292 | } |
---|
293 | |
---|
294 | } |
---|
295 | } |
---|
296 | |
---|
297 | $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, |
---|
298 | img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, |
---|
299 | img.level, ic.category_id, cat.name AS catname, cat.comment AS catcomment, cat.rank, cat.status, |
---|
300 | cat.visible, cat.uppercats, cat.permalink ' |
---|
301 | .' FROM ' . IMAGES_TABLE.' AS img' |
---|
302 | .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' |
---|
303 | .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' |
---|
304 | .' WHERE ic.category_id IN ('.implode(',', $cat).')' |
---|
305 | .(sizeof($obj->my_config['included_file_types']) ? ' AND (img.tn_ext IN ('.implode(',', $type_ext).')' : '') |
---|
306 | .($tn_ext_is_null ? ' OR img.tn_ext IS NULL)' : (sizeof($obj->my_config['included_file_types']) ? ')' : '')) |
---|
307 | // Verif droits (niveaux) de l'utilisateur sur les images |
---|
308 | .' AND img.level <='.$user['level'].' ' |
---|
309 | // Choix du critere de tri d'affichage |
---|
310 | .$order_list[ $obj->my_config['piclens_order_cat'] ] |
---|
311 | .$order_sort[ $obj->my_config['piclens_sort_cat'] ]; |
---|
312 | |
---|
313 | } |
---|
314 | } |
---|
315 | |
---|
316 | if ($debug) echo $query; |
---|
317 | |
---|
318 | // Si au moins une image récupérée (une catégorie ou une image présente) |
---|
319 | if (count($cat)!=0) |
---|
320 | { |
---|
321 | $result = pwg_query($query); |
---|
322 | while ($row = mysql_fetch_assoc($result)) |
---|
323 | { |
---|
324 | // Plugin Extended Description present et active |
---|
325 | // suppression des categories et images pour lesquelles un <!--hidden--> est present |
---|
326 | if (!$plugins_ExtendedDesc |
---|
327 | OR ($plugins_ExtendedDesc |
---|
328 | && !(substr_count($row['name'], $piclens_extdesc_hidden)) |
---|
329 | && ((isset($row['catname']) ? !(substr_count($row['catname'], $piclens_extdesc_hidden)) : true)) |
---|
330 | )) |
---|
331 | array_push($pictures, $row); |
---|
332 | } |
---|
333 | } |
---|
334 | // Fin requetes recherches photos |
---|
335 | |
---|
336 | |
---|
337 | // Creation du fichier xml (flux rss) |
---|
338 | // It's a rss file |
---|
339 | header("Content-Type: application/xml; charset=UTF-8"); |
---|
340 | echo '<?xml version="1.0" encoding="utf-8" standalone="yes"?>'; |
---|
341 | echo "\n"; |
---|
342 | echo '<rss version="2.0" '."\n" |
---|
343 | .'xmlns:media="http://search.yahoo.com/mrss/" '."\n" |
---|
344 | .'xmlns:atom="http://www.w3.org/2005/Atom">'; |
---|
345 | echo "\n"; |
---|
346 | echo '<channel>'; |
---|
347 | echo "\n"; |
---|
348 | |
---|
349 | // <!-- <title>test Page</title> --> |
---|
350 | echo '<link>'.$obj->root_site_piclens.'</link>'; |
---|
351 | echo "\n"; |
---|
352 | echo '<description>Flux RSS pour cooliris</description>'; |
---|
353 | echo "\n"; |
---|
354 | echo '<language>fr</language>'; |
---|
355 | echo "\n"; |
---|
356 | |
---|
357 | // Version du plugin Piclens |
---|
358 | $db_plugins = get_db_plugins('', 'piclens'); |
---|
359 | if (!empty($db_plugins)) |
---|
360 | $piclens_version = $db_plugins[0]['version']; |
---|
361 | else |
---|
362 | $piclens_version = 'N/A'; |
---|
363 | |
---|
364 | echo '<generator>Piwigo Cooliris Plugin v.'.$piclens_version.'</generator>'; |
---|
365 | echo "\n"; |
---|
366 | |
---|
367 | // Icone de la gallerie dans le flux RSS |
---|
368 | // echo '<logo url="'.get_root_url().'template-common/favicon.ico"></logo>'; |
---|
369 | echo "\n"; |
---|
370 | echo '<atom:icon>'.$obj->root_site_piclens.'template-common/favicon.ico</atom:icon>'; |
---|
371 | echo "\n"; |
---|
372 | // <atom:link href="http://mywebsite.com/photos.rss" rel="self" type="application/rss+xml" /> |
---|
373 | |
---|
374 | // Pour chacune des images, preparation du flux xml |
---|
375 | foreach ($pictures as $row) |
---|
376 | { |
---|
377 | // Mode de l'image parametre |
---|
378 | $piclens_normal = $obj->my_config['piclens_normal']; |
---|
379 | |
---|
380 | // si parametrage high et high absente ou utilisateur non habilite, affichage version normale |
---|
381 | if (($piclens_normal == 3) && (!($row['has_high']) || !$user['enabled_high'])) |
---|
382 | $piclens_normal = 2; // Normal uniquement pour l'image en cours |
---|
383 | |
---|
384 | // Get thumbnail url |
---|
385 | if ($plugins_SecureImage) // SecureImage installe et actif |
---|
386 | { |
---|
387 | $link_url = $obj->root_site_piclens.'plugins/secureImages/getFile.php?image_id='.$row['id']; |
---|
388 | |
---|
389 | $thumbnail_url = $obj->root_site_piclens.'plugins/secureImages/getFile.php?image_id='.$row['id'] |
---|
390 | .$thumb_secure[$obj->my_config['piclens_thumb'] ]; |
---|
391 | $content_url = $obj->root_site_piclens.'plugins/secureImages/getFile.php?image_id='.$row['id'] |
---|
392 | .$normal_secure[$piclens_normal ]; |
---|
393 | } |
---|
394 | else // SecureImage non installe ou non actif |
---|
395 | { |
---|
396 | $link_url = $obj->root_site_piclens.$row['path']; |
---|
397 | |
---|
398 | if ( ($obj->my_config['piclens_thumb']) == 2) // Normal |
---|
399 | $thumbnail_url = (url_is_remote($row['path']) ? $row['path']: embellish_url($obj->root_site_piclens.$row['path'])); |
---|
400 | else |
---|
401 | { |
---|
402 | if ($plugins_SecureImage_only) // Plugin secureimage active mais configuration compatibilite piclens-secureimage desactivee |
---|
403 | { |
---|
404 | $path=get_thumbnail_location($row); |
---|
405 | $thumbnail_url = ( url_is_remote($path) ? $path : embellish_url($obj->root_site_piclens.$path) ); |
---|
406 | } |
---|
407 | else // Plugin secureimage desactive |
---|
408 | { |
---|
409 | $thumbnail_url = embellish_url($obj->root_site_piclens.get_thumbnail_location($row)); |
---|
410 | } |
---|
411 | } |
---|
412 | |
---|
413 | switch ($piclens_normal) |
---|
414 | { |
---|
415 | case 1 : // miniature |
---|
416 | if ($plugins_SecureImage_only) // Plugin secureimage active mais configuration compatibilite piclens-secureimage desactivee |
---|
417 | { |
---|
418 | $path=get_thumbnail_location($row); |
---|
419 | $content_url = ( url_is_remote($path) ? $path : embellish_url($obj->root_site_piclens.$path) ); |
---|
420 | } |
---|
421 | else // Plugin secureimage desactive |
---|
422 | { |
---|
423 | $content_url = embellish_url($obj->root_site_piclens.get_thumbnail_location($row));; |
---|
424 | } |
---|
425 | break; |
---|
426 | case 2 : // normal |
---|
427 | $content_url = (url_is_remote($row['path']) ? $row['path']: embellish_url($obj->root_site_piclens.$row['path'])); |
---|
428 | break; |
---|
429 | case 3 : |
---|
430 | $content_url = (url_is_remote($row['path']) ? dirname($row['path']).'/pwg_high/'.basename($row['path']) |
---|
431 | : embellish_url( $obj->root_site_piclens. dirname($row['path']).'/pwg_high/'.basename($row['path'])) |
---|
432 | ); |
---|
433 | break; |
---|
434 | default : // normal |
---|
435 | $content_url = (url_is_remote($row['path']) ? $row['path'] : embellish_url($obj->root_site_piclens.$row['path'])); |
---|
436 | break; |
---|
437 | } |
---|
438 | } |
---|
439 | |
---|
440 | // link on picture.php page |
---|
441 | set_make_full_url(); |
---|
442 | if ( isset($row['category_id']) & isset($row['catname']) ) |
---|
443 | { |
---|
444 | $url = duplicate_picture_url( |
---|
445 | array( |
---|
446 | 'image_id' => $row['id'], |
---|
447 | 'image_file' => $row['file'], |
---|
448 | 'category' => array( |
---|
449 | 'id' => $row['category_id'], |
---|
450 | 'name' => $row['catname'], |
---|
451 | 'permalink' => '' |
---|
452 | ) |
---|
453 | ), |
---|
454 | array('start') |
---|
455 | ); |
---|
456 | } |
---|
457 | else |
---|
458 | { |
---|
459 | $url = duplicate_picture_url( |
---|
460 | array( |
---|
461 | 'image_id' => $row['id'], |
---|
462 | 'image_file' => $row['file'] |
---|
463 | ), |
---|
464 | array('start') |
---|
465 | ); |
---|
466 | } |
---|
467 | unset_make_full_url(); |
---|
468 | |
---|
469 | // HTTPS Patch : If needed NO_https can easily be set in your config_local thru LocalFiles Editor |
---|
470 | if (isset($conf['NO_https']) and $conf['NO_https'] and strncasecmp($url, 'https://', 8) == 0 ) |
---|
471 | $url = 'http://' . substr($url, 8); |
---|
472 | |
---|
473 | // Show rss item for a picture |
---|
474 | echo "<item>\n"; |
---|
475 | |
---|
476 | // Recuperation informations de la categorie (Present maintenant dans row['catname']) |
---|
477 | //$catinfo = get_cat_info($row['category_id']); |
---|
478 | // Titre de l'image dans Piclens |
---|
479 | switch($obj->my_config['piclens_name_image']) |
---|
480 | { |
---|
481 | case 2 : |
---|
482 | // format nom fichier |
---|
483 | echo "<title><![CDATA[" |
---|
484 | .(($obj->my_config['piclens_cat_view'] && isset ($row['catname'])) ? $row['catname']." - " : "") |
---|
485 | . $row['file'] . "]]></title>\n"; |
---|
486 | break; |
---|
487 | case 3 : |
---|
488 | // format nom de la photo |
---|
489 | if (isset($row['name'])) |
---|
490 | echo "<title><![CDATA[" |
---|
491 | .(($obj->my_config['piclens_cat_view'] && isset ($row['catname'])) ? $row['catname']." - " : "") |
---|
492 | .$row['name']."]]></title>\n"; |
---|
493 | else |
---|
494 | echo "<title><![CDATA[" |
---|
495 | .(($obj->my_config['piclens_cat_view'] && isset ($row['catname'])) ? $row['catname']." - " : "") |
---|
496 | . $row['file'] . "]]></title>\n"; |
---|
497 | break; |
---|
498 | default : |
---|
499 | // format nom fichier : taille |
---|
500 | echo "<title><![CDATA[" |
---|
501 | .(($obj->my_config['piclens_cat_view'] && isset ($row['catname'])) ? $row['catname']." - " : "") |
---|
502 | . get_thumbnail_title($row) . "]]></title>\n"; |
---|
503 | break; |
---|
504 | } |
---|
505 | |
---|
506 | // Description (nom de vignette) present |
---|
507 | switch($obj->my_config['piclens_name_desc']) |
---|
508 | { |
---|
509 | case 2 : |
---|
510 | if (isset($row['name'])) |
---|
511 | echo '<media:description type="html"><![CDATA['.$row['name'].']]> </media:description>'; |
---|
512 | break; |
---|
513 | case 3 : |
---|
514 | if (isset($row['comment'])) |
---|
515 | { |
---|
516 | if ($plugins_ExtendedDesc) // Extended description compatibility |
---|
517 | { |
---|
518 | $desc=trigger_event('render_element_description',$row['comment']); |
---|
519 | echo '<media:description type="html"><![CDATA['.$desc.']]> </media:description>'; |
---|
520 | } |
---|
521 | else |
---|
522 | echo '<media:description type="html"><![CDATA['.$row['comment'].']]> </media:description>'; |
---|
523 | |
---|
524 | } |
---|
525 | break; |
---|
526 | default : |
---|
527 | break; |
---|
528 | } |
---|
529 | echo "\n"; |
---|
530 | |
---|
531 | // link |
---|
532 | echo "<link>" . $url . "</link>\n"; |
---|
533 | |
---|
534 | // echo "<guid>" . $row['id'] . "\</guid>\n"; |
---|
535 | echo "<guid isPermaLink=\"false\">\"" . $row['id'] . "\"</guid>\n"; |
---|
536 | |
---|
537 | |
---|
538 | echo "<media:thumbnail url=\"" . $thumbnail_url . "\" />\n"; |
---|
539 | |
---|
540 | $extension = explode(".", $row['file']); |
---|
541 | $extension = $extension[sizeof($extension)-1]; |
---|
542 | |
---|
543 | // Fichiers video (Charlies content) |
---|
544 | if ((in_array($extension, $video_ext_piclens))) |
---|
545 | { |
---|
546 | if ($obj->my_config['piclens_video']) // activation des videos |
---|
547 | { |
---|
548 | switch ($extension) |
---|
549 | { |
---|
550 | case "flv": |
---|
551 | echo "<media:content type=\"video/x-flv\" url=\"".$content_url."\"/>\n"; |
---|
552 | break; |
---|
553 | } |
---|
554 | } |
---|
555 | else |
---|
556 | { |
---|
557 | echo "<media:content url=\"" . $thumbnail_url . "\" />\n"; |
---|
558 | } |
---|
559 | } |
---|
560 | // Fichiers video (PY Gvideo) |
---|
561 | elseif ((in_array($extension, $py_addext))) |
---|
562 | { |
---|
563 | if ($obj->my_config['piclens_video']) // activation des videos |
---|
564 | { |
---|
565 | // Si impossibilite de lire le fichier! |
---|
566 | if( false == ($idvideo = file_get_contents(PHPWG_ROOT_PATH.$row['path']))) |
---|
567 | { |
---|
568 | echo "<media:content url=\"" . $thumbnail_url . "\" />\n"; |
---|
569 | } |
---|
570 | else |
---|
571 | { |
---|
572 | $sp = explode("/", $idvideo); |
---|
573 | switch ($extension) |
---|
574 | { |
---|
575 | case "dm" : |
---|
576 | echo "<enclosure url=\"http://www.dailymotion.com/swf/".$sp[0]."\" type=\"application/x-shockwave-flash\" />\n"; |
---|
577 | break; |
---|
578 | case "ytube": |
---|
579 | echo "<enclosure url=\"http://youtube.com/v/".$sp[0].".swf\" type=\"application/x-shockwave-flash\" />\n"; |
---|
580 | break; |
---|
581 | case "wideo": |
---|
582 | 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"; |
---|
583 | break; |
---|
584 | case "gvideo": |
---|
585 | echo "<enclosure url=\"http://video.google.com/googleplayer.swf?docid=".$sp[0]."\" type=\"application/x-shockwave-flash\" />\n"; |
---|
586 | break; |
---|
587 | case "vimeo": |
---|
588 | echo "<enclosure url=\"http://vimeo.com/moogaloop.swf?clip_id=".$sp[0]."\" type=\"application/x-shockwave-flash\" />\n"; |
---|
589 | break; |
---|
590 | } |
---|
591 | } |
---|
592 | } |
---|
593 | else |
---|
594 | { |
---|
595 | echo "<media:content url=\"" . $thumbnail_url . "\" />\n"; |
---|
596 | } |
---|
597 | } |
---|
598 | // Images (standard) |
---|
599 | else |
---|
600 | echo "<media:content url=\"" . $content_url . "\" />\n"; |
---|
601 | |
---|
602 | echo "</item>\n"; |
---|
603 | echo "\n"; |
---|
604 | } |
---|
605 | echo "</channel>\n"; |
---|
606 | echo "</rss>"; |
---|
607 | } |
---|
608 | |
---|
609 | } |
---|
610 | |
---|
611 | ?> |
---|