summaryrefslogtreecommitdiff
path: root/lib/forms.pm
blob: 5f313687efe3a671ae0cfcfc1b620ef8ac01cfb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
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;