Example #1
0
}
$id = abs($_REQUEST['id']);
$sql = "SELECT file_name, folder_id, description FROM %sfiles WHERE file_id=%d AND owner_type=%d AND owner_id=%d";
$row = queryDB($sql, array(TABLE_PREFIX, $id, $owner_type, $owner_id), TRUE);
if (count($row) == 0) {
    $msg->printErrors('FILE_NOT_EXIST');
    require AT_INCLUDE_PATH . 'footer.inc.php';
    exit;
}
if (isset($_POST['description'])) {
    $row['description'] = $stripslashes($_POST['description']);
    $row['file_name'] = $stripslashes($_POST['name']);
    $row['comment'] = $stripslashes($_POST['comment']);
    $_POST['body'] = $stripslashes($_POST['body']);
}
$ext = fs_get_file_extension($row['file_name']);
$file_path = fs_get_file_path($id);
?>

<form method="post" action="<?php 
echo $_SERVER['PHP_SELF'] . $owner_arg_prefix;
?>
" name="form">
<input type="hidden" name="id" value="<?php 
echo $id;
?>
" />
<input type="hidden" name="folder" value="<?php 
echo $row['folder_id'];
?>
" />
/**
 * returns the image name (w/o the ".gif" ending) of the icon to use
 * for the given file name.
 * if no icon is specified (by mime.inc.php) then returns "generic"
 */
function fs_get_file_type_icon($file_name) {
	global $mime;
	if (!isset($mime)) {
		require(AT_INCLUDE_PATH.'lib/mime.inc.php');
	}
	$ext = fs_get_file_extension($file_name);

	if (isset($mime[$ext]) && $mime[$ext][1]) {
		return $mime[$ext][1];
	}
	return 'generic';
}