detectads/webif/plugin/detectads/savelist.jim

35 lines
657 B
Plaintext
Executable File

#!/mod/bin/jimsh
# cloned from channeldel package - mymsman 150331
package require sqlite3
package require cgi
source /mod/webif/lib/setup
set cf "/mod/etc/detectads.conf"
httpheader
set clist [cgi_get clist ""]
if {![string length $clist]} {
puts "Nothing to save."
exit
}
if {[catch {set fp [open $cf w]} msg]} {
puts "ERROR: $msg"
exit
}
foreach line [split $clist "\n"] {
# Strip leading and trailing whitespace
regsub -all -- {^[[:space:]]+} $line "" line
regsub -all -- {[[:space:]]+$} $line "" line
if {![string length $line]} continue
puts $fp $line
}
$fp close
puts "Exclusion list saved successfully."