home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
UPCHECK
/
UPLOAD20.ZIP
/
UPLOAD.PPS
< prev
next >
Wrap
Text File
|
1993-10-24
|
6KB
|
142 lines
;*****************************************************************************
;* *
;* UPLOAD.PPE v2.00 *
;* PCBOARD 15.0 Upload Extension Checker *
;* *
;* Written by Steven Hauswirth *
;* Written in PCBoard Programming Language *
;* *
;* "The Power Palace BBS" *
;* Node 1 - 312-594-0643 - [14.4 v32b] - 80386/40 *
;* *
;* This PPE will check to see if the user is trying to upload a type of *
;* file that you do not want in the current conference (by extension). *
;* It will also display a pre-upload text file based on which conference *
;* the user is in. *
;*****************************************************************************
STRING TEMP ;Temporary Storage variable
STRING NUM_FILES ;Number of upload processors configuration files to swap
STRING NAME_EXT ;Name of current extension not to allow
STRING CONF_NUM ;Number of current conference indexed to in the config file
STRING NUM_EXT ;Number of extensions not allowed in the current indexed conference
;in the config file
STRING FILE_NAME ;Name of file to be uploaded
STRING STUFF ;Variable to stuff into keyboard on exit
STRING CMDLINE ;Command line used to call this PPE
STRING FILE_LEAD ;Leader to be stuffed into kbd. 9
INTEGER K ;Loop counter
;**************************************************************************
;* Initialize some variables and get command line passed to PPE *
;**************************************************************************
FILE_NAME = ""
CMDLINE = TOKENSTR()
TOKENIZE CMDLINE
IF (TOKCOUNT() > 0) GETTOKEN FILE_NAME ;Get command line to see if a file
;name was passed
IF (UPPER(FILE_NAME) = "/PCBTEXT") THEN
FILE_LEAD = "" ;If being called from PCBTEXT
FILE_NAME = "" ;then replace the "Upload" prompt
ELSE
FILE_LEAD = "U " ;Else need to stuff a "U"
ENDIF
;**************************************************************************
;* Index past the upload processor configuration file names in the *
;* UPLOAD.CFG file, to get to information for the current conference, the *
;* conference specific pre-upload screen, and not allowed extensions. *
;**************************************************************************
FOPEN 1, PPEPATH() + PPENAME() + ".CFG", O_RD, S_DN
FGET 1, NUM_FILES
IF (UPPER(NUM_FILES) = "NONE") GOTO SKIP ;Config files option wont be used
FGET 1, TEMP
FGET 1, TEMP
FOR K = 1 TO NUM_FILES
FGET 1, TEMP
IF (FERR(1)) GOTO EXIT
NEXT
;**************************************************************************
;* Check to see if current conference has its own pre-upload screen to be *
;* displayed. If not then display the default one. *
;**************************************************************************
:SKIP
IF (FILE_NAME != "") GOTO GOT_NAME
IF (EXIST(PPEPATH() + PPENAME() + "." + STRING(CURCONF()))) THEN
DISPFILE PPEPATH() + PPENAME() + "." + STRING(CURCONF()), GRAPH + LANG
ELSE
DISPFILE PPEPATH() + PPENAME() + ".DEF", LANG + GRAPH
ENDIF
;**************************************************************************
;* Ask for filename to be uploaded. Do some minor error checking *
;**************************************************************************
INPUTSTR "Enter the Filename to Upload (Enter)=none",FILE_NAME,@X0E,12,MASK_FILE(),UPCASE+NEWLINE+LFAFTER+FIELDLEN+GUIDE
IF (LEN(FILE_NAME) = 0) THEN
STUFF = CHR(13)
GOTO EXIT
ENDIF
:GOT_NAME
FILE_NAME = FILE_LEAD + FILE_NAME ;Stuff "U" if needed to filename
FGET 1, CONF_NUM
IF (UPPER(CONF_NUM) = "NONE") THEN ;Check to see if .ext limiting option is to be used
STUFF = FILE_NAME
GOTO EXIT
ENDIF
;**************************************************************************
;* Index to the correct portion of the config file to get the names of *
;* of the extensions that are not allowed in the current conference. *
;**************************************************************************
FGET 1, NUM_EXT ;Get the number of not allowed extension from config file
:SEARCH
WHILE ( CONF_NUM <> STRING(CURCONF()) & !FERR(1) ) DO
FOR K = 1 TO NUM_EXT
FGET 1, NAME_EXT
NEXT
FGET 1, CONF_NUM
FGET 1, NUM_EXT
ENDWHILE
IF (FERR(1)) THEN
STUFF = FILE_NAME
GOTO EXIT
ENDIF
;*************************************************************************
;* Look to see if the extension entered is one that is not allowed. And i*
;* if it is then display a message to the user. *
;*************************************************************************
FOR K = 1 TO NUM_EXT
FGET 1, NAME_EXT
IF (FERR(1)) GOTO EXIT
IF (RIGHT(FILE_NAME,LEN(FILE_NAME)-INSTR(FILE_NAME,".")) = NAME_EXT) THEN
PRINTLN "You have tried to upload a filetype that is not allowed in this conference."
PRINTLN "Please join the appropriate conference and try your upload again."
PRINTLN
STUFF = CHR(13)
WAIT
GOTO EXIT
ENDIF
NEXT
STUFF = FILE_NAME
;**************************************************************************
;* Close files and stuff keyboard *
;**************************************************************************
:EXIT
FCLOSE 1
KBDSTUFF STUFF
END