2
# $Id: empty.tcl 1150 2008-08-20 00:27:11Z mikes@u.washington.edu $
3
# ========================================================================
4
# Copyright 2008 University of Washington
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
# you may not use this file except in compliance with the License.
8
# You may obtain a copy of the License at
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# ========================================================================
16
# Purpose: CGI script generating response to xmlHttpRequest
21
{c "Unspecified Collection"}
22
{f "Unspecified Folder"}
26
# inherit global config
30
# Import data validate it and get session id
31
if {[catch {WPGetInputAndID sessid}]} {
36
foreach item $empty_args {
37
if {[catch {eval WPImport $item} errstr]} {
38
WPInfoPage "Web Alpine Error" [font size=+2 $errstr] "Please close this window."
44
cgi_puts "Content-type: text/html; charset=\"UTF-8\""
47
# ONLY ever empty Junk, Trash or Drafts
48
set defc [WPCmd PEFolder defaultcollection]
50
set tf [lindex [WPCmd PEConfig varget trash-folder] 0]
51
set df [lindex [WPCmd PEConfig varget postponed-folder] 0]
52
set f [wpLiteralFolder $c $f]
54
&& (([info exists _wp(spamfolder)] && 0 == [string compare $f $_wp(spamfolder)])
55
|| ([string length $tf] && 0 == [string compare $f $tf])
56
|| ([string length $tf] && 0 == [string compare $f $df]))} {
62
cgi_puts [WPCmd PEFolder empty $c $f $u]
65
error "Unknown option"
72
cgi_puts "Empty $f NOT permitted"