Processing table: prc.clean_strings




 
If:
'Strip dangerous shell meta's from fields. The string to be

 
 
Then:
'processed goes in CString. CSan should be "Y" to sanitise.

 
If:
'If CSan is "N", only space conversion is performed. Leading

 
 
Then:
'and trailing spaces are nuked, intervening spaces converted to

 
If:
'an underscore. The CNoAmp, SNoQuest, and CNoSlash variables

 
 
Then:
'control whether those characters are eliminated, as they can

 
If:
'be present in URLs, which we would want to retain them in.

 
 
Then:
'The ending converted string is left in CString.

 
If:
'CNoSpUn set to "Y" causes intermediate spaces to be retained

 
 
Then:
'as spaces rather than converted, although leading and trailing

 
If:
'spaces are still nuked.

 
 
Then:
'To add more characters to strip, alter the SSet variable.

 
If:
 

 
 
Then:
declare extern CSan,CString,CNoAmp,CNoQuest,CNoSlash,CNoSpUn,CNoPlus

 
If:
 

 
 
Then:
declare SChar(1,*),SSet

 
If:
 

 
 
Then:
Sset="\"'!;*&#%|<>?/`$()[]{}+"

 
If:
CSan ne "Y"

 
 
Then:
goto spacelp

If:
SSet eq ""

 
 
Then:
goto spacelp

 
If:
 

 
 
Then:
sl=len(SSet)-"1"

 
If:
sl lt "1"

 
 
Then:
sl="1"

 
If:
 

 
 
Then:
SChar=mid(SSet,"1","1");SSet=mid(SSet,"2",sl)

 
If:
CNoAmp eq "Y" and SChar eq "&"

 
 
Then:
goto sanlp

 
If:
CNoQuest eq "Y" and SChar eq "?"

 
 
Then:
goto sanlp

 
If:
CNoSlash eq "Y" and SChar eq "/"

 
 
Then:
goto sanlp

 
If:
CNoPlus eq "Y" and SChar eq "+"

 
 
Then:
goto sanlp

If:
 

 
 
Then:
ps=instr(CString,SChar)

 
If:
ps eq "0"

 
 
Then:
goto sanlp

 
If:
ps eq "1"

 
 
Then:
CString=mid(CString,"2",len(CString)-"1");goto charlp

 
If:
ps eq len(CString)

 
 
Then:
CString=mid(Cstring,"1",len(CString)-"1");goto charlp

 
If:
ps eq len(CString)-"1"

 
 
Then:
CString=mid(CString,"1",ps-"1")&mid(CString,ps+"1","1");goto charlp

 
If:
 

 
 
Then:
CString=mid(CString,"1",ps-"1")&mid(CString,ps+"1",len(CString)-ps);goto charlp

 
If:
 

 
 
Then:
sl="1"

If:
 

 
 
Then:
CString=CString{"";ps=instr(CString," ",sl)

 
If:
ps eq "0"

 
 
Then:
goto myend

 
If:
ps eq "1"

 
 
Then:
CString=mid(CString,"2",len(CString)-"1");goto spacelp

 
If:
ps eq len(CString)

 
 
Then:
CString=mid(Cstring,"1",len(CString)-"1");goto spacelp

 
If:
CNoSpUn eq "Y"

 
 
Then:
sl=ps+"1";goto spacelp

 
If:
ps eq len(CString)-"1"

 
 
Then:
CString=mid(CString,"1",ps-"1")&"_"&mid(CString,ps+"1","1");sl=ps+"1";goto spacelp

 
If:
 

 
 
Then:
CString=mid(CString,"1",ps-"1")&"_"&mid(CString,ps+"1",len(CString)-ps);sl=ps+"1";goto spacelp

If:
 

 
 
Then:
end