<?php
function smarty_function_admin_add($params, &$smarty) {
	//
	global $section;
	global $data;
	global $key_name;
	
	//
	$schema = HOME_DIR."data/".$section."/schema/schema.php";	
	$smarty->assign("success", "Unknown error.");
	for($i = 1; $i <= $_POST['number']; $i ++) {
		$target = HOME_DIR."data/".$section."/new_item".sprintf("%03d",$i).".php";
		if(copy($schema, $target)) {
			$smarty->assign("success", "true");
		} else {
			$smarty->assign("success", "Problem copying schema.");
		}
	}
}
?>