| |
| scriptlog:lib:utility:downloadutility [2026/09/26 09:09] – admin admin | scriptlog:lib:utility:downloadutility [2026/09/26 09:16] (current) – admin admin |
|---|
| ======= Docblock Metadata ======= | ======= Docblock Metadata ======= |
| |
| ^ Tag ^ Value ^ | ^ Tag ^ Value ^ |
| | ''@category'' | Utility Class | | | ''@category'' | Utility Class | |
| | ''@author'' | M.Noermoehammad | | | ''@author'' | M.Noermoehammad | |
| | ''@license'' | MIT | | | ''@license'' | MIT | |
| | ''@version'' | 1.0 | | | ''@version'' | 1.0 | |
| | ''@since'' | Since Release 1.0 | | | ''@since'' | Since Release 1.0 | |
| |
| ======= Inheritance ======= | ======= Inheritance ======= |
| ======= Constants (2) ======= | ======= Constants (2) ======= |
| |
| ^ Visibility ^ Name ^ Value ^ Line ^ | ^ Visibility ^ Name ^ Value ^ Line ^ |
| | ''-'' | ''CHUNK_SIZE'' | ''8192;'' | 18 | | | ''-'' | ''CHUNK_SIZE'' | ''8192;'' | 18 | |
| | ''-'' | ''DEFAULT_EXPIRY'' | ''28800;'' | 19 | | | ''-'' | ''DEFAULT_EXPIRY'' | ''28800;'' | 19 | |
| |
| ======= Properties (0) ======= | ======= Properties (0) ======= |
| ======= Methods (9) ======= | ======= Methods (9) ======= |
| |
| ^ Visibility ^ Method ^ Summary ^ Line ^ | ^ Visibility ^ Method ^ Summary ^ Line ^ |
| | public static | ''setDownloadHeaders()'' | Set download headers for file delivery | 29 | | | public static | ''setDownloadHeaders()'' | Set download headers for file delivery | 29 | |
| | public static | ''validateDownloadRequest()'' | Validate download request by identifier | 45 | | | public static | ''validateDownloadRequest()'' | Validate download request by identifier | 45 | |
| | public static | ''isHotlinkingAllowed()'' | Check if hotlinking is allowed based on referer | 57 | | | public static | ''isHotlinkingAllowed()'' | Check if hotlinking is allowed based on referer | 57 | |
| | public static | ''isMimeTypeAllowed()'' | Check if MIME type is allowed based on settings | 77 | | | public static | ''isMimeTypeAllowed()'' | Check if MIME type is allowed based on settings | 77 | |
| | public static | ''deliverFile()'' | Deliver file to client with streaming | 91 | | | public static | ''deliverFile()'' | Deliver file to client with streaming | 91 | |
| | public static | ''getMimeType()'' | Get MIME type of a file | 117 | | | public static | ''getMimeType()'' | Get MIME type of a file | 117 | |
| | public static | ''sanitizeFilePath()'' | Sanitize file path to prevent traversal attacks | 143 | | | public static | ''sanitizeFilePath()'' | Sanitize file path to prevent traversal attacks | 143 | |
| | public static | ''isExpired()'' | Check if download link has expired | 164 | | | public static | ''isExpired()'' | Check if download link has expired | 164 | |
| | private static | ''getMimeTypeDictionary()'' | Get basic MIME type dictionary | 174 | | | private static | ''getMimeTypeDictionary()'' | Get basic MIME type dictionary | 174 | |
| |
| |
| Set download headers for file delivery | Set download headers for file delivery |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$filename'' | ''(untyped)'' | //required// | //none// | | | ''$filename'' | ''(untyped)'' | //required// | //none// | |
| | ''$mimeType'' | ''(untyped)'' | //required// | //none// | | | ''$mimeType'' | ''(untyped)'' | //required// | //none// | |
| | ''$filesize'' | ''(untyped)'' | //required// | //none// | | | ''$filesize'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| Validate download request by identifier | Validate download request by identifier |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$identifier'' | ''(untyped)'' | //required// | //none// | | | ''$identifier'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — bool | **Returns:** ''(none declared)'' — bool |
| Check if hotlinking is allowed based on referer | Check if hotlinking is allowed based on referer |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$referer'' | ''(untyped)'' | //required// | //none// | | | ''$referer'' | ''(untyped)'' | //required// | //none// | |
| | ''$allowedDomains'' | ''(untyped)'' | ''[]'' | //none// | | | ''$allowedDomains'' | ''(untyped)'' | ''[]'' | //none// | |
| |
| **Returns:** ''(none declared)'' — bool | **Returns:** ''(none declared)'' — bool |
| Check if MIME type is allowed based on settings | Check if MIME type is allowed based on settings |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$mimeType'' | ''(untyped)'' | //required// | //none// | | | ''$mimeType'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — bool | **Returns:** ''(none declared)'' — bool |
| Deliver file to client with streaming | Deliver file to client with streaming |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$filepath'' | ''(untyped)'' | //required// | //none// | | | ''$filepath'' | ''(untyped)'' | //required// | //none// | |
| | ''$filename'' | ''(untyped)'' | //required// | //none// | | | ''$filename'' | ''(untyped)'' | //required// | //none// | |
| | ''$mimeType'' | ''(untyped)'' | //required// | //none// | | | ''$mimeType'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| Get MIME type of a file | Get MIME type of a file |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$filepath'' | ''(untyped)'' | //required// | //none// | | | ''$filepath'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — string | **Returns:** ''(none declared)'' — string |
| Sanitize file path to prevent traversal attacks | Sanitize file path to prevent traversal attacks |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$filename'' | ''(untyped)'' | //required// | //none// | | | ''$filename'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — string|false | **Returns:** ''(none declared)'' — string|false |
| Check if download link has expired | Check if download link has expired |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$beforeExpired'' | ''(untyped)'' | //required// | //none// | | | ''$beforeExpired'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — bool | **Returns:** ''(none declared)'' — bool |