#!/usr/bonsaitools/bin/mysqltcl
# -*- Mode: tcl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Netscape Public License
# Version 1.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.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
# License for the specific language governing rights and limitations
# under the License.
#
# The Original Code is the Bonsai CVS tool.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are Copyright (C) 1998
# Netscape Communications Corporation. All Rights Reserved.
source CGI.tcl
source adminfuncs.tcl
puts "Content-type: text/html
"
CheckPassword $FORM(password)
Lock
LoadCheckins
switch -exact -- $FORM(command) {
close {
AdminCloseTree [ParseTimeAndCheck [FormData closetimestamp]]
puts "
Clang!
The tree is now closed.
Mail has been sent notifying \"the hook\" and anyone subscribed to
bonsai-treeinterest.
Click here
to send e-mail about it to clienteng.
"
}
open {
AdminOpenTree [ParseTimeAndCheck [FormData lastgood]] \
[info exists FORM(doclear)]
puts "
The floodgates are open.
The tree is now open.
Mail has been sent notifying \"the hook\" and anyone subscribed to
bonsai-treeinterest.
Click here
to send e-mail about it to clienteng.
"
}
tweaktimes {
set lastgoodtimestamp [ParseTimeAndCheck [FormData lastgood]]
set closetimestamp [ParseTimeAndCheck [FormData lastclose]]
puts "
Let's do the time warp again...
Times have been tweaked.
"
Log "Times tweaked: lastgood is [MyFmtClock $lastgoodtimestamp], closetime is [MyFmtClock $closetimestamp]"
}
editmotd {
LoadMOTD
if {![cequal [FormData origmotd] $motd]} {
puts "
Oops!
Someone else has been here!
It looks like somebody else has changed the message-of-the-day.
Terry was too lazy to implement anything beyond detecting this
condition. You'd best go start over -- go back to the top of Bonsai,
look at the current message-of-the-day, and decide if you still
want to make your edits."
PutsTrailer
exit
}
MailDiffs "message-of-the-day" $motd [FormData motd]
set motd [FormData motd]
puts "
New MOTD
The message-of-the-day has been changed.
"
WriteMOTD
Log "New motd: $motd"
}
changepassword {
if {![cequal $FORM(newpassword) $FORM(newpassword2)]} {
puts "
Oops!
Mismatch!
The two passwords you typed didn't match. Click Back and try again."
PutsTrailer
exit
}
if {$FORM(doglobal)} {
CheckGlobalPassword
set outfile data/passwd
} else {
set outfile "[DataDir]/treepasswd"
}
set encoded [string trim [exec ./data/trapdoor $FORM(newpassword)]]
set fid [open $outfile "w"]
puts $fid $encoded
close $fid
catch {chmod 0777 $outfile}
puts "
Locksmithing complete.
Password changed.
The new password is now in effect."
PutsTrailer
exit
}
}
PutsTrailer
WriteCheckins
Unlock
exit