summaryrefslogtreecommitdiff
path: root/web/cgi/session/logout.tcl
diff options
context:
space:
mode:
authorEduardo Chappa <echappa@gmx.com>2013-02-03 00:59:38 -0700
committerEduardo Chappa <echappa@gmx.com>2013-02-03 00:59:38 -0700
commit094ca96844842928810f14844413109fc6cdd890 (patch)
treee60efbb980f38ba9308ccb4fb2b77b87bbc115f3 /web/cgi/session/logout.tcl
downloadalpine-094ca96844842928810f14844413109fc6cdd890.tar.xz
Initial Alpine Version
Diffstat (limited to 'web/cgi/session/logout.tcl')
-rwxr-xr-xweb/cgi/session/logout.tcl67
1 files changed, 67 insertions, 0 deletions
diff --git a/web/cgi/session/logout.tcl b/web/cgi/session/logout.tcl
new file mode 100755
index 00000000..698e3558
--- /dev/null
+++ b/web/cgi/session/logout.tcl
@@ -0,0 +1,67 @@
+#!./tclsh
+# $Id: logout.tcl 1204 2009-02-02 19:54:23Z hubert@u.washington.edu $
+# ========================================================================
+# Copyright 2006 University of Washington
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# ========================================================================
+
+# Imported args
+set logout_vars {
+ {serverid {} 0}
+ {expinbox {} 0}
+ {expcurrent {} 0}
+ {cid "Missing Command ID"}
+}
+
+# and any global config
+source ./alpine.tcl
+
+WPEval $logout_vars {
+
+ if {$cid != [WPCmd PEInfo key]} {
+ error [list _action Logout "Invalid Operation ID" "Please close this window."]
+ }
+
+ if {$expinbox && [catch {WPCmd PEMailbox expunge inbox} result]} {
+ set logouterr $result
+ }
+
+ if {$expcurrent && [catch {WPCmd PEMailbox expunge current} result]} {
+ if {[info exists logouterr] == 0} {
+ set logouterr $result
+ }
+ }
+
+ if {[catch {WPCmd PESession close} result]} {
+ if {[info exists logouterr] == 0} {
+ set logouterr $result
+ }
+ }
+
+ if {[catch {WPCmd set wp_ver_dir} verdir]} {
+ set verdir $_wp(appdir)
+ }
+
+ catch {WPCmd exit}
+
+ cgi_http_head {
+ set parms "?verdir=${verdir}"
+
+ if {[regexp {^[0-9]+$} $serverid]} {
+ append parms "&serverid=$serverid"
+ }
+
+ if {[info exists logouterr]} {
+ append parms "&logerr=[WPPercentQuote $logouterr]"
+ }
+
+ cgi_redirect $_wp(serverpath)/$_wp(appdir)/farewell.tcl${parms}
+ }
+}
+