From e9192b3d42660a5781101df4357d276318151e8a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 2 Aug 2013 17:14:41 -0500 Subject: cgi-bin & lib --- cgi-bin/import | 286 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 286 insertions(+) create mode 100755 cgi-bin/import (limited to 'cgi-bin/import') diff --git a/cgi-bin/import b/cgi-bin/import new file mode 100755 index 0000000..fc7add5 --- /dev/null +++ b/cgi-bin/import @@ -0,0 +1,286 @@ +#!/usr/bin/perl +######################################### +# import +# escorts ftp'd files into the database +######################################### + +use localbucky; + +my $pid; + +$dbh = DBI->connect ($dsn); + +our ($USER, $lastlog) = checkin(); +logout() unless ($USER != -1); + +if ($input->{c} eq "n") + { + my $valid = 0; + my $thread_id = 0; + if ($DEBUG) + { + header("importing files..."); + foreach $k (sort keys %$input) { print "$k => ".$input->{$k}."
"; } + } + foreach my $k (keys %$input) + { + if ($k =~ /^import/) + { $valid = 1; last; } + } + if ($valid) + { + if ($input->{id} && $input->{id} ne "new") + { + $thread = get_thread($input->{id}); + $keyword = get_keyword($thread->{keyword}); + if ($thread != -1 && check_privacy($thread, $keyword)) + { + $thread_id = $thread->{id}; + touch_thread($thread); + } + else + { + error("cannot import into specified thread"); + } + } + else + { + if ($input->{title} eq undef || $input->{title} =~ /^\s+$/) + { + error ("No thread title!"); + } + else + { + $thread_id = add_thread($input->{title}, $USER->{username}, 0); + } + } + print "thread_id => $thread_id
" if ($DEBUG); + add_comment($thread_id,-1,$USER->{username},$input->{comment}) if ($input->{comment} ne undef); + situate_imports($thread_id, $USER->{username}); + if (exists($input->{keyword})) + { + my $k = get_keyword($input->{keyword}); + if ($k->{public} || check_op($k)) + { + keyword_assign_mechanism($input->{keyword}, $thread_id, $k); + } + } + } + else + { error("No imports specified!"); } + if ($DEBUG) + { + print qq{this way to your new thread: link!}; + footer(); + } + redirect("$BUCKY/details/$thread_id"); + } + +else + { + my ($title, $size, $inc); + + my $thread = -1; + my $keyword = -1; + if ($input->{id}) + { + # id title username createdate lastmodified size private allowed flagged + $thread = get_thread($input->{id}); + $keyword = get_keyword($thread->{keyword}); + } + if ($input->{keyword}) + { + $keyword = get_keyword($input->{keyword}); + } + elsif ($thread->{keyword}) + { + $keyword = get_keyword($thread->{keyword}); + } + + header("ftp import"); + menu(); + if ($USER->{'username'} eq "asdfasdfadsfadsf") + { + print <<__SORRY__; +
+
+
+
SORRY! +
+You have maxed out your upload quota!

+Delete some things you've uploaded, then try again. +


+__SORRY__ + exit; + } + print < +
+
+ +UPLOAD FILES TO BUCKY WITH CONVENIENCE USING SFTP +
+ +You must generate a cryptographic key to use this service. Don't worry it's easy!
+
+
+
+ +ON A MAC / UNIX
+
+recc'd sftp client: Cyberd*ck
+to generate the key, from Terminal run:
+ssh-keygen -t rsa
+send me the public key +
+(private key is handled automatically) +
+
+
+
+ +ON WINDOWS ...
+
+recc'd sftp client: WINSCP (PC)
+generate the key with the program puttygen +
+send me the public key +
+(the private key goes in the program when you set up the session.) + +
+
+
+
+ +log in here: +
+
+ +$BUCKY_FTP_HOST
+username: $BUCKY_FTP_USER
+ +
+
+
+
+ +Once you're in, upload your files and they should show up below. Check off only the files that are yours, +or click the toggle button to select them all. +impHEAD + + if ($thread == -1) + { + print qq(To attach FTP'd files to a pre-existing thread, go to the thread and click ftp here.); + } + print qq!
\n\n!; + + print qq!
\n!; + print qq!
\n!; + ($title, $inc, $size) = list_imports(); + + print < + + + + + + + +
+widget + + if ($inc) + { + print "
INCOMPLETE FILES ARE SHOWN IN ITALICS -- PLEASE WAIT FOR YOUR UPLOAD TO FINISH

\n\n"; + } + + if ($DEBUG) { print qq!\n!; } + print qq!\n!; + + print qq!

!; + print qq!!; + if ($thread != -1 && check_privacy($thread, $keyword)) + { + print qq!!; + } + else + { + print qq!\n\n!; + print qq!!; + print qq!!; + } + print qq!!; + + print qq! + +
!; + print qq! !; + print qq!!; + print qq!These files will be added to:

$thread->{title}
\n!; + print qq!posted by $thread->{username} on !.verbosedate($thread->{createdate}).qq!

\n\n!; + print qq!\n!; + print qq!

!; + print qq!title: !; + print qq!!; + print qq!
\n!; + print qq!
!; + print "keyword: "; + print qq!!; + if (exists($input->{keyword})) + { + my $k = get_keyword($input->{keyword}); + if ($k->{public} || check_op($k)) + { + keyword_pulldown($k->{keyword}); + $checked = $k->{public} ? "" : " checked"; + } + else + { keyword_pulldown("NONE"); } + } + else + { keyword_pulldown("NONE"); } + print qq!
!; + print " "; + print qq!
!; + print qq!comment: !; + print qq!!; + print < + +

+ +

+
+ + +
+ +impFOOT + footer(); + } + +$dbh->disconnect (); + -- cgit v1.2.3-70-g09d2