(file) Return to manage.cgi CVS log (file) (dir) Up to [RizwankCVS] / geekymedia_web / twiki / bin

  1 rizwank 1.1 #!/usr/bin/perl -wT
  2             #
  3             # TWiki Collaboration Platform, http://TWiki.org/
  4             #
  5             # Copyright (C) 2002-2004 Peter Thoeny, peter@thoeny.com
  6             #
  7             # For licensing info read license.txt file in the TWiki root.
  8             # This program is free software; you can redistribute it and/or
  9             # modify it under the terms of the GNU General Public License
 10             # as published by the Free Software Foundation; either version 2
 11             # of the License, or (at your option) any later version.
 12             #
 13             # This program is distributed in the hope that it will be useful,
 14             # but WITHOUT ANY WARRANTY; without even the implied warranty of
 15             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16             # GNU General Public License for more details, published at
 17             # http://www.gnu.org/copyleft/gpl.html
 18             #
 19             # The manage script is used to manage some actions like creating
 20             # a new web.
 21             #
 22 rizwank 1.1 #usage example:
 23             #
 24             #
 25             #C h a n g e
 26             #
 27             #</form>
 28             #<form name="passwd" action="/%SCRIPTURLPATH%/passwd%SCRIPTSUFFIX%/%WEB%/">
 29             #Username     <input type="text" name="username" value="" size="16" /> <br />
 30             #Old password <input type="password" name="oldpassword" size="16" />
 31             #New password <input type="password" name="password" size="16" />
 32             #retype New password <input type="password" name="passwordA" size="16" />
 33             #<input type="submit" name="passwd" />
 34             #<input type="hidden" name="action" value="changePassword" />
 35             #</form>
 36             #
 37             
 38             BEGIN {
 39                 # Set default current working directory
 40                 if( $ENV{"SCRIPT_FILENAME"} && $ENV{"SCRIPT_FILENAME"} =~ /^(.+)\/[^\/]+$/ ) {
 41                     chdir $1;
 42                 }
 43 rizwank 1.1     # Set library paths in @INC at compile time
 44                 unshift @INC, '.';
 45                 require 'setlib.cfg';
 46             }
 47             
 48             use CGI::Carp qw( fatalsToBrowser );
 49             use CGI;
 50             
 51             use TWiki::UI::Manage;
 52             
 53             my $query = new CGI;
 54             my $action = $query->param( 'action' ) || "";
 55             my $thePathInfo = $query->path_info();
 56             my $theUrl = $query->url;
 57             my $theRemoteUser = $query->remote_user();
 58             my $theTopic = $query->param( 'topic' );
 59             
 60             # initialization has to be done differently for each because it is passed
 61             # different parameters, oddly.
 62             if( $action eq "createweb" ) {
 63             
 64 rizwank 1.1   my( $topic, $webName, $dummy, $userName ) = 
 65                 TWiki::initialize( $thePathInfo, $theRemoteUser,
 66                                    $theTopic, $theUrl, $query );
 67             
 68               TWiki::UI::Manage::createWeb( $webName, $topic, $userName, $query );
 69             
 70             } elsif( $action eq "changePassword" ) {
 71             
 72               my $wikiName = $query->param( 'username' );
 73               my $topicName = $query->param( 'TopicName' );
 74             
 75               my ( $topic, $webName ) =
 76                 TWiki::initialize( $thePathInfo, $wikiName, $topicName, $theUrl, $query );
 77             
 78               TWiki::UI::Manage::changePassword( $webName, $topic, $query );
 79             
 80             } elsif( $action eq "deleteUserAccount" ) {
 81             
 82               my $wikiName = $query->param( 'username' );
 83               my $topicName = $query->param( 'TopicName' );
 84             
 85 rizwank 1.1   my ( $topic, $webName ) =
 86                 TWiki::initialize( $thePathInfo, $wikiName, $topicName, $theUrl, $query );
 87             
 88                 TWiki::UI::Manage::removeUser($webName, $topic, $wikiName, $query);
 89             
 90             } elsif( $action eq "relockrcs" ) {
 91                 TWiki::UI::Manage::relockRcsFiles();
 92             } elsif( $action ) {
 93             
 94               my( $topic, $webName, $dummy, $userName ) = 
 95                 TWiki::initialize( $thePathInfo, $theRemoteUser,
 96                                    $theTopic, $theUrl, $query );
 97               TWiki::UI::oops( "", "", "manage",
 98                                TWiki::UI::Manage::_template("msg_unrecognized_action"),
 99                                $action );
100             
101             } else {
102             
103               my( $topic, $webName, $dummy, $userName ) = 
104                 TWiki::initialize( $thePathInfo, $theRemoteUser,
105                                    $theTopic, $theUrl, $query );
106 rizwank 1.1   TWiki::UI::oops( "", "", "manage",
107                                TWiki::UI::Manage::_template("msg_missing_action") );
108             
109             }
110             
111             

Rizwan Kassim
Powered by
ViewCVS 0.9.2