svnno****@sourc*****
svnno****@sourc*****
2007年 11月 15日 (木) 23:58:08 JST
Revision: 255 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=255 Author: caesar Date: 2007-11-15 23:58:07 +0900 (Thu, 15 Nov 2007) Log Message: ----------- deluser plugin Added Paths: ----------- slashjp/branches/deluser/plugins/DelUser/ slashjp/branches/deluser/plugins/DelUser/PLUGIN slashjp/branches/deluser/plugins/DelUser/deluser.pl slashjp/branches/deluser/plugins/DelUser/templates/ slashjp/branches/deluser/plugins/DelUser/templates/deleteUserForm;deluser;default -------------- next part -------------- Added: slashjp/branches/deluser/plugins/DelUser/PLUGIN =================================================================== --- slashjp/branches/deluser/plugins/DelUser/PLUGIN 2007-11-09 10:15:48 UTC (rev 254) +++ slashjp/branches/deluser/plugins/DelUser/PLUGIN 2007-11-15 14:58:07 UTC (rev 255) @@ -0,0 +1,7 @@ +name=DelUser +description="User deletion plugin" +#mysql_dump=mysql_dump +#mysql_schema=mysql_schema +htdoc=deluser.pl +#task=get_translation_articles.pl +template=templates/deleteUserForm;deluser;default Added: slashjp/branches/deluser/plugins/DelUser/deluser.pl =================================================================== --- slashjp/branches/deluser/plugins/DelUser/deluser.pl 2007-11-09 10:15:48 UTC (rev 254) +++ slashjp/branches/deluser/plugins/DelUser/deluser.pl 2007-11-15 14:58:07 UTC (rev 255) @@ -0,0 +1,68 @@ +#!/usr/bin/perl -w +# This code is a part of Slash, and is released under the GPL. +# Copyright 1997-2001 by Open Source Development Network. See README +# and COPYING for more information, or see http://slashcode.com/. +# $Id: $ + +use strict; +#use Image::Size; +#use POSIX qw(O_RDWR O_CREAT O_EXCL tmpnam); + +use utf8; + +use Slash; +use Slash::Display; +use Slash::Utility; +use Data::Dumper; + +sub main { + my $user = getCurrentUser(); + my $form = getCurrentForm(); + my $slashdb = getCurrentDB(); + my $reader = getObject('Slash::DB', { db_type => 'reader' }); + my $constants = getCurrentStatic(); + my $post_ok = $user->{state}{post}; + my $user_ok = !$user->{is_anon}; + # lc just in case + my $op = lc($form->{op}); + + my %ops = ( + deleteform => [$user_ok, \&deleteUserForm], + delete => [$post_ok, \&deleteUser], + ); + + # set default op + my $op = $form->{op}; + if (!$op || !exists $ops{$op} || !$ops{$op}[ALLOWED]) { + $form->{op} = $op = 'deleteform'; + } + + # if not logged in + if (!$user_ok) { + redirect("$rootdir/"); + } + + $ops{$op}[FUNCTION]->($slashdb, $reader, $constants, $user, $form); + writeLog($user->{nickname}); +} + + +################################################################## +sub deleteUserForm { + my($slashdb, $reader, $constants, $user, $form) = @_; + slashDisplay('deleteUserForm'); + footer(); +} + +sub deleteUser { + my($slashdb, $reader, $constants, $user, $form) = @_; + my $uid = $user->{uid}; + +# my $rows = $slashdb->deleteUser($uid); + slashDisplay('deleteUserFinished'); + footer(); +} + +createEnvironment(); +main(); +1; Property changes on: slashjp/branches/deluser/plugins/DelUser/deluser.pl ___________________________________________________________________ Name: svn:executable + * Added: slashjp/branches/deluser/plugins/DelUser/templates/deleteUserForm;deluser;default =================================================================== --- slashjp/branches/deluser/plugins/DelUser/templates/deleteUserForm;deluser;default 2007-11-09 10:15:48 UTC (rev 254) +++ slashjp/branches/deluser/plugins/DelUser/templates/deleteUserForm;deluser;default 2007-11-15 14:58:07 UTC (rev 255) @@ -0,0 +1,18 @@ +__section__ +default +__description__ +Delete user form +__title__ +Delete user form +__page__ +deluser +__lang__ +en_US +__name__ +deleteUserForm +__template__ +This is test +__seclev__ +500 +__version__ +$Id: $