#!/usr/bin/perl ######################################### # administration of threads, keywords, # privacy, etc. use localbucky; our $id; our $files; $dbh = DBI->connect ($dsn); our ($USER, $lastlog) = checkin(); logout() unless ($USER != -1); if ($USER->{ulevel} != 3) { redirect("/"); } else { header( { title => "bucky administrauma", color => "red" } ); menu(); if (exists($input->{c})) { if ($input->{c} eq "s") { update_thread_title($id, $input->{title}); $t->{title} = $input->{title}; print "Changed thread $id title to: $t->{title}
\n"; } elsif ($input->{c} eq "pass") { do_password_reset(); } elsif ($input->{c} eq "p") { if ($input->{private} == 1) { print "Thread is now private.
"; switch_thread_privacy($id, 1); $t->{allowed} = update_whitelist(); $t->{private} = 1; } else { print "Thread is now public.
"; switch_thread_privacy($id, 0); $t->{private} = 0; } } elsif ($input->{c} eq "f") { my @flagged = corral($input, "file"); if ($DEBUG) { print "
\nfiles flagged: "; foreach (@flagged) { print; print " "; } print "
\n"; } if ($input->{verb} eq "flag") { print "Flagged file $flagged[0]
"; update_flagged($id, $flagged[0]); $t->{flagged} = $flagged[0]; admin_form($id, $t, $files, $k); } elsif ($input->{verb} eq "move") { print "When this works it will be like this:!
\n"; print "Where do you want to move these files here
\n"; print "Moving files...
\n"; # system("mv", $data_path/$oldpid/$filenamea ..., "$data_path/$newpid/"); print "Moving ids...
\n"; print "Recalculating thread sizes...
\n"; } elsif ($input->{verb} eq "rm") { if (!$input->{ok}) { print qq!

Are you sure you want to delete these files?

\n!; print qq!

!; print qq{\n}; print qq{\n}; print qq{\n} if ($DEBUG); print qq{\n}; print qq{\n}; my $i = 0; my $fid = shift(@flagged); foreach my $fh (sort_by_id(@$files)) { next if ($fid != $$fh{id}); $i++; print qq{\n}; print $$fh{filename}."
\n"; $fid = shift(@flagged); } print qq{
}; } else { my $i = 0; my $fid = shift(@flagged); foreach my $fh (sort_by_id(@$files)) { next if ($fid != $$fh{id}); $i++; delete_file_record($fid); system("rm", "-f", qq!$data_path/$id/$$fh{filename}!); print qq!deleted $$fh{filename}
\n!; $fid = shift(@flagged); } print "Recalculating thread size...
\n"; update_thread_size($id); $files = get_files($id); } } } adminster_form(); } else { adminster_form(); } footer(); } sub sort_by_username { sort { lc($a->{username}) cmp lc($b->{username}) } @_; } sub sort_by_id { sort { $a->{id} <=> $b->{id} } @_; } sub adminster_form { print qq{
\n\n}; # my $reqs = get_user_requests(); # if ($reqs != -1) # { # my $s = (@$reqs != 1) ? "s" : ""; # alert_box("$BUCKY/approve", @$reqs." account request$s pending!"); # } print < password reset form
end password_reset_form(); print ""; # "flush" zips button # recalculcate thread sizes # links to approval etc (alert!) print qq{
\n\n}; } sub password_reset_form { my $users = get_all_users(); print qq!
!; print qq{\n}; print qq{\n} if ($DEBUG); print qq!!; print qq!
user:!; print qq!\n!; print <
password?

again!
pws print qq!
\n!; } sub do_password_reset { if (exists($input->{pw1}) && exists($input->{pw2}) && $input->{pw1} && $input->{pw2}) { if ($input->{pw1} eq $input->{pw2}) { update_password($input->{user}, crypt($input->{pw1},lc($input->{user}))); print qq(password changed for $input->{user}
\n); } else { print "passwords don't match!
\n"; } } }