Index: /extensions/user_delete_photo/admin/admin.php
===================================================================
--- /extensions/user_delete_photo/admin/admin.php	(revision 21964)
+++ /extensions/user_delete_photo/admin/admin.php	(revision 21964)
@@ -0,0 +1,76 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+global $template, $conf, $user;
+include_once(PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php');
+load_language('plugin.lang', UDP_PATH);
+$my_base_url = get_admin_plugin_menu_link(__FILE__);
+
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok                      |
+// +-----------------------------------------------------------------------+
+check_status(ACCESS_ADMINISTRATOR);
+
+//-------------------------------------------------------- sections definitions
+
+// Gestion des onglets
+if (!isset($_GET['tab']))
+    $page['tab'] = 'gestion';
+else
+    $page['tab'] = $_GET['tab'];
+
+$tabsheet = new tabsheet();
+$tabsheet->add('gestion',
+               l10n('Configuration'),
+               $my_base_url.'&amp;tab=gestion');
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+// Onglet gest
+switch ($page['tab'])
+{
+  case 'gestion':
+
+  global $conf;
+  
+    $selected = $conf['udp'];
+	$options['Author'] = l10n('Author');
+	$options['datecreate'] = l10n('Created on');
+	$options['datepost'] = l10n('Posted on');
+	$options['Dimensions'] = l10n('Dimensions');
+	$options['File'] = l10n('File');
+	$options['Filesize'] = l10n('Filesize');
+	$options['Tags'] = l10n('tags');
+	$options['Categories'] = l10n('Albums');
+	$options['Visits'] = l10n('Visits');
+	$options['Average'] = l10n('Rating score');
+
+	
+
+  $template->assign(
+    'gestionA',
+    array(
+      'OPTIONS' => $options,
+      'SELECTED' => $selected
+      ));
+   
+
+if (isset($_POST['infoudp']))
+	{
+conf_update_param('udp', $_POST['infoudp']);
+$template->delete_compiled_templates();
+array_push($page['infos'], l10n('Your configuration settings are saved'));
+
+  $selected = $_POST['infoudp'];
+  $template->assign(
+    'gestionA',
+    array(
+      'OPTIONS' => $options,
+      'SELECTED' => $selected
+      ));
+	}
+  break;
+} 
+
+$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); 
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/user_delete_photo/admin/admin.tpl
===================================================================
--- /extensions/user_delete_photo/admin/admin.tpl	(revision 21964)
+++ /extensions/user_delete_photo/admin/admin.tpl	(revision 21964)
@@ -0,0 +1,18 @@
+<div class="titrePage">
+  <h2>user delete photo</h2>
+</div>
+{if isset ($gestionA)}
+	<div>
+		<form method="post">
+			<fieldset>
+				<legend>{'Add information before'|@translate}</legend>
+		{html_options name="infoudp" options=$gestionA.OPTIONS selected=$gestionA.SELECTED}
+				<br>	
+				<br>
+					<div style="text-align:center;">
+					<input class="submit" name="submitudp" type="submit" value="{'Save Settings'|@translate}">
+					</div>
+			</fieldset>
+		</form>
+	</div>
+{/if}
Index: /extensions/user_delete_photo/admin/index.php
===================================================================
--- /extensions/user_delete_photo/admin/index.php	(revision 21964)
+++ /extensions/user_delete_photo/admin/index.php	(revision 21964)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2013 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/user_delete_photo/index.php
===================================================================
--- /extensions/user_delete_photo/index.php	(revision 21964)
+++ /extensions/user_delete_photo/index.php	(revision 21964)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 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/user_delete_photo/initpicture.php
===================================================================
--- /extensions/user_delete_photo/initpicture.php	(revision 21964)
+++ /extensions/user_delete_photo/initpicture.php	(revision 21964)
@@ -0,0 +1,90 @@
+<?php
+
+
+
+//Ajout du prefiltre
+add_event_handler('loc_begin_picture', 'udp', 55 );
+
+function udp()
+ {
+	global $template;
+	$template->set_prefilter('picture', 'udpT');
+ }
+
+function udpT($content, &$smarty)
+ {
+	  global $conf;
+ 
+  $search = '#<div id="'.$conf['udp'].'" class="imageInfo">#';
+  
+  $replacement = '
+
+{if $UDFA}
+  <div id="udp" class="imageInfo">
+    <form method="post">
+	  <input class="submit" name="submitudpA" type="submit" value="{\'delete photo\'|@translate}">
+	  <label><input type="checkbox" name="confirm_deletionudp" value="1"> {\'Are you sure?\'|@translate}</label>
+    </form>
+  </div>
+{/if}
+<div id="'.$conf['udp'].'" class="imageInfo">';
+
+  return preg_replace($search, $replacement, $content);
+ }
+
+add_event_handler('loc_begin_picture', 'udpA');
+
+function udpA()
+{
+global $conf, $page, $template  ;
+load_language('plugin.lang', UDP_PATH);
+load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
+
+	  global $conf, $user, $page;
+
+  $query = '
+select added_by
+  FROM ' . IMAGES_TABLE . '
+  WHERE id = \''.$page['image_id'].'\'
+  ;';
+$result = pwg_query($query);
+$row = pwg_db_fetch_assoc($result);
+$userudp=$row['added_by'];
+  
+  $query = '
+select username
+  FROM ' . USERS_TABLE . '
+  WHERE id = \''.$userudp.'\'
+  ;';
+$result = pwg_query($query);
+$row = pwg_db_fetch_assoc($result);
+$udp=$row['username'];
+
+if (($udp == $user['username']))
+ {
+		    $template->assign(		array	(
+		'UDFA' => 'udp',
+				)			);
+ }
+
+if ((isset($_POST['submitudpA']) and ($udp == $user['username'])))
+  {
+	
+	if (!(isset($_POST['confirm_deletionudp']) and 1 == $_POST['confirm_deletionudp']))
+	{
+	 array_push($page['errors'], l10n('You need to confirm deletion'));
+	}
+	else
+	{
+	include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+	  global $page;
+	$deletephotoudp =array($page['image_id']);
+	delete_elements($deletephotoudp, true);
+	$redirect_url = get_root_url().'index.php?/category/'.($page['category']['id']);
+        redirect($redirect_url);
+	}
+  }
+}
+			
+
+?>
Index: /extensions/user_delete_photo/language/en_UK/description.txt
===================================================================
--- /extensions/user_delete_photo/language/en_UK/description.txt	(revision 21964)
+++ /extensions/user_delete_photo/language/en_UK/description.txt	(revision 21964)
@@ -0,0 +1,1 @@
+Users can delete their photos (option on the photo page)
Index: /extensions/user_delete_photo/language/en_UK/index.php
===================================================================
--- /extensions/user_delete_photo/language/en_UK/index.php	(revision 21964)
+++ /extensions/user_delete_photo/language/en_UK/index.php	(revision 21964)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 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/user_delete_photo/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/user_delete_photo/language/en_UK/plugin.lang.php	(revision 21964)
+++ /extensions/user_delete_photo/language/en_UK/plugin.lang.php	(revision 21964)
@@ -0,0 +1,3 @@
+<?php
+$lang['Add information before'] = 'Add information before';
+?>
Index: /extensions/user_delete_photo/language/fr_FR/description.txt
===================================================================
--- /extensions/user_delete_photo/language/fr_FR/description.txt	(revision 21964)
+++ /extensions/user_delete_photo/language/fr_FR/description.txt	(revision 21964)
@@ -0,0 +1,1 @@
+Les utilisateurs peuvent supprimer les photos qu'ils ont ajouter. (option sur la page de visualisation de la photo)
Index: /extensions/user_delete_photo/language/fr_FR/index.php
===================================================================
--- /extensions/user_delete_photo/language/fr_FR/index.php	(revision 21964)
+++ /extensions/user_delete_photo/language/fr_FR/index.php	(revision 21964)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 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/user_delete_photo/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/user_delete_photo/language/fr_FR/plugin.lang.php	(revision 21964)
+++ /extensions/user_delete_photo/language/fr_FR/plugin.lang.php	(revision 21964)
@@ -0,0 +1,3 @@
+<?php
+$lang['Add information before'] = 'Ajouter l\'information avant';
+?>
Index: /extensions/user_delete_photo/language/index.php
===================================================================
--- /extensions/user_delete_photo/language/index.php	(revision 21964)
+++ /extensions/user_delete_photo/language/index.php	(revision 21964)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 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/user_delete_photo/main.inc.php
===================================================================
--- /extensions/user_delete_photo/main.inc.php	(revision 21964)
+++ /extensions/user_delete_photo/main.inc.php	(revision 21964)
@@ -0,0 +1,35 @@
+<?php
+/*
+Plugin Name: user delete photo
+Version: auto
+Description: Users can delete their photos (option on the photo page)
+Plugin URI: http://piwigo.org/ext/extension_view.php?eid=690
+Author: ddtddt
+Author URI: 
+*/
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $prefixeTable;
+
+define('UDP_DIR' , basename(dirname(__FILE__)));
+define('UDP_PATH' , PHPWG_PLUGINS_PATH . UDP_DIR . '/');
+
+
+ // Plugin on picture page
+if (script_basename() == 'picture')  
+{  
+  include_once(dirname(__FILE__).'/initpicture.php');
+}
+
+// menu admin
+add_event_handler('get_admin_plugin_menu_links', 'UDP_admin_menu');
+function UDP_admin_menu($menu)
+{
+  array_push($menu, array(
+	'NAME' => 'user delete photo',
+    'URL' => get_admin_plugin_menu_link(UDP_PATH . 'admin/admin.php')));
+  return $menu;
+}
+
+?>
Index: /extensions/user_delete_photo/maintain.inc.php
===================================================================
--- /extensions/user_delete_photo/maintain.inc.php	(revision 21964)
+++ /extensions/user_delete_photo/maintain.inc.php	(revision 21964)
@@ -0,0 +1,25 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+function plugin_install()
+{
+    global $prefixeTable;
+
+	$query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("udp","datecreate","user delete photo");';
+    pwg_query($query);
+
+}
+
+
+function plugin_uninstall()
+{
+	global $prefixeTable;
+
+
+	$q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="udp" LIMIT 1;';
+    pwg_query($q);
+}
+
+
+?>
