summaryrefslogtreecommitdiff
path: root/lib/forms.pm
diff options
context:
space:
mode:
authorJules Laplace <carbon@melanarchy.org>2013-08-02 17:14:41 -0500
committerJules Laplace <carbon@melanarchy.org>2013-08-02 17:14:41 -0500
commite9192b3d42660a5781101df4357d276318151e8a (patch)
tree059eb6ace6147cf9559af74ed1ab5e221c80e280 /lib/forms.pm
parent79670053c7247d3a49b607960efd284e93f057e5 (diff)
cgi-bin & lib
Diffstat (limited to 'lib/forms.pm')
-rw-r--r--lib/forms.pm854
1 files changed, 854 insertions, 0 deletions
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(<table border=0 height=10 cellpadding=0 cellspacing=0><tr><td valign=top>);
+ print "<small>sticky?&nbsp;</small>";
+ print qq(</td><td valign=top>);
+ print qq!<form action="$BUCKY/profile" method="post" enctype="multipart/form-data" name="stickiness">!;
+ print qq{<input type=hidden name="debug" value="1">} if ($DEBUG);
+ print qq{<input type=hidden name="c" value="sticky">};
+ print qq{<input type=hidden name="keyword" value="$keyword">};
+ print qq{<input type="checkbox" name="chexor" value="keyword"$checked onclick="this.form.submit();" style="padding: 0px; margin: 0px">};
+ print qq{</form>};
+ print qq(</td></tr></table>\n);
+ }
+
+# short upload form for sidebar
+sub upload_form
+ {
+ my ($keyword) = @_;
+print <<MID;
+<!-- upload form -->
+<div class="message">
+make a <b>new post</b>
+<hr noshade color="$BUCKY_COLOR_HR">
+<small>
+<form action="$BUCKY/post" method="post" enctype="multipart/form-data">
+MID
+
+ print qq{<input type=hidden name="debug" value=1">\n} if ($DEBUG);
+ if ($keyword)
+ {
+ print "category:&nbsp;";
+ keyword_pulldown($keyword);
+ print "<br>\n";
+ }
+
+ print <<MID2;
+
+<input type=hidden name="c" value="new">
+
+subject:<input name="title" value="" size=20 maxlength=50 style="font-size: 10px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif;
+ color: #140A0A; border: 1px #140A0A solid; padding: 1px; margin: 5px 5px 0px 5px;"><br>
+
+<input type="file" name="file1" size="12" maxlength="192" style="font-size: 10px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif;
+ color: #140A0A; border: 1px #140A0A solid; padding: 1px; margin: 5px;"><br>
+
+description:<br>
+<textarea name="comment" value="" rows="4" style="width: 100%; padding: 0px 1px 1px 1px; font-family: trebuchet ms, sans serif; font-size: 11px;">
+</textarea>
+<br>
+
+<table width="100%" border=0><tr>
+<td align=right valign=middle><small><a href="$BUCKY/post">big&nbsp;post&nbsp;form</a>&nbsp;|</small></td>
+<td align=left valign=middle><input type="submit" value="CREATE POST" class="clicky"></td>
+</tr></table>
+</form>
+</small>
+</div>
+MID2
+ }
+
+#############################################
+
+sub reply_form
+ {
+ my ($id, $t) = @_;
+ my $submittag;
+ return unless ($USER != -1 );
+ if ($t->{comments} == 0)
+ { $submittag = "POST"; }
+ else
+ { $submittag = "REPLY"; }
+
+ print qq{<form action="$BUCKY/comment" method="post" enctype="multipart/form-data">\n};
+
+ if ($DEBUG) { print qq!<input type="hidden" name="debug" value="$DEBUG">\n\n!; }
+
+ print <<FORMEND;
+<div align="left" style="padding: 5px 0px 5px 10px;"><small>POST A COMMENT . . .</small></div>
+<input type="hidden" name="id" value="$id">
+<table border=0 width="100%" cellpadding=0 cellspacing=0 style="padding: 0px; margin: 0px">
+<tr>
+<td align="center" valign="middle" colspan=2>
+<textarea id="comment" name="comment" rows="8" style="width: 96%; font-family: trebuchet ms, sans serif; font-size: 12px;">
+</textarea>
+</td>
+</tr>
+<tr>
+FORMEND
+
+ if (! check_key($t->{display}, "no-upload"))
+ {
+ print <<FORMEND;
+<td align="left" valign="middle" style="padding-left: 10px;">
+<!--<small>enter a comment in the box above OR add some files below OR <i>both!</i>&nbsp;</small><br>-->
+<input type="file" name="file1" size="12" maxlength="192" style="font-size: 10px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif;" />
+<input type="file" name="file2" size="12" maxlength="192" style="font-size: 10px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif;" /><br>
+<input type="file" name="file3" size="12" maxlength="192" style="font-size: 10px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif;" />
+<input type="file" name="file4" size="12" maxlength="192" style="font-size: 10px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif;" />
+</td>
+<td align="center" valign="middle" style="padding-right: 10px;">
+FORMEND
+ }
+ else
+ {
+ print qq(<td align="right" valign="middle" style="padding-right: 10px;">);
+ }
+ print <<FORMEND;
+<div style="text-align: center; width: 50px;">
+<input type="submit" class="clicky" value="$submittag">
+<br>
+<small><a href="$BUCKY/post?thread=$t->{id}">big&nbsp;form</a></small>
+</div>
+</form>
+</td></tr></table>
+FORMEND
+ }
+
+#############################################
+
+sub curt_post_form
+ {
+ my ($c) = @_;
+ my $pid = ($c->{parent_id} > 0) ? $c->{parent_id} : -1;
+
+ print qq{<form action="$BUCKY/comment" method="post" enctype="multipart/form-data">\n};
+
+ if ($DEBUG) { print qq!<input type="hidden" name="debug" value="$DEBUG">\n\n!; }
+
+ my $date = plaindate($c->{date});
+ my $comment = $c->{comment};
+ $comment =~ s/&/&amp;/g;
+ $comment =~ s/>/&gt;/g;
+ $comment =~ s/</&lt;/g;
+
+ print <<FORMEND;
+<div align="left" style="padding: 5px;">$c->{username} posted this comment on $date:</div>
+<input type="hidden" name="c" value="update">
+<input type="hidden" name="id" value="$c->{id}">
+<textarea name="comment" rows="21" style="width: 100%; font-family: trebuchet ms, sans serif; font-size: 12px;">
+$comment</textarea>
+<table border=0 width="100%" cellpadding=0 cellspacing=0 style="padding: 0px; margin: 0px">
+<tr>
+<td align="right" valign="middle" style="padding: 10px;">
+<input type="submit" class="clicky" value="EDIT COMMENT">
+</form>
+</td></tr></table>
+FORMEND
+ }
+
+#############################################
+
+sub curt_reply_form
+ {
+ my ($c, $t, $k) = @_;
+
+ print qq{<form action="$BUCKY/comment" method="post" enctype="multipart/form-data">\n};
+
+ if ($DEBUG) { print qq!<input type="hidden" name="debug" value="$DEBUG">\n\n!; }
+ if ($c != -1)
+ {
+ my $date = plaindate($c->{date});
+ print <<FORMEND;
+<div align="left" style="padding: 5px;">$c->{username} posted this comment on $date:
+<blockquote>$c->{comment}</blockquote></div>
+<input type="hidden" name="id" value="$t->{id}">
+<input type="hidden" name="parent_id" value="$c->{id}">
+FORMEND
+ }
+ else
+ {
+ print qq!<input type="hidden" name="id" value="$t->{id}">\n!;
+ }
+ print <<FORMEND;
+<textarea name="comment" rows="21" style="width: 100%; font-family: trebuchet ms, sans serif; font-size: 12px;">
+</textarea>
+<table border=0 width="100%" cellpadding=0 cellspacing=0 style="padding: 0px; margin: 0px">
+<tr>
+<td align="right" valign="middle" style="padding: 10px;">
+<input type="submit" class="clicky" value="REPLY">
+</form>
+</td></tr></table>
+FORMEND
+ }
+
+#############################################
+
+sub hoot_form
+ {
+ my ($id, $t) = @_;
+ print qq{<form action="$BUCKY/comment" method="post" enctype="multipart/form-data">\n};
+ if ($DEBUG) { print qq!<input type="hidden" name="debug" value="$DEBUG">\n\n!; }
+ print <<FORMEND;
+<input type="hidden" name="id" value="$id">
+<td style="text-align: center; vertical-align: middle; padding: 5px 10px 5px 10px;">
+<textarea name="comment" rows="2" style="width: 95%; font-family: trebuchet ms, sans serif; font-size: 11px;">
+</textarea>
+</td>
+<td style="text-align: center; vertical-align: middle; padding-right: 20px;">
+<input type="submit" class="clicky" value="CHAT">
+<br>
+<small><a href="$BUCKY/post?thread=$t->{id}">big&nbsp;form</a></small>
+</td></tr>
+FORMEND
+ print "</form>";
+ }
+
+#############################################
+
+sub print_garrow
+ {
+ my ($a, $b) = @_;
+ $a =~ s/\s/&nbsp;/g;
+ print qq!<tr><td style="text-align: right; vertical-align: middle;"><big>$a:</big></td><td style="text-align: left; vertical-align: middle; padding: 5px;">$b</a></td></tr>\n!;
+ }
+
+#############################################
+
+sub onebutton
+ {
+ my ($id, $key, $button) = @_;
+
+ print qq(<form action="$BUCKY/maintain" method="post" enctype="multipart/form-data">\n);
+ print qq(<input type=hidden name="id" value="$id">\n);
+ print qq(<input type=hidden name="c" value="$key">\n);
+ print qq(<input type="submit" value="$button" class="clicky" align="center">\n</form>\n);
+ }
+
+sub onecheckbox
+ {
+ my ($key, $gloss, $tokens) = @_;
+
+ print qq(<td valign=top align="right">\n);
+ print qq(<input type="checkbox" name="$key" value="1" style="padding: 0px; margin: 0px");
+ print qq( checked) if (check_key($tokens, $key));
+ print qq(></td>) .
+ qq(<td valign=top align="left">&nbsp;$gloss&nbsp;</td>);
+ }
+
+sub oneradiobutton
+ {
+ my ($key, $value, $gloss, $check) = @_;
+
+ print qq(<td valign=top align="right">\n);
+ print qq(<input type="radio" name="$key" value="$value" style="padding: 0px; margin: 0px");
+ print qq( checked) if ($check == $value);
+ print qq(></td>) .
+ qq(<td valign=top align="left">&nbsp;$gloss&nbsp;</td>);
+ }
+
+#############################################
+
+sub privacy_select
+ {
+ my ($key, $level) = @_;
+ print "<table cellpadding=0 cellspacing=2 border=0>";
+ print "<tr>";
+ 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 "</tr>";
+ print "</table>";
+ }
+
+#############################################
+
+sub admin_form
+ {
+ my ($id, $t, $f, $k) = @_;
+ print <<adminhead;
+<table width=100% border=0 cellpadding=0 cellspacing=5>
+<tr>
+<td colspan=2 align=left style="padding-left: 10px;">
+<div style="float: right; text-align: center;">
+<br>
+<a href="$BUCKY/details/$id"><u><big><b>exit</b> settings screen</big></u></a><br><br><br>
+adminhead
+ ($many, $flagged) = find_jpeg($files, $t->{flagged});
+ print qq!</div>!;
+
+ thread_display_settings($id, $t, $k);
+ print q{ </td>};
+ print q{</tr>};
+ print q{<tr><td align="left" valign="top">};
+ keyword_display_settings($id, $t, $k);
+ print q{ </td>};
+
+ if ($t->{files} > 0)
+ {
+ print q{ <td align=center valign=top>};
+ file_display_settings($id, $t);
+ print q{ </td>};
+ }
+ print q{</tr>};
+ print q{<tr><td colspan=2 align=right>};
+ thread_delete_box($id);
+ print q{</td></tr>};
+ print q{</table>};
+ }
+
+sub thread_display_settings
+ {
+ my ($id, $t, $k) = @_;
+
+ my $rcolor = get_color($t, $k);
+
+ print qq!<div style="text-align: center; width: 350px;">!;
+ print qq!<center>!;
+ print <<keywordhead;
+<big><b>display</b> settings</big>
+<hr noshade color="$BUCKY_COLOR_HR">
+keywordhead
+ print qq!<div style="text-align: center; width: 250px;">!;
+ print qq!<form action="$BUCKY/maintain" name="display" method="post" enctype="multipart/form-data">\n!;
+ print qq{<input type=hidden name="debug" value="1">\n} if ($DEBUG);
+ print qq{<input type=hidden name="id" value="$id">\n};
+ print qq{<input type=hidden name="c" value="display">\n};
+
+ print qq!<table border=0 cellpadding=0 cellspacing=0>!;
+ print qq!<tr>!;
+ print qq!<td align="right">!;
+ print qq(title:&nbsp;);
+ print qq!</td>!;
+ print qq!<td align="left">!;
+ print qq(<input type=text name="title" value="$t->{title}" size=30 maxlength=48> );
+ print qq!</td>!;
+ print qq!</tr>!;
+ print qq!<tr>!;
+ print qq!<td align="right">!;
+ print qq(color:&nbsp;);
+ print qq!</td>!;
+ print qq!<td align="left">!;
+ color_dropdown($rcolor, 0);
+ print qq!</td>!;
+ print qq!</tr>!;
+
+ print qq!<tr>!;
+ print qq!<td>&nbsp;</td>!;
+ print qq!<td align="left">!;
+
+ print qq!<table border=0 cellpadding=0 cellspacing=0>!;
+ print qq!<tr>!;
+ onecheckbox("no-upload", "disable file upload", $t->{display});
+ print qq!</tr>!;
+ print qq!<tr>!;
+ onecheckbox("shorturl", "shorten urls", $t->{display});
+ print qq!</tr>!;
+ print qq!<tr>!;
+ onecheckbox("editable", "comments editable by ops", $t->{display});
+ print qq!</tr>!;
+ print qq!<tr>!;
+ onecheckbox("opset", "post settings available to ops", $t->{display});
+ print qq!</tr>!;
+ print qq!<tr>!;
+ onecheckbox("no-zip-button", "no zip button", $t->{display});
+ print qq!</tr>!;
+
+ if ($t->{keyword} ne undef)
+ {
+ print qq!<tr>!;
+ onecheckbox("hidekws", "hide keyword list", $t->{display});
+ print qq!</tr>!;
+ }
+ print qq!</table>!;
+
+ if ($t->{files} > 5)
+ {
+ my $filelist = 1;
+ print qq!<table border=0 cellpadding=0 cellspacing=0>!;
+ print qq!<tr>!;
+ 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!</tr><tr>!;
+ oneradiobutton("filelist", 1, "trim if many images", $filelist);
+ print qq!</tr><tr>!;
+ oneradiobutton("filelist", 0, "no file list", $filelist);
+ print qq!</tr>!;
+ print qq!</table>!;
+ }
+ else
+ {
+ print qq(<input type="hidden" name="filelist" value="1">);
+ }
+
+ print qq(<input type="submit" value="UPDATE DISPLAY" class="clicky" align="center">\n</form>\n);
+ print qq!</td>!;
+ print qq!</tr>!;
+ print qq!</table>!;
+ print qq!</form>!;
+
+ print qq!<hr noshade color="$BUCKY_COLOR_HR" size=1>!;
+ print qq!<table cellpadding=0 cellspacing=0 border=0>!;
+ 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! <span class="older">duder$ps</span>!));
+ if ($t->{zipped} == -1)
+ {
+ my $zipfile = retrieve_zip_mechanism($t);
+ if ($zipfile == 1)
+ { print_garrow("zipfile?", qq(<b>in progress</b>)); }
+ }
+ 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,&nbsp;<small>complete&nbsp;as&nbsp;of&nbsp;).(verbosedatetime($zip->{date}))[0].qq(<br><u>freshen</u> | <u>flush</u></small>));
+ }
+ print qq!</table>!;
+
+ print qq!</center>!;
+ print qq!</div>!;
+
+ print qq!</td>!;
+ print qq!</tr>!;
+ }
+
+sub keyword_display_settings
+ {
+ my ($id, $t, $k) = @_;
+
+ print <<keywordhead;
+<div style="width: 350px;">
+<center>
+<big><b>category &amp; tag</b> settings</big>
+<hr noshade color="$BUCKY_COLOR_HR">
+keywordhead
+
+# no keyword set
+ if ($t->{keyword} eq undef)
+ {
+ print qq!<form action="$BUCKY/index" method="post" name="keyword" enctype="multipart/form-data">\n!;
+ print qq{<input type=hidden name="debug" value="1">\n} if ($DEBUG);
+ print qq{<input type=hidden name="thread" value="$id">\n};
+ print qq{<input type=hidden name="c" value="assign">\n};
+ print qq!<table border=0 cellpadding=0 cellspacing=0>!;
+ print qq!<tr><td align="center" valign="middle">SELECT ONE:&nbsp; !;
+ keyword_pulldown($t->{keyword});
+ print <<kwform;
+<input type="submit" value="SET CATEGORY" class="clicky">
+</form>
+</td>
+</tr>
+<tr>
+<td align="center" valign="middle">
+or<br><a href="$BUCKY/index?thread=$t->{id}&keyword=new"><big>make <b>new</b> category</big></a>
+</td>
+</tr>
+</table>
+kwform
+ }
+ else
+ {
+ print qq{current category: <b>$k->{keyword}</b>};
+
+ print qq!&nbsp;&middot;&nbsp;<a href="$BUCKY/index?c=detach&thread=$t->{id}!;
+ print qq!&debug=1! if ($DEBUG);
+ print qq!"><small>detach</small></a>!;
+
+ if ($k->{owner} eq $USER->{username} || check_op($k) || $USER->{ulevel} == 3)
+ {
+ print qq!&nbsp;&middot;&nbsp;<a href="$BUCKY/index?c=edit&keyword=$t->{keyword}!;
+ print qq!&debug=1! if ($DEBUG);
+ print qq!"><small>settings</small></a>!;
+ }
+ }
+ print qq(<br>);
+ print qq!<form action="$BUCKY/maintain" name="tags" method="post" enctype="multipart/form-data">\n!;
+ print qq{<input type=hidden name="debug" value="1">\n} if ($DEBUG);
+ my $tags_string = tags_stringify( $t->{tags} );
+ print qq{<input type=hidden name="tags_saved" value="$tags_string">\n};
+ print qq{<input type=hidden name="id" value="$id">\n};
+ print qq{<input type=hidden name="c" value="t">\n};
+
+ print qq(Tags: );
+ print qq!<input type=text name="tags" value="$tags_string" size=30 maxlength=48>!;
+
+ print <<kwform;
+<input type="submit" value="UPDATE TAGS" class="clicky">
+</form>
+<br>
+<br>
+<big><b>privacy</b> settings</big>
+<hr noshade color="$BUCKY_COLOR_HR">
+kwform
+
+ print qq!<form action="$BUCKY/maintain" name="privacy" method="post" enctype="multipart/form-data">\n!;
+ print qq{<input type=hidden name="debug" value="1">\n} if ($DEBUG);
+ print qq{<input type=hidden name="id" value="$id">\n};
+ print qq{<input type=hidden name="c" value="p">\n};
+
+ print qq!<table border=0 cellpadding=0 cellspacing=0>!;
+ print qq!<tr>!;
+ print qq!<td valign="middle" align=right>viewable by &nbsp;&middot;</td>!;
+ print qq!<td valign="middle" align=left>!;
+ privacy_select("private", $t->{private});
+ print qq!</td></tr></table>!;
+ if ($t->{private} > 1)
+ {
+ print qq!<span style="font-family: georgia, garamond, serif; font-size: 12px;">\n!;
+ print qq!<nobr><small>users checked off below will be able to <b>read</b> and <b>update</b> this post!;
+ if ($k != -1 && $k->{public} != 1)
+ {
+ print qq!,<br>but cannot see the rest of the keyword!;
+ }
+ print qq!.</small></nobr>\n!;
+ print qq!</span>!;
+ user_checkerboard($t->{allowed}, undef, $t->{username});
+ }
+ print <<privend;
+<input type="submit" value="UPDATE PRIVACY" class="clicky">
+</form>
+</small>
+</center>
+</div>
+privend
+ }
+
+sub file_display_settings
+ {
+ my ($id, $t) = @_;
+ print <<dirtop;
+<div style="width: 500px; text-align: center;">
+<big><b>file</b> settings</big><br>
+<hr noshade color="$BUCKY_COLOR_HR">
+dirtop
+
+ print qq!<form name="filez" action="$BUCKY/maintain" method="post" enctype="multipart/form-data">!;
+ print qq{<input type=hidden name="c" value="f">\n};
+ print qq{<input type=hidden name="id" value="$id">\n};
+ print qq{<input type=hidden name="debug" value="1">\n} if ($DEBUG);
+ print <<actionform;
+<script type="text/javascript">
+<!--
+function toggle()
+ {
+ var e = document.filez.elements.length;
+ for (var i = 0; i < e; i++)
+ {
+ var y = "document.filez[i].type";
+ type = eval(y);
+
+ var n = "document.filez[i]";
+ box = eval(n);
+
+ if (type == "checkbox")
+ {
+ if (box.checked == false)
+ { box.checked = true; }
+ else
+ { box.checked = false; }
+ }
+ }
+ }
+-->
+</script>
+
+ <input type=button value="toggle checked" onClick="JavaScript:toggle()"> &middot;
+ <select name="verb">
+ <option value="flag" selected>Check off main image...</option>
+ <option value="rm">Delete checked files (no undo)</option>
+<!-- <option value="move">Move checked files...</option> -->
+ </select>
+ <input type="submit" value="UPDATE FILES" class="clicky">
+actionform
+ file_list($files, -1, 1);
+ print <<end;
+</form>
+</div>
+end
+ }
+
+sub thread_delete_box
+ {
+ my ($id) = @_;
+ print <<formend;
+<tr>
+<td align="right" colspan=2 nowrap>
+<form action="$BUCKY/maintain" name="delete" method="post" enctype="multipart/form-data">
+<input type=hidden name="id" value="$id">
+<input type=hidden name="c" value="clobber">
+<input type="submit" value="EMERGENCY DELETE BUTTON" class="clicky" style="margin-right: 15px;">
+</form>
+</span>
+</td>
+</tr>
+</table>
+formend
+ }
+
+#############################################
+
+sub profile_form
+ {
+ my ($uname) = @_;
+ my $profile = get_user_profile($uname);
+
+ print qq!<form action="$BUCKY/profile" method="post" enctype="multipart/form-data">\n!;
+ print qq!<input type="hidden" name="debug" value="$DEBUG">! if ($DEBUG);
+ print qq!<input type="hidden" name="c" value="update">!;
+
+ print <<profileform;
+<br><br>
+<center>
+<table border=0 cellpadding=0 cellspacing=5>
+<tr><td colspan=2><hr noshade color="$BUCKY_COLOR_HR" size=1></td></tr>
+<tr><td align="left" colspan=2><b><big>profile settings</big></b></td></tr>
+<tr><td colspan=2><hr noshade color="$BUCKY_COLOR_HR" size=1></td></tr>
+<tr>
+<td align="right"><b>Real name:</b></td>
+<td align="left"><input type="text" name="realname" value="$$profile{realname}" size=20></td>
+</tr>
+<tr>
+<td align="right"><b>Email address:</b></td>
+<td align="left"><input type="text" name="email" value="$$profile{email}" size=30></td>
+</tr>
+<tr>
+<td align="right"><b>AIM:</b></td>
+<td align="left"><input type="text" name="aim" value="$$profile{aim}" size=15></td>
+</tr>
+<tr>
+<td align="right"><b>Phone:</b></td>
+<td align="left"><input type="text" name="phone" value="$$profile{phone}" size=15></td>
+</tr>
+<tr>
+<td align="right"><b>Location:</b></td>
+<td align="left"><input type="text" name="location" value="$$profile{location}" size=30></td>
+</tr>
+<tr>
+<td align="right"><b>Timezone:</b></td>
+profileform
+
+ print qq!<td align="left">!;
+ print qq!<select name="timezone">!;
+ my %tzs = ( eastern => -5, central => -6, pacific => -8, englandish => 0 );
+ foreach $tzk (sort keys %tzs)
+ {
+ print qq!<option value="$tzs{$tzk}"!;
+ print " selected" if ($tzs{$tzk} == $$USER{timezone});
+ print qq!>$tzk</option>!;
+ }
+ print qq!</select>!;
+ print qq!</td>\n!;
+
+ print <<profileform;
+</tr>
+<tr>
+<td align="right"><b>Profile picture:</b></td>
+<td align="left"><input type="file" name="userpic" size="12" maxlength="192" style="font-size: 10px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif;" /></td>
+</tr>
+profileform
+
+ if (-e $data_path."/profile/.thumb/pro.".$uname.".jpg")
+ { print qq!<tr><td valign="top" align="right"><i>current profile picture:</i></td><td align="left"><img src="$live_path/profile/$uname.jpg" style="padding: 2px; height: 101px;"> <input type="checkbox" name="rmpic" value="1"> tick to delete picture</td></tr>\n!; }
+
+ $stick = $profile->{stickies};
+ $sink = $profile->{sink};
+ $stick =~ s/^ (.*)/$1/;
+ $stick =~ s/(.*) $/$1/;
+ $sink =~ s/^ (.*)/$1/;
+ $sink =~ s/(.*) $/$1/;
+ print <<profileform;
+<tr><td colspan=2><hr noshade color="$BUCKY_COLOR_HR" size=1></td></tr>
+<tr><td align="left" colspan=2><b><big>home page</big></b></td></tr>
+<tr><td colspan=2><hr noshade color="$BUCKY_COLOR_HR" size=1></td></tr>
+profileform
+ print "<tr>";
+ onecheckbox("welcome", "welcome box", $USER->{boxes});
+ print "</tr><tr>";
+ onecheckbox("bPod", "bPod", $USER->{boxes});
+ print "</tr><tr>";
+# onecheckbox("radio", "radio free chompy <small>(when broadcasting)</small>", $USER->{boxes});
+# print "</tr><tr>";
+ onecheckbox("postform", "quick-post form", $USER->{boxes});
+ print "</tr><tr>";
+ onecheckbox("hootbox", "chat", $USER->{boxes});
+ print "</tr><tr>";
+ onecheckbox("photostream", "photostream", $USER->{boxes});
+ print "</tr>";
+ print <<profileform;
+<tr>
+<td align="right"><b>Sticky keywords:</b></td>
+<td align="left"><input type="text" name="stickies" value="$stick" size=30></td>
+</tr>
+<!--
+<tr>
+<td align="right"><b>Sunken posts:</b></td>
+<td align="left"><input type="text" name="sink" value="$sink" size=30></td>
+</tr>
+-->
+<tr><td colspan=2><hr noshade color="$BUCKY_COLOR_HR" size=1></td></tr>
+profileform
+ print "<tr>";
+ onecheckbox("autoplay", "autoplay mp3s", $USER->{boxes});
+ if ($USER->{'ulevel'} == 3)
+ {
+ print "</tr><tr>";
+ onecheckbox("showhidden", "show hidden posts", $USER->{boxes});
+ }
+ print "</tr><tr>";
+ onecheckbox("nologout", "never log out (your cookie will not expire)", $USER->{boxes});
+ print "</tr>";
+ print <<profileform;
+<tr><td colspan=2><hr noshade color="$BUCKY_COLOR_HR" size=1></td></tr>
+<tr>
+<td align="right"><b>Change password?</b><br><small>please verify:</small></td>
+<td align="left">
+<input type="password" name="pw1" value="" size=13 maxlength=20><br>
+<input type="password" name="pw2" value="" size=13 maxlength=20>
+</td>
+</tr>
+</table>
+<p>
+
+<input type="submit" class="clicky" value="UPDATE PROFILE">
+</center>
+</form>
+profileform
+ return;
+ }
+
+#############################################
+
+sub message_form
+ {
+ my ($recipient, $oldmsg) = @_;
+ my $subject = '';
+ $recipient = '' if ($recipient == -1);
+
+ print qq{<form action="$BUCKY/message" method="post" enctype="multipart/form-data">\n};
+ if ($DEBUG) { print qq!<input type="hidden" name="debug" value="$DEBUG">\n!; }
+ print qq!<input type="hidden" name="c" value="s">\n!;
+ if ($$oldmsg{mbox} =~ /drafts/)
+ {
+ print qq!<input type="hidden" name="oldid" value="$$oldmsg{id}">\n!;
+ }
+
+ print <<FORMmid;
+<center>
+<table cellpadding=0 cellspacing=0 border=0>
+<tr><td class="bluebox">
+<div align="left" style="padding-right: 20px;">
+FORMmid
+
+ print qq!<table cellpadding=0 cellspacing=2 border=0>!;
+ print qq!<tr><td style="text-align: right; vertical-align: center;">!;
+ print qq[<b>to:</b> ];
+ print qq!</td><td style="text-align: left; vertical-align: center;">!;
+ print <<FORMrecip;
+ <input name="recipient" value="$recipient" size=20 maxlength=50 style="font-size: 11px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif;
+ color: #140A0A; border: 1px #140A0A solid; padding: 1px; margin: 0px 5px 0px 5px;">
+<small><a href="$BUCKY/users">need to find someone?</a></small>
+FORMrecip
+ print qq!</td></tr>!;
+
+ 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!<tr><td style="text-align: right; vertical-align: center;">!;
+ print <<FORMsubj;
+<b>subject:</b>
+</td><td style="text-align: left; vertical-align: center;">
+<input name="subject" value="$subject" size=50 maxlength=64 style="font-size: 11px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif;
+ color: #140A0A; border: 1px #140A0A solid; padding: 1px; margin: 0px 5px 0px 5px;"><br>
+</td></tr>
+</table>
+</div>
+FORMsubj
+
+ print qq[<textarea name="body" cols="80" rows="20" style="font-family: trebuchet ms, sans serif; font-size: 12px;">\n];
+ if ($$oldmsg{mbox} =~ /drafts/)
+ {
+ print $$oldmsg{body};
+ }
+ elsif ($oldmsg != -1)
+ {
+ my $verb = get_random_line("mail-verbs");
+ print "\n\n\n\n_______________\n";
+ print "on ".(plaindate($$oldmsg{date})).", ".$$oldmsg{sender}." $verb:\n\n";
+ print $$oldmsg{body};
+ print "\n";
+ }
+ print qq[</textarea><br>\n];
+
+ print <<FORMEND
+<input type="submit" name="send" value="SEND" class="clicky">
+<input type="submit" name="later" value="SAVE FOR LATER" class="clicky">
+</form>
+</td></tr></table>
+FORMEND
+ }
+
+sub login_form
+ {
+ my $uri = '';
+ print qq{<form action="https://$BUCKY_HOST$BUCKY/login" method="post" enctype="multipart/form-data" name="lf">\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{<input type=hidden name="redir" value="$uri">\n}; }
+
+ if ($DEBUG)
+ { print qq{<input type=hidden name="debug" value="1">\n}; }
+ print <<loginform;
+
+<center><table cellpadding=0 cellspacing=0 border=0>
+<tr><td valign="middle" align="right">username:</td><td valign="middle"><input type=text name="username" value="" size=9 maxlength=9 style="font-size: 10px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif;
+ color: #140A0A; border: 1px #140A0A solid; padding: 1px; margin: 5px 5px 0px 5px;"></td></tr>
+
+<tr><td valign="middle" align="right">password:</td><td valign="middle"><input type=password name="password" size=9 maxlength=20
+style="font-size: 10px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif;
+ color: #140A0A; border: 1px #140A0A solid; padding: 1px; margin: 5px 5px 0px 5px;"></td></tr>
+
+<tr><td>&nbsp;</td>
+<td valign="middle" align="center"><input type="submit" value="LOGIN" class="clicky"></td></tr></table></center>
+</form>
+
+loginform
+ }
+
+1;