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 --- lib/forms.pm | 854 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 854 insertions(+) create mode 100644 lib/forms.pm (limited to 'lib/forms.pm') diff --git a/lib/forms.pm b/lib/forms.pm new file mode 100644 index 0000000..5f31368 --- /dev/null +++ b/lib/forms.pm @@ -0,0 +1,854 @@ + +############################################# +# FORMS +############################################# + +sub sticky_button + { + my ($keyword) = @_; + my $checked = ''; + if (check_key($USER->{stickies}, $keyword)) + { $checked = " checked"; } + print qq(
); + print "sticky? "; + print qq(); + print qq!
!; + print qq{} if ($DEBUG); + print qq{}; + print qq{}; + print qq{}; + print qq{
}; + print qq(
\n); + } + +# short upload form for sidebar +sub upload_form + { + my ($keyword) = @_; +print < +
+make a new post +
+ +
+MID + + print qq{\n} if ($DEBUG); + if ($keyword) + { + print "category: "; + keyword_pulldown($keyword); + print "
\n"; + } + + print < + +subject:
+ +
+ +description:
+ +
+ + + + +
big post form |
+ +
+
+MID2 + } + +############################################# + +sub reply_form + { + my ($id, $t) = @_; + my $submittag; + return unless ($USER != -1 ); + if ($t->{comments} == 0) + { $submittag = "POST"; } + else + { $submittag = "REPLY"; } + + print qq{
\n}; + + if ($DEBUG) { print qq!\n\n!; } + + print <POST A COMMENT . . . + + + + + + +FORMEND + + if (! check_key($t->{display}, "no-upload")) + { + print < + + +
+ + + +
+ +
+FORMEND + } + else + { + print qq(); + } + print < + +
+big form + + +
+FORMEND + } + +############################################# + +sub curt_post_form + { + my ($c) = @_; + my $pid = ($c->{parent_id} > 0) ? $c->{parent_id} : -1; + + print qq{
\n}; + + if ($DEBUG) { print qq!\n\n!; } + + my $date = plaindate($c->{date}); + my $comment = $c->{comment}; + $comment =~ s/&/&/g; + $comment =~ s/>/>/g; + $comment =~ s/$c->{username} posted this comment on $date: + + + + + +
+ + +
+FORMEND + } + +############################################# + +sub curt_reply_form + { + my ($c, $t, $k) = @_; + + print qq{
\n}; + + if ($DEBUG) { print qq!\n\n!; } + if ($c != -1) + { + my $date = plaindate($c->{date}); + print <$c->{username} posted this comment on $date: +
$c->{comment}
+ + +FORMEND + } + else + { + print qq!\n!; + } + print < + + + +
+ + +
+FORMEND + } + +############################################# + +sub hoot_form + { + my ($id, $t) = @_; + print qq{
\n}; + if ($DEBUG) { print qq!\n\n!; } + print < + + + + + +
+big form + +FORMEND + print ""; + } + +############################################# + +sub print_garrow + { + my ($a, $b) = @_; + $a =~ s/\s/ /g; + print qq!$a:$b\n!; + } + +############################################# + +sub onebutton + { + my ($id, $key, $button) = @_; + + print qq(
\n); + print qq(\n); + print qq(\n); + print qq(\n
\n); + } + +sub onecheckbox + { + my ($key, $gloss, $tokens) = @_; + + print qq(\n); + print qq() . + qq( $gloss ); + } + +sub oneradiobutton + { + my ($key, $value, $gloss, $check) = @_; + + print qq(\n); + print qq() . + qq( $gloss ); + } + +############################################# + +sub privacy_select + { + my ($key, $level) = @_; + print ""; + print ""; + oneradiobutton($key, 0, $BUCKY_CONFIG->{PRIVACY_WORLD}, $level) if $BUCKY_CONFIG->{PRIVACY_WORLD}; + oneradiobutton($key, 1, $BUCKY_CONFIG->{PRIVACY_BBS}, $level) if $BUCKY_CONFIG->{PRIVACY_BBS}; + oneradiobutton($key, 1.5, $BUCKY_CONFIG->{PRIVACY_KEYWORD}, $level) if $BUCKY_CONFIG->{PRIVACY_KEYWORD}; + oneradiobutton($key, 2, $BUCKY_CONFIG->{PRIVACY_OWNER}, $level) if $BUCKY_CONFIG->{PRIVACY_OWNER}; + print ""; + print "
"; + } + +############################################# + +sub admin_form + { + my ($id, $t, $f, $k) = @_; + print < + + +
+
+exit settings screen


+adminhead + ($many, $flagged) = find_jpeg($files, $t->{flagged}); + print qq!
!; + + thread_display_settings($id, $t, $k); + print q{ }; + print q{}; + print q{}; + keyword_display_settings($id, $t, $k); + print q{ }; + + if ($t->{files} > 0) + { + print q{ }; + file_display_settings($id, $t); + print q{ }; + } + print q{}; + print q{}; + thread_delete_box($id); + print q{}; + print q{}; + } + +sub thread_display_settings + { + my ($id, $t, $k) = @_; + + my $rcolor = get_color($t, $k); + + print qq!
!; + print qq!
!; + print <display settings +
+keywordhead + print qq!
!; + print qq!
\n!; + print qq{\n} if ($DEBUG); + print qq{\n}; + print qq{\n}; + + print qq!!; + print qq!!; + print qq!!; + print qq!!; + print qq!!; + print qq!!; + print qq!!; + print qq!!; + print qq!!; + + print qq!!; + print qq!!; + print qq!!; + print qq!!; + print qq!
!; + print qq(title: ); + print qq!!; + print qq( ); + print qq!
!; + print qq(color: ); + print qq!!; + color_dropdown($rcolor, 0); + print qq!
 !; + + print qq!!; + print qq!!; + onecheckbox("no-upload", "disable file upload", $t->{display}); + print qq!!; + print qq!!; + onecheckbox("shorturl", "shorten urls", $t->{display}); + print qq!!; + print qq!!; + onecheckbox("editable", "comments editable by ops", $t->{display}); + print qq!!; + print qq!!; + onecheckbox("opset", "post settings available to ops", $t->{display}); + print qq!!; + print qq!!; + onecheckbox("no-zip-button", "no zip button", $t->{display}); + print qq!!; + + if ($t->{keyword} ne undef) + { + print qq!!; + onecheckbox("hidekws", "hide keyword list", $t->{display}); + print qq!!; + } + print qq!
!; + + if ($t->{files} > 5) + { + my $filelist = 1; + print qq!!; + print qq!!; + if (check_key($t->{display}, "ffl")) + { $filelist = 2; } + elsif (check_key($t->{display}, "nfl")) + { $filelist = 0; } + oneradiobutton("filelist", 2, "full file list", $filelist); + print qq!!; + oneradiobutton("filelist", 1, "trim if many images", $filelist); + print qq!!; + oneradiobutton("filelist", 0, "no file list", $filelist); + print qq!!; + print qq!
!; + } + else + { + print qq(); + } + + print qq(\n\n); + print qq!
!; + print qq!!; + + print qq!
!; + print qq!!; + print_garrow("date posted", (verbosedate($t->{createdate}))); + print_garrow("last changed", (verbosedate($t->{lastmodified}))); + print_garrow("total comments", (hushnull($t->{comments}))); + print_garrow("total files", (hushnull($t->{files}))); + my $par = get_participation($t->{id}); + my $ps = $par != 1 ? 's' : ''; + print_garrow("participating",(hushnull($par).qq! duder$ps!)); + if ($t->{zipped} == -1) + { + my $zipfile = retrieve_zip_mechanism($t); + if ($zipfile == 1) + { print_garrow("zipfile?", qq(in progress)); } + } + if ($t->{zipped} == 0) + { + print_garrow("zipfile?", qq(none)); + } + if ($t->{zipped} == 1) + { + my $zip = get_file_from_filename(generate_zip_filename($t)); + print_garrow("zipfile?", qq(exists, complete as of ).(verbosedatetime($zip->{date}))[0].qq(
freshen | flush
)); + } + print qq!
!; + + print qq!
!; + print qq!
!; + + print qq!!; + print qq!!; + } + +sub keyword_display_settings + { + my ($id, $t, $k) = @_; + + print < +
+category & tag settings +
+keywordhead + +# no keyword set + if ($t->{keyword} eq undef) + { + print qq!
\n!; + print qq{\n} if ($DEBUG); + print qq{\n}; + print qq{\n}; + print qq!!; + print qq! + + + + +
SELECT ONE:  !; + keyword_pulldown($t->{keyword}); + print < + +
+or
make new category +
+kwform + } + else + { + print qq{current category: $k->{keyword}}; + + print qq! · detach!; + + if ($k->{owner} eq $USER->{username} || check_op($k) || $USER->{ulevel} == 3) + { + print qq! · settings!; + } + } + print qq(
); + print qq!
\n!; + print qq{\n} if ($DEBUG); + my $tags_string = tags_stringify( $t->{tags} ); + print qq{\n}; + print qq{\n}; + print qq{\n}; + + print qq(Tags: ); + print qq!!; + + print < + +
+
+privacy settings +
+kwform + + print qq!
\n!; + print qq{\n} if ($DEBUG); + print qq{\n}; + print qq{\n}; + + print qq!!; + print qq!!; + print qq!!; + print qq!
viewable by  ·!; + privacy_select("private", $t->{private}); + print qq!
!; + if ($t->{private} > 1) + { + print qq!\n!; + print qq!users checked off below will be able to read and update this post!; + if ($k != -1 && $k->{public} != 1) + { + print qq!,
but cannot see the rest of the keyword!; + } + print qq!.
\n!; + print qq!
!; + user_checkerboard($t->{allowed}, undef, $t->{username}); + } + print < + + +
+ +privend + } + +sub file_display_settings + { + my ($id, $t) = @_; + print < +file settings
+
+dirtop + + print qq!
!; + print qq{\n}; + print qq{\n}; + print qq{\n} if ($DEBUG); + print < + + + + · + + +actionform + file_list($files, -1, 1); + print < + +end + } + +sub thread_delete_box + { + my ($id) = @_; + print < + + + + + + + + + + +formend + } + +############################################# + +sub profile_form + { + my ($uname) = @_; + my $profile = get_user_profile($uname); + + print qq!
\n!; + print qq!! if ($DEBUG); + print qq!!; + + print <
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +profileform + + print qq!\n!; + + print < + + + + +profileform + + if (-e $data_path."/profile/.thumb/pro.".$uname.".jpg") + { print qq!\n!; } + + $stick = $profile->{stickies}; + $sink = $profile->{sink}; + $stick =~ s/^ (.*)/$1/; + $stick =~ s/(.*) $/$1/; + $sink =~ s/^ (.*)/$1/; + $sink =~ s/(.*) $/$1/; + print < + + +profileform + print ""; + onecheckbox("welcome", "welcome box", $USER->{boxes}); + print ""; + onecheckbox("bPod", "bPod", $USER->{boxes}); + print ""; +# onecheckbox("radio", "radio free chompy (when broadcasting)", $USER->{boxes}); +# print ""; + onecheckbox("postform", "quick-post form", $USER->{boxes}); + print ""; + onecheckbox("hootbox", "chat", $USER->{boxes}); + print ""; + onecheckbox("photostream", "photostream", $USER->{boxes}); + print ""; + print < + + + + + +profileform + print ""; + onecheckbox("autoplay", "autoplay mp3s", $USER->{boxes}); + if ($USER->{'ulevel'} == 3) + { + print ""; + onecheckbox("showhidden", "show hidden posts", $USER->{boxes}); + } + print ""; + onecheckbox("nologout", "never log out (your cookie will not expire)", $USER->{boxes}); + print ""; + print < + + + + +

profile settings

Real name:
Email address:
AIM:
Phone:
Location:
Timezone:!; + print qq!!; + print qq!
Profile picture:
current profile picture: tick to delete picture

home page

Sticky keywords:


Change password?
please verify:
+
+ +
+

+ + +

+ +profileform + return; + } + +############################################# + +sub message_form + { + my ($recipient, $oldmsg) = @_; + my $subject = ''; + $recipient = '' if ($recipient == -1); + + print qq{
\n}; + if ($DEBUG) { print qq!\n!; } + print qq!\n!; + if ($$oldmsg{mbox} =~ /drafts/) + { + print qq!\n!; + } + + print < + +
+
+FORMmid + + print qq!!; + print qq!!; + + if ($oldmsg == -1) + { + $subject = get_random_line("subjects"); + } + elsif ($$oldmsg{subject} =~ /^Re: / || $$oldmsg{mbox} =~ /drafts/) + { $subject = $$oldmsg{subject}; } + else + { $subject = "Re: ".$$oldmsg{subject}; } + + print qq! +
!; + print qq[to: ]; + print qq!!; + print < +need to find someone? +FORMrecip + print qq!
!; + print <subject: + +
+
+
+FORMsubj + + print qq[
\n]; + + print < + + +
+FORMEND + } + +sub login_form + { + my $uri = ''; + print qq{
\n}; + + if ($input->{redir} =~ /\?/) + { + my ($duh, $qs) = split /redir=/, $ENV{QUERY_STRING}, 2; + $uri .= "$qs"; + } + else + { + $uri .= $input->{redir}; + } + + if (defined($uri) && $uri !~ /logout/) + { print qq{\n}; } + + if ($DEBUG) + { print qq{\n}; } + print < + + + + + +
username:
password:
 
+ + +loginform + } + +1; -- cgit v1.2.3-70-g09d2