package WebGUI::Operation::User;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001 Plain Black Software.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use Digest::MD5 qw(md5_base64);
use Exporter;
use strict;
use Tie::CPHash;
use WebGUI::Form;
use WebGUI::International;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::Utility;
our @ISA = qw(Exporter);
our @EXPORT = qw(&www_becomeUser &www_addUser &www_addUserSave &www_deleteUser &www_deleteUserConfirm &www_editUser &www_editUserSave &www_listUsers);
#-------------------------------------------------------------------
sub www_addUser {
my ($output, %hash, @array);
if (WebGUI::Privilege::isInGroup(3)) {
$output .= '
';
$output .= '
';
$output .= ''; $output .= '
'; return $output; } else { return WebGUI::Privilege::adminOnly(); } } #------------------------------------------------------------------- sub www_deleteUserConfirm { if ($session{form}{uid} < 26) { return WebGUI::Privilege::vitalComponent(); } elsif (WebGUI::Privilege::isInGroup(3)) { WebGUI::SQL->write("delete from users where userId=$session{form}{uid}",$session{dbh}); WebGUI::SQL->write("delete from groupings where userId=$session{form}{uid}",$session{dbh}); return www_listUsers(); } else { return WebGUI::Privilege::adminOnly(); } } #------------------------------------------------------------------- sub www_editUser { my ($output, %user, %hash, @array, %gender); tie %hash, 'Tie::CPHash'; if (WebGUI::Privilege::isInGroup(3)) { %gender = ('male'=>WebGUI::International::get(339),'female'=>WebGUI::International::get(340)); %user = WebGUI::SQL->quickHash("select * from users where userId=$session{form}{uid}",$session{dbh}); $output .= '
';
$output .= '
';
$output .= '| '; $output .= ''.WebGUI::International::get(169).''; $output .= ' |
'; if ($session{form}{keyword} ne "") { $search = " and (username like '%".$session{form}{keyword}."%' or email like '%".$session{form}{keyword}."%') "; } $output .= '
';
$row[$i] .= ' ';
$row[$i] .= ' ';
$row[$i] .= ' ';
$row[$i] .= ' | ';
$row[$i] .= ''.$data[1].' | '; #$row[$i] .= ''.$data[1].' | '; $row[$i] .= ''.$data[2].' |