# Remove entry in DB delete_bhdb("uploads", array("sessionid" => session_id())); } else { bh_log("Fatal error in upload notification system", "BH_ERROR"); } } elseif (count($fupload) > 0) { # Notify the popup to close $uploadrows = select_bhdb("uploads", array("sessionid" => session_id()), 1); if (empty($uploadrows)) { insert_bhdb("uploads", array("sessionid" => session_id(), "status" => "finished")); } else { update_bhdb("uploads", array("status" => "finished"), array("sessionid" => session_id())); } # Calculate used bandwidth foreach ($fupload as $fileinfo) { bh_bandwidth($bhsession['username'], "up", $fileinfo['size']); } # Check they can write to the destination directory if (bh_checkrights($infolder, $bhsession['username']) >= 2) { foreach ($fupload as $fileinfo) { # If it's a valid upload... if (empty($fileinfo['name']) !== TRUE) { # Check the file actually exists. if (file_exists($fileinfo['tempname'])) { # Create thing of banned exts $bannedexts = array("exexexexex" => 1); $invalid = False; foreach ($bannedexts as $ext => $one) { if (substr($fileinfo['name'], 0 - strlen($ext)) == $ext) { $invalid = True; }
# Note: no layouts here, of course. Unless we get an error. # Test for include status if (IN_BH != 1) { header("Location: ../index.php"); die; } $filepath = bh_fpclean($_GET['filepath']); $filename = bh_get_filename($filepath); if (bh_file_exists($filepath) == true) { $fileobj = new bhfile($filepath); #if ($fileobj->fileinfo['size'] == 0) { # bh_log($bhlang['error:file_not_exist'], "BH_NOPAGE"); # require "modules/error.inc.php"; #} else { # Log bandwidth usage. New feature, for those who like Absolute Control(tm). This comment shamelessly copied from upload.inc.php. bh_bandwidth($bhsession['username'], "down", $fileobj->fileinfo['filesize']); header("Content-type: " . $fileobj->mimetype()); # If there's a Secret Message from the view image script not to include download headers, don't. if ($_GET['nodownheaders'] == 1) { header("Content-Disposition: filename=" . $filename); } else { header("Content-Disposition: attachment; filename=" . $filename); } header("Content-length: " . $fileobj->fileinfo['filesize']); # IE SSL fix header("Pragma: "); header("Cache-Control: "); $fileobj->readfile(); #} } else { bh_log($bhlang['error:file_not_exist'], "BH_NOPAGE");