Index: /extensions/delete_hit_rate/admin/admin.php
===================================================================
--- /extensions/delete_hit_rate/admin/admin.php	(revision 9796)
+++ /extensions/delete_hit_rate/admin/admin.php	(revision 9796)
@@ -0,0 +1,78 @@
+<?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', PDHR_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'] = 'pdhr';
+else
+    $page['tab'] = $_GET['tab'];
+
+$tabsheet = new tabsheet();
+$tabsheet->add('pdhr',
+               l10n('pdhr_onglet_all'),
+               $my_base_url.'&amp;tab=pdhr');
+
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+// Onglet gestion par photo
+switch ($page['tab'])
+{
+ case 'pdhr':
+
+  $template->assign(
+    'gestion',
+    array(
+
+      ));
+
+//purge photo
+if (isset($_POST['pdhr_all_h']))
+	{
+	$query = '
+UPDATE ' . IMAGES_TABLE . '
+  SET hit= \'0\'
+    ;';
+$result = pwg_query($query);
+
+	array_push( $page['infos'], l10n('pdhr_all_hok') );
+	
+	}
+	
+if (isset($_POST['pdhr_all_r']))
+	{
+	$query = '
+UPDATE ' . IMAGES_TABLE . '
+  SET average_rate= \'NULL\'
+    ;';
+$result = pwg_query($query);
+
+	$query = '
+TRUNCATE ' . RATE_TABLE . '
+    ;';
+$result = pwg_query($query);
+
+	array_push( $page['infos'], l10n('pdhr_all_rok') );
+	
+	}
+	  
+    break;
+
+} 
+
+$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); 
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/delete_hit_rate/admin/admin.tpl
===================================================================
--- /extensions/delete_hit_rate/admin/admin.tpl	(revision 9796)
+++ /extensions/delete_hit_rate/admin/admin.tpl	(revision 9796)
@@ -0,0 +1,14 @@
+<div class="titrePage">
+  <h2>Delete Hit/Rate</h2>
+</div>
+
+{if isset ($gestion)}
+	<div>
+		<form method="post" >
+			<div style="text-align:center;">
+				<input class="submit" name="pdhr_all_h" type="submit" "onclick="return confirm('{'Are you sure?'|@translate}');" value="{'pdhr_all_h'|@translate|@escape:'javascript'}" {$TAG_INPUT_ENABLED} />
+				<input class="submit" name="pdhr_all_r" type="submit" "onclick="return confirm('{'Are you sure?'|@translate}');" value="{'pdhr_all_r'|@translate|@escape:'javascript'}" {$TAG_INPUT_ENABLED} />
+			</div>
+		</form>
+	</div>
+{/if}
Index: /extensions/delete_hit_rate/admin/index.php
===================================================================
--- /extensions/delete_hit_rate/admin/index.php	(revision 9796)
+++ /extensions/delete_hit_rate/admin/index.php	(revision 9796)
@@ -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/delete_hit_rate/index.php
===================================================================
--- /extensions/delete_hit_rate/index.php	(revision 9796)
+++ /extensions/delete_hit_rate/index.php	(revision 9796)
@@ -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/delete_hit_rate/initadmin.php
===================================================================
--- /extensions/delete_hit_rate/initadmin.php	(revision 9796)
+++ /extensions/delete_hit_rate/initadmin.php	(revision 9796)
@@ -0,0 +1,169 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+define('PDHR_DIR' , basename(dirname(__FILE__)));
+define('PDHR_PATH' , PHPWG_PLUGINS_PATH . PDHR_DIR . '/');
+load_language('plugin.lang', PDHR_PATH);
+
+add_event_handler('get_admin_plugin_menu_links', 'dphr_admin_menu');
+function dphr_admin_menu($menu)
+{
+  array_push($menu, array(
+	'NAME' => 'Delete Hit Rate',
+    'URL' => get_admin_plugin_menu_link(PDHR_PATH . 'admin/admin.php')));
+  return $menu;
+}
+
+
+//add prefiltre photo
+add_event_handler('loc_begin_admin', 'plugdphrPf',60);
+
+function plugdphrPf()
+	{
+	global $template;
+	$template->set_prefilter('picture_modify', 'plugdphrPT');
+	}
+
+function plugdphrPT($content, &$smarty)
+	{
+load_language('plugin.lang', PDHR_PATH);
+  $search = '#<form id="associations"#';
+  
+  $replacement = '
+	<div>
+		<form method="post" >
+			<fieldset>
+				<legend>{\'pdhr_l\'|@translate}</legend>
+					<div style="text-align:center;">
+					<input class="submit" name="plugdphphoto" type="submit" onclick="return confirm(\'{\'Are you sure?\'|@translate|@escape:\'javascript\'}\');" value="{\'pdhr_photo_h\'|@translate}" {$TAG_INPUT_ENABLED} />
+					<input class="submit" name="plugdprphoto" type="submit" onclick="return confirm(\'{\'Are you sure?\'|@translate|@escape:\'javascript\'}\');" value="{\'pdhr_photo_r\'|@translate}" {$TAG_INPUT_ENABLED} />
+					</div>
+			</fieldset>
+		</form>
+	</div>
+  <form id="associations"';
+
+  return preg_replace($search, $replacement, $content);
+	}
+ 
+if (isset($_POST['plugdphphoto']))
+ {
+	$query = '
+UPDATE ' . IMAGES_TABLE . '
+  SET hit= \'0\'
+  WHERE id = '.$_GET['image_id'].'
+    ;';
+$result = pwg_query($query);
+  }
+
+if (isset($_POST['plugdprphoto']))
+ {
+	$query = '
+UPDATE ' . IMAGES_TABLE . '
+  SET average_rate = \'NULL\'
+  WHERE id = '.$_GET['image_id'].'
+    ;';
+$result = pwg_query($query);
+
+	$query = '
+  DELETE FROM ' . RATE_TABLE . '
+  WHERE element_id = '.$_GET['image_id'].'
+    ;';
+$result = pwg_query($query);
+  }
+  
+  
+//add prefiltre album
+add_event_handler('loc_end_cat_modify', 'plugdphrAf');
+
+function plugdphrAf()
+ {
+	global $template;
+	$template->set_prefilter('categories', 'plugdphrAT');
+ }
+
+function plugdphrAT($content, &$smarty)
+ {
+load_language('plugin.lang', PDHR_PATH);
+  $search = '#name="reset">
+</p>#';
+  
+  $replacement = 'name="reset">
+</p>
+
+  	<div>
+		<form method="post" >
+			<fieldset>
+				<legend>{\'pdhr_l\'|@translate}</legend>
+					<div style="text-align:center;">
+					<input class="submit" name="plugdphA" type="submit" onclick="return confirm(\'{\'Are you sure?\'|@translate|@escape:\'javascript\'}\');" value="{\'pdhr_album_h\'|@translate}" {$TAG_INPUT_ENABLED} />
+					<input class="submit" name="plugdprA" type="submit" onclick="return confirm(\'{\'Are you sure?\'|@translate|@escape:\'javascript\'}\');" value="{\'pdhr_album_r\'|@translate}" {$TAG_INPUT_ENABLED} />
+					</div>
+			</fieldset>
+		</form>
+	</div>
+  ';
+
+  return preg_replace($search, $replacement, $content);
+ }
+ 
+ 
+if (isset($_POST['plugdphA']))
+ {
+  	$query = '
+select image_id
+  FROM ' . IMAGE_CATEGORY_TABLE . '
+  WHERE category_id = '.$_GET['cat_id'].'
+  ;';
+$result = pwg_query($query);
+
+$delval = array();
+while($row = mysql_fetch_array($result))
+	{
+    array_push($delval, $row['image_id']);
+	}
+ 
+ foreach ($delval as $delrate)
+	{
+ 	$query = '
+UPDATE ' . IMAGES_TABLE . '
+  SET hit= \'0\'
+  WHERE id = \''.$delrate.'\'
+    ;';
+$result = pwg_query($query);
+	}
+ }
+
+if (isset($_POST['plugdprA']))
+ {
+ 	$query = '
+select image_id
+  FROM ' . IMAGE_CATEGORY_TABLE . '
+  WHERE category_id = '.$_GET['cat_id'].'
+  ;';
+$result = pwg_query($query);
+
+$delval = array();
+while($row = mysql_fetch_array($result))
+	{
+    array_push($delval, $row['image_id']);
+	}
+
+foreach ($delval as $delrate)
+	{
+		$query = '
+		UPDATE ' . IMAGES_TABLE . '
+		SET average_rate = \'NULL\'
+		WHERE id = \''.$delrate.'\'
+    ;';
+$result = pwg_query($query);
+	
+		$query = '
+		DELETE FROM ' . RATE_TABLE . '
+		WHERE element_id = \''.$delrate.'\'
+		;';
+		$result = pwg_query($query);
+	}
+ } 
+
+?>
Index: /extensions/delete_hit_rate/language/en_UK/description.txt
===================================================================
--- /extensions/delete_hit_rate/language/en_UK/description.txt	(revision 9796)
+++ /extensions/delete_hit_rate/language/en_UK/description.txt	(revision 9796)
@@ -0,0 +1,1 @@
+Purge rates or hits to a photo, all photo album or all photos in the gallery
Index: /extensions/delete_hit_rate/language/en_UK/index.php
===================================================================
--- /extensions/delete_hit_rate/language/en_UK/index.php	(revision 9796)
+++ /extensions/delete_hit_rate/language/en_UK/index.php	(revision 9796)
@@ -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/delete_hit_rate/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/delete_hit_rate/language/en_UK/plugin.lang.php	(revision 9796)
+++ /extensions/delete_hit_rate/language/en_UK/plugin.lang.php	(revision 9796)
@@ -0,0 +1,14 @@
+<?php
+
+$lang['pdhr_onglet_all'] = 'Purge All';
+$lang['pdhr_all_h'] = 'Purge all hits on all pictures gallery';
+$lang['pdhr_all_hok'] = 'Hit purge completed successfully';
+$lang['pdhr_all_r'] = 'Purge all rate on all pictures gallery';
+$lang['pdhr_all_rok'] = 'Rate purge completed successfully';
+$lang['pdhr_l'] = 'Purge - Plugin Delete Hit/Rate';
+$lang['pdhr_photo_h'] = 'Purge hit of the photo';
+$lang['pdhr_photo_r'] = 'Purge rate of the photo';
+$lang['pdhr_album_h'] = 'Purge hits on all pictures album';
+$lang['pdhr_album_r'] = 'Purge rates on all pictures album';
+
+?>
Index: /extensions/delete_hit_rate/language/fr_FR/description.txt
===================================================================
--- /extensions/delete_hit_rate/language/fr_FR/description.txt	(revision 9796)
+++ /extensions/delete_hit_rate/language/fr_FR/description.txt	(revision 9796)
@@ -0,0 +1,1 @@
+Purger les notes ou le nombre de visites d'un photo, des photos d'un album ou de toutes les photos de la galerie
Index: /extensions/delete_hit_rate/language/fr_FR/index.php
===================================================================
--- /extensions/delete_hit_rate/language/fr_FR/index.php	(revision 9796)
+++ /extensions/delete_hit_rate/language/fr_FR/index.php	(revision 9796)
@@ -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/delete_hit_rate/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/delete_hit_rate/language/fr_FR/plugin.lang.php	(revision 9796)
+++ /extensions/delete_hit_rate/language/fr_FR/plugin.lang.php	(revision 9796)
@@ -0,0 +1,14 @@
+<?php
+
+$lang['pdhr_onglet_all'] = 'Purge Total';
+$lang['pdhr_all_h'] = 'Purger tous les hits de la galerie';
+$lang['pdhr_all_hok'] = 'Purge totale des hits effectuée avec succès';
+$lang['pdhr_all_r'] = 'Purger toutes les notes de la galerie';
+$lang['pdhr_all_rok'] = 'Purge total des notes effectuée avec succès';
+$lang['pdhr_l'] = 'Purger - Plugin Delete Hit/Rate';
+$lang['pdhr_photo_h'] = 'Purger le hit de la photo';
+$lang['pdhr_photo_r'] = 'Purger la note de la photo';
+$lang['pdhr_album_h'] = 'Purger les hits de toutes les photos de l\'album';
+$lang['pdhr_album_r'] = 'Purger les notes de toutes les photos de l\'album';
+
+?>
Index: /extensions/delete_hit_rate/language/index.php
===================================================================
--- /extensions/delete_hit_rate/language/index.php	(revision 9796)
+++ /extensions/delete_hit_rate/language/index.php	(revision 9796)
@@ -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/delete_hit_rate/main.inc.php
===================================================================
--- /extensions/delete_hit_rate/main.inc.php	(revision 9796)
+++ /extensions/delete_hit_rate/main.inc.php	(revision 9796)
@@ -0,0 +1,19 @@
+<?php
+/*
+Plugin Name: Delete Hit/Rate
+Version: auto
+Description: delete hit Rate
+Plugin URI: http://piwigo.org/ext/extension_view.php?eid=520
+Author: ddtddt
+Author URI: http://piwigo.org/
+*/
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// Plugin for admin
+if (script_basename() == 'admin')   
+{
+  include_once(dirname(__FILE__).'/initadmin.php');
+}
+
+?>
