Index: tensions/Front2Back/Front2Back.css
===================================================================
--- /extensions/Front2Back/Front2Back.css	(revision 9783)
+++ 	(revision )
@@ -1,11 +1,0 @@
-a.reverse {
-	display:inline-block;
-	border:1px solid #666 !important;
-	padding:3px 5px;
-	margin-bottom:10px;
-	font-size:15px;
-	font-style:italic;	
-}
-a.reverse img {
-	vertical-align:top;
-}
Index: /extensions/Front2Back/Front2Back.php
===================================================================
--- /extensions/Front2Back/Front2Back.php	(revision 9783)
+++ /extensions/Front2Back/Front2Back.php	(revision 9784)
@@ -5,34 +5,28 @@
 {
 	global $template, $conf;
-	
-	/* Default values */
-	if (!isset($conf['Front2Back_dir'])) $conf['Front2Back_dir'] = 'verso/'; 
-	if (!isset($conf['Front2Back_parent'])) $conf['Front2Back_parent'] = 'thumbnail/';
-	if (!isset($conf['Front2Back_hd_parent'])) $conf['Front2Back_hd_parent'] = 'pwg_high/';
-	if (!isset($conf['Front2Back_path']))
-		$conf['Front2Back_inside']= true;
-	else 
-		$conf['Front2Back_inside']= false; 
+	$conf['Front2Back'] = explode(',', $conf['Front2Back']);
+	load_language('plugin.lang', F2B_PATH);
 
 	/* dirs and files */
-	if ( $conf['Front2Back_inside'] ) {
-		$verso_dir = str_replace($image['file'], null, $image['path']) . $conf['Front2Back_parent'] . $conf['Front2Back_dir'];
-		$hd_dir = str_replace($image['file'], null, $image['path']) . $conf['Front2Back_hd_parent'] . $conf['Front2Back_dir'];
+	if (empty($conf['Front2Back'][0])) {
+		$verso_dir = str_replace($image['file'], null, $image['path']) . $conf['Front2Back'][1];
+		$hd_dir = str_replace($image['file'], null, $image['path']) . $conf['Front2Back'][2];
 	} else {
-		$verso_dir = $conf['Front2Back_path'] . $conf['Front2Back_parent'] . $conf['Front2Back_dir'];
-		$hd_dir = $conf['Front2Back_path'] . $conf['Front2Back_hd_parent'] . $conf['Front2Back_dir'];
+		$verso_dir = PHPWG_ROOT_PATH . $conf['Front2Back'][0] . $conf['Front2Back'][1];
+		$hd_dir = PHPWG_ROOT_PATH . $conf['Front2Back'][0] . $conf['Front2Back'][2];
 	}
-	$rotat_file = substr($image['file'],0,-4).'-r'.substr($image['file'],-4);
+	$verso_file = get_filename_wo_extension($image['file']) . $conf['Front2Back'][3] . '.' . get_extension($image['file']);
+	$rotat_file = get_filename_wo_extension($image['file']) . '-r.' . get_extension($image['file']);
 
-	$template->set_filenames(array('Front2Back' => dirname(__FILE__) . '/Front2Back.tpl') );
+	$template->set_filenames(array('Front2Back' => dirname(__FILE__) . '/template/Front2Back.tpl') );
 	$template->assign('F2B_PATH', F2B_PATH);
 
 	/* Is there a verso file ? */
-	if (is_file($verso_dir.$image['file'])) 
+	if (is_file($verso_dir.$verso_file)) 
 	{
-		$template->assign('VERSO_URL', $verso_dir.$image['file']);
+		$template->assign('VERSO_URL', $verso_dir.$verso_file);
 
-		if (is_file($hd_dir.$image['file'])) {
-			$template->assign('VERSO_HD', $hd_dir.$image['file']);
+		if (is_file($hd_dir.$verso_file)) {
+			$template->assign('VERSO_HD', $hd_dir.$verso_file);
 		}
 	}
Index: tensions/Front2Back/Front2Back.tpl
===================================================================
--- /extensions/Front2Back/Front2Back.tpl	(revision 9783)
+++ 	(revision )
@@ -1,45 +1,0 @@
-{combine_script id="jquery"}
-{combine_css path=$F2B_PATH|@cat:"Front2Back.css"}
-
-{footer_script require="jquery"}
-	jQuery('.reverse').click(function() {ldelim}
-		if (jQuery(this).attr('name') == 'front') {ldelim}
-			/* picture attributes */
-			jQuery('#theImage img:first-child').attr({ldelim}
-				src: '{$VERSO_URL}',
-				style: 'width:;height:;',
-			});
-			
-			/* hd link atributes */
-			{if isset($VERSO_HD)}
-			jQuery('#theImage a:first-child').attr({ldelim}
-				href: "javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"
-			});
-			{/if}
-			
-			/* f2b link content */
-			jQuery(this).html('<img src="{$F2B_PATH}rotate_2.png"/> {'Front2Back_front'|@translate}');
-			jQuery(this).attr('name', 'back');
-			
-		} else if (jQuery(this).attr('name') == 'back') {ldelim}
-			jQuery('#theImage img:first-child').attr({ldelim}
-				src: '{$SRC_IMG}',
-				style: 'width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;',
-			});
-			
-			{if isset($VERSO_HD)}
-			jQuery('#theImage a:first-child').attr({ldelim}
-				href: "javascript:phpWGOpenWindow('{$high.U_HIGH}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')')"
-			});
-			{/if}
-			
-			jQuery(this).html('<img src="{$F2B_PATH}rotate_1.png"/> {'Front2Back_back'|@translate}');
-			jQuery(this).attr('name', 'front');
-		}
-	});
-{/footer_script}
-
-<a class="reverse" name="front">
-	<img src="{$F2B_PATH}rotate_1.png"/>
-	{'Front2Back_back'|@translate}
-</a>
Index: /extensions/Front2Back/admin.php
===================================================================
--- /extensions/Front2Back/admin.php	(revision 9784)
+++ /extensions/Front2Back/admin.php	(revision 9784)
@@ -0,0 +1,36 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $conf, $template;
+load_language('plugin.lang', F2B_PATH);
+$conf['Front2Back'] = explode(',', $conf['Front2Back']);
+
+// Enregistrement de la configuration
+if (isset($_POST['submit']))
+{
+	$conf['Front2Back'] = array(
+		!empty($_POST['path']) ? rtrim($_POST['path'],'/').'/' : '',
+		!empty($_POST['parent']) ? rtrim($_POST['parent'],'/').'/' : '',
+		!empty($_POST['hd_parent']) ? rtrim($_POST['hd_parent'],'/').'/' : '',
+		!empty($_POST['suffix']) ? $_POST['suffix'] : '',
+	);
+			
+    $query = 'UPDATE ' . CONFIG_TABLE . '
+		SET value="' . implode (',', $conf['Front2Back']) . '"
+		WHERE param="Front2Back"';
+    pwg_query($query);
+	
+	array_push($page['infos'], l10n('Information data registered in database'));
+}
+
+$template->assign(array(
+	'PATH' => $conf['Front2Back'][0],
+	'PARENT' => $conf['Front2Back'][1],
+	'HD_PARENT' => $conf['Front2Back'][2],
+	'SUFFIX' => $conf['Front2Back'][3],
+));
+	
+$template->set_filename('Front2Back_conf', dirname(__FILE__).'/template/admin.tpl');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'Front2Back_conf');
+
+?>
Index: /extensions/Front2Back/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/Front2Back/language/en_UK/plugin.lang.php	(revision 9783)
+++ /extensions/Front2Back/language/en_UK/plugin.lang.php	(revision 9784)
@@ -4,3 +4,35 @@
 $lang['Front2Back_front'] = 'See front';
 
+$lang['f2b_path'] = "Back sides' folder";
+$lang['f2b_parent'] = "Web sized pics' sub-folder";
+$lang['f2b_hd_parent'] = "HD pics' sub-folder";
+$lang['f2b_suffix'] = "Suffix";
+
+$lang['f2b_help'] = "
+<fieldset>
+	<legend>Usage examples</legend>
+	<fieldset>
+		If you put the web sized back side in <i>thumbnail/back/</i> subfolder of your normal image directory and the high-definition back side in the subfolder <i>pwg_high/back/</i>, use the basic configuration:<ul>
+			<li><b>Back sides' folder:</b> <i>empty</i>
+			<li><b>Web sized pics' sub-folder:</b> thumbnail/verso/</li>
+			<li><b>HD pics' sub-folder:</b> pwg_high/verso/</li>
+		</ul>
+	</fieldset>
+	
+	<fieldset>
+		If you prefer to put your backs into a different folder, change the value of the first parameter (relative to the root of the site). Keep in mind that in this case the tree of your gallery is not reproduced, and two images with the same name in two different albums will load the same back side.
+		<br>For example you can use this setup to search the web sided backs in <i>[ROOT]/verso/</i> and HD backs in <i>[ROOT]/verso/hd/</i>
+		<ul>
+			<li><b>Back sides' folder:</b> verso/
+			<li><b>Web sized pics' sub-folder:</b> <i>empty</i></li>
+			<li><b>HD pics' sub-folder:</b> hd/</li>
+		</ul>
+	</fieldset>
+	
+	<fieldset>
+		Anyway the back side pic may have the same name as the normal pic, in this case let <b>Suffix</b> empty, or a name with suffix.
+	</fieldset>
+</fieldset>
+";
+
 ?>
Index: /extensions/Front2Back/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/Front2Back/language/fr_FR/plugin.lang.php	(revision 9783)
+++ /extensions/Front2Back/language/fr_FR/plugin.lang.php	(revision 9784)
@@ -4,3 +4,36 @@
 $lang['Front2Back_front'] = 'Voir le devant';
 
+$lang['f2b_path'] = "Dossier des versos";
+$lang['f2b_parent'] = "Sous-dossier des images web";
+$lang['f2b_hd_parent'] = "Sous-dossier des images HD";
+$lang['f2b_suffix'] = "Suffixe de détection";
+
+$lang['f2b_help'] = "
+<fieldset>
+	<legend>Exemples d'utilisation</legend>
+	<fieldset>
+		Si vous placez le verso taille web dans le sous-dossier <i>thumbnail/verso/</i> du dossier de votre image normale et le verso haute-définition dans le sous-dossier <i>pwg_high/verso/</i>, utilisez la configuration de base :
+		<ul>
+			<li><b>Dossier des versos :</b> <i>vide</i>
+			<li><b>Sous-dossier des images web :</b> thumbnail/verso/</li>
+			<li><b>Sous-dossier des images HD :</b> pwg_high/verso/</li>
+		</ul>
+	</fieldset>
+	
+	<fieldset>
+		Si vous préferez placer vos versos dans un tout autre dossier changez la valeur du premier paramètre (relatif à la racine du site). Gardez à l'esprit que dans ce cas l'arborescence de votre galerie n'est pas reproduite, et deux images qui ont le même nom dans deux albums différents chargeront le même verso.
+		<br>Par exemple vous pouvez utiliser cette configuration pour chercher les versos web dans <i>[RACINE]/verso/</i> et les versos HD dans <i>[RACINE]/verso/hd/</i>
+		<ul>
+			<li><b>Dossier des versos :</b> verso/
+			<li><b>Sous-dossier des images web :</b> <i>vide</i></li>
+			<li><b>Sous-dossier des images HD :</b> hd/</li>
+		</ul>
+	</fieldset>
+	
+	<fieldset>
+		Dans tous les cas les versos peuvent avoir le même nom que les images normale, dans ce cas laisser <b>Suffixe de détection</b> vide, ou un nom avec suffixe.
+	</fieldset>
+</fieldset>
+";
+
 ?>
Index: /extensions/Front2Back/main.inc.php
===================================================================
--- /extensions/Front2Back/main.inc.php	(revision 9783)
+++ /extensions/Front2Back/main.inc.php	(revision 9784)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: Front2Back
-Version: 2.2.0
+Version: 2.2.a
 Description: Add a link on picture's page to show a alternative version of the pic (for postcards for example)
 Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=183
@@ -13,7 +13,18 @@
 define('F2B_PATH', PHPWG_PLUGINS_PATH . F2B_DIR . '/');
 
-load_language('plugin.lang', F2B_PATH);
 include_once(F2B_PATH . 'Front2Back.php');
 add_event_handler('render_element_content', 'Front2Back_content', 99, 2);
 	
+if (script_basename() == 'admin')
+{
+	add_event_handler('get_admin_plugin_menu_links', 'Front2Back_admin_menu');
+	function Front2Back_admin_menu($menu) 
+	{
+		array_push($menu, array(
+			'NAME' => 'Front2Back',
+			'URL' => get_root_url().'admin.php?page=plugin-' . F2B_DIR));
+		return $menu;
+	}
+}
+
 ?>
Index: /extensions/Front2Back/maintain.inc.php
===================================================================
--- /extensions/Front2Back/maintain.inc.php	(revision 9784)
+++ /extensions/Front2Back/maintain.inc.php	(revision 9784)
@@ -0,0 +1,24 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+function plugin_install()
+{
+	global $conf;
+
+	if (!isset($conf['Front2Back'])) {
+		$q = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
+			VALUES ("Front2Back", ",thumbnail/verso/,pwg_high/verso/,", "Parametres Front2Back");';
+		pwg_query($q);
+	}
+}
+
+function plugin_uninstall()
+{
+	global $conf;
+
+	if (isset($conf['Front2Back'])) {
+		pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE param="Front2Back";');
+	}
+}
+
+?>
Index: /extensions/Front2Back/template/Front2Back.css
===================================================================
--- /extensions/Front2Back/template/Front2Back.css	(revision 9784)
+++ /extensions/Front2Back/template/Front2Back.css	(revision 9784)
@@ -0,0 +1,11 @@
+a.reverse {
+	display:inline-block;
+	border:1px solid #666 !important;
+	padding:3px 5px;
+	margin-bottom:10px;
+	font-size:15px;
+	font-style:italic;	
+}
+a.reverse img {
+	vertical-align:top;
+}
Index: /extensions/Front2Back/template/Front2Back.tpl
===================================================================
--- /extensions/Front2Back/template/Front2Back.tpl	(revision 9784)
+++ /extensions/Front2Back/template/Front2Back.tpl	(revision 9784)
@@ -0,0 +1,45 @@
+{combine_script id="jquery"}
+{combine_css path=$F2B_PATH|@cat:"template/Front2Back.css"}
+
+{footer_script require="jquery"}
+	jQuery('.reverse').click(function() {ldelim}
+		if (jQuery(this).attr('name') == 'front') {ldelim}
+			/* picture attributes */
+			jQuery('#theImage img:first-child').attr({ldelim}
+				src: '{$VERSO_URL}',
+				style: 'width:;height:;',
+			});
+			
+			/* hd link atributes */
+			{if isset($VERSO_HD)}
+			jQuery('#theImage a:first-child').attr({ldelim}
+				href: "javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"
+			});
+			{/if}
+			
+			/* f2b link content */
+			jQuery(this).html('<img src="{$F2B_PATH}template/rotate_2.png"/> {'Front2Back_front'|@translate}');
+			jQuery(this).attr('name', 'back');
+			
+		} else if (jQuery(this).attr('name') == 'back') {ldelim}
+			jQuery('#theImage img:first-child').attr({ldelim}
+				src: '{$SRC_IMG}',
+				style: 'width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;',
+			});
+			
+			{if isset($VERSO_HD)}
+			jQuery('#theImage a:first-child').attr({ldelim}
+				href: "javascript:phpWGOpenWindow('{$high.U_HIGH}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')')"
+			});
+			{/if}
+			
+			jQuery(this).html('<img src="{$F2B_PATH}template/rotate_1.png"/> {'Front2Back_back'|@translate}');
+			jQuery(this).attr('name', 'front');
+		}
+	});
+{/footer_script}
+
+<a class="reverse" name="front">
+	<img src="{$F2B_PATH}template/rotate_1.png"/>
+	{'Front2Back_back'|@translate}
+</a>
Index: /extensions/Front2Back/template/admin.tpl
===================================================================
--- /extensions/Front2Back/template/admin.tpl	(revision 9784)
+++ /extensions/Front2Back/template/admin.tpl	(revision 9784)
@@ -0,0 +1,31 @@
+<div class="titrePage">
+	<h2>Front2Back</h2>
+</div>
+
+<form method="post" action="" class="properties" ENCTYPE="multipart/form-data"> 
+	<fieldset>
+		<legend>{'Configuration'|@translate}</legend>	  
+		<ul>			
+			<li>
+				<span class="property">{'f2b_path'|@translate}</span>
+				<input type="text" name="path" value="{$PATH}"/>
+			</li>
+			<li>
+				<span class="property">{'f2b_parent'|@translate}</span>
+				<input type="text" name="parent" value="{$PARENT}"/>
+			</li>		
+			<li>
+				<span class="property">{'f2b_hd_parent'|@translate}</span>
+				<input type="text" name="hd_parent" value="{$HD_PARENT}"/>
+			</li>
+			<li>
+				<span class="property">{'f2b_suffix'|@translate}</span>
+				<input type="text" name="suffix" value="{$SUFFIX}"/>
+			</li>
+		</ul>
+	</fieldset>
+		
+	<p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p>
+</form>
+
+{'f2b_help'|@translate}
Index: /extensions/Front2Back/template/index.php
===================================================================
--- /extensions/Front2Back/template/index.php	(revision 9784)
+++ /extensions/Front2Back/template/index.php	(revision 9784)
@@ -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();
+?>
