root_site_piclens = get_root_url(); // 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($this->root_site_piclens, 'https://', 8) == 0 ) $this->root_site_piclens = 'http://' . substr($this->root_site_piclens, 8); // HTTPS unset_make_full_url(); } // Add Piclens CSS & Javascript in HEAD section function piclens_link() { global $template, $page, $user; $jscript = ''; $template->append('head_elements',$jscript); // Vérification d'activation du plugin (page administration) if ($this->my_config['piclens_active']) { // Correction bug compteur "fou". Les pages d'affichage des images seules ne sont pas a prendre en compte. if (isset($page['section']) && !isset($page['image_id'])) { // Page Tags if (($page['section']) == 'tags' && $this->my_config['piclens_tags_active']) { $tags = ''; foreach ($page['tag_ids'] as $id => $tag) $tags .= '/'.$tag.'-'.$page['tags'][''.$id.'']['name']; $piclnkMaster='' . "\n"; } // Page images recentes elseif (($page['section']) == 'recent_pics' && $this->my_config['piclens_recentpics_active']) { $piclnkMaster='' . "\n"; } // Page categories recentes elseif (($page['section']) == 'recent_cats' && $this->my_config['piclens_recentcats_active']) { if ($this->my_config['piclens_recursive_mode'] != 'standard') { $query = 'SELECT c.id, c.permalink FROM '.CATEGORIES_TABLE.' c INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON 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' ).' ;'; $piclnkMaster=''; $result = pwg_query($query); while ($row = mysql_fetch_assoc($result)) { // Gestion des permalinks $categoryId = $row['id'] ; if (!empty($row['permalink'])) $categoryId = $row['permalink']; $piclnkMaster.='' . "\n"; } } else { $piclnkMaster='' . "\n"; } } // Page plus vues elseif (($page['section']) == 'most_visited' && $this->my_config['piclens_mostvisited_active']) { $piclnkMaster='' . "\n"; } // mieux notees else if ($page['section'] == 'best_rated' && $this->my_config['piclens_bestrated_active']) { $piclnkMaster='' . "\n"; } // favories else if ($page['section'] == 'favorites' && $this->my_config['piclens_favorites_active']) { $piclnkMaster='' . "\n"; } // Seulement sur une page type 'categorie' // Correction bug compteur "fou". Les pages d'affichage des images seules ne sont pas a prendre en compte. elseif (($page['section']) == 'categories' && !isset($page['image_id'])) { // Page accueil et option gallerie activee if( (empty($page['category'])) && $this->my_config['piclens_gallerie_active'] ) { if ($this->my_config['piclens_recursive_mode'] != 'standard') { $query = 'SELECT id,name,permalink FROM ' . CATEGORIES_TABLE .' WHERE id_uppercat is NULL'; $piclnkMaster=''; $result = pwg_query($query); while ($row = mysql_fetch_assoc($result)) { if (!(in_array($row['id'], explode(',', $user['forbidden_categories'])))) { $piclnkMaster.='' . "\n"; } } } else { $piclnkMaster='' . "\n"; } } // Add only if we are in category page elseif (!empty($page['category']['id'])) { if ($this->my_config['piclens_recursive_mode'] != 'standard') { $categoryId = $page['category']['id'] ; if (!empty($page['category']['permalink'])) $categoryId = $page['category']['permalink']; $piclnkMaster='' . "\n"; $query = ' SELECT DISTINCT(id) FROM '.CATEGORIES_TABLE.' WHERE id_uppercat='.$page['category']['id'].';'; $result = pwg_query($query); while ($row = mysql_fetch_array($result)) { $piclnkMaster.='' . "\n"; } /* $piclnkMaster.='' . "\n"; */ } else { // Gestion des permalinks $categoryId = $page['category']['id'] ; if (!empty($page['category']['permalink'])) $categoryId = $page['category']['permalink']; $piclnkMaster='' . "\n"; } } } if (isset($piclnkMaster)) { $piclnk=$piclnkMaster; // We need absolute path $template->append('head_elements',$piclnk.''); } } } } // Add piclens Flash slideshow to toolbar // Thanks to P@t function add_piclens_icon() { global $template, $page; if ($this->my_config['piclens_lite_active'] && $this->my_config['piclens_active']) { // Seulement sur une page type 'categorie' if (isset($page['section'])) { // images recentes if ( (($page['section']) == 'recent_pics' && $this->my_config['piclens_recentpics_active']) || (($page['section']) == 'recent_cats' && $this->my_config['piclens_recentcats_active']) || (($page['section']) == 'most_visited' && $this->my_config['piclens_mostvisited_active']) || (($page['section']) == 'best_rated' && $this->my_config['piclens_bestrated_active']) || (($page['section']) == 'favorites' && $this->my_config['piclens_favorites_active']) || (($page['section']) == 'tags' && $this->my_config['piclens_tags_active']) || (($page['section']) == 'categories') ) // categories recentes // plus vues // mieux notees // favories { if($page['section'] == 'categories') { if (empty($page['category'])) // acceuil $rssfeed = $this->root_site_piclens.PICLENS_PATH.'piclens-rss.php?/categories'; else { $rssfeed = $this->root_site_piclens.PICLENS_PATH.'piclens-rss.php?/category/'; $rssfeed .= empty($page['category']['permalink']) ? $page['category']['id'] : $page['category']['permalink']; } if (isset($conf['NO_https']) and $conf['NO_https'] and strncasecmp($rssfeed, 'https://', 8) == 0 ) $rssfeed = 'http://' . substr($rssfeed, 8); } $tpl_code = '
  • '; $tpl_code.=''.l10n('piclens_button').'
  • '; if(($page['section'] == 'categories') && empty($page['category']) && !$this->my_config['piclens_gallerie_active']) // Accueil et option piclens gallerie desactivee $tpl_code='
  • '.l10n('piclens_button').'
  • '; } if (isset($tpl_code)) $template->concat('PLUGIN_INDEX_ACTIONS', $tpl_code."\n"); } } } // Add piclens pics to start slideshow // Another thanks to P@t function set_make_full_url_piclens() { global $page; set_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($page['root_path'], 'https://', 8) == 0 ) $page['root_path'] = 'http://' . substr($page['root_path'], 8); } /* Loading of the configuration on database */ function load_config() { $query = ' SELECT value FROM '.CONFIG_TABLE.' WHERE param = \''.PICLENS_CFG_DB.'\' ;'; $result = pwg_query($query); if($result) { $row = mysql_fetch_row($result); if(is_string($row[0])) { // $this->my_config = unserialize($row[0]); $this->my_config = unserialize(($row[0])); } } $this->load_default_config(); // Desactivation de piclenswall si PWG Stuff est installe $this->my_config['piclens_wall'] = (get_db_plugins('active','PWG_Stuffs') ? false : $this->my_config['piclens_wall']); // Si tri = defaut PIWIGO ==> l'ordre est egalement defaut PIWIGO if ($this->my_config['piclens_order'] == 1) $this->my_config['piclens_sort'] = 1; if ($this->my_config['piclens_order_cat'] == 1) $this->my_config['piclens_sort_cat'] = 1; } /* Loading of the configuration file - If not exist -> load default values */ function load_config_file() { // changement du nom du fichier de conf. if (!file_exists(PICLENS_CFG_FILE)) { if (file_exists(PICLENS_CFG_FILE_OLD)) @rename(PICLENS_CFG_FILE_OLD,PICLENS_CFG_FILE); } $x = @file_get_contents( PICLENS_CFG_FILE ); if ($x!==false) { $c = unserialize($x); $this->my_config = $c; } // Init default value for the config file $this->load_default_config(); // Desactivation de piclenswall si PWG Stuff est installe $this->my_config['piclens_wall'] = (get_db_plugins('active','PWG_Stuffs') ? false : $this->my_config['piclens_wall']); // Si tri = defaut PIWIGO ==> l'ordre est egalement defaut PIWIGO if ($this->my_config['piclens_order'] == 1) $this->my_config['piclens_sort'] = 1; if ($this->my_config['piclens_order_cat'] == 1) $this->my_config['piclens_sort_cat'] = 1; } /* Saving of the configuration on DB*/ function save_config() { $query = ' REPLACE INTO '.CONFIG_TABLE.' VALUES( \''.PICLENS_CFG_DB.'\', \''.(serialize($this->my_config)).'\', \'Configuration de Piclens\') ;'; $result = pwg_query($query); if($result) return true; else return false; } /* Saving of the configuration file with data */ function save_config_file() { $file = fopen( PICLENS_CFG_FILE, 'w' ); fwrite($file, serialize($this->my_config) ); fclose( $file ); } private function load_default_config() { include PICLENS_INC_PATH.'default_values.inc.php'; foreach ($piclens_default_values as $key => $value) { if (!isset($this->my_config[$key])) $this->my_config[$key] = $value; } } function piclens_admin_menu($menu) { array_push($menu, array( 'NAME' => 'Cooliris-Piclens', 'URL' => get_admin_plugin_menu_link(PICLENS_ADMIN_PATH.'piclens_admin.php') ) ); return $menu; } function piclenswall() { global $page; // piclens active+ activation du mur // if ($this->my_config['piclens_active'] && $this->my_config['piclens_wall']) if ($this->my_config['piclens_wall']) if (isset($page['body_id']) and $page['section'] == 'categories') include_once(PICLENS_PATH.'piclenswall.php'); } function piclens_thumbnails() { global $template, $page; // piclens active if ( isset($page['section']) and $this->my_config['piclens_active']) { // Pages speciales et configuration activee if ($this->my_config['piclens_wall_spec']) { // Page images recentes if (($page['section']) == 'recent_pics' && $this->my_config['piclens_wall_spec_recentpics']) $rssfeed = $this->root_site_piclens.PICLENS_PATH.'piclens-rss.php?/recent_pics'; // Page categories recentes elseif (($page['section']) == 'recent_cats' && $this->my_config['piclens_wall_spec_recentcats']) $rssfeed = $this->root_site_piclens.PICLENS_PATH.'piclens-rss.php?/recent_cats'; // Page plus vues elseif (($page['section']) == 'most_visited' && $this->my_config['piclens_wall_spec_mostvisited']) $rssfeed = $this->root_site_piclens.PICLENS_PATH.'piclens-rss.php?/most_visited'; // mieux notees else if ($page['section'] == 'best_rated' && $this->my_config['piclens_wall_spec_bestrated']) $rssfeed = $this->root_site_piclens.PICLENS_PATH.'piclens-rss.php?/best_rated'; // favories else if ($page['section'] == 'favorites' && $this->my_config['piclens_wall_spec_favorites']) $rssfeed = $this->root_site_piclens.PICLENS_PATH.'piclens-rss.php?/favorites'; else if ($page['section'] == 'tags' && $this->my_config['piclens_wall_spec_tags']) { $tags = ''; foreach ($page['tag_ids'] as $id => $tag) $tags .= '/'.$tag.'-'.$page['tags'][''.$id.'']['name']; $rssfeed = $this->root_site_piclens.PICLENS_PATH.'piclens-rss.php?/tags'.$tags; } } // Remplacement de la navigation if ($this->my_config['piclens_wall_nav']) { // Page categories if ($page['section'] == 'categories' and !empty($page['category']) and !empty($page['items'])) { // verification de presence de la categorie dans la liste parametree if (in_array($page['category']['id'], $this->my_config['piclens_wall_cat_nav_replace'])) { $rssfeed = $this->root_site_piclens.PICLENS_PATH.'piclens-rss.php?/category/'; $rssfeed .= empty($page['category']['permalink']) ? $page['category']['id'] : $page['category']['permalink']; } } } } if (isset($rssfeed)) { if (isset($conf['NO_https']) and $conf['NO_https'] and strncasecmp($rssfeed, 'https://', 8) == 0 ) $rssfeed = 'http://' . substr($rssfeed, 8); $color = $this->my_config['piclens_wall_color']; $height = $this->my_config['piclens_wall_height']; $showfullscreen = ($this->my_config['piclens_wall_showfullscreen'] ? "true" : "false"); $showembed = ($this->my_config['piclens_wall_showembed'] ? "true" : "false"); $showsearch = ($this->my_config['piclens_wall_showsearch'] ? "true" : "false"); $template->assign('THUMBNAILS', ' ' .($this->my_config['piclens_wall_transparent'] ? ' '); // Suppression de la barre de navigation $template->clear_assign('NAV_BAR'); // Suppression de la barre de navigation categories (cas de l'affichage des categories recentes) if (($page['section']) == 'recent_cats') $template->clear_assign('CATEGORIES'); } } } ?>