set_prefilter('picture_modify', 'plugdphrPT'); $template->assign( array( 'U_DELETEPHIT' => $admin_base_url . '&deletephit', 'U_DELETEPRATE' => $admin_base_url . '&deleteprate', )); } function plugdphrPT($content) { load_language('plugin.lang', PDHR_PATH); $search = "#
#";
$replacement = '
{\'Purge hit of the photo\'|@translate}
{\'Purge rate of the photo\'|@translate}
';
return preg_replace($search, $replacement, $content);
}
function plugdphrPf2()
{
if (isset($_GET['deletephit'])) {
$admin_base_url=explode('&deletephit', $_SERVER['REQUEST_URI']);
$photoid = explode('photo-', $_SERVER['REQUEST_URI']);
if(strstr($photoid[1], '-properties')){$photoid = explode('-properties', $photoid[1]);}
else if(strstr($photoid[1], '&cat')){$photoid = explode('&cat', $photoid[1]);}
else{
$_SESSION['page_infos'] = array('error');
redirect($_SERVER['REQUEST_URI']);
}
$_SESSION['page_infos'] = $admin_base_url;
$query = 'UPDATE ' . IMAGES_TABLE . ' SET hit= \'0\' WHERE id = '.$photoid[0].';';
$result = pwg_query($query);
redirect($admin_base_url[0]);
}
if (isset($_GET['deleteprate'])) {
$admin_base_url=explode('&deleteprate', $_SERVER['REQUEST_URI']);
$photoid = explode('photo-', $_SERVER['REQUEST_URI']);
if(strstr($photoid[1], '-properties')){$photoid = explode('-properties', $photoid[1]);}
else if(strstr($photoid[1], '&cat')){$photoid = explode('&cat', $photoid[1]);}
else{
$_SESSION['page_infos'] = array('error');
redirect($_SERVER['REQUEST_URI']);
}
$query = 'UPDATE ' . IMAGES_TABLE . ' SET rating_score = NULL WHERE id = '.$photoid[0].';';
$result = pwg_query($query);
$query = 'DELETE FROM ' . RATE_TABLE . ' WHERE element_id = '.$photoid[0].';';
$result = pwg_query($query);
redirect($admin_base_url[0]);
}
}
//add prefiltre album
add_event_handler('loc_end_cat_modify', 'plugdphrAf');
add_event_handler('loc_end_cat_modify', 'plugdphrAf2');
function plugdphrAf()
{
global $template;
$admin_base_url = $_SERVER['REQUEST_URI'];
$template->set_prefilter('album_properties', 'plugdphrAT');
$template->assign(
array(
'U_DELETEAHIT' => $admin_base_url . '&deleteahit',
'U_DELETEARATE' => $admin_base_url . '&deletearate',
));
}
function plugdphrAT($content)
{
load_language('plugin.lang', PDHR_PATH);
$search = '#