<?php

include 'icl/show#primaryfield##mediatype#.inc.php';

function remove#primaryfield##mediatype#pic(){
	$#primarykey#=GETVAL('#primarykey#');
	
	global $db;
	
	checkgskey('remove#primaryfield##mediatype#pic_'.$#primarykey#);	
		
	$query="update #tablename# set #picflag#=0 where #primarykey#=$#primarykey#";
	sql_query($query,$db);
		
	$fn='#uploaddir#'.$#primarykey#.'#fileext#';
	if (file_exists($fn)) unlink($fn);
		
	logaction("removed #mediatype# picture of #primaryfield# #$#primarykey#",array('#primarykey#'=>$#primarykey#));
		
	
	show#primaryfield##mediatype#($#primarykey#);
		
}