'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);
add_event_handler('loc_begin_admin_page', 'plugdphrPf2',60);
function plugdphrPf()
{
global $template;
$template->set_prefilter('picture_modify', 'plugdphrPT');
}
function plugdphrPT($content, &$smarty)
{
load_language('plugin.lang', PDHR_PATH);
$search = '##';
$replacement = '
';
return preg_replace($search, $replacement, $content);
}
function plugdphrPf2()
{
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 rating_score = \'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');
add_event_handler('loc_end_cat_modify', 'plugdphrAf2');
function plugdphrAf()
{
global $template;
$template->set_prefilter('album_properties', 'plugdphrAT');
}
function plugdphrAT($content, &$smarty)
{
load_language('plugin.lang', PDHR_PATH);
$search = '##';
$replacement = '
';
return preg_replace($search, $replacement, $content);
}
function plugdphrAf2()
{
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 = pwg_db_fetch_assoc($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 = pwg_db_fetch_assoc($result))
{
array_push($delval, $row['image_id']);
}
foreach ($delval as $delrate)
{
$query = '
UPDATE ' . IMAGES_TABLE . '
SET rating_score = \'NULL\'
WHERE id = \''.$delrate.'\'
;';
$result = pwg_query($query);
$query = '
DELETE FROM ' . RATE_TABLE . '
WHERE element_id = \''.$delrate.'\'
;';
$result = pwg_query($query);
}
}
}
?>