set_prefilter('picture', 'udpT'); } function udpT($content, &$smarty) { global $conf; $search = '#
#'; $replacement = ' {if $UDFA}
{/if}
'; return preg_replace($search, $replacement, $content); } add_event_handler('loc_begin_picture', 'udpA'); function udpA() { global $conf, $page, $template ; load_language('plugin.lang', UDP_PATH); load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); global $conf, $user, $page; $query = ' select added_by FROM ' . IMAGES_TABLE . ' WHERE id = \''.$page['image_id'].'\' ;'; $result = pwg_query($query); $row = pwg_db_fetch_assoc($result); $userudp=$row['added_by']; $query = ' select username FROM ' . USERS_TABLE . ' WHERE id = \''.$userudp.'\' ;'; $result = pwg_query($query); $row = pwg_db_fetch_assoc($result); $udp=$row['username']; if (($udp == $user['username'])) { $template->assign( array ( 'UDFA' => 'udp', ) ); } if ((isset($_POST['submitudpA']) and ($udp == $user['username']))) { if (!(isset($_POST['confirm_deletionudp']) and 1 == $_POST['confirm_deletionudp'])) { array_push($page['errors'], l10n('You need to confirm deletion')); } else { include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); global $page; $deletephotoudp =array($page['image_id']); delete_elements($deletephotoudp, true); invalidate_user_cache(); $redirect_url = get_root_url().'index.php?/category/'.($page['category']['id']); $_SESSION['page_infos'] = array(l10n('Photo deleted')); redirect($redirect_url); } } } ?>