59 lines
No EOL
1.4 KiB
Text
59 lines
No EOL
1.4 KiB
Text
;********************************
|
|
;*
|
|
;* lweb_helper.pbi
|
|
;*
|
|
|
|
Procedure.s mimetype(file.s)
|
|
Select file
|
|
Case "pdf"
|
|
ProcedureReturn "application/pdf"
|
|
Case "zip"
|
|
ProcedureReturn "application/zip"
|
|
Case "gz"
|
|
ProcedureReturn "application/gzip"
|
|
Case "doc"
|
|
ProcedureReturn "application/msword"
|
|
Case "xls"
|
|
ProcedureReturn "application/vnd.ms-excel"
|
|
Case "ppt"
|
|
ProcedureReturn "application/vnd.ms-powerpoint"
|
|
Case "png"
|
|
ProcedureReturn "image/png"
|
|
Case "gif"
|
|
ProcedureReturn "image/gif"
|
|
Case "jpg"
|
|
ProcedureReturn "image/jpeg"
|
|
Case "jpeg"
|
|
ProcedureReturn "image/jpeg"
|
|
Case "txt"
|
|
ProcedureReturn "text/plain"
|
|
Case "html"
|
|
ProcedureReturn "text/html"
|
|
Case "htm"
|
|
ProcedureReturn "text/html"
|
|
Case "mss"
|
|
ProcedureReturn "text/html"
|
|
Case "php"
|
|
ProcedureReturn "text/html"
|
|
Case "css"
|
|
ProcedureReturn "text/css"
|
|
Case "js"
|
|
ProcedureReturn "text/javascript"
|
|
Default
|
|
ProcedureReturn "application/octet-stream"
|
|
EndSelect
|
|
EndProcedure
|
|
|
|
|
|
Procedure.s MapToJSONString(Map ConvertMap.s())
|
|
Protected MyJSON
|
|
Protected.s Response
|
|
MyJSON = CreateJSON(#PB_Any)
|
|
If MyJSON
|
|
InsertJSONMap(JSONValue(MyJSON), ConvertMap())
|
|
Response = ComposeJSON(MyJSON)
|
|
FreeJSON(MyJSON)
|
|
ProcedureReturn Response
|
|
EndIf
|
|
ProcedureReturn #error_string
|
|
EndProcedure |