my_config['piclens_recursive'] = false; } // extensions video $py_addext = array("gvideo", "dm", "ytube", "wideo", "vimeo", "flv"); $video_ext_piclens = array("flv"); // Vérification présence et activation plugin SecureImages ET si actif, vérification d'activation de compatibilité $plugins_SecureImage_only = (get_db_plugins('active','secureImages') ? true : false ); $plugins_SecureImage = ($plugins_SecureImage_only && ($obj->my_config['piclens_secureimage']) ? true : false ); // Verification presence et activation plugin ExtendedDescription $plugins_ExtendedDesc = (get_db_plugins('active','ExtendedDescription') && ($obj->my_config['piclens_extendeddesc']) ? true : false ); // Vérification d'activation du plugin (page administration) OU activation de piclensWall 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'))) { //-------------------------------------------------------------- initialization // Mode des miniatures et des images normales dans piclens (avec et sans plugin secureimage) $thumb_secure = array('', '&thumb=1', ''); // correspondant a 1-->'miniature' et 2-->'normal' $normal_secure = array('', '&thumb=1', '', '&highdef=1'); // correspondant a 1-->'miniature' et 2-->'normal' et 3 --> High $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'); $order_sort = array('', '', ' ASC', ' DESC'); // Extensions a prendre en compte $tn_ext_is_null = false; $type_ext = $obj->my_config['included_file_types']; foreach($type_ext as $i => $value) { if ($value == '!NULL!') $tn_ext_is_null = true; $type_ext[$i] = '"'.($value == '!NULL!' ? 'NULL' : $value).'"'; } // Categories a prendre en compte pour le mur $piclenswall_cat = (isset($obj->my_config['piclens_wall_categories']) ? $obj->my_config['piclens_wall_categories'] : array()); // Seulement sur une page type 'categorie' if (isset($page['section'])) { $cat = array(); $pictures = array(); $forbidden = get_sql_condition_FandF( array ( 'forbidden_categories' => 'category_id', 'visible_categories' => 'category_id', 'visible_images' => 'id' ), 'AND' ); // Images recentes if (($page['section']) == 'recent_pics') { if ( !isset($page['super_order_by']) ) { $conf['order_by'] = str_replace( 'ORDER BY ', 'ORDER BY date_available DESC,', $conf['order_by'] ); } // $cat need to bo not null... array_push($cat, "1"); $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, img.level ' .' FROM ' . IMAGES_TABLE.' AS img' .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' .' WHERE img.date_available >= SUBDATE( CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY) ' .$forbidden .' '.$conf['order_by'].';'; } // Plus vues elseif ($page['section'] == 'recent_cats') { // $cat need to bo not null... array_push($cat, "1"); $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, img.level, ic.category_id, cat.name AS catname, cat.comment AS catcomment, cat.rank, cat.status, cat.visible, cat.uppercats, cat.permalink ' .' FROM ' . IMAGES_TABLE.' AS img' .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' .' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON cat.id = cat_id and user_id = '.$user['id'] .' WHERE date_last >= SUBDATE( CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY ) '.get_sql_condition_FandF ( array('visible_categories' => 'id',), 'AND' ).' ;'; } // Plus vues elseif ($page['section'] == 'most_visited') { // $cat need to bo not null... array_push($cat, "1"); $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, img.level, ic.category_id, cat.name AS catname, cat.comment AS catcomment, cat.rank, cat.status, cat.visible, cat.uppercats, cat.permalink ' .' FROM ' . IMAGES_TABLE.' AS img' .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' .' WHERE img.hit > 0 ' .$forbidden .' ORDER BY hit DESC, file ASC' .' LIMIT 0, '.$conf['top_number'].';'; } // mieux notees elseif ($page['section'] == 'best_rated') { // $cat need to bo not null... array_push($cat, "1"); $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, img.level ' .' FROM ' . IMAGES_TABLE.' AS img' .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' .' WHERE img.average_rate IS NOT NULL ' .$forbidden .' ORDER BY average_rate DESC, id ASC' .' LIMIT 0, '.$conf['top_number'].';'; } elseif ($page['section'] == 'favorites') { check_user_favorites(); // $cat need to bo not null... array_push($cat, "1"); $query = 'SELECT img.id, img.file, img.date_available, img.date_creation, img.tn_ext, img.name, img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, img.level ' .' FROM '.FAVORITES_TABLE.' AS fav ' .' INNER JOIN '.IMAGES_TABLE.' AS img ON fav.image_id = img.id' .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' .' WHERE user_id = '.$user['id'] .' '.get_sql_condition_FandF ( array('visible_images' => 'id'), 'AND' ) .' '.$conf['order_by'].';'; } elseif (($page['section']) == 'categories') { // Accueil if(empty($page['category'])) { // Page accueil // Vérification d'activation du plugin (page administration) // ou flux pour piclenswall et configuration specifique if ($obj->my_config['piclens_gallerie_active'] || $piclenswallfeed) { // Categories de premier niveau $query = 'SELECT id,name,permalink FROM ' . CATEGORIES_TABLE .' WHERE id_uppercat is NULL'; $result = pwg_query($query); while ($row = mysql_fetch_assoc($result)) { if (!(in_array($row['id'], explode(',', $user['forbidden_categories'])))) { array_push($cat, $row['id']); } } // Type = avec recursiite // Si parametrage specifique pour le mur 3D, recursivite sur les categories if (($piclenswallfeed) || (( $obj->my_config['piclens_gallerie_type'])-1)) { // recuperation des sous-categories (tous niveaux) de la categorie en cours. $subcat= get_subcat_ids($cat); // Verification droits des sous-categories foreach($subcat as $sscat) { if (!(in_array($sscat, explode(',', $user['forbidden_categories'])))) array_push($cat, $sscat); } } // selection uniquement des categories a afficher (si flux pour le mur ET parametre mur = specifique) if ($piclenswallfeed) { foreach($cat as $i => $wcat) { if (!in_array($wcat, $piclenswall_cat)) unset($cat[$i]); } } $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, img.level, ic.category_id, cat.name AS catname, cat.comment AS catcomment, cat.rank, cat.status, cat.visible, cat.uppercats, cat.permalink ' .' FROM ' . IMAGES_TABLE.' AS img' .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' .' WHERE ic.category_id IN ('.implode(',', $cat).')' .(sizeof($obj->my_config['included_file_types']) ? ' AND (img.tn_ext IN ('.implode(',', $type_ext).')' : '') .($tn_ext_is_null ? ' OR img.tn_ext IS NULL)' : (sizeof($obj->my_config['included_file_types']) ? ')' : '')) // Verif droits (niveaux) de l'utilisateur sur les images .' AND img.level <='.$user['level'].' ' // Choix du critere de tri d'affichage .$order_list[ $obj->my_config['piclens_order'] ] .$order_sort[ $obj->my_config['piclens_sort'] ]; } } // Page category elseif (isset($page['category'])) { check_restrictions($page['category']['id']); // Flux pour le mur 3D et mur en mode "specifique" if ($piclenswallfeed) { $selectionID = $page['category']['id']; // categorie parametre pour etre affichee dans le mur if (in_array($selectionID, $piclenswall_cat)) array_push($cat, $selectionID); // recuperation des sous-categories (tous niveaux) de la categorie en cours. $subcat= get_subcat_ids(array($selectionID)); // Verification ajout des sous-categories qui peuvent être affichees (parametrees dans mur 3D) et des drois des sous categories foreach($subcat as $sscat) { if ((in_array($sscat, $piclenswall_cat)) && (!(in_array($sscat, explode(',', $user['forbidden_categories']))))) array_push($cat, $sscat); } } // Piclens (et mur 3D avec meme parametrage que piclens) : paramétrage "commun" else { // recherche de toutes les photos de la categorie (incluant les photos des sous-categories si necessaire) $selectionID = $page['category']['id']; array_push($cat, $selectionID); // Si recursivite activee if ($obj->my_config['piclens_recursive']) { // recuperation des sous-categories (tous niveaux) de la categorie en cours. $subcat= get_subcat_ids(array($selectionID)); // Verification droits des sous-categories foreach($subcat as $sscat) { if (!(in_array($sscat, explode(',', $user['forbidden_categories'])))) array_push($cat, $sscat); } } } $query = 'SELECT DISTINCT(img.id), img.file, img.date_available, img.date_creation, img.tn_ext, img.name, img.comment, img.author, img.hit ,img.filesize, img.average_rate, img.has_high, img.path, img.level, ic.category_id, cat.name AS catname, cat.comment AS catcomment, cat.rank, cat.status, cat.visible, cat.uppercats, cat.permalink ' .' FROM ' . IMAGES_TABLE.' AS img' .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' .' WHERE ic.category_id IN ('.implode(',', $cat).')' .(sizeof($obj->my_config['included_file_types']) ? ' AND (img.tn_ext IN ('.implode(',', $type_ext).')' : '') .($tn_ext_is_null ? ' OR img.tn_ext IS NULL)' : (sizeof($obj->my_config['included_file_types']) ? ')' : '')) // Verif droits (niveaux) de l'utilisateur sur les images .' AND img.level <='.$user['level'].' ' // Choix du critere de tri d'affichage .$order_list[ $obj->my_config['piclens_order_cat'] ] .$order_sort[ $obj->my_config['piclens_sort_cat'] ]; } } if ($debug) echo $query; // Si au moins une image récupérée (une catégorie ou une image présente) if (count($cat)!=0) { $result = pwg_query($query); while ($row = mysql_fetch_assoc($result)) { // Plugin Extended Description present et active // suppression des categories et images pour lesquelles un est present if (!$plugins_ExtendedDesc OR ($plugins_ExtendedDesc && !(substr_count($row['name'], $piclens_extdesc_hidden)) && ((isset($row['catname']) ? !(substr_count($row['catname'], $piclens_extdesc_hidden)) : true)) )) array_push($pictures, $row); } } // Fin requetes recherches photos // Creation du fichier xml (flux rss) // It's a rss file header("Content-Type: application/xml; charset=UTF-8"); echo ''; echo "\n"; echo ''; echo "\n"; echo ''; echo "\n"; // echo ''.$obj->root_site_piclens.''; echo "\n"; echo 'Flux RSS pour cooliris'; echo "\n"; echo 'fr'; echo "\n"; // Version du plugin Piclens $db_plugins = get_db_plugins('', 'piclens'); if (!empty($db_plugins)) $piclens_version = $db_plugins[0]['version']; else $piclens_version = 'N/A'; echo 'Piwigo Cooliris Plugin v.'.$piclens_version.''; echo "\n"; // Icone de la gallerie dans le flux RSS // echo ''; echo "\n"; echo ''.$obj->root_site_piclens.'template-common/favicon.ico'; echo "\n"; // // Pour chacune des images, preparation du flux xml foreach ($pictures as $row) { // Mode de l'image parametre $piclens_normal = $obj->my_config['piclens_normal']; // si parametrage high et high absente ou utilisateur non habilite, affichage version normale if (($piclens_normal == 3) && (!($row['has_high']) || !$user['enabled_high'])) $piclens_normal = 2; // Normal uniquement pour l'image en cours // Get thumbnail url if ($plugins_SecureImage) // SecureImage installe et actif { $link_url = $obj->root_site_piclens.'plugins/secureImages/getFile.php?image_id='.$row['id']; $thumbnail_url = $obj->root_site_piclens.'plugins/secureImages/getFile.php?image_id='.$row['id'] .$thumb_secure[$obj->my_config['piclens_thumb'] ]; $content_url = $obj->root_site_piclens.'plugins/secureImages/getFile.php?image_id='.$row['id'] .$normal_secure[$piclens_normal ]; } else // SecureImage non installe ou non actif { $link_url = $obj->root_site_piclens.$row['path']; if ( ($obj->my_config['piclens_thumb']) == 2) // Normal $thumbnail_url = (url_is_remote($row['path']) ? $row['path']: embellish_url($obj->root_site_piclens.$row['path'])); else { if ($plugins_SecureImage_only) // Plugin secureimage active mais configuration compatibilite piclens-secureimage desactivee { $path=get_thumbnail_location($row); $thumbnail_url = ( url_is_remote($path) ? $path : embellish_url($obj->root_site_piclens.$path) ); } else // Plugin secureimage desactive { $thumbnail_url = embellish_url($obj->root_site_piclens.get_thumbnail_location($row)); } } switch ($piclens_normal) { case 1 : // miniature if ($plugins_SecureImage_only) // Plugin secureimage active mais configuration compatibilite piclens-secureimage desactivee { $path=get_thumbnail_location($row); $content_url = ( url_is_remote($path) ? $path : embellish_url($obj->root_site_piclens.$path) ); } else // Plugin secureimage desactive { $content_url = embellish_url($obj->root_site_piclens.get_thumbnail_location($row));; } break; case 2 : // normal $content_url = (url_is_remote($row['path']) ? $row['path']: embellish_url($obj->root_site_piclens.$row['path'])); break; case 3 : $content_url = (url_is_remote($row['path']) ? dirname($row['path']).'/pwg_high/'.basename($row['path']) : embellish_url( $obj->root_site_piclens. dirname($row['path']).'/pwg_high/'.basename($row['path'])) ); break; default : // normal $content_url = (url_is_remote($row['path']) ? $row['path'] : embellish_url($obj->root_site_piclens.$row['path'])); break; } } // link on picture.php page set_make_full_url(); if ( isset($row['category_id']) & isset($row['catname']) ) { $url = duplicate_picture_url( array( 'image_id' => $row['id'], 'image_file' => $row['file'], 'category' => array( 'id' => $row['category_id'], 'name' => $row['catname'], 'permalink' => '' ) ), array('start') ); } else { $url = duplicate_picture_url( array( 'image_id' => $row['id'], 'image_file' => $row['file'] ), array('start') ); } unset_make_full_url(); // HTTPS Patch : If needed NO_https can easily be set in your config_local thru LocalFiles Editor if (isset($conf['NO_https']) and $conf['NO_https'] and strncasecmp($url, 'https://', 8) == 0 ) $url = 'http://' . substr($url, 8); // Show rss item for a picture echo "\n"; // Recuperation informations de la categorie (Present maintenant dans row['catname']) //$catinfo = get_cat_info($row['category_id']); // Titre de l'image dans Piclens switch($obj->my_config['piclens_name_image']) { case 2 : // format nom fichier echo "<![CDATA[" .(($obj->my_config['piclens_cat_view'] && isset ($row['catname'])) ? $row['catname']." - " : "") . $row['file'] . "]]>\n"; break; case 3 : // format nom de la photo if (isset($row['name'])) echo "<![CDATA[" .(($obj->my_config['piclens_cat_view'] && isset ($row['catname'])) ? $row['catname']." - " : "") .$row['name']."]]>\n"; else echo "<![CDATA[" .(($obj->my_config['piclens_cat_view'] && isset ($row['catname'])) ? $row['catname']." - " : "") . $row['file'] . "]]>\n"; break; default : // format nom fichier : taille echo "<![CDATA[" .(($obj->my_config['piclens_cat_view'] && isset ($row['catname'])) ? $row['catname']." - " : "") . get_thumbnail_title($row) . "]]>\n"; break; } // Description (nom de vignette) present switch($obj->my_config['piclens_name_desc']) { case 2 : if (isset($row['name'])) echo ' '; break; case 3 : if (isset($row['comment'])) { if ($plugins_ExtendedDesc) // Extended description compatibility { $desc=trigger_event('render_element_description',$row['comment']); echo ' '; } else echo ' '; } break; default : break; } echo "\n"; // link echo "" . $url . "\n"; // echo "" . $row['id'] . "\\n"; echo "\"" . $row['id'] . "\"\n"; echo "\n"; $extension = explode(".", $row['file']); $extension = $extension[sizeof($extension)-1]; // Fichiers video (Charlies content) if ((in_array($extension, $video_ext_piclens))) { if ($obj->my_config['piclens_video']) // activation des videos { switch ($extension) { case "flv": echo "\n"; break; } } else { echo "\n"; } } // Fichiers video (PY Gvideo) elseif ((in_array($extension, $py_addext))) { if ($obj->my_config['piclens_video']) // activation des videos { // Si impossibilite de lire le fichier! if( false == ($idvideo = file_get_contents(PHPWG_ROOT_PATH.$row['path']))) { echo "\n"; } else { $sp = explode("/", $idvideo); switch ($extension) { case "dm" : echo "\n"; break; case "ytube": echo "\n"; break; case "wideo": echo "\n"; break; case "gvideo": echo "\n"; break; case "vimeo": echo "\n"; break; } } } else { echo "\n"; } } // Images (standard) else echo "\n"; echo "\n"; echo "\n"; } echo "\n"; echo ""; } } ?>