function download() { global $mainframe; if (!$mainframe->isAdmin()) { $errmsg = JText::_('ERROR MUST BE LOGGED IN AS ADMIN'); JError::raiseError(500, $errmsg); } // Get the attachment ID $id = JRequest::getVar('id', null); if (!is_numeric($id)) { JError::raiseError(500, $errmsg); } require_once JPATH_BASE . DS . '..' . DS . 'components' . DS . 'com_attachments' . DS . 'helper.php'; AttachmentsHelper::download_attachment($id); }
/** * Download an attachment */ public function download() { // Get the attachment ID $id = JRequest::getInt('id'); if (!is_numeric($id)) { $errmsg = JText::sprintf('ATTACH_ERROR_INVALID_ATTACHMENT_ID_N', $id) . ' (ERR 143)'; JError::raiseError(500, $errmsg); } // NOTE: AttachmentsHelper::download_attachment($id) checks access permission AttachmentsHelper::download_attachment($id); }
function download() { // Get the attachment ID $id = JRequest::getVar('id', null); if (!is_numeric($id)) { $errmsg = JText::_('ERROR INVALID ATTACHMENT ID') . " ({$id})"; JError::raiseError(500, $errmsg); exit; } AttachmentsHelper::download_attachment($id); }