Index: /extensions/FacebookPlug/Plugin/admin.config.php
===================================================================
--- /extensions/FacebookPlug/Plugin/admin.config.php	(revision 8241)
+++ /extensions/FacebookPlug/Plugin/admin.config.php	(revision 8241)
@@ -0,0 +1,143 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | FacebookPlug - a Piwigo Plugin                                        |
+// | Copyright (C) 2010 Ruben ARNAUD - rub@piwigo.org                      |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+// include
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
+// Lingua
+load_language('plugin.lang', FBP_DIR.'/');
+
+// Arguments
+$page['tab'] = (isset($_GET['tab']) ? $_GET['tab'] : 'social_plugin');
+
+// Data
+$base_url = get_admin_plugin_menu_link(__FILE__);
+$url_type = array('page', 'image');
+$url_type_l10n = array_map('l10n', $url_type);
+$layout = array('standard', 'button_count', 'box_count');
+$layout_l10n = array_map('l10n', $layout);
+$action = array('like', 'recommend');
+$action_l10n = array_map('l10n', $action);
+$colorscheme = array('light', 'dark');
+$colorscheme_l10n = array_map('l10n', $colorscheme);
+
+// Tabsheet
+$tabsheet = new tabsheet();
+$tabsheet->add('social_plugin',
+               l10n('Social plugin'),
+               add_url_params($base_url, array('tab' => 'social_plugin')));
+$tabsheet->add('advanced',
+               l10n('Advanced'),
+               add_url_params($base_url, array('tab' => 'advanced')));
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+// Update
+if (isset($_POST['submit']))
+{
+  switch ($page['tab'])
+  {
+    case 'social_plugin' :
+    {
+      $conf['fbp']['social_plugin_like_button']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED']) ? false : true;
+      $conf['fbp']['social_plugin_like_button']['url_type'] = $url_type[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_URL_TYPE']];
+      $conf['fbp']['social_plugin_like_button']['layout'] = $layout[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_LAYOUT']];
+      $conf['fbp']['social_plugin_like_button']['show_faces'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_SHOW_FACES']) ? false : true;
+      $conf['fbp']['social_plugin_like_button']['action'] = $action[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ACTION']];
+      $conf['fbp']['social_plugin_like_button']['colorscheme'] = $colorscheme[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_COLORSCHEME']];
+
+      break;
+    }
+
+    case 'advanced' :
+    {
+      $conf['fbp']['async_script'] = empty($_POST['FBP_ASYNC_SCRIPT']) ? false : true;
+      $conf['fbp']['allow_fb_access_private_page'] = empty($_POST['FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE']) ? false : true;
+    //~ if (isset($_POST['fbp_day_number']))
+    //~ {
+      //~ $conf['fbp']['day_number'] = $_POST['fbp_day_number'];
+    //~ }
+      break;
+    }
+  }
+
+  $query = '
+update '.CONFIG_TABLE.'
+set
+  value = \''.serialize($conf['fbp']).'\'
+where 
+  param = \'fbp\'
+;';
+  pwg_query($query);
+}
+
+// Display
+switch ($page['tab'])
+{
+  case 'social_plugin' :
+  {
+    $template->assign(
+      $page['tab'],
+      array(
+        'like_button' => array
+          (
+            'FB_PAGE' => 'http://developers.facebook.com/docs/reference/plugins/like',
+            'ENABLED' => ($conf['fbp']['social_plugin_like_button']['enabled'] ? 'checked="checked"' : ''),
+            'URL_TYPE_OPTIONS' => $url_type_l10n,
+            'URL_TYPE_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['url_type'], $url_type),
+            'LAYOUT_OPTIONS' => $layout_l10n,
+            'LAYOUT_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['layout'], $layout),
+            'SHOW_FACES' => ($conf['fbp']['social_plugin_like_button']['show_faces'] ? 'checked="checked"' : ''),
+            'ACTION_OPTIONS' => $action_l10n,
+            'ACTION_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['action'], $action),
+            'COLORSCHEME_OPTIONS' => $colorscheme_l10n,
+            'COLORSCHEME_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['colorscheme'], $colorscheme),
+          ),
+        ));
+    break;
+  }
+  case 'advanced' :
+  {
+    $template->assign(
+      $page['tab'],
+      array(
+        'FBP_ASYNC_SCRIPT'=> ($conf['fbp']['async_script'] ? 'checked="checked"' : ''),
+        'FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE'=> ($conf['fbp']['allow_fb_access_private_page'] ? 'checked="checked"' : ''),
+        ));
+    break;
+  }
+}
+
+/*$template->assign(
+  array(
+    'FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE'=> ($conf['fbp']['allow_fb_access_private_page'] ? 'checked="checked"' : ''),
+    //~ 'FBP_DAY_NUMBER'=> $conf['fbp']['day_number'],
+    ));*/
+
+$template->set_filename('plugin_admin_content', FBP_DIR.'/tpl/admin.config.tpl');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
+
+?>
Index: /extensions/FacebookPlug/Plugin/include/admin.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/admin.inc.php	(revision 8241)
+++ /extensions/FacebookPlug/Plugin/include/admin.inc.php	(revision 8241)
@@ -0,0 +1,43 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | FacebookPlug - a Piwigo Plugin                                        |
+// | Copyright (C) 2010 Ruben ARNAUD - rub@piwigo.org                      |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+
+function fbp_get_admin_plugin_menu_links($menu)
+{
+  array_push(
+    $menu, 
+    array(
+      'NAME' => 'FacebookPlug',
+      'URL' => get_admin_plugin_menu_link(
+        FBP_DIR.'/admin.config.php')
+        )
+      );
+  return $menu;
+}
+
+add_event_handler('get_admin_plugin_menu_links', 'fbp_get_admin_plugin_menu_links');
+
+
+?>
Index: /extensions/FacebookPlug/Plugin/include/common.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/common.inc.php	(revision 8241)
+++ /extensions/FacebookPlug/Plugin/include/common.inc.php	(revision 8241)
@@ -0,0 +1,29 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | FacebookPlug - a Piwigo Plugin                                        |
+// | Copyright (C) 2010 Ruben ARNAUD - rub@piwigo.org                      |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+include_once(dirname(__FILE__).'/constants.inc.php');
+include_once(FBP_DIR.'/include/conf.inc.php');
+
+?>
Index: /extensions/FacebookPlug/Plugin/include/conf.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/conf.inc.php	(revision 8241)
+++ /extensions/FacebookPlug/Plugin/include/conf.inc.php	(revision 8241)
@@ -0,0 +1,49 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | FacebookPlug - a Piwigo Plugin                                        |
+// | Copyright (C) 2010 Ruben ARNAUD - rub@piwigo.org                      |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+global $conf;
+
+$conf['fbp'] = array_merge(
+  // default values
+  array
+  (
+    'allow_fb_access_private_page' => true,
+    'async_script' => true,
+    'social_plugin_like_button' => array
+      (
+        'enabled' => true,
+        'url_type' => 'page',
+        'layout' => 'standard',
+        'show_faces' => true,
+        'action' => 'like',
+        'colorscheme' => 'dark',
+      ),
+  ),
+  unserialize($conf['fbp'])
+  );
+
+//~ print_r($conf['fbp']);
+
+?>
Index: /extensions/FacebookPlug/Plugin/include/constants.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/constants.inc.php	(revision 8241)
+++ /extensions/FacebookPlug/Plugin/include/constants.inc.php	(revision 8241)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | FacebookPlug - a Piwigo Plugin                                        |
+// | Copyright (C) 2010 Ruben ARNAUD - rub@piwigo.org                      |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+define('FACEBOOK_APP_ID', '111499825588662');
+define('FBP_DIR', dirname(dirname(__FILE__)));
+define('FBP_IP_FB', '66.220.');
+
+?>
Index: /extensions/FacebookPlug/Plugin/include/index.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/index.php	(revision 8241)
+++ /extensions/FacebookPlug/Plugin/include/index.php	(revision 8241)
@@ -0,0 +1,27 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | FacebookPlug - a Piwigo Plugin                                        |
+// | Copyright (C) 2008-2010 Ruben ARNAUD - rub@piwigo.org                 |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/FacebookPlug/Plugin/include/picture.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/picture.inc.php	(revision 8241)
+++ /extensions/FacebookPlug/Plugin/include/picture.inc.php	(revision 8241)
@@ -0,0 +1,184 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | FacebookPlug - a Piwigo Plugin                                        |
+// | Copyright (C) 2010 Ruben ARNAUD - rub@piwigo.org                      |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+function fbp_header($content, &$smarty)
+{
+  global $conf;
+
+  // replace tag html
+  $search = '<html ';
+  $replacement = '<html xmlns:fb="http://www.facebook.com/2008/fbml" ';
+
+  $content = preg_replace('#'.$search.'#', $replacement, $content);
+
+  // Piwigo init
+  if ($conf['fbp']['async_script'])
+  {
+    // async method
+    $fbp_content = '
+<div id="fb-root"></div>
+<script>
+{literal}
+  window.fbAsyncInit = function() { 
+    FB.init({ 
+      appId  : \''.FACEBOOK_APP_ID.'\', 
+      status : true, // check login status 
+      cookie : true, // enable cookies to allow the server to access the session 
+      xfbml  : true  // parse XFBML 
+    }); 
+  }; 
+  (function() {
+    var e = document.createElement(\'script\');
+  {/literal}
+    e.src = document.location.protocol + \'//connect.facebook.net/{$LANGUAGE}/all.js\';
+{literal}
+    e.async = true;
+    document.getElementById(\'fb-root\').appendChild(e);
+  }());
+{/literal}
+</script>
+';
+  }
+  else
+  {
+    // sync method
+    $fbp_content = '
+<div id="fb-root"></div>
+<script src="http://connect.facebook.net/en_US/all.js"></script>
+<script>
+  FB.init({ldelim}
+    appId  : \''.FACEBOOK_APP_ID.'\',
+    status : true, // check login status
+    cookie : true, // enable cookies to allow the server to access the session
+    xfbml  : true  // parse XFBML
+ {rdelim});
+</script>
+<script src="http://connect.facebook.net/{$LANGUAGE}/all.js#xfbml=1"></script>
+';
+  }
+
+  $search = '<div id="the_page">';
+  return preg_replace('#'.$search.'#', $fbp_content.$search, $content);
+}
+
+function fbp_add_social($content, &$smarty)
+{
+  global $conf;
+  $fbp_content .= '<div id="fb-xfbml">';
+
+  // iframe implementation
+/*  $fbp_content = '
+<iframe src="http://www.facebook.com/plugins/like.php?href={$SRC_IMG}&amp;layout=standard&amp;show_faces=true&amp;width={$WIDTH_IMG}&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{$WIDTH_IMG}px; height:80px;" allowTransparency="true"></iframe>
+';*/
+
+  // XFBML implementation
+  /*$fbp_content .= '
+<fb:like href="{$SRC_IMG}" show_faces="true" width="{$WIDTH_IMG}"></fb:like>
+';*/
+  $fbp_content .= '
+<fb:like href="{$FBP_URL_PICTURE}" layout="{$FBP_SOCIAL_PLUGIN_LIKE_BUTTON.layout}" show_faces="{if $FBP_SOCIAL_PLUGIN_LIKE_BUTTON.show_faces}true{else}false{/if}" width="{$WIDTH_IMG}" action="{$FBP_SOCIAL_PLUGIN_LIKE_BUTTON.action}" colorscheme="{$FBP_SOCIAL_PLUGIN_LIKE_BUTTON.colorscheme}"></fb:like>
+';
+
+  $fbp_content .= '</div>';
+
+  return $content.$fbp_content;
+}
+
+function fbp_loc_begin_picture()
+{
+  global $template, $user, $page, $conf, $picture;
+
+  // set prefilter
+  $template->set_prefilter('header', 'fbp_header');
+  //~ $template->set_prefilter('header', 'fbp_add_fb_init');
+  if ($conf['fbp']['social_plugin_like_button']['enabled'])
+  {
+    $template->set_prefilter('default_content', 'fbp_add_social');
+  }
+}
+
+//~ function fbp_loc_end_picture()
+function fbp_render_element_content($content, $current_picture)
+{
+  global $template, $user, $page, $conf, $picture;
+
+  if ($conf['fbp']['social_plugin_like_button']['enabled'])
+  {
+    //~ $template->set_prefilter('default_content', 'fbp_add_social');
+    // Always use full url for FB social plugin
+    //~ set_make_full_url();
+    // define language
+    $template->assign('LANGUAGE', $user['language']);
+    // define picture FB link
+    set_make_full_url();
+    if ($conf['fbp']['social_plugin_like_button']['url_type'] == 'image')
+    {
+      $fbp_url_picture = get_element_url($picture['current']);
+    }
+    else
+    {
+      $fbp_url_picture = make_picture_url(array('image_id' => $page['image_id']));
+    }
+    unset_make_full_url();
+    $template->assign('FBP_URL_PICTURE', $fbp_url_picture);
+    $template->assign('FBP_SOCIAL_PLUGIN_LIKE_BUTTON', $conf['fbp']['social_plugin_like_button']);
+  }
+  return $content;
+}
+
+function ftp_loc_end_section_init()
+{
+  global $conf;
+
+  if ($conf['fbp']['social_plugin_like_button']['enabled'])
+  {
+    if ($conf['fbp']['allow_fb_access_private_page'])
+    {
+      global $user, $page;
+
+      // No restristion for facebook user
+      if (preg_match('/'.FBP_IP_FB. '/', $_SERVER["REMOTE_ADDR"]))
+      {
+        //Allow guest access
+        $conf['guest_access'] = true;
+        // No forbidden categorie
+        $user['forbidden_categories'] = '';
+        $user['level'] = max($conf['available_permission_levels']);
+        $page['rank_of'][$page['image_id']] = 0;
+        $page['items'] = array_flip($page['rank_of']);
+      }
+    }
+  }
+}
+
+if ($conf['fbp']['social_plugin_like_button']['enabled'])
+{
+  add_event_handler('loc_begin_picture', 'fbp_loc_begin_picture');
+  add_event_handler('render_element_content', 'fbp_render_element_content', null, 2);
+  //~ add_event_handler('loc_end_picture', 'fbp_loc_end_picture');
+  add_event_handler('loc_end_section_init', 'ftp_loc_end_section_init');
+}
+
+?>
Index: /extensions/FacebookPlug/Plugin/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/FacebookPlug/Plugin/language/en_UK/plugin.lang.php	(revision 8241)
+++ /extensions/FacebookPlug/Plugin/language/en_UK/plugin.lang.php	(revision 8241)
@@ -0,0 +1,46 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | FacebookPlug - a Piwigo Plugin                                        |
+// | Copyright (C) 2010 Ruben ARNAUD - rub@piwigo.org                      |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+$lang['page'] = 'page';
+$lang['image'] = 'image';
+$lang['standard'] = 'standard';
+$lang['button_count'] = 'button_count';
+$lang['box_count'] = 'box_count';
+$lang['like'] = 'like';
+$lang['recommend'] = 'recommend';
+$lang['light'] = 'light';
+$lang['dark'] = 'dark';
+$lang['Social plugin'] = 'Social plugin';
+$lang['Advanced'] = 'Advanced';
+$lang['Asynchronous Facebook access'] = 'Asynchronous Facebook access';
+$lang['Allow Facebook to see private page (recommended)'] = 'Allow Facebook to see private page (recommended)';
+$lang['Like button'] = 'Like button';
+$lang['Enabled'] = 'Enabled';
+$lang['URL type'] = 'URL type';
+$lang['Layout style'] = 'Layout style';
+$lang['Show faces'] = 'Voir les faces';
+$lang['Verb to display'] = 'Texte à afficher';
+$lang['Color scheme'] = 'Jeu de couleurs';
+
+?>
Index: /extensions/FacebookPlug/Plugin/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/FacebookPlug/Plugin/language/fr_FR/plugin.lang.php	(revision 8241)
+++ /extensions/FacebookPlug/Plugin/language/fr_FR/plugin.lang.php	(revision 8241)
@@ -0,0 +1,46 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | FacebookPlug - a Piwigo Plugin                                        |
+// | Copyright (C) 2010 Ruben ARNAUD - rub@piwigo.org                      |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+$lang['page'] = 'page';
+$lang['image'] = 'image';
+$lang['standard'] = 'standard';
+$lang['button_count'] = 'bouton avec compteur';
+$lang['box_count'] = 'boite avec compteur';
+$lang['like'] = 'j\'aime';
+$lang['recommend'] = 'recommande';
+$lang['light'] = 'clair';
+$lang['dark'] = 'foncé';
+$lang['Social plugin'] = 'Plugin social';
+$lang['Advanced'] = 'Avancé';
+$lang['Asynchronous Facebook access'] = 'Accès asynchrone à Facebook';
+$lang['Allow Facebook to see private page (recommended)'] = 'Permettre à Facebook de voir les pages privées (recommendé)';
+$lang['Like button'] = 'Bouton "J\'aime"';
+$lang['Enabled'] = 'Activé';
+$lang['URL type'] = 'Type d\'URL';
+$lang['Layout style'] = 'Style d\'affichage';
+$lang['Show faces'] = 'Show face';
+$lang['Verb to display'] = 'Verb to display';
+$lang['Color scheme'] = 'Color scheme';
+
+?>
Index: /extensions/FacebookPlug/Plugin/main.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/main.inc.php	(revision 8240)
+++ /extensions/FacebookPlug/Plugin/main.inc.php	(revision 8241)
@@ -33,16 +33,14 @@
 }
 
-global $conf;
-
-$conf['fbp'] = unserialize($conf['fbp']);
-
 if (script_basename() == 'picture')
 {
-  include_once(dirname(__FILE__).'/picture.inc.php');
+  include_once(dirname(__FILE__).'/include/common.inc.php');
+  include_once(FBP_DIR.'/include/picture.inc.php');
 }
 else
 if (script_basename() == 'admin')
 {
-  //~ include_once(dirname(__FILE__).'/admin.inc.php');
+  include_once(dirname(__FILE__).'/include/common.inc.php');
+  include_once(FBP_DIR.'/include/admin.inc.php');
 }
 
Index: /extensions/FacebookPlug/Plugin/maintain.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/maintain.inc.php	(revision 8240)
+++ /extensions/FacebookPlug/Plugin/maintain.inc.php	(revision 8241)
@@ -32,5 +32,5 @@
   (
     \'fbp\',
-    \''.serialize(array('implementation_type' => 'XFBML')).'\',
+    \''.serialize(array()).'\',
     \'Parameters of "FacebookPlug" plugin\'
   )
Index: tensions/FacebookPlug/Plugin/picture.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/picture.inc.php	(revision 8240)
+++ 	(revision )
@@ -1,138 +1,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | FacebookPlug - a Piwigo Plugin                                        |
-// | Copyright (C) 2010 Ruben ARNAUD - rub@piwigo.org                      |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-if (!defined('PHPWG_ROOT_PATH'))
-{
-  die('Hacking attempt!');
-}
-
-function fbp_AddSocial($content, &$smarty)
-{
-  // iframe implementation
-/*  $fbp_content = '
-<iframe src="http://www.facebook.com/plugins/like.php?href={$SRC_IMG}&amp;layout=standard&amp;show_faces=true&amp;width={$WIDTH_IMG}&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{$WIDTH_IMG}px; height:80px;" allowTransparency="true"></iframe>
-';*/
-
-  // XFBML implementation
-  // async method
-/*  $fbp_content = '
-<div id="fb-root"></div> 
-<script>
-{literal}
-  window.fbAsyncInit = function() { 
-    FB.init({ 
-      appId  : \'111499825588662\', 
-      status : true, // check login status 
-      cookie : true, // enable cookies to allow the server to access the session 
-      xfbml  : true  // parse XFBML 
-    }); 
-  }; 
-  (function() {
-    var e = document.createElement(\'script\');
-  {/literal}
-    e.src = document.location.protocol + \'//connect.facebook.net/{$LANGUAGE}/all.js\';
-{literal}
-    e.async = true;
-    document.getElementById(\'fb-root\').appendChild(e);
-  }());
-{/literal}
-</script>
-';*/
-  // sync method
-  $fbp_content = '
-<div id="fb-root"></div>
-<script src="http://connect.facebook.net/en_US/all.js"></script>
-<script>
-  FB.init({ldelim}
-    appId  : \'111499825588662\',
-    status : true, // check login status
-    cookie : true, // enable cookies to allow the server to access the session
-    xfbml  : true  // parse XFBML
- {rdelim});
-</script>
-<script src="http://connect.facebook.net/{$LANGUAGE}/all.js#xfbml=1"></script>
-';
-  /*$fbp_content .= '
-<fb:like href="{$SRC_IMG}" show_faces="true" width="{$WIDTH_IMG}"></fb:like>
-';*/
-  $fbp_content .= '
-<fb:like href="{$FBP_URL_PICTURE}" show_faces="true" width="{$WIDTH_IMG}"></fb:like>
-';
-
-  return $content.$fbp_content;
-}
-
-function fbp_loc_begin_picture()
-{
-  global $template, $user, $page;
-
-  // set prefilter
-  $template->set_prefilter('header', 'fbp_header');
-  $template->set_prefilter('default_content', 'fbp_AddSocial');
-  // Always use full url for FB social plugin
-  //~ set_make_full_url();
-  // define language
-  $template->assign('LANGUAGE', $user['language']);
-  // define picture FB link
-  set_make_full_url();
-  $template->assign('FBP_URL_PICTURE', make_picture_url(array('image_id' => $page['image_id'])));
-  unset_make_full_url();
-}
-
-function fbp_loc_end_picture()
-{
-  // Restore url
-  //~ unset_make_full_url();
-}
-
-function fbp_header($content, &$smarty)
-{
-  $search = '#<html #';
-
-  $replacement = '<html xmlns:fb="http://www.facebook.com/2008/fbml" ';
-
-  return preg_replace($search, $replacement, $content);
-}
-
-add_event_handler('loc_begin_picture', 'fbp_loc_begin_picture');
-add_event_handler('loc_end_picture', 'fbp_loc_end_picture');
-
-
-function ftp_loc_end_section_init()
-{
-  global $conf, $user, $page;
-
-  $fbp_ip_check = '66.220.';
-  //~ $fbp_ip_check = '127.0.';
-  // No restristion for facebook user
-  if (preg_match('/'. $fbp_ip_check . '/', $_SERVER["REMOTE_ADDR"]))
-  {
-    //Allow guest access
-    $conf['guest_access'] = true;
-    // No forbidden categorie
-    $user['forbidden_categories'] = '';
-    $user['level'] = max($conf['available_permission_levels']);
-    $page['rank_of'][$page['image_id']] = 0;
-    $page['items'] = array_flip($page['rank_of']);
-  }
-}
-add_event_handler('loc_end_section_init', 'ftp_loc_end_section_init');
-
-?>
Index: /extensions/FacebookPlug/Plugin/tpl/admin.config.tpl
===================================================================
--- /extensions/FacebookPlug/Plugin/tpl/admin.config.tpl	(revision 8241)
+++ /extensions/FacebookPlug/Plugin/tpl/admin.config.tpl	(revision 8241)
@@ -0,0 +1,130 @@
+<div class="titrePage">
+  <h2>FacebookPlug</h2>
+</div>
+<br>
+
+<form method="post" class="properties">
+
+<fieldset id="fbpConf">
+  {if isset($social_plugin)}
+  <ul>
+    <h3><a href="{$social_plugin.like_button.FB_PAGE}" onclick="window.open(this.href); return false;">{'Like button'|@translate}</a></h3>
+    <li>
+      <label>
+        <span class="property">{'Enabled'|@translate}</span>
+        <input type="checkbox" name="FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED" {$social_plugin.like_button.ENABLED} />
+      </label>
+    </li>
+
+    <div id='like_button'>
+      <li>
+        <label>
+          <span class="property">{'URL type'|@translate}</span>
+          <select name="FBP_SOCIAL_PLUGIN_LIKE_BUTTON_URL_TYPE" size="1">
+            {html_options options=$social_plugin.like_button.URL_TYPE_OPTIONS selected=$social_plugin.like_button.URL_TYPE_OPTIONS_SELECTED}
+          </select>
+        </label>
+      </li>
+
+      <li>
+        <label>
+          <span class="property">{'Layout style'|@translate}</span>
+          <select name="FBP_SOCIAL_PLUGIN_LIKE_BUTTON_LAYOUT" size="1">
+            {html_options options=$social_plugin.like_button.LAYOUT_OPTIONS selected=$social_plugin.like_button.LAYOUT_OPTIONS_SELECTED}
+          </select>
+        </label>
+      </li>
+      <li>
+        <label>
+          <span class="property">{'Show faces'|@translate}</span>
+          <input type="checkbox" name="FBP_SOCIAL_PLUGIN_LIKE_BUTTON_SHOW_FACES" {$social_plugin.like_button.SHOW_FACES} />
+        </label>
+      </li>
+      <li>
+        <label>
+          <span class="property">{'Verb to display'|@translate}</span>
+          <select name="FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ACTION" size="1">
+            {html_options options=$social_plugin.like_button.ACTION_OPTIONS selected=$social_plugin.like_button.ACTION_OPTIONS_SELECTED}
+          </select>
+        </label>
+      </li>
+      <li>
+        <label>
+          <span class="property">{'Color scheme'|@translate}</span>
+          <select name="FBP_SOCIAL_PLUGIN_LIKE_BUTTON_COLORSCHEME" size="1">
+            {html_options options=$social_plugin.like_button.COLORSCHEME_OPTIONS selected=$social_plugin.like_button.COLORSCHEME_OPTIONS_SELECTED}
+          </select>
+        </label>
+      </li>
+
+{*      <li>
+        <span class="property">
+          <label for="fbp_day_number">{'fbp_day_number'|@translate}</label>
+        </span>
+        <input type="text" size="3" maxlength="4" name="fbp_day_number" id="fbp_day_number" value="{$fbp_DAY_NUMBER}" />
+      </li>*}
+    </div>
+  </ul>
+  {/if}{* isset $social_plugin*}
+
+  {if isset($advanced)}
+  <ul>
+    <li>
+      <label>
+        <span class="property">{'Asynchronous Facebook access'|@translate}</span>
+        <input type="checkbox" name="FBP_ASYNC_SCRIPT" {$advanced.FBP_ASYNC_SCRIPT} />
+      </label>
+    </li>
+
+    <li>
+      <label>
+        <span class="property">{'Allow Facebook to see private page (recommended)'|@translate}</span>
+        <input type="checkbox" name="FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE" {$advanced.FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE} />
+      </label>
+    </li>
+  </ul>
+  {/if}{* isset $advanced*}
+
+</fieldset>
+
+  <p>
+    <input class="submit" type="submit" name="submit" value="{'Submit'|@translate}">
+    <input class="submit" type="reset" name="reset" value="{'Reset'|@translate}">
+  </p>
+
+</form>
+
+{literal}
+<script type="text/javascript">
+  function show_hide(checkbox_name, div_name)
+  {
+    if (jQuery("input[name="+checkbox_name+"]").attr('checked'))
+    {
+      jQuery("#"+div_name).show();
+    }
+    else
+    {
+      jQuery("#"+div_name).hide();
+    }
+  }
+
+  function init_checkbox(checkbox_name, div_name)
+  {
+    jQuery("input[name="+checkbox_name+"]").click(
+      function()
+      {
+        show_hide(checkbox_name, div_name);
+      }
+    );
+    show_hide(checkbox_name, div_name);
+  }
+
+  jQuery(document).ready(
+    function()
+    {
+      //Init all main checkbox
+      init_checkbox("FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED", "like_button");
+    });
+
+</script>
+{/literal}
