Index: /extensions/WiredForSound/admin/add_page_on_index.php
===================================================================
--- /extensions/WiredForSound/admin/add_page_on_index.php	(revision 3302)
+++ /extensions/WiredForSound/admin/add_page_on_index.php	(revision 3302)
@@ -0,0 +1,131 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+load_language('plugin.lang', WFS_PATH);
+
+$wfs_conf = explode(',' , $conf['wired_for_sound']);
+$mp3_path = $wfs_conf[0];
+
+$cat_id = $_GET['catid'];
+$back_url = $_GET['backurl'];
+$volume = '';
+
+// Changement de repertoire
+if (isset($_POST['change_path']))
+{
+  $mp3_path = $_POST['mp3_path'];
+  if (strrpos($mp3_path , '/') != (strlen($mp3_path) - 1))
+  {
+    $mp3_path .= '/';
+  }
+}
+
+// Suppression de l'association
+if (isset($_POST['delete']))
+{
+  pwg_query('DELETE FROM ' . WFS_IMG_CAT_TABLE . ' WHERE image_id IS NULL AND cat_id = ' . $cat_id . ';');
+}
+
+// Enregistrement de l'association
+if (isset($_POST['submit']) and !empty($_POST['mp3_select']))
+{
+  pwg_query('DELETE FROM ' . WFS_IMG_CAT_TABLE . ' WHERE image_id IS NULL AND cat_id = ' . $cat_id . ';');
+  if (empty($_POST['volume'])) $_POST['volume'] = 'NULL';
+
+  $q = 'SELECT id FROM ' . WFS_SOUNDS_TABLE . ' WHERE file = "' . $_POST['mp3_select'] . '";';
+  $result = mysql_fetch_assoc(pwg_query($q));
+
+  if (empty($result))
+  {
+    $q = 'SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id  FROM ' . WFS_SOUNDS_TABLE . ' ;';
+    list($next_element_id) = mysql_fetch_array(pwg_query($q));
+    $q = 'INSERT INTO ' . WFS_SOUNDS_TABLE . ' ( id , file ) VALUES ( ' . $next_element_id . ' , "' . $_POST['mp3_select'] . '");';
+    pwg_query($q);
+    $result['id'] = $next_element_id;
+  }
+
+  $q = 'INSERT INTO ' . WFS_IMG_CAT_TABLE . ' ( image_id , cat_id , sound_id , volume )
+VALUES ( NULL , ' . $cat_id . ' , ' . $result['id'] . ' , ' . $_POST['volume'] . ');';
+  pwg_query($q);
+}
+
+// Recupération des données de la table
+$q = 'SELECT sound.file AS sound, ic.volume AS volume
+FROM ' . WFS_SOUNDS_TABLE . ' AS sound
+INNER JOIN ' . WFS_IMG_CAT_TABLE . ' AS ic
+ON sound.id = ic.sound_id
+WHERE ic.cat_id = ' . $cat_id . ' AND ic.image_id IS NULL;';
+$result = mysql_fetch_assoc(pwg_query($q));
+
+// Bouton de suppression
+if (!empty($result))
+{
+  $template->assign('delete', true);
+}
+
+// Dossier mp3
+if (isset($result['sound']) and !isset($_POST['change_path']) and !isset($wfs_param[2]))
+{
+  $mp3_path = substr($result['sound'] , 0 , strrpos($result['sound'] , '/') + 1);
+}
+  
+// Volume
+if (isset($result['volume']))
+{
+  $volume = $result['volume'];
+}
+
+// Liste des mp3 du dossier spécifié
+if (is_dir('./' . $mp3_path) and $contents = opendir($mp3_path))
+{
+  $options[] = '----------------';
+  $selected = 0;
+  while (($node = readdir($contents)) !== false)
+  {
+    if (is_file('./' . $mp3_path . $node))
+    {
+      $extension = strtolower(get_extension($node));
+      if ($extension == 'mp3')
+      {
+        $value = $mp3_path . $node;
+        if (isset($result['sound']) and $result['sound'] == $value)
+        {
+          $selected = $value;
+        }
+        $options[$value] = $node;
+      }
+    }
+  }
+  closedir($contents);
+  // Erreur si pas de mp3
+  if (count($options) == 1)
+  {
+    array_push($page['errors'], l10n('wfs_no_mp3'));
+  }
+  else
+  {
+    $template->assign('mp3_select', array(
+      'OPTIONS' => $options,
+      'SELECTED' => $selected));
+  }
+}
+else
+{
+  array_push($page['errors'], l10n('wfs_no_path'));
+}
+
+// Affichage du fichier associé
+if (isset($result['sound']))
+{
+  $template->assign('ACTUAL_FILE', $result['sound']);
+}
+
+$template->assign(array(
+  'MP3_PATH' => $mp3_path,
+  'BACK' => $back_url,
+  'VOLUME' => $volume));
+
+$template->set_filename('plugin_admin_content', dirname(__FILE__) . '/../template/add_page_on_index.tpl');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
+?>
Index: /extensions/WiredForSound/admin/add_page_on_picture.php
===================================================================
--- /extensions/WiredForSound/admin/add_page_on_picture.php	(revision 3302)
+++ /extensions/WiredForSound/admin/add_page_on_picture.php	(revision 3302)
@@ -0,0 +1,178 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+load_language('plugin.lang', WFS_PATH);
+
+$wfs_conf = explode(',' , $conf['wired_for_sound']);
+$mp3_path = $wfs_conf[0];
+
+$cat_id = $_GET['catid'];
+$img_id = $_GET['imgid'];
+$back_url = $_GET['backurl'];
+$volume = '';
+
+function get_wfs_from_table()
+{
+  global $img_id, $cat_id;
+  if (empty($cat_id))
+  {
+    $clause = 'cat_id IS NULL';
+  }
+	else
+  {
+    $clause = '(cat_id = ' . $cat_id . ' OR cat_id IS NULL)';
+  }
+	$q = 'SELECT sound.id AS id, sound.file AS sound, ic.volume AS volume, ic.cat_id AS cat_id
+FROM ' . WFS_SOUNDS_TABLE . ' AS sound
+INNER JOIN ' . WFS_IMG_CAT_TABLE . ' AS ic
+ON sound.id = ic.sound_id
+WHERE ic.image_id = ' . $img_id . '  AND ' . $clause . '
+ORDER BY ic.cat_id DESC;';
+    return mysql_fetch_assoc(pwg_query($q));
+}
+
+function delete_wfs_from_table($param)
+{
+  global $img_id, $cat_id;
+  if (!empty($param))
+  {
+    pwg_query('DELETE FROM ' . WFS_IMG_CAT_TABLE . ' WHERE image_id = ' . $img_id . ' AND cat_id = ' . $cat_id . ';');
+  }
+  else
+  {
+    pwg_query('DELETE FROM ' . WFS_IMG_CAT_TABLE . ' WHERE image_id = ' . $img_id . ' AND cat_id IS NULL;');
+  }
+}
+
+// Changement de repertoire
+if (isset($_POST['change_path']))
+{
+  $mp3_path = $_POST['mp3_path'];
+  if (strrpos($mp3_path , '/') != (strlen($mp3_path) - 1))
+  {
+    $mp3_path .= '/';
+  }
+}
+
+// Suppression de l'association
+if (isset($_POST['delete']))
+{
+  $result = get_wfs_from_table();
+  delete_wfs_from_table($result['cat_id']);
+}
+
+// Enregistrement de l'association
+if (isset($_POST['submit']) and !empty($_POST['mp3_select']))
+{
+  // Suppression des eventuelles données existantes
+  if (!isset($_POST['assign_all']))
+  {
+    $_POST['assign_all'] = '';
+  }
+  delete_wfs_from_table($_POST['assign_all']);
+
+  $cat_write = $cat_id;
+  if (empty($_POST['assign_all'])) $cat_write = 'NULL';
+  if (empty($_POST['volume'])) $_POST['volume'] = 'NULL';
+
+  // Ecriture dans la table
+  $q = 'SELECT id FROM ' . WFS_SOUNDS_TABLE . ' WHERE file = "' . $_POST['mp3_select'] . '";';
+  $result = mysql_fetch_assoc(pwg_query($q));
+  if (empty($result))
+  {
+    $q = 'SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id  FROM ' . WFS_SOUNDS_TABLE . ' ;';
+    list($next_element_id) = mysql_fetch_array(pwg_query($q));
+    $q = 'INSERT INTO ' . WFS_SOUNDS_TABLE . ' ( id , file ) VALUES ( ' . $next_element_id . ' , "' . $_POST['mp3_select'] . '");';
+    pwg_query($q);
+    $result['id'] = $next_element_id;
+  }
+  $q = 'INSERT INTO ' . WFS_IMG_CAT_TABLE . ' ( image_id , cat_id , sound_id , volume )
+VALUES (' . $img_id . ' , ' . $cat_write . ' , ' . $result['id'] . ' , ' . $_POST['volume'] . ');';
+  pwg_query($q);
+}
+
+// Récupération des données de la table
+$result = get_wfs_from_table();
+
+// Bouton de suppression
+if (!empty($result))
+{
+  $template->assign('delete', true);
+}
+
+// Dossier mp3
+if (isset($result['sound']) and !isset($_POST['change_path']) and !isset($wfs_param[2]))
+{
+  $mp3_path = substr($result['sound'] , 0 , strrpos($result['sound'] , '/') + 1);
+}
+
+// Volume
+if (isset($result['volume']))
+{
+  $volume = $result['volume'];
+}
+
+// Liste des mp3 du dossier spécifié
+if (is_dir('./' . $mp3_path) and $contents = opendir($mp3_path))
+{
+  $options[] = '----------------';
+  $selected = 0;
+  while (($node = readdir($contents)) !== false)
+  {
+    if (is_file('./' . $mp3_path . $node))
+    {
+      $extension = strtolower(get_extension($node));
+      if ($extension == 'mp3')
+      {
+        $value = $mp3_path . $node;
+        if (isset($result['sound']) and $result['sound'] == $value)
+        {
+          $selected = $value;
+        }
+        $options[$value] = $node;
+      }
+    }
+  }
+  closedir($contents);
+  // Erreur si pas de mp3
+  if (count($options) == 1)
+  {
+    array_push($page['errors'], l10n('wfs_no_mp3'));
+  }
+  else
+  {
+    $template->assign('mp3_select', array(
+      'OPTIONS' => $options,
+      'SELECTED' => $selected));
+  }
+}
+else
+{
+  array_push($page['errors'], l10n('wfs_no_path'));
+}
+
+// Affichage du fichier associé
+if (isset($result['sound']))
+{
+	if (isset($result['cat_id']))
+  {
+    $assign_all = l10n('wfs_only_this_cat');
+  }
+	else
+  {
+    $assign_all = l10n('wfs_all_cat');
+  }
+  $template->assign(array(
+    'ACTUAL_FILE' => $result['sound'],
+    'ASSIGN_ALL' => $assign_all));
+}
+
+$template->assign(array(
+  'MP3_PATH' => $mp3_path,
+  'BACK' => $back_url,
+  'VOLUME' => $volume));
+
+$template->set_filename('plugin_admin_content', dirname(__FILE__) . '/../template/add_page_on_picture.tpl');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
+?>
Index: /extensions/WiredForSound/admin/admin.php
===================================================================
--- /extensions/WiredForSound/admin/admin.php	(revision 3302)
+++ /extensions/WiredForSound/admin/admin.php	(revision 3302)
@@ -0,0 +1,65 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+load_language('plugin.lang', WFS_PATH);
+
+global $conf, $template, $lang;
+
+$wfs_conf = explode ("," , $conf['wired_for_sound']);
+// Enregistrement de la configuration
+if (isset($_POST['submit']))
+{
+  if (strrpos($_POST['default_path'] , '/') != (strlen($_POST['default_path']) - 1))
+  {
+    $_POST['default_path'] .= '/';
+  }
+  if (!is_dir('./' . $_POST['default_path']))
+  {
+    $wfs_conf[0] = $_POST['default_path'];
+    array_push($page['errors'], l10n('wfs_no_path'));
+  }
+  else
+  {
+    $wfs_conf = array($_POST['default_path'],
+      $_POST['default_volume'],
+      $_POST['width_player'],
+      $_POST['autostart'],
+      $_POST['autoreplay']);
+    $new_wfs_conf = implode ("," , $wfs_conf);
+    $query = '
+UPDATE ' . CONFIG_TABLE . '
+    SET value="' . $new_wfs_conf . '"
+    WHERE param="wired_for_sound"
+    LIMIT 1';
+      pwg_query($query);
+      array_push($page['infos'], l10n('wfs_conf_saved'));
+  }
+}
+// Parametrage du template
+$template->assign(array(
+  'DEFAULT_PATH' => $wfs_conf[0],
+  'DEFAULT_VOLUME' => $wfs_conf[1]));
+if ($wfs_conf[2] == '44') $template->assign(array('SMALL_PLAYER' => 'checked="checked"'));
+if ($wfs_conf[2] == '64') $template->assign(array('MEDIUM_PLAYER' => 'checked="checked"'));
+if ($wfs_conf[2] == '202') $template->assign(array('BIG_PLAYER' => 'checked="checked"'));
+if ($wfs_conf[3] == '1')
+{
+  $template->assign(array('AUTOSTART_ON' => 'checked="checked"'));
+}
+else
+{
+  $template->assign(array('AUTOSTART_OFF' => 'checked="checked"'));
+}
+if ($wfs_conf[4] == '1')
+{
+  $template->assign(array('AUTOREPLAY_ON' => 'checked="checked"'));
+}
+else
+{
+  $template->assign(array('AUTOREPLAY_OFF' => 'checked="checked"'));
+}
+
+$template->set_filenames(array('plugin_admin_content' => realpath(WFS_PATH . 'template/admin.tpl')));
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
+?>
Index: /extensions/WiredForSound/admin/index.php
===================================================================
--- /extensions/WiredForSound/admin/index.php	(revision 3302)
+++ /extensions/WiredForSound/admin/index.php	(revision 3302)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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/WiredForSound/index.php
===================================================================
--- /extensions/WiredForSound/index.php	(revision 3302)
+++ /extensions/WiredForSound/index.php	(revision 3302)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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/WiredForSound/language/en_UK/index.php
===================================================================
--- /extensions/WiredForSound/language/en_UK/index.php	(revision 3302)
+++ /extensions/WiredForSound/language/en_UK/index.php	(revision 3302)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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/WiredForSound/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/WiredForSound/language/en_UK/plugin.lang.php	(revision 3302)
+++ /extensions/WiredForSound/language/en_UK/plugin.lang.php	(revision 3302)
@@ -0,0 +1,38 @@
+<?php
+
+$lang['wfs_associate_category'] = 'Wire for sound this category';
+$lang['wfs_associate_image'] = 'Wire for sound this picture';
+
+$lang['wfs_associate_sound'] = 'Wired For Sound - Add sound';
+$lang['wfs_actual_file'] = 'Current linked file';
+$lang['wfs_path'] = 'Directory path';
+$lang['wfs_change_path'] = 'Change directory';
+$lang['wfs_show_default_path'] = 'Show defalt directory';
+$lang['wfs_file'] = 'File';
+$lang['wfs_volume'] = 'Volume';
+$lang['wfs_apply_only_this_cat'] = 'Link only within the current category';
+$lang['wfs_associate_to_cat'] = 'Link to the current category';
+$lang['wfs_associate_to_pic'] = 'Link to the picture';
+$lang['wfs_delete'] = 'Unlink';
+$lang['wfs_back_cat'] = 'Back to category';
+$lang['wfs_back_pic'] = 'Back to picture';
+$lang['wfs_optional'] = 'optional';
+
+$lang['wfs_no_mp3'] = 'No sound available in this directory.';
+$lang['wfs_no_path'] = 'Directory not found.';
+$lang['wfs_only_this_cat'] = 'Current category only';
+$lang['wfs_all_cat'] = 'All categories';
+
+$lang['wfs_conf_saved'] = 'Configuration has been saved.';
+
+$lang['wfs_configuration'] = 'Configuration';
+$lang['wfs_default_directory'] = 'Default directory';
+$lang['wfs_default_volume'] = 'Default volume';
+$lang['wfs_player_width'] = 'Player width';
+$lang['wfs_litle'] = 'Litle';
+$lang['wfs_medium'] = 'Medium';
+$lang['wfs_large'] = 'Large';
+$lang['wfs_autostart'] = 'Autostart';
+$lang['wfs_loop'] = 'Autoloop';
+
+?>
Index: /extensions/WiredForSound/language/fr_FR/index.php
===================================================================
--- /extensions/WiredForSound/language/fr_FR/index.php	(revision 3302)
+++ /extensions/WiredForSound/language/fr_FR/index.php	(revision 3302)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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/WiredForSound/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/WiredForSound/language/fr_FR/plugin.lang.php	(revision 3302)
+++ /extensions/WiredForSound/language/fr_FR/plugin.lang.php	(revision 3302)
@@ -0,0 +1,38 @@
+<?php
+
+$lang['wfs_associate_category'] = 'Associer un son à la catégorie';
+$lang['wfs_associate_image'] = 'Associer un son à l\'image';
+
+$lang['wfs_associate_sound'] = 'Wired For Sound - Associer un son';
+$lang['wfs_actual_file'] = 'Fichier associé actuellement';
+$lang['wfs_path'] = 'Dossier';
+$lang['wfs_change_path'] = 'Changer de dossier';
+$lang['wfs_show_default_path'] = 'Afficher le dossier par defaut';
+$lang['wfs_file'] = 'Fichier';
+$lang['wfs_volume'] = 'Volume';
+$lang['wfs_apply_only_this_cat'] = 'Appliquer à l\'image uniquement dans cette catégorie';
+$lang['wfs_associate_to_cat'] = 'Associer le mp3 à la catégorie';
+$lang['wfs_associate_to_pic'] = 'Associer le mp3 à l\'image';
+$lang['wfs_delete'] = 'Supprimer l\'association existante';
+$lang['wfs_back_cat'] = 'Retour à la catégorie';
+$lang['wfs_back_pic'] = 'Retour à l\'image';
+$lang['wfs_optional'] = 'facultatif';
+
+$lang['wfs_no_mp3'] = 'Aucun mp3 n\'a été trouvé dans ce dossier.';
+$lang['wfs_no_path'] = 'Le dossier spécifié n\'existe pas.';
+$lang['wfs_only_this_cat'] = 'Uniquement pour cette catégorie';
+$lang['wfs_all_cat'] = 'Quelle que soit la catégorie';
+
+$lang['wfs_conf_saved'] = 'Configuration sauvegardée.';
+
+$lang['wfs_configuration'] = 'Configuration';
+$lang['wfs_default_directory'] = 'Repertoire par défaut';
+$lang['wfs_default_volume'] = 'Volume par défaut';
+$lang['wfs_player_width'] = 'Taille du lecteur';
+$lang['wfs_litle'] = 'Petit';
+$lang['wfs_medium'] = 'Moyen';
+$lang['wfs_large'] = 'Grand';
+$lang['wfs_autostart'] = 'Autostart';
+$lang['wfs_loop'] = 'Lecture continue';
+
+?>
Index: /extensions/WiredForSound/language/index.php
===================================================================
--- /extensions/WiredForSound/language/index.php	(revision 3302)
+++ /extensions/WiredForSound/language/index.php	(revision 3302)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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/WiredForSound/main.inc.php
===================================================================
--- /extensions/WiredForSound/main.inc.php	(revision 3302)
+++ /extensions/WiredForSound/main.inc.php	(revision 3302)
@@ -0,0 +1,45 @@
+<?php
+/*
+Plugin Name: WiredForSound
+Version: 2.0.b
+Description: Ajoute du son à la galerie / Wire for sound your gallery
+Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=152
+Author: P@t
+Author URI: http://www.gauchon.com
+*/
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $prefixeTable;
+
+define('WFS_DIR' , basename(dirname(__FILE__)));
+define('WFS_PATH' , PHPWG_PLUGINS_PATH . WFS_DIR . '/');
+define('WFS_IMG_CAT_TABLE' , $prefixeTable . 'wfs_img_cat_sound');
+define('WFS_SOUNDS_TABLE' , $prefixeTable . 'wfs_sounds');
+
+function wfs_admin_menu($menu)
+{
+    array_push($menu, array(
+      'NAME' => 'Wired For Sound',
+      'URL' => get_admin_plugin_menu_link(WFS_PATH . 'admin/admin.php')));
+    return $menu;
+}
+
+function wired_for_sound_on_index()
+{
+    global $page, $template, $conf, $prefixeTable, $lang; 
+    if (isset($page['category']) || isset($page['section']) and !isset($page['chronology_field']) and !isset($page['flat']))
+        include(WFS_PATH . 'wfs_on_index.php');
+}
+
+function wired_for_sound_on_picture()
+{
+    global $page, $template, $conf, $prefixeTable, $lang;
+	include(WFS_PATH . 'wfs_on_picture.php');
+}
+
+add_event_handler('get_admin_plugin_menu_links', 'wfs_admin_menu');
+add_event_handler('loc_end_index' , 'wired_for_sound_on_index');
+add_event_handler('loc_end_picture' , 'wired_for_sound_on_picture');
+
+?>
Index: /extensions/WiredForSound/maintain.inc.php
===================================================================
--- /extensions/WiredForSound/maintain.inc.php	(revision 3302)
+++ /extensions/WiredForSound/maintain.inc.php	(revision 3302)
@@ -0,0 +1,57 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+function plugin_install()
+{
+  global $prefixeTable, $conf;
+
+  $query = 'SHOW TABLES LIKE "' . $prefixeTable . 'wfs_%"';
+  $result = pwg_query($query);
+  if (!mysql_fetch_row($result))
+  {
+    $q = 'CREATE TABLE ' . $prefixeTable . 'wfs_img_cat_sound(
+image_id MEDIUMINT( 8 ) UNSIGNED default NULL ,
+cat_id MEDIUMINT( 8 ) default NULL ,
+sound_id SMALLINT( 5 ) NOT NULL ,
+volume SMALLINT ( 3 ) UNSIGNED default NULL ,
+INDEX (image_id) ,
+INDEX (cat_id),
+INDEX (sound_id))
+DEFAULT CHARACTER SET utf8;';
+    pwg_query($q);
+
+    $q = 'CREATE TABLE ' . $prefixeTable . 'wfs_sounds (
+id SMALLINT( 5 ) NOT NULL ,
+file VARCHAR( 255 ) NOT NULL ,
+PRIMARY KEY (id))
+DEFAULT CHARACTER SET utf8;';
+    pwg_query($q);
+  }
+
+  if (!isset($conf['wired_for_sound']))
+  {
+    $q = '
+INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
+	VALUES
+	("wired_for_sound" , "plugins/WiredForSound/mp3/,100,44,1,0" , "Parametres du plugin WiredForSound");';
+
+    pwg_query($q);
+  }
+}
+
+function plugin_uninstall()
+{
+  global $prefixeTable;
+
+	$q = 'DROP TABLE ' . $prefixeTable . 'wfs_img_cat_sound;';
+    pwg_query($q);
+
+	$q = 'DROP TABLE ' . $prefixeTable . 'wfs_sounds;';
+    pwg_query($q);
+
+	$q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="wired_for_sound" LIMIT 1;';
+    pwg_query($q);
+}
+
+?>
Index: /extensions/WiredForSound/mp3/index.php
===================================================================
--- /extensions/WiredForSound/mp3/index.php	(revision 3302)
+++ /extensions/WiredForSound/mp3/index.php	(revision 3302)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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/WiredForSound/template/add_page_on_index.tpl
===================================================================
--- /extensions/WiredForSound/template/add_page_on_index.tpl	(revision 3302)
+++ /extensions/WiredForSound/template/add_page_on_index.tpl	(revision 3302)
@@ -0,0 +1,44 @@
+<div class="titrePage">
+	<h2>{'wfs_associate_sound'|@translate}</h2>
+</div>
+<form method="post" action="" class="properties"  ENCTYPE="multipart/form-data"> 
+	<table>
+		{if isset($ACTUAL_FILE)}
+		<tr>
+		<td colspan="3" align="center">{'wfs_actual_file'|@translate}: <b>{$ACTUAL_FILE}</b><br><br><br></td>
+		</tr>
+		{/if}
+		<tr>
+			<td>{'wfs_path'|@translate} &nbsp;&nbsp;</td>
+			<td><input type="text" size="40" maxlength="255" value="{$MP3_PATH}" name="mp3_path"/></td>
+			<td><input class="submit" type="submit" value="{'wfs_change_path'|@translate}" name="change_path" /></td>
+		</tr>
+		
+    {if !empty($mp3_select)}
+		<tr>
+			<td><br>{'wfs_file'|@translate} &nbsp;&nbsp;</td>
+			<td><br>
+      {html_options name="mp3_select" options=$mp3_select.OPTIONS selected=$mp3_select.SELECTED}
+			</td>
+		</tr>
+		<tr>
+			<td><br>{'wfs_volume'|@translate} &nbsp;&nbsp;</td>
+			<td><br>
+			<input type="text" size="3" maxlength="3" value="{$VOLUME}" name="volume"/> %&nbsp;&nbsp; ({'wfs_optional'|@translate})</td>
+		</tr>
+
+		<tr><td colspan="3" align="center"><br><br>
+		<input class="submit" type="submit" value="{'wfs_associate_to_cat'|@translate}" name="submit" />
+    </td></tr>
+    {/if}
+
+		{if isset($delete)}
+    <tr><td colspan="3" align="center">
+		<br><br><input class="submit" type="submit" value="{'wfs_delete'|@translate}" name="delete" />
+    </td></tr>
+		{/if}
+		
+	</table>
+
+</form>
+<p><a href="..{$BACK}">{'wfs_back_cat'|@translate}</a></p>
Index: /extensions/WiredForSound/template/add_page_on_picture.tpl
===================================================================
--- /extensions/WiredForSound/template/add_page_on_picture.tpl	(revision 3302)
+++ /extensions/WiredForSound/template/add_page_on_picture.tpl	(revision 3302)
@@ -0,0 +1,53 @@
+<div class="titrePage">
+	<h2>{'wfs_associate_sound'|@translate}</h2>
+</div>
+<form method="post" action="" class="properties"  ENCTYPE="multipart/form-data"> 
+	<table>
+		{if isset($ACTUAL_FILE)}
+		<tr>
+		<td colspan="3" align="center">{'wfs_actual_file'|@translate}: <b>{$ACTUAL_FILE}</b><br><br><br></td>
+		</tr>
+		{/if}
+		<tr>
+			<td>{'wfs_path'|@translate} &nbsp;&nbsp;</td>
+			<td><input type="text" size="40" maxlength="255" value="{$MP3_PATH}" name="mp3_path"/></td>
+			<td><input class="submit" type="submit" value="{'wfs_change_path'|@translate}" name="change_path" /></td>
+		</tr>
+
+    {if !empty($mp3_select)}
+		<tr>
+			<td><br>{'wfs_file'|@translate} &nbsp;&nbsp;</td>
+			<td><br>
+      {html_options name="mp3_select" options=$mp3_select.OPTIONS selected=$mp3_select.SELECTED}
+			</td>
+		</tr>
+		<tr>
+			<td><br>{'wfs_volume'|@translate} &nbsp;&nbsp;</td>
+			<td><br>
+			<input type="text" size="3" maxlength="3" value="{$VOLUME}" name="volume"/> %&nbsp;&nbsp; ({'wfs_optional'|@translate})</td>
+		</tr>
+    {if isset($assign_all)}
+		<tr>
+		<td colspan="3"><br>{'wfs_apply_only_this_cat'|@translate} &nbsp;&nbsp;
+		<input type="checkbox" name="assign_all" value="on" {$assign_all.CHECKED}/></td>
+		</tr>
+		{/if}
+
+		<tr>
+		  <td colspan="3" align="center"><br><br>
+		    <input class="submit" type="submit" value="{'wfs_associate_to_pic'|@translate}" name="submit" />
+      </td>
+    </tr>
+    {/if}
+		{if isset($delete)}
+    <tr>
+      <td colspan="3" align="center"><br><br>
+        <input class="submit" type="submit" value="{'wfs_delete'|@translate}" name="delete" />
+      </td>
+    </tr>      
+		{/if}
+		
+	</table>
+
+</form>
+<p><a href="..{$BACK}">{'wfs_back_pic'|@translate}</a></p>
Index: /extensions/WiredForSound/template/admin.tpl
===================================================================
--- /extensions/WiredForSound/template/admin.tpl	(revision 3302)
+++ /extensions/WiredForSound/template/admin.tpl	(revision 3302)
@@ -0,0 +1,48 @@
+<div class="titrePage">
+	<h2>Wired For Sound</h2>
+</div>
+
+<form method="post" action="" class="properties"  ENCTYPE="multipart/form-data"> 
+<fieldset>
+	<legend>{'wfs_configuration'|@translate}</legend>
+	<table>
+		<tr>
+			<td align="right"><br>{'wfs_default_directory'|@translate} &nbsp;&nbsp;</td>
+			<td><br>
+			<input type="text" size="80" maxlength="255" value="{$DEFAULT_PATH}" name="default_path"/></td>
+		</tr>
+		<tr>
+			<td align="right"><br>{'wfs_default_volume'|@translate} &nbsp;&nbsp;</td>
+			<td><br>
+			<input type="text" size="3" maxlength="3" value="{$DEFAULT_VOLUME}" name="default_volume"/> %</td>
+		</tr>
+		<tr>
+			<td align="right"><br>{'wfs_player_width'|@translate} &nbsp;&nbsp;</td>
+			<td><br>
+			<input type="radio" value="44" name="width_player" {$SMALL_PLAYER} />{'wfs_litle'|@translate}
+			<input type="radio" value="64" name="width_player" {$MEDIUM_PLAYER} />{'wfs_medium'|@translate}
+			<input type="radio" value="202" name="width_player" {$BIG_PLAYER} />{'wfs_large'|@translate}
+			</td>
+		</tr>
+		<tr>
+			<td align="right"><br>{'wfs_autostart'|@translate} &nbsp;&nbsp;</td>
+			<td><br>
+			<input type="radio" value="1" name="autostart" {$AUTOSTART_ON} />On
+			<input type="radio" value="0" name="autostart" {$AUTOSTART_OFF} />Off
+			</td>
+		</tr>
+		<tr>
+			<td align="right"><br>{'wfs_loop'|@translate} &nbsp;&nbsp;</td>
+			<td><br>
+			<input type="radio" value="1" name="autoreplay" {$AUTOREPLAY_ON} />On
+			<input type="radio" value="0" name="autoreplay" {$AUTOREPLAY_OFF} />Off
+			</td>
+		</tr>
+	</table>
+<br>
+</fieldset>
+<div style="text-align: center;">
+  <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" />
+</div>
+
+</form>
Index: /extensions/WiredForSound/template/index.php
===================================================================
--- /extensions/WiredForSound/template/index.php	(revision 3302)
+++ /extensions/WiredForSound/template/index.php	(revision 3302)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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/WiredForSound/template/wfs_on_index.tpl
===================================================================
--- /extensions/WiredForSound/template/wfs_on_index.tpl	(revision 3302)
+++ /extensions/WiredForSound/template/wfs_on_index.tpl	(revision 3302)
@@ -0,0 +1,13 @@
+{if isset($mp3_button)}
+      <li><a href="{$mp3_button.URL}" title="{'wfs_associate_category'|@translate}"><img src="{$mp3_button.ICON}" class="button" alt="{'wfs_associate_category'|@translate}"/></a></li>
+{/if}
+
+{if isset($wfs)}
+<li>
+<object style="vertical-align:top; margin-top:3px;" type="application/x-shockwave-flash" width="{$wfs.PLAYER_WIDTH}" height="20"
+    data="{$wfs.MP3}&amp;autostart={$wfs.AUTOSTART}&amp;autoreplay={$wfs.AUTOREPLAY}&amp;volume={$wfs.VOLUME}&amp;showtime=1">
+    <param name="movie" value="{$wfs.MP3}&amp;autostart={$wfs.AUTOSTART}&amp;autoreplay={$wfs.AUTOREPLAY}&amp;volume={$wfs.VOLUME}&amp;showtime=1">
+    <param name="wmode" value="transparent">
+</object>
+</li>
+{/if}
Index: /extensions/WiredForSound/template/wfs_on_picture.tpl
===================================================================
--- /extensions/WiredForSound/template/wfs_on_picture.tpl	(revision 3302)
+++ /extensions/WiredForSound/template/wfs_on_picture.tpl	(revision 3302)
@@ -0,0 +1,13 @@
+{if isset($mp3_button)}
+  <a href="{$mp3_button.URL}" title="{'wfs_associate_category'|@translate}"><img src="{$mp3_button.ICON}" class="button" alt="{'wfs_associate_image'|@translate}"/></a>
+{/if}
+
+{if isset($wfs)}
+<div style="margin:4px 13px 0 13px;width:{$wfs.PLAYER_WIDTH}px;float:left;">
+<object type="application/x-shockwave-flash" width="{$wfs.PLAYER_WIDTH}" height="20"
+    data="{$wfs.MP3}&amp;autostart={$wfs.AUTOSTART}&amp;autoreplay={$wfs.AUTOREPLAY}&amp;volume={$wfs.VOLUME}&amp;showtime=1">
+    <param name="movie" value="{$wfs.MP3}&amp;autostart={$wfs.AUTOSTART}&amp;autoreplay={$wfs.AUTOREPLAY}&amp;volume={$wfs.VOLUME}&amp;showtime=1">
+    <param name="wmode" value="transparent">
+</object>
+</div>
+{/if}
Index: /extensions/WiredForSound/wfs_on_index.php
===================================================================
--- /extensions/WiredForSound/wfs_on_index.php	(revision 3302)
+++ /extensions/WiredForSound/wfs_on_index.php	(revision 3302)
@@ -0,0 +1,90 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+load_language('plugin.lang', WFS_PATH);
+
+$wfs_conf = explode(',' , $conf['wired_for_sound']);
+if (isset($page['category']))
+{
+  $cat_id = $page['category']['id'];
+}
+else
+{
+  switch ($page['section'])
+  {
+    case 'categories':
+      $cat_id = -1 ;
+      break;
+    case 'tags':
+      $cat_id = -2 ;
+      break;
+    case 'search':
+      $cat_id = -3 ;
+      break;
+    case 'favorites':
+      $cat_id = -4 ;
+      break;
+    case 'recent_pics':
+      $cat_id = -5 ;
+      break;
+    case 'recent_cats':
+      $cat_id = -6 ;
+      break;
+    case 'most_visited':
+      $cat_id = -7 ;
+      break;
+    case 'best_rated':
+      $cat_id = -8 ;
+      break;
+    case 'list':
+      $cat_id = -9 ;
+      break;
+    case 'most_commented':
+      $cat_id = -10 ;
+      break;
+  }
+}
+
+if (empty($cat_id)) return;
+
+$q = 'SELECT sound.id AS id, sound.file AS sound, ic.volume AS volume
+FROM ' . WFS_SOUNDS_TABLE . ' AS sound
+INNER JOIN ' . WFS_IMG_CAT_TABLE . ' AS ic
+ON sound.id = ic.sound_id
+WHERE ic.cat_id = ' . $cat_id . ' AND ic.image_id IS NULL;';
+
+$result = mysql_fetch_assoc(pwg_query($q));
+
+if (is_admin())
+{
+  $template->assign('mp3_button', array(
+    'URL' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . WFS_DIR . '%2Fadmin%2Fadd_page_on_index.php&amp;catid=' . $cat_id . '&amp;backurl=' . $_SERVER['REQUEST_URI'],
+    'ICON' => WFS_PATH . 'template/add_button.png'));
+}
+
+if (!empty($result))
+{
+  if (file_exists($result['sound']))
+  {
+    if (!empty($result['volume']))
+    {
+      $wfs_conf[1] = $result['volume'];
+    }
+    $template->assign('wfs', array(
+      'MP3' => WFS_PATH . 'dewplayer.swf?mp3=' . strtr($result['sound'] , array(' ' => '%20')),
+      'VOLUME' => $wfs_conf[1],
+      'PLAYER_WIDTH' => $wfs_conf[2] - 2,
+      'AUTOSTART' => $wfs_conf[3],
+      'AUTOREPLAY' => $wfs_conf[4]));
+  }
+  else
+  {
+    pwg_query('DELETE FROM ' . WFS_IMG_CAT_TABLE . ' WHERE sound_id = ' . $result['id'] . ';');
+    pwg_query('DELETE FROM ' . WFS_SOUNDS_TABLE . ' WHERE id = ' . $result['id'] . ';');
+  }
+}
+
+$template->set_filenames(array('wfs' => dirname(__FILE__) . '/template/wfs_on_index.tpl'));
+$template->concat('PLUGIN_INDEX_ACTIONS', $template->parse('wfs', true));
+
+?>
Index: /extensions/WiredForSound/wfs_on_picture.php
===================================================================
--- /extensions/WiredForSound/wfs_on_picture.php	(revision 3302)
+++ /extensions/WiredForSound/wfs_on_picture.php	(revision 3302)
@@ -0,0 +1,60 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+load_language('plugin.lang', WFS_PATH);
+
+$wfs_conf = explode(',' , $conf['wired_for_sound']);
+$img_id = $page['image_id'];
+if (isset($page['category']['id']))
+{
+  $cat_id = $page['category']['id'];
+  $clause = '(cat_id = ' . $cat_id . ' OR cat_id IS NULL)';
+}
+else
+{
+  $cat_id = '';
+  $clause = 'cat_id IS NULL';
+}
+
+$q = 'SELECT sound.id AS id, sound.file AS sound, ic.volume AS volume
+FROM ' . WFS_SOUNDS_TABLE . ' AS sound
+INNER JOIN ' . WFS_IMG_CAT_TABLE . ' AS ic
+ON sound.id = ic.sound_id
+WHERE ic.image_id = ' . $img_id . '  AND ' . $clause . '
+ORDER BY ic.cat_id DESC;';
+
+$result = mysql_fetch_assoc(pwg_query($q));
+
+if (is_admin())
+{
+  $template->assign('mp3_button', array(
+    'URL' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . WFS_DIR . '%2Fadmin%2Fadd_page_on_picture.php&amp;catid=' . $cat_id . '&amp;imgid=' . $img_id . '&amp;backurl=' . $_SERVER['REQUEST_URI'],
+    'ICON' => WFS_PATH . 'template/add_button.png'));
+}
+
+if (isset($result['sound']))
+{
+  if (file_exists($result['sound']))
+  {
+		if (!empty($result['volume']))
+    {
+      $wfs_conf[1] = $result['volume'];
+    }
+    $template->assign('wfs', array(
+      'MP3' => WFS_PATH . 'dewplayer.swf?son=' . strtr($result['sound'] , array(' ' => '%20')),
+      'VOLUME' => $wfs_conf[1],
+      'PLAYER_WIDTH' => $wfs_conf[2] - 2, // 2px de moins pour la nouvelle version de dewplayer
+      'AUTOSTART' => $wfs_conf[3],
+      'AUTOREPLAY' => $wfs_conf[4]));
+  }
+  else
+  {
+  	pwg_query('DELETE FROM ' . WFS_IMG_CAT_TABLE . ' WHERE sound_id = ' . $result['id'] . ';');
+    pwg_query('DELETE FROM ' . WFS_SOUNDS_TABLE . ' WHERE id = ' . $result['id'] . ';');
+  }
+}
+
+$template->set_filenames(array('wfs' => dirname(__FILE__) . '/template/wfs_on_picture.tpl'));
+$template->concat('PLUGIN_PICTURE_ACTIONS', $template->parse('wfs', true));
+
+?>
