Processing table: prc.manage_file




 
If:
 

 
 
Then:
2=@td;3=@tm;write

 
If:
 

 
 
Then:
declare global ErrMsg,ErrReturn(8,*),OutFile(256,*),FString,FMDate,FMTime

 
If:
 

 
 
Then:
declare global UName,Pass(20,*),FName,LName,Email,URL,SessID,Expire,SIDString,SessUName,FileRoot,TUser(12,ALLUP)

 
If:
 

 
 
Then:
declare global UpReal,UpOrig,UpSize,UpDest,UpBase,RmBase,SUpdate(1,YESNO),AuthGet(1,YESNO),FileID,Oper

 
If:
 

 
 
Then:
declare OHandle(4,.0),Msg,IHandle(4,.0),SelfURL,Style,Pre,FPos(20,.0),FLine

 
If:
 

 
 
Then:
declare global PEncode(40,*),UpPass,UpDesc,NameEnc,OutShare

 
If:
 

 
 
Then:
declare Cookie,CLUName,CLPass

 
If:
 

 
 
Then:
declare global CookiePresent(1,YESNO)

 
If:
 

 
 
Then:
declare FControl(20,.0),ISDeleted,ISRestricted,TimesDownloaded

 
If:
 

 
 
Then:
declare global CString,CSan(1,YESNO),CNoAmp(1,YESNO),CNoQuest(1,YESNO),CNoSlash(1,YESNO),CNoSpUn(1,YESNO)

 
If:
 

 
 
Then:
declare global CNoPlus(1,YESNO)

 
If:
 

 
 
Then:
ErrReturn="NOT DONE"

 
If:
 

 
 
Then:
OutFile=getenv("ONEGATE_OUTFILE")

 
If:
 

 
 
Then:
declare global OGParseResult(4,*)

 
If:
 

 
 
Then:
call "onegate/ogcgixml"

 
If:
OGParseResult eq "FAIL"

 
 
Then:
ErrMsg="OGCGIXML Parse Failed.";call "generr"

 
If:
ErrReturn eq "DONE"

 
 
Then:
goto myexit

 
If:
 

 
 
Then:
lookup cgi = onegate k=@PW i=A -npx

If:
not cgi

 
 
Then:
close cgi;goto postcgi

 
If:
cgi(1) ne @PW

 
 
Then:
close cgi;goto postcgi

 
If:
cgi(2) eq "session" and cgi(8) eq "N"

 
 
Then:
SessID=cgi(3)

 
If:
cgi(2) eq "fileid" and cgi(8) eq "N"

 
 
Then:
FileID=cgi(3)

 
If:
cgi(2) eq "oper" and cgi(8) eq "N"

 
 
Then:
Oper=cgi(3)

 
If:
cgi(2) eq "flfsslog" and cgi(8) eq "Y"

 
 
Then:
Cookie=cgi(3)

 
If:
cgi(2) eq "pass" and cgi(8) eq "N"

 
 
Then:
UpPass=cgi(3)

 
If:
cgi(2) eq "desc" and cgi(8) eq "N"

 
 
Then:
UpDesc=cgi(3)

 
If:
 

 
 
Then:
delete cgi;getnext cgi;goto cgiloop

If:
Cookie eq ""

 
 
Then:
goto nocook

 
If:
Cookie ne ""

 
 
Then:
cp=instr(Cookie,"|");CookiePresent="Y"

 
If:
cp ne "0"

 
 
Then:
CLUName=mid(Cookie,"1",cp-"1");CLPass=mid(Cookie,cp+"1",len(Cookie)-cp);PEncode=CLPass

 
If:
 

 
 
Then:
lookup ckchk = flfss_accounts k=(CLUName) i=A -nx

 
If:
not ckchk

 
 
Then:
close ckchk;goto nocook

 
If:
 

 
 
Then:
Pass=ckchk(9);close ckchk

If:
(SessID eq "" or SessID eq "NOSESSION") and Cookie eq ""

 
 
Then:
ErrMsg="Your session has expired. Please log in again.";call "loginform";exit

 
If:
 

 
 
Then:
SUpdate="Y";call "verify_session"

 
If:
SessID eq "CHANGEDIP"

 
 
Then:
ErrMsg="Your session ID does not match your IP Address.";call "loginform";exit

 
If:
(SessID eq "" or SessID eq "NOSESSION") and Cookie eq ""

 
 
Then:
ErrMsg="Your session has expired. Please log in again.";call "loginform";exit

 
If:
(SessID eq "" or SessID eq "NOSESSION") and (Cookie ne "" and PEncode eq Pass)

 
 
Then:
UName=CLUname;SIDString=@PW;call "make_sessionid";SessID=SIDString;UName=CLUName;call "insert_session";SUpdate="N"

 
If:
SUpdate eq "Y"

 
 
Then:
call "update_session"

 
If:
Cookie eq ""

 
 
Then:
UName=SessUName

 
If:
Cookie ne ""

 
 
Then:
UName=CLUname

 
If:
 

 
 
Then:
lookup valt = flfss_accounts k=(UName) i=A -nx

 
If:
not valt

 
 
Then:
close valt;ErrMsg="User '"{UName{"' does not exist.";call "logindone";exit

 
If:
 

 
 
Then:
close valt

 
If:
 

 
 
Then:
CNoSpUn="Y";CSan="Y";CNoAmp="N";CNoQuest="N";CNoSlash="N";CNoPlus="N";CString=Oper;call "clean_strings";Oper=CString

 
If:
 

 
 
Then:
CNoSpUn="Y";CSan="Y";CNoAmp="N";CNoQuest="N";CNoSlash="N";CNoPlus="N";CString=FileID;call "clean_strings";FileID=CString

 
If:
 

 
 
Then:
CNoSpUn="Y";CSan="Y";CNoAmp="N";CNoQuest="N";CNoSlash="N";CNoPlus="N";CString=UpPass;call "clean_strings";UpPass=CString

 
If:
 

 
 
Then:
CNoSpUn="Y";CSan="Y";CNoAmp="N";CNoQuest="N";CNoSlash="N";CNoPlus="N";CString=UpDesc;call "clean_strings";UpDesc=CString

 
If:
FileID eq ""

 
 
Then:
ErrMsg="No file specified.";call "logindone";exit

 
If:
Oper ne "sd" and Oper ne "hd" and Oper ne "ud" and Oper ne "cp" and Oper ne "rp" and Oper ne "cd" and Oper ne "ms"

 
 
Then:
ErrMsg="No valid operation specified.";call "logindone";exit

 
If:
 

 
 
Then:
IHandle=open("flfss.styleurl","r")

 
If:
IHandle lt "0"

 
 
Then:
Style="";goto skiprd

 
If:
 

 
 
Then:
ln=readline(IHandle,Style,"999")

 
If:
 

 
 
Then:
ln=close(Ihandle)

If:
 

 
 
Then:
IHandle=open("flfss.baseurl","r")

 
If:
IHandle lt "0"

 
 
Then:
SelfURL="/~fairlite/cgi-bin/cgiwrap/filepro/onegate";goto skiprd2

 
If:
 

 
 
Then:
ln=readline(IHandle,SelfURL,"999")

 
If:
 

 
 
Then:
ln=close(IHandle)

If:
 

 
 
Then:
lookup upmg = flfss_uploads k=(FileID) i=B -npx

 
If:
not upmg

 
 
Then:
ErrMsg="File does not exist.";close upmg;call "logindone";exit;

 
If:
upmg(1) ne UName

 
 
Then:
close upmg;ErrMsg="You are not the file's owner. Access Denied.";call "logindone";exit

 
If:
upmg(10) eq "Y" and Oper eq "sd"

 
 
Then:
close upmg;ErrMsg="File already deleted.";call "logindone";exit

 
If:
Oper eq "cp" and UpPass eq ""

 
 
Then:
close upmg;ErrMsg="No new password provided. Password not changed.";call "logindone";exit

 
If:
upmg(10) eq "N" and Oper eq "sd"

 
 
Then:
upmg(10)="Y";write upmg;close upmg;ErrMsg="File deleted.";call "logindone";exit

 
If:
upmg(10) eq "N" and Oper eq "ud"

 
 
Then:
close upmg;ErrMsg="File already undeleted.";call "logindone";exit

 
If:
upmg(10) eq "Y" and Oper eq "ud"

 
 
Then:
upmg(10)="N";write upmg;close upmg;ErrMsg="File undeleted.";call "logindone";exit

 
If:
Oper eq "hd"

 
 
Then:
UpReal=upmg(3);ln=remove(UpReal);delete upmg;close upmg;ErrMsg="File permanently deleted.";call "logindone";exit

 
If:
Oper eq "cp"

 
 
Then:
Pass=UpPass;call "scramble_pass";upmg(8)="Y";upmg(12)=PEncode;write upmg;close upmg;ErrMsg="File Password Changed."

 
If:
Oper eq "cp"

 
 
Then:
call "logindone";exit

 
If:
Oper eq "rp"

 
 
Then:
upmg(8)="N";upmg(12)="";write upmg;close upmg;ErrMsg="File Password Removed.";call "logindone";exit

 
If:
Oper eq "cd"

 
 
Then:
upmg(11)=UpDesc;write upmg;close upmg;ErrMsg="File Description Changed."

 
If:
Oper eq "cd"

 
 
Then:
call "logindone";exit

 
If:
Oper eq "ms"

 
 
Then:
call "make_shareusername";call "publicize_file";close upmg;call "logindone";exit

 
If:
 

 
 
Then:
exit

If:
 

 
 
Then:
exit