return $mask['callbacks'][$_POST['callback']]();
}
+function download_file($table,$column,$path,$id)
+{
+ global $mask;
+
+ $sql = sprintf("SELECT %s FROM %s WHERE id = %d", $column, $table, $id);
+ $sth = pg_query($sql);
+ if ($sth === false) return "Database error, Query " . $sql;
+
+ $row = pg_fetch_assoc($sth);
+
+ $fname = $_SESSION['sys']['basedir'] . 'archive/' . $path . '/' . $row[$column];
+
+ if (($f = fopen($fname,'r')) === false)
+ return sprintf("Cannot open file for id %d", $id);
+
+ $basename = basename($row[$column]);
+ $filesize = filesize($fname);
+ $content_type = mime_content_type($fname);
+
+ header(sprintf('Content-disposition: inline; filename="%s"', $basename));
+ header(sprintf('Content-Length: %d', $filesize));
+ header(sprintf('Content-Type: %s', $content_type));
+ header("Cache-Control: ");
+ header("Pragma: ");
+ usleep(5000);
+ fpassthru($f);
+ fclose($f);
+}
+
function process_file($mask)
{
if (!array_key_exists('files',$mask))