function removeAttachment($hash) { global $gConf; $ret = $this->query("DELETE FROM " . TF_FORUM_ATTACHMENTS . " WHERE `att_hash` = ?", [$hash]); @unlink($gConf['dir']['attachments'] . orca_build_path($hash) . $hash); return $ret; }
function download($hash) { global $gConf; prepare_to_db($hash, 0); $a = $this->fdb->getAttachment($hash); if (!$a) { header("HTTP/1.1 404 Not Found"); echo '404 Not Found'; exit; } if (!$this->_checkUserPerm('', '', 'download', (int) $a['forum_id'])) { transCheck($this->_no_access(1), $gConf['dir']['xsl'] . 'search_form_main.xsl', $_GET['debug'] ? 0 : 1); exit; } $this->fdb->updateAttachmentDownloads($hash); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-type: {$a['att_type']}"); header("Content-Length: " . $a['att_size']); if (0 != strncmp('image/', $a['att_type'], 6)) { header("Content-Disposition: attachment; filename=\"{$a['att_name']}\""); } readfile($gConf['dir']['attachments'] . orca_build_path($hash) . $hash); exit; }