Index: /extensions/TweetThis/admin.php
===================================================================
--- /extensions/TweetThis/admin.php	(revision 11419)
+++ /extensions/TweetThis/admin.php	(revision 11419)
@@ -0,0 +1,29 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $conf, $template, $page;
+
+load_language('plugin.lang', TWEET_PATH);
+$conf['TweetThis'] = explode(',', $conf['TweetThis']);
+
+if (isset($_POST['submit']))
+{
+  $conf['TweetThis'] = array(
+    $_POST['button_style'],
+    $_POST['position'],
+    );
+  
+  conf_update_param('TweetThis', implode(',', $conf['TweetThis']));
+  array_push($page['infos'], l10n('Information data registered in database'));
+}
+
+$template->assign(array(
+  'button_style' => $conf['TweetThis'][0],
+  'position' => $conf['TweetThis'][1],
+  'TWEET_PATH' => TWEET_PATH,
+));
+
+$template->set_filename('tweet_content', dirname(__FILE__).'/admin.tpl');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'tweet_content');
+
+?>
Index: /extensions/TweetThis/admin.tpl
===================================================================
--- /extensions/TweetThis/admin.tpl	(revision 11419)
+++ /extensions/TweetThis/admin.tpl	(revision 11419)
@@ -0,0 +1,84 @@
+{combine_css path=$TWEET_PATH|@cat:"style.css"}
+
+<div class="titrePage">
+	<h2>TweetThis</h2>
+</div>
+
+<form method="post" action="" class="properties" ENCTYPE="multipart/form-data"> 
+	<fieldset>
+		<legend>{'Configuration'|@translate}</legend>	  
+    
+    <ul>
+      <li>
+      
+      <table class="twitter_buttons">
+        <tr>
+          <td><label>
+            <img src="http://twitter-badges.s3.amazonaws.com/twitter-a.png"/>
+            <input type="radio" name="button_style" value="twitter-a" {if $button_style == 'twitter-a'}checked="checked"{/if}/>
+          </label></td>
+          <td><label>
+            <img src="http://twitter-badges.s3.amazonaws.com/t_logo-a.png"/>
+            <input type="radio" name="button_style" value="t_logo-a" {if $button_style == 't_logo-a'}checked="checked"{/if}/>
+          </label></td>
+          <td><label>
+            <img src="http://twitter-badges.s3.amazonaws.com/t_small-a.png"/>
+            <input type="radio" name="button_style" value="t_small-a" {if $button_style == 't_small-a'}checked="checked"{/if}/>
+          </label></td>
+          <td><label>
+            <img src="http://twitter-badges.s3.amazonaws.com/t_mini-a.png"/>
+            <input type="radio" name="button_style" value="t_mini-a" {if $button_style == 't_mini-a'}checked="checked"{/if}/>
+          </label></td>
+        </tr>
+        <tr>
+          <td><label>
+            <img src="http://twitter-badges.s3.amazonaws.com/twitter-b.png"/>
+            <input type="radio" name="button_style" value="twitter-b" {if $button_style == 'twitter-b'}checked="checked"{/if}/>
+          </label></td>
+          <td><label>
+            <img src="http://twitter-badges.s3.amazonaws.com/t_logo-b.png"/>
+            <input type="radio" name="button_style" value="t_logo-b" {if $button_style == 't_logo-b'}checked="checked"{/if}/>
+          </label></td>
+          <td><label>
+            <img src="http://twitter-badges.s3.amazonaws.com/t_small-b.png"/>
+            <input type="radio" name="button_style" value="t_small-b" {if $button_style == 't_small-b'}checked="checked"{/if}/>
+          </label></td>
+          <td><label>
+            <img src="http://twitter-badges.s3.amazonaws.com/t_mini-b.png"/>
+            <input type="radio" name="button_style" value="t_mini-b" {if $button_style == 't_mini-b'}checked="checked"{/if}/>
+          </label></td>
+        </tr>
+        <tr>
+          <td><label>
+            <img src="http://twitter-badges.s3.amazonaws.com/twitter-c.png"/>
+            <input type="radio" name="button_style" value="twitter-c" {if $button_style == 'twitter-c'}checked="checked"{/if}/>
+          </label></td>
+          <td><label>
+            <img src="http://twitter-badges.s3.amazonaws.com/t_logo-c.png"/>
+            <input type="radio" name="button_style" value="t_logo-c" {if $button_style == 't_logo-c'}checked="checked"{/if}/>
+          </label></td>
+          <td><label>
+            <img src="http://twitter-badges.s3.amazonaws.com/t_small-c.png"/>
+            <input type="radio" name="button_style" value="t_small-c" {if $button_style == 't_small-c'}checked="checked"{/if}/>
+          </label></td>
+          <td><label>
+            <img src="http://twitter-badges.s3.amazonaws.com/t_mini-c.png"/>
+            <input type="radio" name="button_style" value="t_mini-c" {if $button_style == 't_mini-c'}checked="checked"{/if}/>
+          </label></td>
+        </tr>
+      </table>
+      
+    </li>
+    
+    <li>
+      <span class="property">{'Link position'|@translate}</span>
+      <label><input type="radio" name="position" value="top" {if $position == 'top'}checked="checked"{/if}/> {'Top'|@translate}</label>
+      <label><input type="radio" name="position" value="bottom" {if $position == 'bottom'}checked="checked"{/if}/> {'Bottom'|@translate}</label>
+      <label><input type="radio" name="position" value="toolbar" {if $position == 'toolbar'}checked="checked"{/if}/> {'Toolbar'|@translate}</label>
+    </li>
+  </ul>
+  
+	</fieldset>
+		
+	<p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p>
+</form>
Index: /extensions/TweetThis/index.php
===================================================================
--- /extensions/TweetThis/index.php	(revision 11419)
+++ /extensions/TweetThis/index.php	(revision 11419)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery                                    |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | 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/TweetThis/language/en_UK/description.txt
===================================================================
--- /extensions/TweetThis/language/en_UK/description.txt	(revision 11419)
+++ /extensions/TweetThis/language/en_UK/description.txt	(revision 11419)
@@ -0,0 +1,1 @@
+Add a "Tweet This" button on picture pages
Index: /extensions/TweetThis/language/en_UK/index.php
===================================================================
--- /extensions/TweetThis/language/en_UK/index.php	(revision 11419)
+++ /extensions/TweetThis/language/en_UK/index.php	(revision 11419)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | 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/TweetThis/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/TweetThis/language/en_UK/plugin.lang.php	(revision 11419)
+++ /extensions/TweetThis/language/en_UK/plugin.lang.php	(revision 11419)
@@ -0,0 +1,9 @@
+<?php
+
+$lang['Link position'] = 'Button position';
+$lang['Top'] = 'Top';
+$lang['Bottom'] = 'Bottom';
+$lang['Toolbar'] = 'Toolbar';
+$lang['Share on Twitter'] = 'Share on Twitter';
+
+?>
Index: /extensions/TweetThis/language/fr_FR/description.txt
===================================================================
--- /extensions/TweetThis/language/fr_FR/description.txt	(revision 11419)
+++ /extensions/TweetThis/language/fr_FR/description.txt	(revision 11419)
@@ -0,0 +1,1 @@
+Ajoute un bouton "Partager sur Twitter" sur la page de l'image
Index: /extensions/TweetThis/language/fr_FR/index.php
===================================================================
--- /extensions/TweetThis/language/fr_FR/index.php	(revision 11419)
+++ /extensions/TweetThis/language/fr_FR/index.php	(revision 11419)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | 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/TweetThis/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/TweetThis/language/fr_FR/plugin.lang.php	(revision 11419)
+++ /extensions/TweetThis/language/fr_FR/plugin.lang.php	(revision 11419)
@@ -0,0 +1,9 @@
+<?php
+
+$lang['Link position'] = 'Position du bouton';
+$lang['Top'] = 'Haut';
+$lang['Bottom'] = 'Bas';
+$lang['Toolbar'] = 'Barre d\'outils';
+$lang['Share on Twitter'] = 'Partager sur Twitter';
+
+?>
Index: /extensions/TweetThis/language/index.php
===================================================================
--- /extensions/TweetThis/language/index.php	(revision 11419)
+++ /extensions/TweetThis/language/index.php	(revision 11419)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | 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/TweetThis/main.inc.php
===================================================================
--- /extensions/TweetThis/main.inc.php	(revision 11419)
+++ /extensions/TweetThis/main.inc.php	(revision 11419)
@@ -0,0 +1,90 @@
+<?php
+/*
+Plugin Name: TweetThis
+Version: auto
+Description: Add a "Tweet This" button on picture pages
+Plugin URI: http://piwigo.org/ext/extension_view.php?eid=560
+Author: Mistic
+Author URI: http://www.strangeplanet.fr
+*/
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+define('TWEET_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
+
+load_language('plugin.lang', TWEET_PATH);
+add_event_handler('loc_end_picture', 'tweet_add_button');
+
+
+function tweet_add_button() 
+{
+  global $conf, $template;
+  $conf['TweetThis'] = explode(',', $conf['TweetThis']);
+  
+  $template->assign(array(
+    'TWEET_IMAGE' => $conf['TweetThis'][0],
+    'TWEET_POSITON' => $conf['TweetThis'][1],
+  ));
+      
+  $template->set_prefilter('picture', 'tweet_add_button_prefilter');
+}
+
+function tweet_add_button_prefilter($content, &$smarty)
+{
+  global $template;
+  
+  switch ($template->get_template_vars('TWEET_POSITON'))
+  {
+    case 'top':
+      $search = '<div id="theImage">';
+      $replace = '
+<a href="http://twitter.com/share" class="twitter-share-button" title="{\'Share on Twitter\'|@translate}" style="display:block;">
+  <img src="http://twitter-badges.s3.amazonaws.com/{$TWEET_IMAGE}.png"/>
+</a>
+';
+      break;
+      
+    case 'bottom':
+      $search = '{$ELEMENT_CONTENT}';
+      $replace = '
+<a href="http://twitter.com/share" class="twitter-share-button" title="{\'Share on Twitter\'|@translate}" style="display:block;">
+  <img src="http://twitter-badges.s3.amazonaws.com/{$TWEET_IMAGE}.png"/>
+</a>
+';
+      break;
+      
+    case 'toolbar':
+      $search = '{/if}{/strip}{*caddie management END*}';
+      $replace = '
+<a href="http://twitter.com/share" class="twitter-share-button pwg-button" title="{\'Share on Twitter\'|@translate}">
+  <img src="http://twitter-badges.s3.amazonaws.com/{$TWEET_IMAGE}.png"/>
+</a>
+';
+      break;
+  }
+  
+  $replace = $search . $replace . '{combine_script id=\'twitter_widgets\' path=\'http://platform.twitter.com/widgets.js\'}';
+
+  return str_replace($search, $replace, $content);
+}
+
+
+if (script_basename() == 'admin')
+{
+  add_event_handler('get_admin_plugin_menu_links', 'tweet_plugin_admin_menu');
+
+  function tweet_plugin_admin_menu($menu)
+  {
+    array_push(
+      $menu,
+      array(
+        'NAME' => 'TweetThis',
+        'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
+        )
+      );
+    
+    return $menu;
+  }
+}
+
+?>
Index: /extensions/TweetThis/maintain.inc.php
===================================================================
--- /extensions/TweetThis/maintain.inc.php	(revision 11419)
+++ /extensions/TweetThis/maintain.inc.php	(revision 11419)
@@ -0,0 +1,14 @@
+<?php
+function plugin_install()
+{
+  global $conf;
+  
+  pwg_query('INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("TweetThis","twitter-a,toolbar","TweetButton config");');
+}
+
+function plugin_uninstall()
+{
+  pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="TweetThis" LIMIT 1');
+}
+
+?>
Index: /extensions/TweetThis/style.css
===================================================================
--- /extensions/TweetThis/style.css	(revision 11419)
+++ /extensions/TweetThis/style.css	(revision 11419)
@@ -0,0 +1,22 @@
+.twitter_buttons {
+  border-spacing: 0px;
+  border:10px solid #f9f9f9;
+  border-radius:10px;
+}
+
+.twitter_buttons td {
+  padding:10px 40px;
+  background-color:#ECF6FA;
+  border:1px solid #fff;
+  border-right-color:#CDE8F4;
+  border-bottom-color:#CDE8F4;
+}
+.twitter_buttons td:hover {
+  background-color:#D0E7F2;
+}
+tr td:last-child {
+  border-right:none;
+}
+.twitter_buttons tr:last-child td {
+  border-bottom:none;
+}
