Pm/Html.pm
Copying Source is Forbidden
19024 lines of code
1
package Html;
2
3
#/
4
# functions for displaying HTML elements
5
#
6
# many functions offer an $extras parameter.
7
# this parameter is partially deprecated - don't use it if you don't have to.
8
# $extras (a string of other HTML attributes not directly parameterized by
9
# the function) can be specified via this variable.
10
# eg: "style='color: black;'" or
11
# "id=\"element_id\" title='Any attribute!'"
12
# <br><hr>
13
# This module is slowly being upgraded. Changes here will be obvious, and
14
# some may use Html2.pm subroutines. And in other cases, Html2.pm is used
15
# exclusively. This was done because using hash references for the parameters
16
# is much more convenient, and the subroutine definition doesn't change.
17
# This process will take me months to complete, if there's even such a thing!
18
# Today shall be considered the completion date of the aforementioned process:
19
# November 19, 2020
20
#/
21
22
my $DEBUGGER = 0;
23
my $TABLE_BORDER = "0";
24
25
########################
26
use strict;
27
use warnings;
28
use CGI::Carp qw(fatalsToBrowser);
29
use Exporter;
30
use vars qw($VERSION @ISA @EXPORT_OK @EXPORT %EXPORT_TAGS);
31
use URI::Escape;
32
########################
33
34
use lib "./";
35
use Html2;
36
use Bc_dir;
37
38
################################################################################################
39
40
my $checkmark = "✔";
41
42
################################################################################################
43
our $VERSION = 1.00;
44
our @ISA = qw(Exporter);
45
46
our @EXPORT = qw(
47
pre_html_header
48
header
49
footer
50
centered
51
div
52
table
53
table_void
54
tdata
55
trow
56
href
57
);
58
59
our @EXPORT_OK = qw(
60
_tests
61
62
pre_html_header
63
header
64
beta_footer
65
footer
66
html_end
67
68
centered
69
table
70
table_void
71
table_wide
72
tdata
73
trow
74
fieldset
75
fieldset_constricted
76
div
77
embolden
78
italicize
79
radio
80
checkbox
81
textarea
82
unordered_list
83
ordered_list
84
li
85
href
86
img
87
dropdown
88
dropdown_for_users
89
input
90
form
91
small
92
big
93
94
debug_banner
95
96
display_about_page
97
display_blocked
98
display_browse
99
display_change_email_page
100
display_chat
101
display_city_names
102
display_city_names_asDropdown
103
display_close_account_page
104
display_contact_page
105
display_country_names
106
display_country_names_asDropdown
107
display_data_policy_page
108
display_error_page
109
display_faq_page
110
display_forgot_page
111
display_friends
112
display_fuck_me_alerts
113
display_help_page
114
display_homepage
115
display_js_page
116
display_login
117
display_logo
118
display_mail
119
display_mod_page
120
display_mods_page
121
display_navbar
122
display_pay_page
123
display_photos_page
124
display_ppinfo_page
125
display_searchbar
126
display_signup_page
127
display_source
128
display_stats_page
129
display_store_page
130
display_legals_page
131
display_privacy_page
132
display_refunds_page
133
display_terms_page
134
display_payment_terms_page
135
display_theme_names
136
display_theme_names_asDropdown
137
display_titlebar
138
display_todays_birthdays
139
display_user_list
140
display_welcome_page
141
142
display_admin_page
143
144
display_years_forDropdowns
145
display_users_forDropdowns
146
display_config_forDropdowns
147
display_zodiac_icon
148
149
display_debug_one
150
display_debug_many
151
display_debug_code
152
display_debug_large
153
display_debug_script
154
155
subscribe_now
156
157
get_config_forDropdowns
158
get_years_forDropdowns
159
get_months_forDropdowns
160
get_days_forDropdowns
161
Bc_sql::get_security_forDropdowns
162
get_themes_forDropdowns
163
164
label2
165
input2
166
);
167
168
%EXPORT_TAGS = (
169
'debug' => [qw(
170
display_debug_one
171
display_debug_many
172
display_debug_code
173
display_debug_large
174
display_debug_script
175
_tests
176
)],
177
);
178
########################
179
180
181
182
########################
183
# PROTOTYPES
184
sub display_debug_one($$);
185
sub display_debug_many($$;$$);
186
sub display_debug_code($$;$);
187
sub display_debug_large($$;$);
188
sub display_debug_script($);
189
sub display_debug_scalar($$;$$);
190
sub display_debug_hash($$;$$);
191
sub display_debug_array($$;$$);
192
########################
193
194
195
196
########################
197
sub beta_footer(;$) {
198
#*
199
# creates the bug report table
200
#*
201
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
202
if (not $spacing) { $spacing = ""; }
203
204
my $url = uri_escape($ENV{REQUEST_URI});
205
my $url_unescaped = Bc_misc::shorten_str($ENV{REQUEST_URI}, 25);
206
my @reportTypes = qw(Interface=Interface Display=Display Error=Error Other=Other);
207
my $typeDropdown = dropdown("type", "", -1, "", "", "", "class=mini", "", \@reportTypes);
208
my $notes_width = "165px";
209
my $notes_height = "32px";
210
211
my %spacerx; {
212
$spacerx{tag} = "td";
213
$spacerx{class} = "spacerx";
214
}
215
216
my %spacerx_big; {
217
$spacerx_big{tag} = "td";
218
$spacerx_big{class} = "spacerx_big";
219
}
220
221
my %container; {
222
$container{tag} = "table";
223
$container{border} = "0";
224
$container{cellpadding} = "0";
225
$container{cellspacing} = "0";
226
$container{class} = "red-panel";
227
$container{height} = "75";
228
229
my %tr1; {
230
$tr1{tag} = "tr";
231
232
my %formtd; {
233
$formtd{tag} = "td";
234
$formtd{style} = "width: 190px;";
235
236
my %form; {
237
$form{tag} = "form";
238
$form{action} = "/bugreport.pl";
239
$form{method} = "post";
240
$form{id} = "bugreport";
241
242
my %script; {
243
$script{tag} = "script";
244
$script{innerHTML} .= "function beginBugReport() {\n";
245
$script{innerHTML} .= " //console.log('begin bug report');\n";
246
247
$script{innerHTML} .= " var home = document.getElementById('report_Home');\n";
248
$script{innerHTML} .= " home.style.display = \"none\";\n";
249
250
$script{innerHTML} .= " var url = document.getElementById('report_URL');\n";
251
$script{innerHTML} .= " url.style.display = \"inline\";\n";
252
$script{innerHTML} .= "}\n";
253
254
$script{innerHTML} .= "function bugReportNotes() {\n";
255
$script{innerHTML} .= " var t = document.getElementById('type');\n";
256
257
$script{innerHTML} .= " if (t.selectedIndex != 0) {\n";
258
$script{innerHTML} .= " //console.log('enter bug report notes');\n";
259
$script{innerHTML} .= " var url = document.getElementById('report_URL');\n";
260
$script{innerHTML} .= " url.style.display = \"none\";\n";
261
262
$script{innerHTML} .= " var notes = document.getElementById('report_Notes');\n";
263
$script{innerHTML} .= " notes.style.display = \"inline\";\n";
264
$script{innerHTML} .= " }\n";
265
$script{innerHTML} .= "}\n";
266
267
$script{innerHTML} .= "function submitBugReport() {\n";
268
$script{innerHTML} .= " var n = document.getElementById('notes');\n";
269
$script{innerHTML} .= " if (n.value) {\n";
270
$script{innerHTML} .= " //console.log('submit bug report');\n";
271
$script{innerHTML} .= " var report = document.getElementById('bugreport');\n";
272
$script{innerHTML} .= " report.submit();\n";
273
$script{innerHTML} .= " }\n";
274
$script{innerHTML} .= "}\n";
275
276
$script{innerHTML} .= "function cancelBugReport() {\n";
277
$script{innerHTML} .= " //console.log('cancel bug report');\n";
278
$script{innerHTML} .= " var url = document.getElementById('report_URL');\n";
279
$script{innerHTML} .= " var notes = document.getElementById('report_Notes');\n";
280
281
$script{innerHTML} .= " url.style.display = \"none\";\n";
282
$script{innerHTML} .= " notes.style.display = \"none\";\n";
283
284
$script{innerHTML} .= " var home = document.getElementById('report_Home');\n";
285
$script{innerHTML} .= " home.style.display = \"inline\";\n";
286
287
$script{innerHTML} .= " document.getElementById(\"notes\").value = \"\";\n";
288
$script{innerHTML} .= " document.getElementById(\"type\").selectedIndex = 0;\n";
289
$script{innerHTML} .= "}\n";
290
} # script
291
$form{innerHTML} = Html2::tag(\%script);
292
293
my %report_home; {
294
$report_home{tag} = "div";
295
$report_home{id} = "report_Home";
296
297
my %report_table; {
298
$report_table{tag} = "table";
299
$report_table{border} = "0";
300
$report_table{cellpadding} = "0";
301
$report_table{cellspacing} = "0";
302
$report_table{style} = "height: 75px; width: 100%;";
303
304
my %report_tr; {
305
$report_tr{tag} = "tr";
306
307
my %icon_td; {
308
$icon_td{tag} = "td";
309
$icon_td{width} = "48";
310
311
my %icon; {
312
$icon{tag} = "img";
313
$icon{src} = "/images/grey/spider_web.png";
314
$icon{height} = "48";
315
}
316
317
$icon_td{innerHTML} = Html2::tag(\%icon);
318
} # icon_td
319
320
my %info; {
321
$info{tag} = "td";
322
$info{style} = "text-align: center;";
323
# this will get fixed, just...not now, too much!
324
$info{innerHTML} = "<table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td>";
325
$info{innerHTML} .= "See an issue?";
326
$info{innerHTML} .= "</td></tr><tr><td style=\"padding-top: 5px;\">";
327
{ my %button;
328
$button{tag} = "button";
329
$button{type} = "button";
330
$button{class} = "green";
331
$button{onclick} = "beginBugReport();";
332
$button{innerHTML} = "Bug Report";
333
334
$info{innerHTML} .= Html2::tag(\%button);
335
}
336
$info{innerHTML} .= "</td></tr><tr><td class=spacery>";
337
$info{innerHTML} .= "</td></tr></table>";
338
}
339
340
$report_tr{innerHTML} = Html2::tag(\%icon_td) .
341
Html2::tag(\%spacerx_big) .
342
Html2::tag(\%info);
343
} # report_tr
344
$report_table{innerHTML} = Html2::tag(\%report_tr);
345
} # report_table
346
$report_home{innerHTML} = Html2::tag(\%report_table);
347
} # report_home
348
$form{innerHTML} .= Html2::tag(\%report_home);
349
350
my %report_url; {
351
$report_url{tag} = "div";
352
$report_url{id} = "report_URL";
353
$report_url{style} = "display: none;";
354
$report_url{innerHTML} = "URL: $url_unescaped";
355
{ my %input;
356
$input{tag} = "input";
357
$input{type} = "hidden";
358
$input{name} = "url";
359
$input{value} = $url;
360
361
$report_url{innerHTML} .= Html2::tag(\%input) . Html2::br();
362
}
363
364
$report_url{innerHTML} .= "<table border=0 cellpadding=0 cellspacing=0><tr><td>Report Type:</td><td class=spacerx></td><td>$typeDropdown</td></tr></table>";
365
366
{ my %button;
367
$button{tag} = "button";
368
$button{type} = "button";
369
$button{class} = "red";
370
$button{onclick} = "cancelBugReport();";
371
$button{innerHTML} = "Cancel";
372
373
$report_url{innerHTML} .= Html2::tag(\%button);
374
} # end cancel button
375
{ my %button;
376
$button{tag} = "button";
377
$button{type} = "button";
378
$button{class} = "blue";
379
$button{onclick} = "bugReportNotes();";
380
$button{innerHTML} = "Next";
381
382
$report_url{innerHTML} .= Html2::tag(\%button);
383
} # end next button
384
}
385
$form{innerHTML} .= Html2::tag(\%report_url);
386
387
my %report_notes; {
388
$report_notes{tag} = "div";
389
$report_notes{id} = "report_Notes";
390
$report_notes{style} = "display: none;";
391
$report_notes{innerHTML} = "<table border=0 cellpadding=0 cellspacing=0 width=100% height=75><tr><td align=center>";
392
{ my %ta;
393
$ta{tag} = "textarea";
394
$ta{name} = "notes";
395
$ta{id} = "notes";
396
$ta{noresize} = 1;
397
$ta{style} = "margin-bottom: 3px; font-size: 8pt; scroll: auto; resize: none; height: $notes_height; max-height: $notes_height; max-width: $notes_width; min-height: $notes_height; min-width: $notes_width; width: $notes_width;";
398
$ta{placeholder} = "describe the bug in as much detail as you can";
399
400
$report_notes{innerHTML} .= Html2::tag(\%ta);
401
}
402
403
{ my %button;
404
$button{tag} = "button";
405
$button{type} = "button";
406
$button{class} = "red";
407
$button{onclick} = "cancelBugReport();";
408
$button{innerHTML} = "Cancel";
409
410
$report_notes{innerHTML} .= Html2::tag(\%button);
411
}
412
413
{ my %button;
414
$button{tag} = "button";
415
$button{type} = "button";
416
$button{class} = "green";
417
$button{onclick} = "submitBugReport();";
418
$button{innerHTML} = "Finish";
419
420
$report_notes{innerHTML} .= Html2::tag(\%button);
421
}
422
$report_notes{innerHTML} .= "</td></tr></table>";
423
}
424
$form{innerHTML} .= Html2::tag(\%report_notes);
425
} # form
426
$formtd{innerHTML} = Html2::tag(\%form);
427
} # formtd
428
$tr1{innerHTML} = Html2::tag(\%formtd);
429
} # tr1
430
$container{innerHTML} = Html2::tag(\%tr1);
431
} # container
432
433
return Html2::tag(\%container); # the bug report table in a scalar
434
#usage: print beta_footer($spaces);
435
}
436
437
########################
438
sub footer(;$$) {
439
#*
440
# creates the end of an HTML document, complete with a mini-navigation bar, and legal panel
441
#*
442
my ($spacing, $bytes) = @_; # spacing for pretty printing HTML output (optional) && bytesize of page (optional)
443
if (!$spacing) { $spacing = ""; }
444
445
my @data = split(/\n|;/, Bc_sql::get_constant("SITE_DESIGNER"));
446
my %site_designer;
447
$site_designer{name} = (split("=", $data[0]))[1];
448
$site_designer{url} = (split("=", $data[1]))[1];
449
450
my $designerLink = href("$site_designer{url}", "$site_designer{name}", "snakey-link", "", "target=_blank", "");
451
my $termsLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("LEGALS_PAGE"), "Legals", "snakey-link", "", "", "");
452
my $contactLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("CONTACT_PAGE"), "Contact", "snakey-link", "", "", "");
453
my $sitemapLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("SITEMAP_PAGE"), "Site Map", "snakey-link", "", "", "");
454
my $aboutLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ABOUT_PAGE"), "About", "snakey-link", "", "title=\"About\"", "");
455
my $faqLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("FAQ_PAGE"), "FAQ", "snakey-link", "", "title=\"Frequently Asked Questions\"", "");
456
my $modLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MODS_PAGE"), "Moderators", "snakey-link", "", "title=\"A List of Moderators\"", "");
457
my $sourceLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("SOURCE_PAGE"), "Source", "snakey-link", "", "title=\"View " . Bc_misc::word_as_possessive($Bc_sql::SITE_NAME) . " source code\"", "");
458
459
my $nav_table = "<!-- START FOOTER ----------------------------------------------------->";
460
$nav_table .= "<table cellpadding=0 cellspacing=0 class='subnavbar_dark";
461
if (not $Bc_sql::LOGGEDIN) { $nav_table .= " translucent"; }
462
$nav_table .= "' height=75><tr><td class='small-footer'>";
463
$nav_table .= $sourceLink;
464
$nav_table .= " $Bc_misc::COOL_DOT ";
465
$nav_table .= $modLink;
466
$nav_table .= " $Bc_misc::COOL_DOT ";
467
$nav_table .= $faqLink;
468
$nav_table .= " $Bc_misc::COOL_DOT ";
469
$nav_table .= $termsLink;
470
$nav_table .= " $Bc_misc::COOL_DOT ";
471
$nav_table .= $contactLink;
472
$nav_table .= " $Bc_misc::COOL_DOT ";
473
$nav_table .= $aboutLink;
474
$nav_table .= Html2::br();
475
$nav_table .= "copyright ";
476
{ my %sup;
477
$sup{tag} = "sup";
478
#$sup{innerHTML} = "©";
479
$sup{innerHTML} = "";
480
481
$nav_table .= Html2::tag(\%sup);
482
}
483
$nav_table .= " 2015; " . href("/", Bc_sql::get_site_name(), "snakey-link", "", "", "") . Html2::br();
484
$nav_table .= "Powered by " . $designerLink . Html2::br();
485
$nav_table .= "[bytesize]";
486
$nav_table .= "</td></tr></table>";
487
$nav_table .= "<!-- END FOOTER ----------------------------------------------------->";
488
489
if ($bytes) {
490
my $display_bytes = Bc_misc::commafied($bytes);
491
my $bytesize = "~" . Html2::embolden($display_bytes) . " bytes";
492
$nav_table =~ s/\[bytesize\]/$bytesize/;
493
} else {
494
$nav_table =~ s/\[bytesize\]//;
495
}
496
# we are off by a few bytes..but, close enough. not sure how to get this exact.
497
498
return $nav_table; # the footer in a scalar
499
#usage: print footer($spaces);
500
}
501
502
########################
503
sub header($;$$$$$$$) {
504
#*
505
# creates a header for an HTML document, upto and including the body tag.
506
# print this after printing cookies, of course
507
# includes css.pl, js.pl and ajax.pl
508
#
509
# if $extras is a hash ref, it'll be "tagged" into the head
510
# otherwise, it will be inserted as body attributes
511
#*
512
my ($title, $css, $script, $body_onload, $description, $extras, $htmlextras, $headextras) = @_; # a title for the page && a css file (optional) && a script file (optional) && an onload procedure (optional) && a desc (optional) && extra BODY attributes (optional, eg: style=\"background-image: none;\") && attributes for HTML tag && when not a hash ref, extra html inserted into head
513
if (not $htmlextras) { $htmlextras = ""; }
514
515
my $output = "<!DOCTYPE html>";
516
$output .= "<html";
517
if ($htmlextras) { $output .= " $extras"; }
518
if ($htmlextras !~ / lang='[a-z]*'/i) { $output .= " lang='en'"; }
519
$output .= ">";
520
521
my %head; {
522
$head{tag} = "head";
523
524
my %script; {
525
$script{tag} = "script";
526
$script{innerHTML} .= "function loadjs(src) {\n" .
527
" var script = document.createElement(\"script\");\n" .
528
" script.type = \"text/javascript\";\n" .
529
" script.src = src;\n" .
530
" document.getElementsByTagName(\"head\")[0].appendChild(script);\n" .
531
"}\n" .
532
"\n" .
533
"function postLoadInit() {\n" .
534
" loadjs(\"ajax.pl\");\n" .
535
" loadjs(\"js.pl\");\n" .
536
"}\n";
537
}
538
539
$head{innerHTML} .= Html2::tag(\%script);
540
541
# 'constant' SITE_DESIGNER is a two piece scalar, separated by a \n or ;
542
# further, each of those pieces is separated by an =
543
# for example:
544
# if the DB constant "SITE_DESIGNER" contains
545
# name=The Spidermen\nurl=http://www.spidermen.ca/
546
# then $data[0] will contain "name=The Spidermen" and $data[1] will contain "url=http://www.spidermen.ca/"
547
# the values in each element of @data will then get dumped into a handier hash construct
548
# the hash keys will be the values to the left of the = sign
549
# and the values the keys point to will be the values to the right of the = sign
550
# so $site_designer{name} would then contain "The Spidermen"
551
my @data = split(/\n|;/, Bc_sql::get_constant("SITE_DESIGNER"));
552
my %site_designer;
553
$site_designer{name} = (split("=", $data[0]))[1];
554
$site_designer{url} = (split("=", $data[1]))[1];
555
556
my %metaauthor; {
557
$metaauthor{tag} = "meta";
558
$metaauthor{content} = $site_designer{name};
559
560
$head{innerHTML} .= Html2::tag(\%metaauthor);
561
}
562
563
my %metacharset; {
564
$metacharset{tag} = "meta";
565
$metacharset{charset} = "utf-8";
566
567
$head{innerHTML} .= Html2::tag(\%metacharset);
568
}
569
570
my %metaviewport; {
571
$metaviewport{tag} = "meta";
572
$metaviewport{name} = "viewport";
573
$metaviewport{content} = "height=device-height, width=device-width, initial-scale=1.0";
574
575
$head{innerHTML} .= Html2::tag(\%metaviewport);
576
}
577
578
if ($description) {
579
my %metadesc; {
580
$metadesc{tag} = "meta";
581
$metadesc{name} = "description";
582
$metadesc{content} = $description;
583
584
$head{innerHTML} .= Html2::tag(\%metadesc);
585
}
586
}
587
588
my %title; {
589
$title{tag} = "title";
590
if ($title)
591
{ $title{innerHTML} = $title; } else
592
{ $title{innerHTML} = "(no title)"; }
593
594
$head{innerHTML} .= Html2::tag(\%title);
595
}
596
597
if ($script and $script ne "js.pl" and $script !~ /^\?/) {
598
my %script; {
599
$script{tag} = "script";
600
$script{src} = $script;
601
$script{async} = 1;
602
603
$head{innerHTML} .= Html2::tag(\%script);
604
}
605
}
606
607
my %css; {
608
$css{tag} = "link";
609
$css{async} = 1;
610
$css{defer} = 1;
611
$css{id} = "css";
612
613
if ($css) {
614
if (ref $css eq "HASH") {
615
my $c = "";
616
if ($css{html}) { $c = $css{html}; } else { $c = $css{innerHTML}; }
617
delete $css{innerHTML};
618
619
$css{html} = $c;
620
}
621
else {
622
$css{rel} = "stylesheet";
623
624
if ($css =~ /^\?/) {
625
$css{href} = "/css.pl" . $css . "&" . Bc_misc::new_id();
626
} else {
627
$css{href} = $css;
628
if ($css !~ /\?/)
629
{ $css{href} .= "?" . Bc_misc::new_id() } else
630
{ $css{href} .= "&" . Bc_misc::new_id(); }
631
}
632
}
633
} else {
634
$css{href} .= "/css.pl?tid=" . Bc_misc::new_id();
635
}
636
637
$head{innerHTML} .= Html2::tag(\%css);
638
}
639
640
my %ajax; {
641
$ajax{tag} = "script";
642
$ajax{async} = 1;
643
$ajax{defer} = 1;
644
$ajax{src} = "/ajax.pl?" . Bc_misc::new_id();
645
646
$head{innerHTML} .= Html2::tag(\%ajax);
647
}
648
649
my %js; {
650
$js{tag} = "script";
651
$js{async} = 1;
652
$js{defer} = 1;
653
$js{src} = "/js.pl";
654
if ($script =~ /^\?/)
655
{ $js{src} .= $script . "&" . Bc_misc::new_id(); } else
656
{ $js{src} .= "?" . Bc_misc::new_id(); }
657
658
$head{innerHTML} .= Html2::tag(\%js);
659
}
660
661
{ my %adsense;
662
$adsense{tag} = "script";
663
$adsense{"data-ad-client"} = "ca-pub-1957743624512839";
664
$adsense{async} = 1;
665
$adsense{src} = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";
666
667
#$head{innerHTML} .= Html2::tag(\%adsense);
668
$head{innerHTML} .= "<script data-ad-client=\"ca-pub-1957743624512839\" async src=\"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>";
669
}
670
671
if (ref $extras eq "HASH") { $head{innerHTML} .= Html2::tag($extras); }
672
if ($headextras and not ref $headextras eq "HASH") { $head{innerHTML} .= $headextras; }
673
674
$output .= Html2::tag(\%head);
675
}
676
677
$output .= "<body";
678
if ($body_onload) {
679
$output .= " onload=\"$body_onload";
680
# soon, we'll be adding in the loadjs/postLoadInit stuff here
681
$output .= "\"";
682
}
683
if ($extras and ref $extras ne "HASH") { $output .= " $extras"; }
684
$output .= ">";
685
686
return $output; # the header in a scalar
687
#usage: print header("Bob's Emporium", "css.pl", "js.js", "welcomeMsg();", "this is my personal hodgepodge homepage");
688
}
689
690
########################
691
sub html_end() {
692
#*
693
# prints the end body and html tags
694
#*
695
#@_; # (no parameters)
696
697
return "</body></html>"; # a scalar
698
#usage: print html_end();
699
}
700
701
########################
702
sub pre_html_header(;$$$) {
703
#*
704
# to output the HTTP header response
705
# intended to be used before outputting <a href="#header">header</a> output
706
# the aforementioned <i>header</i> sub does NOT include a
707
# call to this subroutine. the param is a hash reference.
708
# if it is, ignore the rest, and use the data in the hash
709
# to define what kind of header to output.
710
# here's the structure:
711
# \% =>
712
# {origin} = $ (default = 'sameorigin') - X-Frame-Options
713
# {type} = $ (default = 'text/html') - Content-Type
714
# {status} = $ (default = '200 Ok') - Status
715
# {cookies} = $ (default = '') - Cookie data (all encompassing)
716
# eg: where {cookies} = "set-cookie: one=2\nset-cookie: two=3\nset-cookie: three=4\n";
717
#
718
# $doc is a scalar representing the content to be sent. it's used to calculate "content-length"
719
# !validation of hash data is not detailed, nor is it uri_escape'd
720
#*
721
my ($settings, $bare, $doc) = @_; # a reference to a ball of hash (optional) && barebones header (optional; outputs only status, origin, and content-type) && document data (optional)
722
723
my $defOrigin = "sameorigin";
724
my $defStatus = "200 ok";
725
my $defType = "text/html";
726
727
if (ref $settings ne "HASH") { $settings->{type} = $defType; }
728
if (not $settings->{type}) { $settings->{type} = $defType; }
729
730
my $redir = 0;
731
my $output;
732
733
# first! check if undergoing system maintenance and redir to maint.pl if maint underway
734
if (not $settings->{skipmaintcheck}) {
735
my $maintsql = "select * from maint";
736
my $maint = Bc_sql::sql_execute($maintsql, "Html::pre_html_header -> maint sql");
737
if (ref $maint eq "HASH") {
738
if ($maint->{value} eq 2) {
739
$output = Redir::error_redir("/maint.pl", "Undergoing System Maintenance");
740
$redir = 1;
741
}
742
}
743
}
744
745
if (not $redir) {
746
if ($bare) {
747
$output = "status: $defStatus\n";
748
$output .= "origin: $defOrigin\n";
749
$output .= "content-type: $settings->{type};charset=utf-8\n\n";
750
} else {
751
#my $maxAge = 86400; # 1 day
752
my $maxAge = 1; # 1 second!
753
my $eTag = Bc_misc::new_id(256); # this is just a default initialization
754
755
if ($settings->{type} =~ /^image\//i) {
756
757
if ($doc) {
758
# and if $doc is provided, then reset $eTag
759
# how??
760
# tally all the char values?
761
my @hash = split("", $doc); # an array!
762
my $blah = 0; # a counter
763
foreach my $char (@hash) { $blah += ord($char); }
764
$eTag = $blah;
765
}
766
767
$output = "etag: \"$eTag\"\n";
768
$output .= "cache-control: maxage=" . (86400 * 30) . "\n";
769
$output .= "content-type: $settings->{type}\n\n";
770
} else {
771
if ($settings->{maxage})
772
{ $maxAge = $settings->{maxage}; } else
773
{ $maxAge = 86400 * 30; }
774
775
if ($doc) {
776
# and if $doc is provided, then reset $eTag
777
# how??
778
# tally all the char values?
779
my @hash = split("", $doc); # an array!
780
my $blah = 0; # a counter
781
foreach my $char (@hash) { $blah += ord($char); }
782
$eTag = $blah;
783
}
784
785
$output = "etag: \"$eTag\"\n";
786
787
if ($settings->{type} =~ /^image\//i)
788
{ $output .= "cache-control: max-age=$maxAge\n"; } else
789
{ $output .= "cache-control: max-age=$maxAge, no-cache, must-validate, post-check=0, pre-check=0\n"; }
790
$output .= "x-content-type-options: nosniff\n";
791
792
if (ref $settings ne "HASH") {
793
# it will be now!
794
$settings->{origin} = $defOrigin;
795
$settings->{status} = $defStatus;
796
$settings->{type} = $defType;
797
}
798
799
if (not $settings->{origin}) { $settings->{origin} = $defOrigin; }
800
if (not $settings->{status}) { $settings->{status} = $defStatus; }
801
if (not $settings->{type}) { $settings->{type} = $defType; }
802
803
if ($settings->{cookies}) {
804
$settings->{cookies} =~ s/(\n)*$//;
805
$output .= $settings->{cookies} . "\n";
806
}
807
808
$output .= "x-frame-options: $settings->{origin}\n";
809
$output .= "status: $settings->{status}\n";
810
811
if ($settings->{type} =~ /^location\:(.)*/i) {
812
$output .= $settings->{type} . "\n\n";
813
} else {
814
if ($settings->{type} =~ /^image\//i)
815
{ $output .= "content-type: $settings->{type}\n\n"; } else
816
{ $output .= "content-type: $settings->{type}; charset=utf-8\n\n"; }
817
}
818
}
819
}
820
}
821
822
return $output; # the HTTP response header text as ordered
823
#usage: my $httpHeader = pre_html_header();
824
}
825
826
########################################################################
827
########################################################################
828
########################################################################
829
830
831
########################
832
sub fieldset($$$$$$$$$$) {
833
#*
834
# creates a fieldset, with or without a legend
835
# the fieldset and legend can be 'class'ed.
836
# lots of params
837
#*
838
my ($content, $spacing, $class, $legendary, $legendcontent, $legendclass, $centered, $constricted, $extras, $separator) = @_; # content && spacing for pretty printing HTML output && css class && legend toggle && legend content && legend css class && centered fieldset content && constricted (made as little as possible) && extra html tag options && an ending for after the fieldset
839
if (!$spacing) { $spacing = ""; }
840
841
if ($spacing eq 0) { $spacing = ""; }
842
if ($separator eq 0) { $separator = ""; }
843
844
my $constricted_spacing = "";
845
846
my $output = "";
847
848
my %fs; {
849
$fs{tag} = "fieldset";
850
if ($class) { $fs{class} = $class; }
851
if ($constricted) { $fs{style} = "white-space: nowrap;"; }
852
853
if ($legendary) {
854
my %legend; {
855
$legend{tag} = "legend";
856
if ($legendclass) { $legend{class} = $legendclass; }
857
$legend{style} = "white-space: nowrap;";
858
$legend{innerHTML} = $legendcontent;
859
}
860
861
$fs{innerHTML} .= Html2::tag(\%legend);
862
}
863
864
$fs{innerHTML} .= $content;
865
866
$output .= Html2::tag(\%fs);
867
}
868
869
if ($constricted) { $output = table($output, "", "", $centered, "width=1", ""); }
870
871
return $output; # a fieldset in a scalar
872
#usage: my $fs = fieldset("fs content", "", "fs_css_class", 1, "example legend", "legend_css_class",== 0, 1, "style=\"background-color: black;\"", "<hr>");
873
}
874
875
########################
876
sub div($$$$$$) {
877
#*
878
# creates an HTML div tag
879
# can be classed and can be inline...or not.
880
# toss on a separator, too, if you want (like an "<hr>", for instance)
881
#*
882
my ($content, $class, $spacing, $inline, $extras, $separator) = @_; # content && css class && spacing for pretty printing HTML output && toggle inline/block && extra html tag options && an ending for after the div
883
if (!$spacing) { $spacing = ""; }
884
885
if ($spacing eq 0) { $spacing = ""; }
886
if ($separator eq 0) { $separator = ""; }
887
888
$content =~ s/^( )*//;
889
890
my $output;
891
892
{ my %d;
893
$d{tag} = "div";
894
if ($class) { $d{class} = $class; }
895
if ($inline) { $d{style} = "display: inline;"; }
896
$d{innerHTML} .= $content;
897
898
$output = Html2::tag(\%d);
899
}
900
901
if ($extras) { $output =~ s/>/ $extras>/; }
902
903
return $output; # a div in a scalar
904
#usage: my $bobsMenu = div("(list here)", "class_bobsMenuDiv", "", 0, "", "");
905
}
906
907
########################
908
sub input($$$$$) {
909
#*
910
# creates an input field
911
#*
912
my ($id, $title, $extras, $spacing, $separator) = @_; # an id for the input && a title before the input && extra html attributes && spacing for pretty printing HTML output && an ending for after the input
913
if (!$spacing) { $spacing = ""; }
914
915
my $output = "";
916
if ($title) { $output = Html2::italicize(Html2::embolden($title)) . " "; }
917
918
{ my %i;
919
if (ref $extras eq "HASH") { %i = %$extras; }
920
$i{tag} = "input";
921
$i{id} = $id;
922
923
$output .= Html2::tag(\%i);
924
}
925
926
if ($extras) { $output =~ s/>/ $extras>/; }
927
928
return $output; # an input in a scalar
929
#usage: print input("input id", "title", "type=text", "", "");
930
}
931
932
########################
933
sub dropdown($$$$$$$$$;$$$) {
934
#*
935
# creates an html select input, complete with ID, selected item, and a title
936
# $dataRef ought to be a reference to an array
937
# the data within each element in the array ought to be
938
# value=label OR
939
# label
940
#
941
# if $selected == -1, then adds a "select an option" option to top of list
942
# effectively forcing the user to select an option
943
#
944
# if $add999 = 1 then add an "Any" option
945
# if $add999 = 2 then add an "Ask Me" option
946
# and if $add999 = 3 then add both!
947
#*
948
my ($id, $title, $selected, $class, $onChange, $spacing, $extras, $separator, $dataRef, $add999, $special_select_arrayRef, $special_select_colour) = @_; # id && title for before select && selected item && css class && onchange event && spacing for pretty printing HTML output && extra html attributes && an ending for after the select && an array containing 'name=value' pairs for the options in the list (this ought to be a reference!) && add "999=--Any--"? (optional) && a list of options to colourize (optional) && the bg colour of the "specially selected" items
949
if (not $special_select_colour) { $special_select_colour = "selected"; }
950
if (not $selected) { $selected = ""; }
951
my @data = @$dataRef;
952
if (!$spacing) { $spacing = ""; }
953
if (!$add999) { $add999 = 0; }
954
955
if ($spacing eq 0) { $spacing = ""; }
956
if ($separator eq 0) { $separator = ""; }
957
958
{ my %container;
959
$container{tag} = "div";
960
$container{class} = "inline nowrap";
961
if ($class eq "tiny") { $container{style} = "padding-right: 15px;"; }
962
$container{innerHTML} = $title . " ";
963
964
{ my %select;
965
if (ref $id eq "HASH") {
966
if ($id->{id}) { $select{id} = $id->{id}; $select{name} = $select{id}; }
967
if ($id->{class}) { $select{class} = $id->{class}; }
968
if ($id->{onChange}) { $select{onchange} .= $id->{onChange}; }
969
%select = %$id;
970
} else {
971
if ($id) { $select{id} = $id; $select{name} = $id; }
972
if ($class) { $select{class} = $class; }
973
if ($onChange) { $select{onchange} .= $onChange; }
974
}
975
$select{tag} = "select";
976
977
if (@data) {
978
if ($selected eq "-1") {
979
my %option;
980
$option{tag} = "option";
981
$option{value} = "";
982
$option{selected} = 1;
983
$option{disabled} = 1;
984
$option{innerHTML} = "Pick One";
985
986
$select{innerHTML} .= Html2::tag(\%option);
987
}
988
989
if ($add999 eq 1) {
990
my %option;
991
$option{tag} = "option";
992
$option{value} = "999";
993
$option{innerHTML} = "Any";
994
995
$select{innerHTML} .= Html2::tag(\%option);
996
}
997
elsif ($add999 eq 2) {
998
my %option;
999
$option{tag} = "option";
1000
$option{value} = "888";
1001
$option{innerHTML} = "Ask Me";
1002
1003
$select{innerHTML} .= Html2::tag(\%option);
1004
}
1005
elsif ($add999 eq 3) {
1006
{ my %option;
1007
$option{tag} = "option";
1008
$option{value} = "888";
1009
$option{innerHTML} = "Ask Me";
1010
1011
$select{innerHTML} .= Html2::tag(\%option);
1012
}
1013
1014
{ my %option;
1015
$option{tag} = "option";
1016
$option{value} = "999";
1017
$option{innerHTML} = "Any";
1018
1019
$select{innerHTML} .= Html2::tag(\%option);
1020
}
1021
}
1022
elsif ($add999) {
1023
# when all else fails, fallback to
1024
# the "Any" option, (as above, $add999 eq 1),
1025
# and $add999's value is used as the option's display text!
1026
my %option;
1027
$option{tag} = "option";
1028
$option{value} = "999";
1029
$option{innerHTML} = $add999;
1030
1031
$select{innerHTML} .= Html2::tag(\%option);
1032
}
1033
1034
my $first = 1;
1035
my $counter = 1;
1036
if ($selected ne "0") { $first = 0; }
1037
if (@data and $data[1] !~ /\=/) {
1038
foreach my $option (@data) {
1039
if ($option !~ /999=/) { $data[$counter-1] = "$counter=$option"; $counter++; }
1040
}
1041
}
1042
1043
$counter = 1;
1044
foreach my $option (@data) {
1045
if ($option =~ /\=/) {
1046
my ($id, $name) = split("\=", $option);
1047
1048
{ my %op;
1049
$op{tag} = "option";
1050
$op{value} = $id;
1051
if (
1052
($selected eq $id and $first eq 0) or
1053
($first and $selected > 0)
1054
) {
1055
$op{selected} = 1;
1056
}
1057
1058
if (ref $special_select_arrayRef eq "ARRAY") {
1059
my @list = @$special_select_arrayRef;
1060
foreach my $element (@list) {
1061
# see if an element within @list
1062
# matches this option, and if so, colourize it!
1063
if ($element eq $id) {
1064
$op{class} = $special_select_colour;
1065
}
1066
}
1067
}
1068
1069
$op{innerHTML} = $name;
1070
1071
$select{innerHTML} .= Html2::tag(\%op);
1072
}
1073
} else {
1074
my %option;
1075
$option{tag} = "option";
1076
$option{value} = $counter;
1077
$option{innerHTML} = $option;
1078
if ($selected eq $counter and $first eq 0) { $option{selected} = 1; }
1079
if ($first) { $option{selected} = 1; }
1080
1081
if (ref $special_select_arrayRef eq "ARRAY") {
1082
my @list = @$special_select_arrayRef;
1083
foreach my $element (@list) {
1084
# see if an element within @list
1085
# matches this option, and if so, colourize it!
1086
if ($element eq $counter) {
1087
$option{class} = $special_select_colour;
1088
}
1089
}
1090
}
1091
1092
$select{innerHTML} .= Html2::tag(\%option);
1093
$counter++;
1094
}
1095
1096
if ($first) { $first = 0; }
1097
} # end foreach given option
1098
} else {
1099
# @data is empty!, because country number = -1
1100
# how do we deal with that?
1101
# leave the select optionless?
1102
# or put a "look elsewhere?" option?
1103
# if we do that, then we can't just write "look elsewhere"
1104
# we need an appropriate label, so ... add an option to the subroutine's params?
1105
my %op;
1106
$op{tag} = "option";
1107
$op{value} = '';
1108
$op{selected} = 1;
1109
$op{disabled} = 1;
1110
$op{innerHTML} = $add999;
1111
1112
$select{innerHTML} .= Html2::tag(\%op);
1113
}
1114
1115
if (ref $id ne "HASH") {
1116
my $temp = Html2::tag(\%select);
1117
$temp =~ s/<select/<select $extras/;
1118
1119
$container{innerHTML} .= $temp;
1120
} else {
1121
$container{innerHTML} .= Html2::tag(\%select);
1122
}
1123
} # end select input
1124
$container{innerHTML} =~ s/^ //;
1125
1126
my $output .= Html2::tag(\%container);
1127
return $output; # a dropdown in a scalar
1128
}
1129
1130
#usage: my $dd = dropdown("dd", "a drop down menu", "dd_css", "", "", "", @options);
1131
}
1132
1133
########################
1134
sub dropdown_for_users($$$;$$$$$$$$$$) {
1135
#*
1136
# creates an html select input, complete with ID, selected item, and a title
1137
# $dataRef ought to be a reference to an array
1138
# the data within each element in the array ought to be
1139
# value=label OR
1140
# label
1141
# this is nearly identical to dropdown(...), except
1142
# it will only show users and only from start to start+1000
1143
# whatever start may be
1144
#*
1145
my ($id, $title, $selected, $class, $onChange, $spacing, $extras, $separator, $start, $special_select_arrayRef, $special_select_colour, $hidePageNum, $compact) = @_; # id && title for before select && selected item && css class && onchange event && spacing for pretty printing HTML output && extra html attributes && an ending for after the select && start at (optional, default = 0) && a list of options to colourize (optional) && the bg colour of the "specially selected" items (optional) && hide page number? (optional, default = 0) && compact (optional, default = 0)
1146
if ($compact) { $hidePageNum = 1; }
1147
if (not $special_select_colour) { $special_select_colour = "highlight"; }
1148
my @data = Bc_sql::get_users_forDropdowns(0, 1, "", "", $start);
1149
1150
if ($spacing eq 0) { $spacing = ""; }
1151
if ($separator eq 0) { $separator = ""; }
1152
1153
my $lastPage = int(Bc_sql::get_user_count() / 1000);
1154
my $output = "";
1155
1156
{ my %script;
1157
$script{tag} = "script";
1158
$script{defer} = 1;
1159
$script{async} = 1;
1160
$script{innerHTML} ="\nvar start_$id = $start;\n";
1161
1162
$script{innerHTML} .= "function home_userpage_$id() {\n";
1163
$script{innerHTML} .= " start_$id = 0;\n";
1164
$script{innerHTML} .= " update_pagenum_$id();\n";
1165
$script{innerHTML} .= "}\n";
1166
1167
$script{innerHTML} .= "function next_userpage_$id() {\n";
1168
$script{innerHTML} .= " start_$id++;\n";
1169
$script{innerHTML} .= " if (start_$id > $lastPage) { start_$id--; } else { update_pagenum_$id(); }\n";
1170
$script{innerHTML} .= "}\n";
1171
1172
$script{innerHTML} .= "function prev_userpage_$id() {\n";
1173
$script{innerHTML} .= " start_$id--;\n";
1174
$script{innerHTML} .= " if (start_$id < 0) { start_$id = 0; } else { update_pagenum_$id(); }\n";
1175
$script{innerHTML} .= "}\n";
1176
1177
$script{innerHTML} .= "function last_userpage_$id() {\n";
1178
$script{innerHTML} .= " start_$id = $lastPage;\n";
1179
$script{innerHTML} .= " update_pagenum_$id();\n";
1180
$script{innerHTML} .= "}\n";
1181
1182
$script{innerHTML} .= "function update_pagenum_$id() {\n";
1183
$script{innerHTML} .= " //console.log(\"$lastPage\");\n";
1184
$script{innerHTML} .= " Bc_sql::get_users_forDropdowns('$id', start_$id*1000, $selected, 'debug_users');\n";
1185
1186
$script{innerHTML} .= " var hbutton = document.getElementById('" . $id . "hbutton');\n";
1187
$script{innerHTML} .= " var pbutton = document.getElementById('" . $id . "pbutton');\n";
1188
$script{innerHTML} .= " var nbutton = document.getElementById('" . $id . "nbutton');\n";
1189
$script{innerHTML} .= " var lbutton = document.getElementById('" . $id . "lbutton');\n";
1190
1191
if (not $hidePageNum) {
1192
$script{innerHTML} .= " pbutton.innerHTML = \"< \" + (start_$id);\n";
1193
$script{innerHTML} .= " nbutton.innerHTML = (start_$id+2) + \" >\";\n";
1194
}
1195
1196
$script{innerHTML} .= " hbutton.disabled = false;\n";
1197
$script{innerHTML} .= " nbutton.disabled = false;\n";
1198
$script{innerHTML} .= " pbutton.disabled = false;\n";
1199
$script{innerHTML} .= " lbutton.disabled = false;\n";
1200
1201
$script{innerHTML} .= " if (start_$id+1 > $lastPage) {\n";
1202
$script{innerHTML} .= " nbutton.disabled = true;\n";
1203
$script{innerHTML} .= " lbutton.disabled = true;\n";
1204
$script{innerHTML} .= " }\n";
1205
1206
$script{innerHTML} .= " if (start_$id == 0 || !start_$id) {\n";
1207
$script{innerHTML} .= " hbutton.disabled = true;\n";
1208
$script{innerHTML} .= " pbutton.disabled = true;\n";
1209
$script{innerHTML} .= " }\n";
1210
$script{innerHTML} .= "}\n";
1211
1212
$script{innerHTML} .= "if (window.addEventListener){\n";
1213
$script{innerHTML} .= " window.addEventListener('load', update_pagenum_$id);\n";
1214
$script{innerHTML} .= "} else {\n";
1215
$script{innerHTML} .= " window.attachEvent('onload', update_pagenum_$id);\n";
1216
$script{innerHTML} .= "}\n";
1217
1218
$output .= Html2::tag(\%script);
1219
}
1220
1221
my $homeLabel = "<<";
1222
my $prevLabel = "< $start";
1223
my $nextLabel = ($start + 1) . ">";
1224
my $lastLabel = ">>";
1225
if ($hidePageNum) {
1226
{ my %img;
1227
$img{tag} = "img";
1228
$img{src} = "/images/site/first.png";
1229
$img{height} = 18;
1230
1231
$homeLabel = Html2::tag(\%img);
1232
}
1233
1234
{ my %img;
1235
$img{tag} = "img";
1236
$img{src} = "/images/site/prev.png";
1237
$img{height} = 18;
1238
1239
$prevLabel = Html2::tag(\%img);
1240
}
1241
1242
{ my %img;
1243
$img{tag} = "img";
1244
$img{src} = "/images/site/next.png";
1245
$img{height} = 18;
1246
1247
$nextLabel = Html2::tag(\%img);
1248
}
1249
1250
{ my %img;
1251
$img{tag} = "img";
1252
$img{src} = "/images/site/last.png";
1253
$img{height} = 18;
1254
1255
$lastLabel = Html2::tag(\%img);
1256
}
1257
} # hide page num
1258
1259
# home and previous "page" buttons
1260
my $newline = "\n";
1261
if ($compact) { $spacing = ""; $newline = ""; }
1262
my $button_class = "padding-none blue";
1263
if ($compact) { $button_class .= " tiny"; }
1264
$button_class .= "'";
1265
1266
{ my %button;
1267
$button{tag} = "button";
1268
$button{type} = "button";
1269
$button{class} = $button_class;
1270
$button{id} = $id . "hbutton";
1271
$button{onclick} = "home_userpage_$id();";
1272
$button{title} = "Go to first page of users";
1273
$button{innerHTML} = $homeLabel;
1274
1275
$output .= Html2::tag(\%button);
1276
}
1277
1278
{ my %button;
1279
$button{tag} = "button";
1280
$button{type} = "button";
1281
$button{class} = $button_class;
1282
$button{id} = $id . "pbutton";
1283
$button{onclick} = "prev_userpage_$id();";
1284
$button{title} = "Go to previous page of users";
1285
$button{innerHTML} = $prevLabel;
1286
1287
$output .= Html2::tag(\%button);
1288
}
1289
1290
# the drop down
1291
if (not $compact) {
1292
if ($title) { $output .= "$title "; }
1293
}
1294
1295
{ my %select;
1296
$select{tag} = "select";
1297
if ($id) {
1298
$select{id} = $id;
1299
$select{name} = $id;
1300
}
1301
1302
if ($class) {
1303
if ($compact) { $select{class} = "tiny $class"; }
1304
} else {
1305
if ($compact) { $select{class} = "tiny"; }
1306
}
1307
if ($onChange) { $select{onchange} = $onChange; }
1308
1309
$select{innerHTML} = "";
1310
if ($selected == -1) {
1311
my %option;
1312
$option{tag} = "option";
1313
$option{value} = "";
1314
$option{selected} = 1;
1315
$option{disabled} = 1;
1316
$option{innerHTML} = "Pick One";
1317
1318
$select{innerHTML} .= Html2::tag(\%option);
1319
}
1320
1321
my $first = 1;
1322
my $counter = 1;
1323
if ($selected) { $first = 0; }
1324
if (@data and $data[1] !~ /\=/) {
1325
foreach my $option (@data) {
1326
if ($option !~ /999=/) { $data[$counter-1] = "$counter=$option"; $counter++; }
1327
}
1328
}
1329
1330
$counter = 1;
1331
foreach my $option (@data) {
1332
if ($option =~ /\=/) {
1333
my ($opid, $name) = split("\=", $option);
1334
{ my %option;
1335
$option{tag} = "option";
1336
$option{value} = $opid;
1337
if (($selected eq $opid and $first eq 0) or $first) { $option{selected} = 1; }
1338
1339
if (ref $special_select_arrayRef eq "ARRAY") {
1340
my @list = @$special_select_arrayRef;
1341
foreach my $element (@list) {
1342
# see if an element within @list
1343
# matches this option, and if so, colourize it!
1344
if ($element eq $opid) {
1345
$option{class} = $special_select_colour;
1346
}
1347
}
1348
}
1349
1350
$option{innerHTML} = $name;
1351
1352
$select{innerHTML} .= Html2::tag(\%option);
1353
}
1354
} else {
1355
{ my %option;
1356
$option{tag} = "option";
1357
$option{value} = $counter;
1358
1359
if (($selected eq $counter and $first eq 0) or $first) { $option{selected} = 1; }
1360
1361
if (ref $special_select_arrayRef eq "ARRAY") {
1362
my @list = @$special_select_arrayRef;
1363
foreach my $element (@list) {
1364
# see if an element within @list
1365
# matches this option, and if so, colourize it!
1366
if ($element eq $counter) {
1367
$option{class} = $special_select_colour;
1368
}
1369
}
1370
}
1371
1372
$option{innerHTML} = $option;
1373
1374
$select{innerHTML} .= Html2::tag(\%option);
1375
}
1376
$counter++;
1377
}
1378
1379
if ($first) { $first = 0; }
1380
}
1381
1382
$output .= Html2::tag(\%select);
1383
} # end select input
1384
$output =~ s/^ //;
1385
1386
# reload button
1387
if (not $compact) {
1388
my %button;
1389
$button{tag} = "button";
1390
$button{type} = "button";
1391
$button{class} = "yellow";
1392
$button{id} = $id . "rbutton";
1393
$button{onclick} = "update_pagenum_$id();";
1394
$button{title} = "Refresh List";
1395
1396
{ my %img;
1397
$img{tag} = "img";
1398
$img{src} = "/images/site/admin/reload.png";
1399
$img{height} = 14;
1400
1401
$button{innerHTML} = Html2::tag(\%img);
1402
}
1403
1404
$output .= Html2::tag(\%button);
1405
}
1406
# next and last "page" button
1407
1408
{ my %button;
1409
$button{tag} = "button";
1410
$button{type} = "button";
1411
$button{class} = $button_class;
1412
$button{id} = $id . "nbutton";
1413
$button{onclick} = "next_userpage_$id();";
1414
$button{title} = "Go to next page of users";
1415
$button{innerHTML} = $nextLabel;
1416
1417
$output .= Html2::tag(\%button);
1418
}
1419
1420
{ my %button;
1421
$button{tag} = "button";
1422
$button{type} = "button";
1423
$button{class} = $button_class;
1424
$button{id} = $id . "lbutton";
1425
$button{onclick} = "last_userpage_$id();";
1426
$button{title} = "Go to last page of users";
1427
$button{innerHTML} = $lastLabel;
1428
1429
$output .= Html2::tag(\%button);
1430
}
1431
1432
{ my %div;
1433
$div{tag} = "div";
1434
$div{class} = "inline";
1435
$div{innerHTML} = $output;
1436
1437
return Html2::tag(\%div); # a dropdown (with user ID's and names) in a scalar
1438
}
1439
#usage: my $dd = dropdown_for_users("dd", "a drop down menu", "dd_css", "", "", "", @options);
1440
}
1441
1442
########################
1443
sub tdata(;$$$$) {
1444
#*
1445
# creates a TD
1446
# it can be 'class'ed
1447
#*
1448
my ($content, $spacing, $class, $extras) = @_; # content (optional) && spacing for pretty printing HTML output (optional) && css class (optional) && extra html attributes (optional)
1449
my $output = "<td";
1450
if ($class) { $output .= " class=$class"; }
1451
if ($extras) { $output .= " $extras"; }
1452
$output .= ">";
1453
$content =~ s/\n/\n /g;
1454
$content =~ s/\n$//;
1455
if ($content) { $output .= $content; }
1456
$output .= "</td>";
1457
1458
return $output; # a TD in a scalar
1459
#usage: my $cell = tdata("some words and/or pics here", "", "", "align=right");
1460
}
1461
1462
########################
1463
sub trow($;$$$) {
1464
#*
1465
# creates a TR
1466
#*
1467
my ($cells, $spacing, $extras, $separator) = @_; # the TD's && spacing && extra html tag options for this TR (optional) && separator
1468
my $rv = 0;
1469
if ($cells) {
1470
$rv = "<tr";
1471
if ($extras) { $rv .= " $extras"; }
1472
$rv .= ">";
1473
if ($separator) { $rv .= $separator; } else { $rv .= ""; }
1474
$rv .= $cells;
1475
$rv .= "</tr>";
1476
if ($separator) { $rv .= $separator; } else { $rv .= ""; }
1477
}
1478
1479
return $rv; # a TR in a scalar, or 0 when $cells is empty
1480
#usage: my $tr = trow($cell);
1481
}
1482
1483
########################
1484
sub table_void($;$$$$$) {
1485
#*
1486
# creates a table (no TD and no TR)
1487
# use, tdata and trow to build the
1488
# table contents, and pass in as
1489
# $content
1490
#*
1491
my ($content, $spacing, $class, $centered, $extras, $separator) = @_; # content && spacing for pretty printing HTML output (optional) && css class (optional, default = "") && centered table (optional, default = 0) && extra tag options (optional, default = ""), && an ending for after the table (optional, default = "")
1492
if (!$spacing) { $spacing = ""; }
1493
my $rv = 0;
1494
1495
if ($content) {
1496
$rv = "<table";
1497
if ($class) { $rv .= " class=$class"; }
1498
if ($centered) { $rv .= " align=center"; }
1499
if ($extras) { $rv .= " $extras"; }
1500
$rv .= ">";
1501
if ($separator) { $rv .= $separator; } else { $rv .= ""; }
1502
$rv .= $content;
1503
$rv .= "</table>";
1504
if ($separator) { $rv .= $separator; } else { $rv .= ""; }
1505
}
1506
1507
return $rv; # a table in a scalar, or 0 when no content given
1508
#usage: my $table = table_void($tr);
1509
}
1510
1511
########################
1512
sub table($;$$$$$) {
1513
#*
1514
# creates a single celled table
1515
#*
1516
my ($content, $spacing, $class, $centered, $extras, $separator) = @_; # content && spacing for pretty printing HTML output (optional) && css class (optional, default = "") && centered table (optional, default = 0) && extra tag options (optional, default = ""), && an ending for after the table (optional, default = "")
1517
if (!$spacing) { $spacing = ""; }
1518
1519
if ($spacing eq 0) { $spacing = ""; }
1520
if ($separator eq 0) { $separator = ""; }
1521
1522
my $output = "<!-- start table(); -->";
1523
$output .= "<table";
1524
if ($extras !~ /border=/) { $output .= " border=$TABLE_BORDER"; }
1525
$output .= " cellpadding=0 cellspacing=0";
1526
if ($class) { $output .= " class=\"$class\""; }
1527
if ($extras =~ s/^tdalign=//)
1528
{ $output .= "><tr><td align=$extras>"; } else
1529
{ $output .= " $extras><tr><td align=left>"; }
1530
1531
$output .= "<!-- table() CONTENT START -->";
1532
$content =~ s/\n$//g;
1533
$output .= $content;
1534
$output .= "<!-- table() CONTENT END -->";
1535
$output .= "</td></tr></table>$separator";
1536
$output .= "<!-- end table(); -->";
1537
1538
return $output; # a table in a scalar
1539
#usage: my $bobsTable = table("Bob's Emporium (PoS v1.0)", "", "bobs_tables", "1", "", "");
1540
}
1541
1542
########################
1543
sub table_wide($;$$$$$) {
1544
#*
1545
# just like table($$$$$), except this is as wide and tall as the browser window*
1546
# *Note: browser window, and not parent container
1547
#*
1548
my ($content, $spacing, $class, $centered, $extras, $separator) = @_; # content && spacing for pretty printing HTML output && css class && centered content && extra html tag options && an end for after the table
1549
if (!$spacing) { $spacing = ""; }
1550
#$extras .= " style=\"width: 100%;\"";
1551
1552
my $output = table_void(trow(tdata($content, "", "", "align=center")), "", "", 0, "style='padding: 0; margin: 0; height: 98vh; width: 100%;'");
1553
1554
return $output; # a table as wide and tall as the browser window in a scalar
1555
#usage: print table_wide($content, $spacing, $class, $centered, $extras, $separator);
1556
}
1557
1558
########################
1559
sub radio($$$$$) {
1560
#*
1561
# creates a radio input
1562
# can be id'd
1563
#*
1564
my ($id, $label, $spacing, $extras, $separator) = @_; # an id && a title && spacing for pretty printing HTML output && extra html tag options && an ending for after the radio
1565
if (!$spacing) { $spacing = ""; }
1566
1567
if ($spacing eq 0) { $spacing = ""; }
1568
if ($separator eq 0) { $separator = ""; }
1569
1570
my $output = "";
1571
1572
{ my %radio;
1573
$radio{tag} = "input";
1574
$radio{type} = "radio";
1575
$radio{id} = $id;
1576
$radio{innerHTML} = $label;
1577
1578
$output .= Html2::tag(\%radio);
1579
}
1580
1581
if ($extras) { $output =~ s/>/ $extras>/; }
1582
1583
return $output; # a radio input in a scalar
1584
#usage: my $radioBtn = radio("jackFM", "Jack FM", "", "name=jackfm", "<br>");
1585
}
1586
1587
########################
1588
sub checkbox($$$$$) {
1589
#*
1590
# creates a checkbox input
1591
# can be id'd
1592
#*
1593
my ($id, $label, $spacing, $extras, $separator) = @_; # an id && a label && spacing for pretty printing HTML output && extra html tag options && an ending for after the checkbox
1594
if (!$spacing) { $spacing = ""; }
1595
1596
if ($spacing eq 0) { $spacing = ""; }
1597
if ($separator eq 0) { $separator = ""; }
1598
my $output = "";
1599
1600
{ my %cb;
1601
$cb{tag} = "input";
1602
$cb{type} = "checkbox";
1603
$cb{id} = $id;
1604
$cb{innerHTML} = $label;
1605
1606
$output .= Html2::tag(\%cb);
1607
}
1608
1609
if ($extras) { $output =~ s/>/ $extras>/; }
1610
1611
return $output; # a checkbox input in a scalar
1612
#usage: my $cb = checkbox("cb", "stay logged in", "", "", "");
1613
}
1614
1615
########################
1616
sub unordered_list($$$$$) {
1617
#*
1618
# creates an unordered list!
1619
#*
1620
my ($lies, $class, $spacing, $extras, $separator) = @_; # list items && css class && spacing for pretty printing HTML output && extra html tag options && an ending
1621
if (!$spacing) { $spacing = ""; }
1622
1623
if ($spacing eq 0) { $spacing = ""; }
1624
if ($separator eq 0) { $separator = ""; }
1625
1626
my $output = "";
1627
1628
{ my %list;
1629
$list{tag} = "ul";
1630
$list{class} = $class;
1631
$list{innerHTML} = $lies;
1632
1633
$output .= Html2::tag(\%list);
1634
}
1635
1636
if ($extras) { $output =~ s/>/ $extras>/; }
1637
1638
return $output; # an unordered list in a scalar
1639
#usage: my $ul = unordered_list("insert your LI's here", "", "", "", "");
1640
}
1641
1642
########################
1643
sub ordered_list($$$$$) {
1644
#*
1645
# you guessed it. creates an ordered list
1646
#*
1647
my ($lies, $class, $spacing, $extras, $separator) = @_; # list items && css class && spacing for pretty printing HTML output && extra html tag options && an ending
1648
if (!$spacing) { $spacing = ""; }
1649
1650
if ($spacing eq 0) { $spacing = ""; }
1651
if ($separator eq 0) { $separator = ""; }
1652
1653
my $output = "";
1654
1655
{ my %list;
1656
$list{tag} = "ol";
1657
$list{class} = $class;
1658
$list{innerHTML} = $lies;
1659
1660
$output .= Html2::tag(\%list);
1661
}
1662
1663
if ($extras) { $output =~ s/>/ $extras>/; }
1664
1665
return $output; # an ordered list in scalar (shocker, right?)
1666
#usage: my $ol = ordered_list("tell your LI's here", "", "", "", "");
1667
}
1668
1669
########################
1670
sub li($$$$) {
1671
#*
1672
# creates a list item (for use in ordered and unordered lists)
1673
#*
1674
my ($lie, $class, $spacing, $extras) = @_; # list item && css class && spacing for pretty printing HTML output && extras
1675
if (!$spacing) { $spacing = ""; }
1676
1677
if ($spacing eq 0) { $spacing = ""; }
1678
1679
my $output = "";
1680
1681
{ my %li;
1682
$li{tag} = "ul";
1683
$li{class} = $class;
1684
$li{innerHTML} = $lie;
1685
1686
$output .= Html2::tag(\%li);
1687
}
1688
1689
if ($extras) { $output =~ s/>/ $extras>/; }
1690
1691
return $output; # a list item in a scalar
1692
#usage: my $listitem = li("an item", "css_li", "", "");
1693
}
1694
1695
########################
1696
sub href($$;$$$$) {
1697
#*
1698
# creates an html anchor (a link)
1699
#*
1700
my ($url, $text, $class, $spacing, $extras, $separator) = @_; # the web address && a label for the link && a css class (optional) && spacing for pretty printing HTML output (optional) && extra html tag options (optional) && a separator (optional)
1701
if (!$spacing) { $spacing = ""; }
1702
1703
if ($spacing eq 0) { $spacing = ""; }
1704
if ($separator eq 0) { $separator = ""; }
1705
1706
if (not $url or not $text) {
1707
return 0; # 0 on failure
1708
}
1709
1710
my $output = "";
1711
1712
{ my %a;
1713
$a{tag} = "a";
1714
$a{href} = $url;
1715
$a{class} = $class;
1716
$a{title} = $url;
1717
$a{innerHTML} = $text;
1718
1719
$output .= Html2::tag(\%a);
1720
}
1721
1722
if ($extras) { $output =~ s/>/ $extras>/; }
1723
1724
return $output; # an HTML anchor in a scalar
1725
#usage: my $link = href("/", "home", "", "", "", "<br>";
1726
}
1727
1728
########################
1729
sub img($;$$$$$) {
1730
#*
1731
# creates a classable IMG tag put "getimage.pl;" at the
1732
# start of $params to have this function insert getimage.pl
1733
# instead of img.pl as the image display script. img reads
1734
# images from files off the hard drive. getimage reads from
1735
# the database
1736
# if ($nothtml2 eq 0), then html2 will get used.
1737
# in this case, $extras will be treated as a hash ref of html attributes
1738
# to be applied to the html img element (see tag subroutine)<br>
1739
#*
1740
my ($params, $class, $spacing, $extras, $separator, $nothtml2) = @_; # a URL to the image && a css class && spacing for pretty printing HTML output && extra html tag options && an ending && toggle use of Html.pm (1) or Html2.pm (0, default)
1741
if (!$spacing) { $spacing = ""; }
1742
1743
my $rv = "";
1744
if (not $nothtml2) {
1745
if (ref $extras ne "HASH") {
1746
my %img;
1747
$extras = \%img;
1748
}
1749
1750
$extras->{tag} = "img";
1751
my $script = "img.pl";
1752
if ($params =~ s/^getimage\.pl;//i) { $script = "getimage.pl"; }
1753
$params =~ s/ /%20/g;
1754
$extras->{src} = Bc_sql::get_constant("IMAGE_SERVER") . "/$script?$params";
1755
1756
$rv = Html2::tag($extras);
1757
} else {
1758
if ($spacing eq 0) { $spacing = ""; }
1759
if ($separator eq 0) { $separator = ""; }
1760
my $script = "img.pl";
1761
if ($params =~ s/^getimage\.pl;//i) { $script = "getimage.pl"; }
1762
1763
{ my %img;
1764
$img{tag} = "img";
1765
$img{src} = Bc_sql::get_constant("IMAGE_SERVER") . "/$script?$params";
1766
if ($class) { $img{class} = $class; }
1767
1768
$rv .= Html2::tag(\%img);
1769
$rv =~ s/>/ $extras>/;
1770
}
1771
}
1772
1773
return $rv; # an img in a scalar
1774
#usage: my $logo = img("i=logo.jpg&s=f", "css_no_borders", "", "", "", 0);
1775
}
1776
########################
1777
1778
1779
########################################################################
1780
########################################################################
1781
########################################################################
1782
1783
1784
########################
1785
sub display_logo(;$) {
1786
#*
1787
# display the website's logo
1788
#*
1789
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
1790
my $output;
1791
1792
my %spacer;
1793
$spacer{tag} = "div";
1794
$spacer{class} = "spacerx";
1795
1796
my %spacer_large;
1797
$spacer_large{tag} = "div";
1798
$spacer_large{class} = "spacerx_large";
1799
1800
{ my %container;
1801
$container{tag} = "div";
1802
$container{class} = "nowrap";
1803
$container{style} = "display: flex; align-items: center;";
1804
$container{innerHTML} = "";
1805
1806
{ my %img;
1807
$img{tag} = "img";
1808
$img{src} = "/img.pl?i=site/logo.png&s=logo";
1809
$img{align} = "absmiddle";
1810
1811
$container{innerHTML} .= Html2::tag(\%img);
1812
$container{innerHTML} .= Html2::tag(\%spacer_large);
1813
}
1814
1815
{ my %name;
1816
$name{tag} = "div";
1817
$name{class} = "title nowrap";
1818
$name{innerHTML} = $Bc_sql::SITE_NAME . " ";
1819
1820
$container{innerHTML} .= Html2::tag(\%name);
1821
}
1822
1823
{ my %tm;
1824
$tm{tag} = "sup";
1825
$tm{innerHTML} = Html2::small({innerHTML=>Html2::embolden("™")});
1826
1827
#$container{innerHTML} .= Html2::tag(\%spacer);
1828
#$container{innerHTML} .= Html2::tag(\%tm);
1829
}
1830
1831
$output = Html2::tag(\%container);
1832
}
1833
1834
return $output; # the logo in a scalar
1835
#usage: my $logo = display_logo();
1836
}
1837
1838
########################
1839
sub display_login(;$) {
1840
#*
1841
# creates a login/out box
1842
#*
1843
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
1844
if (!$spacing) { $spacing = ""; }
1845
my $BORDERS = 0;
1846
my $output = "";
1847
1848
if ($Bc_sql::LOGGEDIN) {
1849
my %userdata = User::get_user_stats($Bc_sql::LOGGEDIN);
1850
my $short_nick = Bc_misc::shorten_str($userdata{'nickname'}, 9);
1851
if ($short_nick ne $userdata{'nickname'}) { $short_nick .= "..."; }
1852
$output .= "<table border=$BORDERS cellpadding=0 cellspacing=0><tr><td class=spacerx>";
1853
$output .= "</td><td>";
1854
$output .= Html2::profile_link({$Bc_sql::QUERY_UID=>$Bc_sql::LOGGEDIN, innerHTML=>User::get_user_dp(0, "logo")});
1855
$output .= "</td><td class=spacerx>";
1856
$output .= "</td><td align=center class=minititle nowrap>";
1857
{ my %link;
1858
$link{tag} = "a";
1859
$link{href} = "/login.pl?out=1";
1860
$link{title} = "Logout of " . $Bc_sql::SITE_NAME;
1861
$link{innerHTML} = "Pull Out";
1862
1863
$output .= Html2::tag(\%link);
1864
}
1865
$output .= "</td><td class=spacerx>";
1866
$output .= "</td></tr></table>";
1867
} # end if $Bc_sql::LOGGEDIN
1868
else {
1869
{ my %form;
1870
$form{tag} = "form";
1871
$form{method} = "post";
1872
$form{action} = "/login.pl";
1873
$form{class} = "login-container";
1874
$form{innerHTML} = "";
1875
1876
{ my %div;
1877
$div{tag} = "div";
1878
$div{class} = "login-name";
1879
1880
{ my %input;
1881
$input{tag} = "input";
1882
$input{name} = Bc_sql::get_constant("QUERY_NICKNAME");
1883
$input{placeholder} = "Nickname";
1884
$input{required} = 1;
1885
$input{autocomplete} = "on";
1886
$input{size} = 12;
1887
$input{title} = "Type your nickname here";
1888
1889
$div{innerHTML} = Html2::tag(\%input);
1890
}
1891
1892
$form{innerHTML} .= Html2::tag(\%div);
1893
} # end nickname div
1894
1895
{ my %div;
1896
$div{tag} = "div";
1897
$div{class} = "login-password";
1898
1899
{ my %input;
1900
$input{tag} = "input";
1901
$input{name} = Bc_sql::get_constant("QUERY_PASSWORD");
1902
$input{type} = "password";
1903
$input{placeholder} = "Password";
1904
$input{required} = 1;
1905
$input{autocomplete} = "on";
1906
$input{size} = 12;
1907
$input{title} = "Type your password here";
1908
1909
$div{innerHTML} = Html2::tag(\%input);
1910
}
1911
1912
$form{innerHTML} .= Html2::tag(\%div);
1913
} # end password div
1914
1915
{ my %div;
1916
$div{tag} = "div";
1917
$div{class} = "login-button";
1918
$div{innerHTML} = "";
1919
1920
{ my %button;
1921
$button{tag} = "button";
1922
$button{type} = "submit";
1923
$button{class} = "green nowrap";
1924
$button{title} = "Click this button to login";
1925
$button{innerHTML} = "Slide it in!";
1926
1927
$div{innerHTML} .= Html2::tag(\%button);
1928
}
1929
1930
{ my %input;
1931
$input{tag} = "input";
1932
$input{type} = "hidden";
1933
$input{name} = $Bc_sql::QUERY_PAGE;
1934
$input{value} = Bc_sql::get_constant("LOGIN_PAGE");
1935
1936
$div{innerHTML} .= Html2::tag(\%input);
1937
}
1938
1939
$form{innerHTML} .= Html2::tag(\%div);
1940
} # end login button div
1941
1942
{ my %div;
1943
$div{tag} = "div";
1944
$div{class} = "login-create";
1945
1946
{ my %link;
1947
$link{tag} = "a";
1948
$link{class} = "small";
1949
$link{href} = "?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("SIGNUP_PAGE");
1950
$link{title} = "Create an Account";
1951
$link{innerHTML} = "Hook Me Up!";
1952
1953
$div{innerHTML} = Html2::tag(\%link);
1954
}
1955
1956
$form{innerHTML} .= Html2::tag(\%div);
1957
}
1958
1959
{ my %div;
1960
$div{tag} = "div";
1961
$div{class} = "login-forgot";
1962
1963
{ my %link;
1964
$link{tag} = "a";
1965
$link{class} = "small";
1966
$link{href} = "?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("FORGOT_PAGE");
1967
$link{title} = "Reset Your Password";
1968
$link{innerHTML} = "Forgot Protection";
1969
1970
$div{innerHTML} = Html2::tag(\%link);
1971
}
1972
1973
$form{innerHTML} .= Html2::tag(\%div);
1974
}
1975
1976
{ my %div;
1977
$div{tag} = "div";
1978
$div{class} = "login-stayin";
1979
$div{innerHTML} = "<table border=$BORDERS cellpadding=0 cellspacing=0><tr><td>";
1980
1981
{ my %input;
1982
$input{tag} = "input";
1983
$input{type} = "checkbox";
1984
$input{class} = "small margins-none";
1985
$input{id} = "stayin";
1986
$input{name} = Bc_sql::get_constant("QUERY_PERSISTENT");
1987
$input{title} = "Stay Logged In";
1988
1989
$div{innerHTML} .= Html2::tag(\%input);
1990
}
1991
1992
$div{innerHTML} .= "</td><td>";
1993
1994
{ my %label;
1995
$label{tag} = "label";
1996
$label{class} = "small margins-none";
1997
$label{for} = "stayin";
1998
$label{title} = "Stay Logged In";
1999
$label{innerHTML} = " Stay In";
2000
2001
$div{innerHTML} .= Html2::tag(\%label);
2002
}
2003
2004
$div{innerHTML} .= "</td></tr></table>";
2005
$form{innerHTML} .= Html2::tag(\%div);
2006
}
2007
2008
$output .= Html2::tag(\%form);
2009
} # end form
2010
} # end else of if $Bc_sql::LOGGEDIN
2011
2012
return $output; # a scalar
2013
#usage: my $login = display_login();
2014
}
2015
2016
########################
2017
sub display_titlebar(;$) {
2018
#*
2019
# creates a titlebar
2020
# executed after header(...)
2021
#*
2022
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
2023
if (!$spacing) { $spacing = ""; }
2024
2025
my $output = "<!-- BEGIN TITLEBAR -------------------------------------------->";
2026
2027
{ my %subnav;
2028
$subnav{tag} = "div";
2029
$subnav{class} = "subnavbar";
2030
$subnav{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td width=1 align=left valign=top>";
2031
2032
{ my %home;
2033
$home{tag} = "a";
2034
$home{href} = "/";
2035
$home{title} = $Bc_sql::SITE_NAME . " Home";
2036
2037
$home{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
2038
$home{innerHTML} .= img("i=" . Bc_sql::get_constant("IMAGE_LOGO") . "&s=logo", "", "", "", "", 1);
2039
$home{innerHTML} .= "</td><td width=5> </td><td style='white-space: nowrap;' width=1>";
2040
{ my %sitename;
2041
$sitename{tag} = "div";
2042
$sitename{class} = "title";
2043
$sitename{innerHTML} = $Bc_sql::SITE_NAME . " ";
2044
2045
$home{innerHTML} .= Html2::tag(\%sitename);
2046
}
2047
$home{innerHTML} .= "</td></tr></table>";
2048
2049
$subnav{innerHTML} .= Html2::tag(\%home);
2050
}
2051
2052
$subnav{innerHTML} .= "</td><td align=center valign=center>";
2053
{ my %msg;
2054
$msg{tag} = "div";
2055
$msg{id} = "MSGS";
2056
2057
my $e = cookie_get('e');
2058
my $n = cookie_get('n');
2059
if ($e) {
2060
$msg{class} = "error";
2061
$msg{innerHTML} = $e;
2062
} elsif ($n) {
2063
$msg{class} = "notice";
2064
$msg{innerHTML} = $n;
2065
}
2066
2067
$subnav{innerHTML} .= Html2::tag(\%msg);
2068
}
2069
$subnav{innerHTML} .= "</td><td align=right valign=top width=1>";
2070
2071
if ($Bc_sql::LOGGEDIN) {
2072
my $helpLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("HELP_PAGE"), img("i=help.png&s=i", "", "", "", "", 1), "", "", "title=\"Help\"", "");
2073
2074
my %userdata = User::get_user_stats($Bc_sql::LOGGEDIN);
2075
my $short_nick = Bc_misc::shorten_str($userdata{'nickname'}, 9);
2076
if ($short_nick ne $userdata{'nickname'}) { $short_nick .= "..."; }
2077
$subnav{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td valign=top style=\"white-space: nowrap;\">";
2078
{ my %link;
2079
$link{innerHTML} = "";
2080
2081
{ my %linkdiv;
2082
$linkdiv{tag} = "div";
2083
$linkdiv{id} = "display_picture";
2084
$linkdiv{class} = "inline";
2085
$linkdiv{innerHTML} = get_user_pic($Bc_sql::LOGGEDIN, "i");
2086
2087
$link{innerHTML} .= Html2::tag(\%linkdiv);
2088
}
2089
2090
$subnav{innerHTML} .= Html2::profile_link(\%link) . $helpLink;
2091
}
2092
2093
$subnav{innerHTML} .= "</td><td class=spacerx> </td><td valign=center>";
2094
{ my %logout;
2095
$logout{tag} = "a";
2096
$logout{href} = "/login.pl?out=1";
2097
$logout{title} = "Logout";
2098
$logout{innerHTML} = "Pull Out";
2099
2100
$subnav{innerHTML} .= Html2::tag(\%logout);
2101
}
2102
$subnav{innerHTML} .= "</td></tr></table>";
2103
} else {
2104
{ my %form;
2105
$form{tag} = "form";
2106
$form{method} = "post";
2107
$form{action} = "/login.pl";
2108
$form{innerHTML} = "";
2109
2110
$form{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td align=center>";
2111
{ my %page;
2112
$page{tag} = "input";
2113
$page{type} = "hidden";
2114
$page{name} = $Bc_sql::QUERY_PAGE;
2115
$page{value} = Bc_sql::get_constant("LOGIN_PAGE");
2116
2117
$form{innerHTML} .= Html2::tag(\%page);
2118
}
2119
$form{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
2120
{ my %nick;
2121
$nick{tag} = "input";
2122
$nick{type} = "text";
2123
$nick{placeholder} = "billy-joe-bob";
2124
$nick{size} = 9;
2125
$nick{name} = Bc_sql::get_constant("QUERY_NICKNAME");
2126
$nick{style} = "text-transform: lowercase;";
2127
$nick{autocomplete} = Bc_sql::get_constant("QUERY_NICKNAME");
2128
2129
$form{innerHTML} .= Html2::tag(\%nick);
2130
} # end nickname input
2131
2132
$form{innerHTML} .= "</td><td>";
2133
2134
{ my %pass;
2135
$pass{tag} = "input";
2136
$pass{type} = "password";
2137
$pass{placeholder} = "p\!a\$sw\@ord123";
2138
$pass{size} = 9;
2139
$pass{name} = Bc_sql::get_constant("QUERY_PASSWORD");
2140
$pass{autocomplete} = Bc_sql::get_constant("QUERY_PASSWORD");
2141
2142
$form{innerHTML} .= Html2::tag(\%pass);
2143
} # end password input
2144
2145
$form{innerHTML} .= "</td></tr><tr><td valign=top align=left>";
2146
{ my %forgot;
2147
$forgot{tag} = "a";
2148
$forgot{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("FORGOT_PAGE");
2149
$forgot{title} = "Reset Password";
2150
$forgot{innerHTML} = Html2::Html2::small("Forgot Protection");
2151
2152
$form{innerHTML} .= Html2::tag(\%forgot);
2153
} # end forgot password link
2154
2155
$form{innerHTML} .= "</td><td valign=top align=right>";
2156
{ my %signup;
2157
$signup{tag} = "a";
2158
$signup{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("SIGNUP_PAGE");
2159
$signup{innerHTML} = Html2::small("Sign Up");
2160
2161
$form{innerHTML} .= Html2::tag(\%signup);
2162
} # end sign up link
2163
$form{innerHTML} .= "</td></tr></table>";
2164
$form{innerHTML} .= "</td><td align=right>";
2165
$form{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td colspan=2>";
2166
{ my %submit;
2167
$submit{tag} = "button";
2168
$submit{type} = "submit";
2169
$submit{class} = "green";
2170
$submit{innerHTML} = "Slide it in!";
2171
2172
$form{innerHTML} .= Html2::tag(\%submit);
2173
}
2174
2175
$form{innerHTML} .= "</td></tr><tr><td valign=top align=right>";
2176
2177
{ my %stayin;
2178
$stayin{tag} = "input";
2179
$stayin{type} = "checkbox";
2180
$stayin{name} = Bc_sql::get_constant("QUERY_PERSISTENT");
2181
$stayin{checked} = 1;
2182
$stayin{id} = "login_CB";
2183
$stayin{value} = "on";
2184
2185
$form{innerHTML} .= Html2::tag(\%stayin);
2186
} # end stayin checkbox
2187
2188
$form{innerHTML} .= "</td><td style='white-space: nowrap;' width=1>";
2189
2190
{ my %staylabel;
2191
$staylabel{tag} = "label";
2192
$staylabel{for} = "login_CB";
2193
$staylabel{innerHTML} = Html2::small(" Stay In ");
2194
2195
$form{innerHTML} .= Html2::tag(\%staylabel);
2196
} # end stayin label
2197
2198
$form{innerHTML} .= "</td></tr></table>";
2199
$form{innerHTML} .= "</td></tr></table>";
2200
2201
$subnav{innerHTML} .= Html2::tag(\%form);
2202
} # end form
2203
}
2204
$subnav{innerHTML} .= "</td></tr></table>";
2205
2206
$output .= Html2::tag(\%subnav);
2207
} # end of subnav
2208
$output .= Html2::small(Html2::br());
2209
my $numUsers = Bc_sql::get_users(User::isUserAdmin($Bc_sql::LOGGEDIN));
2210
$output .= "Server date is " . Html2::embolden(Date::get_today("", "")) . " and we have " . Html2::embolden($numUsers) . " profiles!";
2211
if (User::isUserAdmin($Bc_sql::LOGGEDIN)) {
2212
my %sup;
2213
$sup{tag} = "sup";
2214
$sup{innerHTML} = " (includes admins)";
2215
2216
$output .= Html2::tag(\%sup);
2217
}
2218
$output .= Html2::br();
2219
if (not $Bc_sql::LOGGEDIN or not User::isUserSubscriber($Bc_sql::LOGGEDIN)) { $output .= Html2::small(Html2::br()) . get_adbanner(""); }
2220
$output .= Html2::small(Html2::br());
2221
$output .= display_navbar("");
2222
$output .= "<!-- END TITLEBAR -------------------------------------------->";
2223
2224
return $output; # the title bar in a scalar
2225
#usage: print display_titlebar("");
2226
}
2227
2228
########################
2229
sub display_navbar(;$$) {
2230
#*
2231
# returns the top navbar HTML which contains
2232
# the menu button, and search bar
2233
# you can optionally exclude the search bar by
2234
# assigning 1 to $no_search
2235
#*
2236
my ($spacing, $no_search) = @_; # spacing for pretty printing HTML output (optional) && exclude search (optional, default = 0)
2237
if (!$spacing) { $spacing = ""; }
2238
2239
if (not $Bc_sql::LOGGEDIN) {
2240
return 0; # 0 when no user is logged in
2241
}
2242
2243
if ($spacing eq 0) { $spacing = ""; }
2244
my %ustats = User::get_user_stats($Bc_sql::LOGGEDIN);
2245
my $qp = $Bc_sql::QUERY_PAGE;
2246
my $p = Bc_misc::get_param($qp);
2247
if (not $p) { $p = Bc_sql::get_constant("HOME_PAGE"); }
2248
2249
my $numFriendRequests = User::get_user_friend_requests($Bc_sql::LOGGEDIN);
2250
my $numBlocked = User::get_user_blocked_users($Bc_sql::LOGGEDIN);
2251
my $msgs = User::get_user_unread_messages($Bc_sql::LOGGEDIN);
2252
my $numMsgs = 0;
2253
if (ref $msgs eq "HASH") {
2254
$numMsgs = 1;
2255
} else {
2256
if (ref $msgs eq "ARRAY") { $numMsgs = @$msgs; }
2257
}
2258
2259
# icons
2260
my $subscribeimage = img("s=i&i=" . Bc_sql::get_constant("IMAGE_SUBSCRIBE_ICON"), "navbar", "", "width=16 title='Get Premium Membership'", "", 1);
2261
2262
my $mailboximage; {
2263
my %img;
2264
$img{tag} = "div";
2265
$img{id} = "mailbox_icon";
2266
$img{class} = "inline";
2267
2268
if ($numMsgs > 0)
2269
{ $img{innerHTML} = img("s=i&i=" . Bc_sql::get_constant("IMAGE_MAILBOX_ICON") . "&wm=$numMsgs", "navbar", "", "onload=\"setTimeout(update_mailbox_icon, 2500);\" id=mailbox_image width=16 title='Fuck Buddies'", "", 1); } else
2270
{ $img{innerHTML} = img("s=i&i=" . Bc_sql::get_constant("IMAGE_MAILBOX_ICON"), "navbar", "", "onload=\"setTimeout(update_mailbox_icon, 2500);\" id=mailbox_image width=16 title='Mailbox'", "", 1); }
2271
2272
$mailboximage = Html2::tag(\%img);
2273
} # end mailbox image
2274
2275
my $friendsimage; {
2276
my %friends;
2277
$friends{tag} = "div";
2278
$friends{id} = "friends_icon";
2279
$friends{class} = "inline";
2280
$friends{innerHTML} = img("s=i&i=" . Bc_sql::get_constant("IMAGE_FRIENDS_ICON") . "&wm=$numFriendRequests", "navbar", "", "onload=\"setTimeout(update_friend_icon, 2500);\" id=friend_image width=16 title='Fuck Buddies'", "", 1);
2281
2282
$friendsimage = Html2::tag(\%friends);
2283
} # end friends image
2284
2285
my $blockedimage; {
2286
my %blocked;
2287
$blocked{tag} = "div";
2288
$blocked{id} = "blocked_icon";
2289
$blocked{class} = "inline";
2290
$blocked{innerHTML} = img("s=i&i=" . Bc_sql::get_constant("IMAGE_BLOCKS_ICON") . "&wm=$numBlocked", "navbar", "", "onload=\"\" id=blocked_image width=16 title='Cock Blocks'", "", 1);
2291
2292
$blockedimage = Html2::tag(\%blocked);
2293
}
2294
my $photosimage = img("s=i&i=" . Bc_sql::get_constant("IMAGE_PICS_ICON"), "navbar", "", "width=16 title='Photos'", "", 1);
2295
my $settingsimage = img("s=i&i=" . Bc_sql::get_constant("IMAGE_SETTINGS_ICON"), "navbar", "", "width=16 title='Settings'", "", 1);
2296
my $adminimage = img("s=i&i=" . Bc_sql::get_constant("IMAGE_ADMIN_ICON"), "", "", "width=16 title='Admin'", "", 1);
2297
my $modimage = img("s=i&i=" . Bc_sql::get_constant("IMAGE_MODERATOR_ICON"), "", "", "width=16 title='Moderator Pages'", "", 1);
2298
my $debugimage = img("s=i&i=" . Bc_sql::get_constant("IMAGE_DEBUG_ICON"), "", "", "width=16 title='DeBugger v2.0'", "", 1);
2299
my $storeimage = img("s=i&i=" . Bc_sql::get_constant("IMAGE_STORE_ICON"), "", "", "width=16 title='Theme Shop'", "", 1);
2300
my $browseimage = img("s=i&i=" . Bc_sql::get_constant("IMAGE_BROWSE_ICON"), "", "", "width=16 title='Browse Members'", "", 1);
2301
my $profileimage = img("s=i&i=" . Bc_sql::get_constant("IMAGE_PROFILE_ICON"), "", "", "width=16 title='My Profile'", "", 1);
2302
my $specialimage = img("s=i&i=site/admin/lock_locked.png", "", "", "width=16 title='Special Access'", "", 1);
2303
2304
my $themeDataRef = Bc_sql::get_theme_data($ustats{TID});
2305
my %theme;
2306
if (ref $themeDataRef eq "HASH") { %theme = %$themeDataRef; }
2307
my $body_color = $theme{body_clr};
2308
my $border_color = "#" . $theme{borders_clr};
2309
2310
# links
2311
my $mailLink_title = "title=\"Mailbox";
2312
if ($numMsgs > 0) { $mailLink_title .= " ($numMsgs unread)\""; } else { $mailLink_title .= " is empty!\""; }
2313
2314
my $mailLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE"),
2315
$mailboximage . " Private Messages",
2316
"",
2317
"",
2318
"$mailLink_title id=mailbox_icon_link",
2319
"");
2320
2321
my $friendsLink_title = "title=\"Fuck Buddies";
2322
if ($numFriendRequests > 0) {
2323
$friendsLink_title .= " ($numFriendRequests request";
2324
if ($numFriendRequests ne 1) { $friendsLink_title .= "s"; }
2325
$friendsLink_title .= ")\"";
2326
} else {
2327
$friendsLink_title .= "\"";
2328
}
2329
my $friendsLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("FRIENDS_PAGE"),
2330
$friendsimage . " Fuck Buddies",
2331
"",
2332
"",
2333
"$friendsLink_title id=friends_icon_link",
2334
"");
2335
2336
my $blockedLink_title = "title=\"Blocked Users";
2337
if ($numBlocked > 0) {
2338
$blockedLink_title .= " ($numBlocked user";
2339
if ($numBlocked ne 1) { $blockedLink_title .= "s"; }
2340
$blockedLink_title .= ")\"";
2341
} else {
2342
$blockedLink_title .= "\"";
2343
}
2344
2345
my $blockedLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("BLOCKED_PAGE"),
2346
$blockedimage . " Cock Blocks",
2347
"",
2348
"",
2349
$blockedLink_title . " id=blocked_icon_link",
2350
"");
2351
my $photosLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("PHOTOS_PAGE"),
2352
$photosimage . " My Photos",
2353
"",
2354
"",
2355
"",
2356
"");
2357
my $settingsLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("STATS_PAGE"),
2358
$settingsimage . " Account Settings",
2359
"",
2360
"",
2361
"",
2362
"");
2363
my $subscribeLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("PAY_PAGE"),
2364
$subscribeimage . " Subscribe",
2365
"",
2366
"",
2367
"",
2368
"");
2369
2370
my $storeLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("STORE_PAGE"),
2371
$storeimage . " Theme Store",
2372
"",
2373
"",
2374
"",
2375
"");
2376
2377
my $browseLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("BROWSE_PAGE"),
2378
$browseimage . " Browse Members",
2379
"",
2380
"",
2381
"",
2382
"");
2383
2384
my $profileLink = Html2::profile_link({$Bc_sql::QUERY_UID=>$Bc_sql::LOGGEDIN, innerHTML=>User::get_user_dp("", "s") . " Your Profile"});
2385
2386
my $adminLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE"), $adminimage . " Administration", "", "", "title=\"Site Administration\"", "");
2387
my $modLink = href("/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MOD_PAGE"), $modimage . " Moderation", "", "", "title=\"Site Moderation\"", "");
2388
my $specialLink = href(Bc_sql::get_constant("SPECIAL_DB_URL"), $specialimage . " Special Access", "", "", "title=\"Special Access\"", "");
2389
2390
my $debugLink = href("/debug.pl", $debugimage . " Debug", "", "", "title=\"DeBugger v1.0\" target=_blank", "");
2391
2392
my $output = "<!-- BEGIN NAVBAR ------------------------------------------>";
2393
my $table_content = "";
2394
if ($Bc_sql::LOGGEDIN) {
2395
{ my %menu;
2396
$menu{tag} = "div";
2397
$menu{class} = "dropdown";
2398
$menu{innerHTML} = "";
2399
2400
{ my %button;
2401
$button{tag} = "button";
2402
$button{type} = "button";
2403
$button{class} = "dropbtn green margins-none";
2404
$button{style} = "min-height: 25px;";
2405
$button{id} = "dropdownbutton";
2406
$button{onclick} = "menu();";
2407
$button{innerHTML} = "=";
2408
2409
$menu{innerHTML} .= Html2::tag(\%button);
2410
} # end menu button
2411
2412
{ my %ddcontent;
2413
$ddcontent{tag} = "div";
2414
$ddcontent{id} = "myDropdown";
2415
$ddcontent{class} = "dropdown-content";
2416
$ddcontent{innerHTML} = "";
2417
2418
if (User::isUserAdmin()) {
2419
{ my %home;
2420
$home{tag} = "a";
2421
$home{href} = "/";
2422
$home{title} = "Night Stand Administration Home";
2423
2424
{ my %img;
2425
$img{tag} = "img";
2426
$img{src} = "/images/site/sec_admin.png";
2427
$img{width} = 16;
2428
2429
$home{innerHTML} = Html2::tag(\%img) . " Home";
2430
}
2431
2432
$ddcontent{innerHTML} .= Html2::tag(\%home);
2433
}
2434
2435
{ my %uhome;
2436
$uhome{tag} = "a";
2437
$uhome{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("HOME_PAGE");
2438
$uhome{title} = "Night Stand User Home";
2439
2440
{ my %img;
2441
$img{tag} = "img";
2442
$img{src} = "/images/site/logo.png";
2443
$img{width} = 16;
2444
2445
$uhome{innerHTML} = Html2::tag(\%img) . " User Home";
2446
}
2447
2448
$ddcontent{innerHTML} .= Html2::tag(\%uhome);
2449
}
2450
} else {
2451
{ my %home;
2452
$home{tag} = "a";
2453
$home{href} = "/";
2454
$home{title} = "Night Stand Home";
2455
2456
{ my %img;
2457
$img{tag} = "img";
2458
$img{src} = "/images/site/logo.png";
2459
$img{width} = 16;
2460
2461
$home{innerHTML} = Html2::tag(\%img) . " Home";
2462
}
2463
2464
$ddcontent{innerHTML} .= Html2::tag(\%home);
2465
}
2466
}
2467
$ddcontent{innerHTML} .= $profileLink;
2468
$ddcontent{innerHTML} .= Html2::hr();
2469
$ddcontent{innerHTML} .= $storeLink;
2470
$ddcontent{innerHTML} .= $browseLink;
2471
$ddcontent{innerHTML} .= Html2::hr();
2472
if (User::isUserSubscriber($Bc_sql::LOGGEDIN)) {
2473
$ddcontent{innerHTML} .= $mailLink;
2474
$ddcontent{innerHTML} .= $friendsLink;
2475
$ddcontent{innerHTML} .= $blockedLink;
2476
$ddcontent{innerHTML} .= $photosLink;
2477
} else {
2478
$ddcontent{innerHTML} .= $subscribeLink;
2479
}
2480
$ddcontent{innerHTML} .= Html2::hr();
2481
$ddcontent{innerHTML} .= $settingsLink;
2482
2483
if (User::isUserModerator($Bc_sql::LOGGEDIN)) {
2484
$ddcontent{innerHTML} .= Html2::hr();
2485
$ddcontent{innerHTML} .= $modLink;
2486
if (User::isUserAdmin($Bc_sql::LOGGEDIN)) {
2487
$ddcontent{innerHTML} .= Html2::hr();
2488
$ddcontent{innerHTML} .= $adminLink;
2489
}
2490
}
2491
2492
my $specialsql = "select * from special_db where uid=" . $Bc_sql::DB->quote($Bc_sql::LOGGEDIN);
2493
my $specialresult = Bc_sql::sql_execute($specialsql, "");
2494
if (ref $specialresult eq "HASH") {
2495
$ddcontent{innerHTML} .= Html2::hr();
2496
$ddcontent{innerHTML} .= $specialLink;
2497
}
2498
2499
if (Bc_sql::is_debuggerAllowed($Bc_sql::LOGGEDIN)) { $ddcontent{innerHTML} .= $debugLink; }
2500
2501
$menu{innerHTML} .= Html2::tag(\%ddcontent);
2502
} # end dd div
2503
2504
$table_content .= Html2::tag(\%menu);
2505
} # end of menu div
2506
2507
if (not $no_search) {
2508
$table_content .= "</td><td align=right>";
2509
$table_content .= display_searchbar();
2510
}
2511
} else { # .. if $ustats{subscriber} ne "no"
2512
if ($DEBUGGER) { $table_content .= "no stats for " . $Bc_sql::LOGGEDIN; }
2513
} # end if ustats[paid] or not
2514
2515
$output .= table($table_content, "", "nowrap", "", "width=100% border=$TABLE_BORDER", "");
2516
$output .= "<!-- END NAVBAR ------------------------------------------>";
2517
2518
return $output; # the navbar in a scalar
2519
#usage: print display_navbar("");
2520
}
2521
2522
########################
2523
sub display_terms_page(;$) {
2524
#*
2525
# displays the terms and conditions page
2526
# !incomplete
2527
#*
2528
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
2529
if (!$spacing) { $spacing = ""; }
2530
my $output = "";
2531
2532
if ($spacing eq 0) { $spacing = ""; }
2533
2534
my $sql = "select value from misc where name='terms'";
2535
my $result = Bc_sql::sql_execute($sql, "display terms page");
2536
if (ref $result eq "HASH") {
2537
$output = $result->{value};
2538
} else {
2539
$output = "terms not found!" . Html2::br();
2540
}
2541
2542
return $output; # the terms page in a scalar
2543
#usage: print display_terms_page("");
2544
}
2545
2546
########################
2547
sub display_legals_page(;$) {
2548
#*
2549
# displays the legal pages page
2550
#*
2551
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
2552
if (!$spacing) { $spacing = ""; }
2553
2554
my $output = "";
2555
2556
if ($spacing eq 0) { $spacing = ""; }
2557
2558
my $sql = "select value from misc where name='legals'";
2559
my $result = Bc_sql::sql_execute($sql, "Html::display_legals_page()");
2560
if (ref $result eq "HASH") {
2561
$output .= $result->{value};
2562
} else {
2563
$output .= "legals page not found!" . Html2::br();
2564
}
2565
2566
return $output; # the legals page in a scalar
2567
#usage: print display_legals_page("");
2568
}
2569
2570
########################
2571
sub display_refunds_page(;$) {
2572
#*
2573
# displays the refunds pages page
2574
# !incomplete
2575
#*
2576
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
2577
if (!$spacing) { $spacing = ""; }
2578
2579
my $output = "";
2580
2581
if ($spacing eq 0) { $spacing = ""; }
2582
2583
my $sql = "select value from misc where name='refunds'";
2584
my $result = Bc_sql::sql_execute($sql, "display refunds page");
2585
if (ref $result eq "HASH") {
2586
$output = $result->{value};
2587
} else {
2588
$output = "refunds page not found!" . Html2::br();
2589
}
2590
2591
return $output; # the refunds page in a scalar
2592
#usage: print display_refunds_page("");
2593
}
2594
2595
########################
2596
sub display_privacy_page(;$) {
2597
#*
2598
# displays the privacy page page
2599
# !incomplete
2600
#*
2601
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
2602
if (!$spacing) { $spacing = ""; }
2603
2604
my $output = "";
2605
2606
if ($spacing eq 0) { $spacing = ""; }
2607
2608
my $sql = "select value from misc where name='privacy'";
2609
my $result = Bc_sql::sql_execute($sql, "display privacy page");
2610
if (ref $result eq "HASH") {
2611
$output = $result->{value};
2612
} else {
2613
$output = "privacy page not found!" . Html2::br();
2614
}
2615
2616
return $output; # the privacy page in a scalar
2617
#usage: print display_privacy_page("");
2618
}
2619
2620
########################
2621
sub display_data_policy_page(;$) {
2622
#*
2623
# displays the data policy page
2624
# !incomplete
2625
#*
2626
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
2627
if (!$spacing) { $spacing = ""; }
2628
2629
my $output = "";
2630
2631
if ($spacing eq 0) { $spacing = ""; }
2632
2633
my $sql = "select value from misc where name='data_policy'";
2634
my $result = Bc_sql::sql_execute($sql, "display data policy page");
2635
if (ref $result eq "HASH") {
2636
$output = $result->{value};
2637
} else {
2638
$output = "data policy not found!" . Html2::br();
2639
}
2640
2641
return $output; # the data policy page in a scalar
2642
#usage: print display_data_policy_page("");
2643
}
2644
2645
########################
2646
sub display_contact_page(;$) {
2647
#*
2648
# displays the contact us page
2649
#*
2650
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
2651
if (!$spacing) { $spacing = ""; }
2652
if ($spacing eq 0) { $spacing = ""; }
2653
my $output = "";
2654
2655
{ my %div;
2656
$div{tag} = "div";
2657
$div{class} = "translucent";
2658
$div{innerHTML} = "Nothing's worse than needing to contact someone from a website." . Html2::br() .
2659
"I'll do my best to provide ways to make contact with $Bc_sql::SITE_NAME in a trustworthy" . Html2::br() .
2660
"manner. Below is an email form. Fill it out, hit the green button. The message" . Html2::br() .
2661
"will go directly to the super administrator." . Html2::br();
2662
2663
$output .= Html2::tag(\%div) . Html2::br();
2664
}
2665
2666
{ my %form;
2667
$form{tag} = "form";
2668
$form{action} = "makecontact.pl";
2669
$form{method} = "post";
2670
$form{class} = "subnavbar padded block text-align-left";
2671
$form{innerHTML} = "";
2672
2673
$form{innerHTML} .= "<table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td class=dynamic_blend>";
2674
$form{innerHTML} .= "Subject:" . Html2::br();
2675
$form{innerHTML} .= "</td></tr><tr><td align=center>";
2676
{ my %input;
2677
$input{tag} = "input";
2678
$input{name} = "subj";
2679
$input{style} = "width: 100%;";
2680
$input{required} = 1;
2681
2682
$form{innerHTML} .= Html2::tag(\%input) . Html2::br();
2683
}
2684
$form{innerHTML} .= "</td></tr><tr><td class=dynamic_blend>";
2685
$form{innerHTML} .= "Message:" . Html2::br();
2686
$form{innerHTML} .= "</td></tr><tr><td align=center>";
2687
{ my %ta;
2688
$ta{tag} = "textarea";
2689
$ta{name} = "msg";
2690
$ta{style} = "width: 100%;";
2691
$ta{rows} = 10;
2692
$ta{required} = 1;
2693
2694
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
2695
}
2696
$form{innerHTML} .= "</td></tr><tr><td align=center>";
2697
{ my %button;
2698
$button{tag} = "button";
2699
$button{class} = "save";
2700
$button{type} = "submit";
2701
$button{innerHTML} = "Submit";
2702
2703
$form{innerHTML} .= Html2::tag(\%button);
2704
}
2705
$form{innerHTML} .= "</td></tr></table>";
2706
2707
$output .= Html2::tag(\%form) . Html2::br();
2708
}
2709
2710
{ my %div;
2711
$div{tag} = "div";
2712
$div{class} = "translucent padded";
2713
$div{innerHTML} = "Alternatively, you can send an email directly to " . Html2::br();
2714
{ my %link;
2715
$link{tag} = "a";
2716
$link{href} = "mailto:admin\@night-stand.ca";
2717
$link{title} = "Send an email to admin\@night-stand.ca";
2718
$link{innerHTML} = "admin\@night-stand.ca";
2719
2720
$div{innerHTML} .= Html2::tag(\%link) . Html2::br();
2721
}
2722
$div{innerHTML} .= Html2::br();
2723
$div{innerHTML} .= "Or you may write to us:" . Html2::br();
2724
2725
{ my %addy;
2726
$addy{tag} = "div";
2727
$addy{class} = "subnavbar padded";
2728
$addy{style} = "width: min-content; white-space: nowrap; text-align: left;";
2729
$addy{innerHTML} = $Bc_sql::SITE_NAME . Html2::br();
2730
$addy{innerHTML} .= "12170 102 Avenue" . Html2::br();
2731
$addy{innerHTML} .= "Surrey, BC, Canada, V3V 6N8";
2732
2733
$div{innerHTML} .= Html2::tag(\%addy);
2734
}
2735
2736
$div{innerHTML} .= Html2::br() . Html2::br();
2737
2738
{ my %support;
2739
$support{tag} = "div";
2740
$support{class} = "yellow-panel";
2741
$support{innerHTML} = "Customer Service: " . Html2::embolden("(778) 552-2812");
2742
2743
$div{innerHTML} .= Html2::tag(\%support);
2744
}
2745
2746
$output .= Html2::tag(\%div);
2747
}
2748
2749
return $output; # the contact us page in a scalar
2750
#usage: print display_contact_page("");
2751
}
2752
2753
########################
2754
sub display_close_account_page(;$) {
2755
#*
2756
# displays the close account page
2757
#*
2758
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
2759
if (!$spacing) { $spacing = ""; }
2760
if ($spacing eq 0) { $spacing = ""; }
2761
2762
my $output;
2763
2764
{ my %form;
2765
$form{tag} = "form";
2766
$form{method} = "post";
2767
$form{action} = "/close_account.pl";
2768
$form{innerHTML} = "";
2769
2770
{ my %hidden;
2771
$hidden{tag} = "input";
2772
$hidden{type} = "hidden";
2773
$hidden{name} = "r";
2774
$hidden{value} = 1;
2775
2776
$form{innerHTML} .= Html2::tag(\%hidden);
2777
}
2778
2779
{ my %subject;
2780
$subject{tag} = "input";
2781
$subject{type} = "checkbox";
2782
$subject{required} = 1;
2783
$subject{label} = "Yes, close my account!";
2784
2785
$form{innerHTML} .= Html2::tag(\%subject);
2786
}
2787
2788
{ my %submit;
2789
$submit{tag} = "button";
2790
$submit{class} = "green";
2791
$submit{type} = "submit";
2792
$submit{innerHTML} = "Submit";
2793
2794
$form{innerHTML} .= Html2::tag(\%submit);
2795
}
2796
2797
{ my %cancel;
2798
$cancel{tag} = "button";
2799
$cancel{type} = "button";
2800
$cancel{class} = "red";
2801
$cancel{onclick} = "previous_page();";
2802
$cancel{innerHTML} = "Cancel";
2803
2804
$form{innerHTML} .= Html2::tag(\%cancel);
2805
}
2806
2807
$output = Html2::tag(\%form);
2808
}
2809
2810
return $output; # the close account page a scalar
2811
#usage: print display_close_account_page("");
2812
}
2813
2814
########################
2815
sub display_change_email_page(;$) {
2816
#*
2817
# displays the change email page
2818
# !incomplete
2819
#*
2820
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
2821
if (!$spacing) { $spacing = ""; }
2822
if ($spacing eq 0) { $spacing = ""; }
2823
2824
my $output;
2825
2826
{ my %form;
2827
$form{tag} = "form";
2828
$form{method} = "post";
2829
$form{action} = "/change_email.pl";
2830
$form{innerHTML} = "";
2831
2832
{ my %desc;
2833
$desc{tag} = "div";
2834
$desc{innerHTML} = "Type the new email address below, and click the green button." . Html2::br() .
2835
"Click the link provided in the email and that's it.";
2836
2837
$form{innerHTML} .= Html2::tag(\%desc);
2838
} # end desc
2839
2840
{ my %email;
2841
$email{tag} = "input";
2842
$email{type} = "email";
2843
$email{name} = "e";
2844
$email{placeholder} = "email\@address.com";
2845
$email{size} = 50;
2846
2847
$form{innerHTML} .= Html2::tag(\%email);
2848
} # end email
2849
2850
{ my %cancel;
2851
$cancel{tag} = "button";
2852
$cancel{type} = "button";
2853
$cancel{class} = "red";
2854
$cancel{onclick} = "previous_page();";
2855
$cancel{innerHTML} = "Cancel";
2856
2857
$form{innerHTML} .= Html2::tag(\%cancel);
2858
} # end cancel
2859
2860
{ my %submit;
2861
$submit{tag} = "button";
2862
$submit{type} = "submit";
2863
$submit{class} = "green";
2864
$submit{innerHTML} = "Ok, let's begin!";
2865
2866
$form{innerHTML} .= Html2::tag(\%submit);
2867
} # end submit
2868
2869
$output = Html2::tag(\%form);
2870
} # end form
2871
2872
return $output; # the change email page in a scalar
2873
#usage: print display_change_email_page("");
2874
}
2875
2876
########################
2877
sub display_searchbar(;$) {
2878
#*
2879
# creates a searchbar (for use in the navbar subroutine)
2880
#*
2881
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
2882
if (!$spacing) { $spacing = ""; }
2883
2884
my $userCountry;
2885
my $userCity;
2886
my %USERSTATS;
2887
2888
if (not $Bc_sql::LOGGEDIN) {
2889
$userCountry = 1;
2890
$userCity = 1;
2891
} else {
2892
$userCountry = User::get_user_stat($Bc_sql::LOGGEDIN, "location", "country");
2893
$userCity = User::get_user_stat($Bc_sql::LOGGEDIN, "location", "city");
2894
%USERSTATS = User::get_user_stats($Bc_sql::LOGGEDIN); #%$Bc_sql::USER_DATA;
2895
}
2896
2897
$userCountry =~ s/\.(.)*//;
2898
2899
my $y = User::get_user_stat($Bc_sql::LOGGEDIN, "dob", "doby");
2900
my $thisY = Date::get_today('y', 0);
2901
my $uAge = $thisY - $y;
2902
my $ageSelect = "";
2903
2904
{ my %age;
2905
$age{tag} = "select";
2906
$age{id} = "agesDropdown";
2907
$age{name} = "search_age";
2908
$age{class} = "search-age";
2909
$age{title} = "select an age range";
2910
$age{innerHTML} = "";
2911
2912
{ my %all;
2913
$all{tag} = "option";
2914
$all{value} = "999";
2915
$all{innerHTML} = "18+";
2916
2917
$age{innerHTML} .= Html2::tag(\%all);
2918
} # end all option
2919
2920
my $c = 1;
2921
for (my $i = 18; $i <= 98; $i += 5) {
2922
my %option;
2923
$option{tag} = "option";
2924
$option{value} = $c;
2925
2926
if ($uAge >= $i and $uAge <= ($i+4)) { $option{selected} = 1; }
2927
if ($i+5 <= 100) {
2928
$option{innerHTML} = "$i to " . ($i + 4);
2929
} else {
2930
$option{innerHTML} = "98+";
2931
}
2932
$c++;
2933
2934
$age{innerHTML} .= Html2::tag(\%option);
2935
}
2936
2937
$ageSelect .= Html2::tag(\%age);
2938
} # end age dd
2939
2940
my @genders = Bc_sql::get_config("genders");
2941
foreach my $g (@genders) { $g .= "s"; }
2942
2943
my $genderSelect = dropdown("gendersDropdown", "", $Bc_sql::USER_DATA->{seeking_gender}, "", "\" title='select a gender' class=search-gender style=\"width: 80px;\"", "", "", "", \@genders, "Guy/Gal");
2944
my $citySelect = display_city_names_asDropdown(User::get_user_stat($Bc_sql::LOGGEDIN, "location", "country"), User::get_user_stat($Bc_sql::LOGGEDIN, "location", "city"), "citiesDropdown", "", "", "", "", 1, "title='select a city' class=search-city style=\"width: 100px;\"");
2945
my $countrySelect = display_country_names_asDropdown(User::get_user_stat($Bc_sql::LOGGEDIN, "location", "country"), "countriesDropdown", "", "populate_with_cities('countriesDropdown', 'citiesDropdown', '--Any City--');", "", "", 1, "title=\"select a country\" class=\"search-country\" style=\"width: 100px;\"");
2946
my @seeking = Bc_sql::get_config("styles");
2947
my $seekingSelect = dropdown("seekingDropdown", "", $Bc_sql::USER_DATA->{seeking}, "", "", "", "title='select an activity' class=search-seeking style='width: 100px;'", "", \@seeking, "Anything");
2948
2949
my $output = "<!-- BEGIN SEARCHBAR -->";
2950
2951
{ my %script;
2952
$script{tag} = "script";
2953
$script{async} = 1;
2954
2955
$script{innerHTML} = "\n" .
2956
"function disableInputs() {\n" .
2957
" var fields = document.getElementById('subnavbardiv').getElementsByTagName('*');\n" .
2958
" for(var i = 0; i < fields.length; i++) {\n" .
2959
" if (fields[i].tagName == 'SELECT' || fields[i].tagName == 'INPUT') {\n" .
2960
" fields[i].disabled = true;\n" .
2961
" fields[i].className = 'disabled';\n" .
2962
" }\n" .
2963
" }\n" .
2964
"}\n" .
2965
"\n" .
2966
"function enableInputs() {\n" .
2967
" var fields = document.getElementById('subnavbardiv').getElementsByTagName('*');\n" .
2968
" for(var i = 0; i < fields.length; i++) {\n" .
2969
" if (fields[i].tagName == 'SELECT' || fields[i].tagName == 'INPUT') {\n" .
2970
" fields[i].disabled = false;\n" .
2971
" fields[i].className = '';\n" .
2972
" }\n" .
2973
" }\n" .
2974
"}\n" .
2975
"\n" .
2976
"function submitSearch() {\n" .
2977
" // search_age, search_gender, search_location\n" .
2978
" disableInputs();\n" .
2979
" var form_age = document.getElementById('agesDropdown').value;\n" .
2980
" var form_gender = document.getElementById('gendersDropdown').value;\n" .
2981
" var form_city = document.getElementById('citiesDropdown').value;\n" .
2982
"\n" .
2983
" var form_country = document.getElementById('countriesDropdown').value;\n" .
2984
" var form_seeking = document.getElementById('seekingDropdown').value;\n" .
2985
" var lowAge = 13 + (Number(form_age) * 5);\n" .
2986
" if (form_age >= 999) { lowAge = 999; }\n" .
2987
" var sAge = 'age,' + lowAge;\n" .
2988
" var sGender = 'gender,' + form_gender;\n" .
2989
" var sLocation = 'location,';" .
2990
" if (form_country < 999) {\n" .
2991
" sLocation = sLocation + form_country + '-' + form_city;\n" .
2992
" } else {\n" .
2993
" sLocation = sLocation + form_city;\n" .
2994
" }\n" .
2995
" var sSeeking = 'seeking,' + form_seeking;\n" .
2996
" var sParam = 'age,' + form_age + '--' + sGender + '--' + sLocation + '--' + sSeeking;\n" .
2997
"\n" .
2998
" document.location = '/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("SEARCH_PAGE") . "&" . Bc_sql::get_constant("QUERY_SEARCH_PAGE") . "=0&" . Bc_sql::get_constant("QUERY_SEARCH_HPP") . "=10&" . Bc_sql::get_constant("QUERY_SEARCH_TERMS") . "=' + sParam;\n" .
2999
"}\n";
3000
3001
$output .= Html2::tag(\%script);
3002
}
3003
3004
{ my %div;
3005
$div{tag} = "div";
3006
$div{class} = "age";
3007
$div{innerHTML} = $ageSelect;
3008
3009
$output .= Html2::tag(\%div);
3010
}
3011
3012
{ my %div;
3013
$div{tag} = "div";
3014
$div{class} = "gender";
3015
$div{innerHTML} = $genderSelect;
3016
3017
$output .= Html2::tag(\%div);
3018
}
3019
3020
{ my %div;
3021
$div{tag} = "div";
3022
$div{class} = "city";
3023
$div{innerHTML} = $citySelect;
3024
3025
$output .= Html2::tag(\%div);
3026
}
3027
3028
{ my %div;
3029
$div{tag} = "div";
3030
$div{class} = "country";
3031
$div{innerHTML} = $countrySelect;
3032
3033
$output .= Html2::tag(\%div);
3034
}
3035
3036
{ my %div;
3037
$div{tag} = "div";
3038
$div{class} = "seeking";
3039
$div{innerHTML} = $seekingSelect;
3040
3041
$output .= Html2::tag(\%div);
3042
}
3043
3044
{ my %div;
3045
$div{tag} = "div";
3046
$div{class} = "search";
3047
$div{innerHTML} = "";
3048
3049
{ my %input;
3050
$input{tag} = "input";
3051
$input{type} = "hidden";
3052
$input{name} = "hpp";
3053
$input{value} = "10";
3054
3055
$output .= Html2::tag(\%input);
3056
}
3057
3058
{ my %button;
3059
$button{tag} = "button";
3060
$button{type} = "button";
3061
$button{id} = "submitSearchbtn";
3062
$button{class} = "save nowrap margins-none";
3063
$button{onclick} = "submitSearch();";
3064
#$button{style} = "height: 21px;";
3065
$button{title} = "Search it up!";
3066
$button{innerHTML} = "";
3067
3068
{ my %img;
3069
$img{tag} = "img";
3070
$img{align} = "absmiddle";
3071
$img{src} = "/images/" . Bc_sql::get_constant("IMAGE_SEARCH_ICON");
3072
$img{height} = "18";
3073
3074
$button{innerHTML} .= Html2::tag(\%img);
3075
}
3076
3077
$output .= Html2::tag(\%button);
3078
} # end search button
3079
} # end search div
3080
3081
{ my %div;
3082
$div{tag} = "div";
3083
$div{class} = "advanced centered";
3084
$div{innerHTML} = "";
3085
3086
{ my %link;
3087
$link{tag} = "a";
3088
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("SEARCH_PAGE");
3089
$link{title} = "Advanced Search";
3090
$link{innerHTML} = "Advanced";
3091
3092
$div{innerHTML} .= Html2::tag(\%link);
3093
}
3094
3095
$output .= Html2::tag(\%div);
3096
} # end advanced search div
3097
$output .= "<!-- END SEARCHBAR -->";
3098
3099
return $output; # the searchbar in a scalar
3100
#usage: print display_searchbar("");
3101
}
3102
3103
########################
3104
sub display_fuck_me_alerts(;$$) {
3105
#*
3106
# generates a list of unreciprocated FMA's
3107
#*
3108
my ($uid, $spacing) = @_; # a uid (optional, default = $Bc_sql::LOGGEDIN) (deprecated) && spacing for pretty printing HTML output (optional)
3109
if (!$spacing) { $spacing = ""; }
3110
3111
$uid = $Bc_sql::LOGGEDIN;
3112
if ($spacing eq 0) { $spacing = ""; }
3113
3114
my $FUCK_TABLE_BORDER = 0;
3115
3116
my $count = 0;
3117
my $output = "<!-- START FMAs HTML -->";
3118
$output .= "<table border=$FUCK_TABLE_BORDER cellpadding=0 cellspacing=0 height=100% width=100%><tr><td align=center class=subtitle height=1 valign=top>";
3119
3120
$output .= "<table border=$FUCK_TABLE_BORDER cellpadding=0 cellspacing=0><tr><td valign=top>";
3121
$output .= img("s=i&i=" . Bc_sql::get_constant("IMAGE_FMN_ICON"), "", "", "", " ", 1) . " ";
3122
$output .= "</td><td class=subtitle align=right;'>";
3123
$output .= "Fuck Me Alerts";
3124
$output .= "</td></tr></table>";
3125
3126
$output .= "</td></tr><tr><td height=1>" . Html2::hr() . "</td></tr><tr><td align=left valign=top centered>";
3127
my $alerts = Bc_sql::sql_execute("select * from fuck_alerts where to_UID= " . $Bc_sql::DB->quote($uid) . " and reciprocated='1' and ignored='1'", "Html.pm - display fuck me alerts, 1");
3128
3129
{ my %div;
3130
$div{tag} = "div";
3131
$div{class} = "centered center";
3132
$div{style} = "width: 100%;";
3133
$div{innerHTML} = "";
3134
3135
if (ref $alerts eq "HASH") {
3136
$div{class} .= " scrolling_vertical-auto text-align-left";
3137
$div{style} .= " height: 100%;";
3138
if ($alerts->{reciprocated} eq 1) {
3139
my %alert_stats = User::get_user_stats($alerts->{from_UID});
3140
my $short_nick = substr($alert_stats{nickname}, 0, 14) . "...";
3141
{ my %link;
3142
$link{tag} = "a";
3143
$link{onclick} = "showDiv('hiddendiv_$alerts->{from_UID}');";
3144
$link{class} = "pointed";
3145
$link{title} = "User's Nickname";
3146
$link{innerHTML} = $short_nick;
3147
3148
$div{innerHTML} .= Html2::tag(\%link) . Html2::br();
3149
} # end nav toggle link
3150
3151
$div{innerHTML} .= "<table id=hiddendiv_$alerts->{from_UID} style=\"display: none;\" class='subnavbar_inset' style='max-width: 170px;'><tr><td width=10></td><td nowrap>";
3152
3153
{ my %link;
3154
$link{$Bc_sql::QUERY_UID} = $Bc_sql::LOGGEDIN;
3155
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_PROFILE_ICON"), "", "", "", "", 1);
3156
3157
$div{innerHTML} .= Html2::profile_link(\%link) . " ";
3158
} # end profile link
3159
3160
if (User::isUserSubscriber($Bc_sql::LOGGEDIN)) {
3161
{ my %link;
3162
$link{tag} = "a";
3163
$link{href} = "fma.pl?" . $Bc_sql::QUERY_UID . "=$alert_stats{ID}&r=1&i=2";
3164
$link{class} = "pointed";
3165
$link{title} = "Reciprocate " . Bc_misc::word_as_possessive($alert_stats{nickname}) . " Fuck Me Alert";
3166
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_HARDON_ICON"), "", "", "", "", 1);
3167
3168
$div{innerHTML} .= Html2::tag(\%link) . " ";
3169
}
3170
3171
# if $alert_stats{ID} is a fuck buddy of loggedin show a remove fuck buddy icon, otherwise, show add fuck buddy icon!
3172
# show a msg user icon
3173
{ my %link;
3174
$link{tag} = "a";
3175
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_COMPOSE_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_TO") . "=$alert_stats{ID}";
3176
$link{title} = "Send message to $alert_stats{nickname}";
3177
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_COMPOSE_ICON"), "", "", "", "", 1);
3178
3179
$div{innerHTML} .= Html2::tag(\%link);
3180
} # end mail link
3181
if (isFriend($alert_stats{ID})) {
3182
$div{innerHTML} .= Html2::embolden(" | ");
3183
{ my %link;
3184
$link{tag} = "a";
3185
$link{href} = "addfriend.pl?r=1&$Bc_sql::QUERY_UID=$alert_stats{ID}";
3186
$link{class} = "pointed";
3187
$link{title} = "Remove $alert_stats{nickname} from Fuck Buddies";
3188
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_REMOVE_FRIEND_ICON"), "", "", "", "", 1);
3189
3190
$div{innerHTML} .= Html2::tag(\%link);
3191
} # end remove friend link
3192
} else {
3193
{ my %link;
3194
$link{tag} = "a";
3195
$link{href} = "addfriend.pl?r=1&$Bc_sql::QUERY_UID=$alert_stats{ID}";
3196
$link{class} = "pointed";
3197
$link{title} = "Add $alert_stats{nickname} to Fuck Buddies";
3198
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_ADD_FRIEND_ICON"), "", "", "", "", 1);
3199
3200
$div{innerHTML} .= Html2::tag(\%link) . " ";
3201
} # end add friend link
3202
3203
$div{innerHTML} .= Html2::embolden(" | ");
3204
}
3205
}
3206
3207
{ my %link;
3208
$link{tag} = "a";
3209
$link{href} = "block.pl?r=1&$Bc_sql::QUERY_UID=$alert_stats{ID}";
3210
$link{class} = "pointed";
3211
$link{title} = "Block $alert_stats{nickname}";
3212
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_ADD_BLOCK_ICON"), "", "", "", "", 1);
3213
3214
$div{innerHTML} .= Html2::tag(\%link);
3215
} # end block member link
3216
3217
{ my %link;
3218
$link{tag} = "a";
3219
$link{href} = "fma.pl?$Bc_sql::QUERY_UID=$alert_stats{ID}&r=1&i=1";
3220
$link{class} = "pointed";
3221
$link{title} = "Ignore this Alert";
3222
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_X_ICON"), "", "", "", "", 1);
3223
3224
$div{innerHTML} .= Html2::tag(\%link);
3225
}
3226
$div{innerHTML} .= "</td></tr></table>";
3227
} else {
3228
$div{innerHTML} .= " (none)" . Html2::br();
3229
}
3230
} elsif (ref $alerts eq "ARRAY") {
3231
if (@$alerts) {
3232
$div{class} .= " scrolling_vertical";
3233
foreach my $alertref (@$alerts) {
3234
# each alertref is a hash reference to FMA data.
3235
my %fma_stats = User::get_user_stats($alertref->{UID});
3236
if ($alertref->{reciprocated} eq 1) {
3237
$count++;
3238
my $short_nick = substr($fma_stats{nickname}, 0, 14);
3239
if ($short_nick ne $fma_stats{nickname}) { $short_nick .= "..."; }
3240
{ my %link;
3241
$link{tag} = "a";
3242
$link{onclick} = "showDiv('hiddendiv_$fma_stats{ID}');";
3243
$link{class} = "pointed";
3244
$link{title} = "User's Nickname";
3245
$link{innerHTML} = $short_nick;
3246
3247
$div{innerHTML} .= Html2::tag(\%link) . Html2::br();
3248
}
3249
3250
$div{innerHTML} .= "<table border=$FUCK_TABLE_BORDER id=hiddendiv_$fma_stats{ID} style=\"display: none; max-width: 170px;\"><tr><td width=10></td><td nowrap>";
3251
3252
{ my %link;
3253
$link{$Bc_sql::QUERY_UID} = $fma_stats{ID};
3254
$link{title} = "Visit $fma_stats{nickname}";
3255
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_PROFILE_ICON"), "", "", "", "", 1);
3256
3257
$div{innerHTML} .= Html2::profile_link(\%link);
3258
}
3259
3260
if (User::isUserSubscriber($Bc_sql::LOGGEDIN)) {
3261
# if an fma for $Bc_sql::LOGGEDIN from $fma_stats{ID} does NOT exist, then we need this link
3262
{ my %link;
3263
$link{tag} = "a";
3264
$link{class} = "pointed";
3265
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_HARDON_ICON"), "", "", "", "", 1);
3266
3267
if (fma_exists($Bc_sql::LOGGEDIN, $fma_stats{ID})) {
3268
$link{href} = "fma.pl?$Bc_sql::QUERY_UID=$fma_stats{ID}&r=1&i=2";
3269
$link{title} = "Reciprocate $fma_stats{nickname} Fuck Me Alert";
3270
} else {
3271
$link{href} = "fma.pl?$Bc_sql::QUERY_UID=$fma_stats{ID}&r=1";
3272
$link{title} = "Send $fma_stats{nickname} Fuck Me Alert";
3273
}
3274
3275
$div{innerHTML} .= Html2::tag(\%link);
3276
} # end fma link
3277
# if $alerts->{UID} is a fuck buddy of loggedin show a remove fuck buddy icon, otherwise, show add fuck buddy icon!
3278
# show a msg user icon
3279
{ my %link;
3280
$link{tag} = "a";
3281
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_COMPOSE_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_TO") . "=$fma_stats{ID}";
3282
$link{title} = "Send message to $fma_stats{nickname}";
3283
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_COMPOSE_ICON"), "", "", "", "", 1);
3284
3285
$div{innerHTML} .= Html2::tag(\%link);
3286
} # end mail link
3287
3288
{ my %link;
3289
$link{tag} = "a";
3290
$link{class} = "pointed";
3291
$link{href} = "/addfriend.pl?$Bc_sql::QUERY_UID=$fma_stats{ID}";
3292
3293
if (isFriend($fma_stats{ID})) {
3294
$link{href} .= "&r=1";
3295
$link{title} = "Remove $fma_stats{nickname} as Fuck Buddy";
3296
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_DELETE_ICON"), "", "", "", "", 1);
3297
} else {
3298
$link{title} = "Add $fma_stats{nickname} as Fuck Buddy";
3299
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_ADD_ICON"), "", "", "", "", 1);
3300
}
3301
3302
$div{innerHTML} .= Html2::tag(\%link);
3303
} # end add/remove friend link
3304
} # end if User::isUserSubscriber
3305
3306
{ my %link;
3307
$link{tag} = "a";
3308
$link{href} = "/block.pl?r=1&$Bc_sql::QUERY_UID=$fma_stats{ID}";
3309
$link{class} = "pointed";
3310
$link{title} = "Block $fma_stats{nickname}";
3311
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_ADD_BLOCK_ICON"), "", "", "", "", 1);
3312
3313
$div{innerHTML} .= Html2::tag(\%link);
3314
} # end block member link
3315
3316
$div{innerHTML} .= Html2::embolden(" | ");
3317
3318
{ my %link;
3319
$link{tag} = "a";
3320
$link{href} = "/fma.pl?$Bc_sql::QUERY_UID=$fma_stats{ID}&r=1&i=1";
3321
$link{class} = "pointed";
3322
$link{title} = "Ignore this Alert";
3323
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_X_ICON"), "", "", "", "", 1);
3324
3325
$div{innerHTML} .= Html2::tag(\%link);
3326
} # end ignore fma link
3327
$div{innerHTML} .= "</td></tr></table>";
3328
}
3329
}
3330
} else {
3331
my %notice;
3332
$notice{tag} = "div";
3333
$notice{class} = "yellow-panel";
3334
$notice{innerHTML} = "none";
3335
3336
$div{innerHTML} .= Html2::tag(\%notice);
3337
}
3338
} else {
3339
my %notice;
3340
$notice{tag} = "div";
3341
$notice{class} = "yellow-panel";
3342
$notice{innerHTML} = "(none)";
3343
3344
$div{innerHTML} .= Html2::tag(\%notice);
3345
}
3346
3347
{ my %container;
3348
$container{tag} = "div";
3349
$container{class} = "flexboxed";
3350
$container{style} = "height: 100%;";
3351
$container{innerHTML} = Html2::tag(\%div);
3352
3353
$output .= Html2::tag(\%container);
3354
}
3355
}
3356
$output .= "</td></tr></table>";
3357
$output .= "<!-- END FMAs TEXT -->";
3358
3359
return $output; # the FMA's in a scalar
3360
#usage: my $fma = display_fuck_me_alerts($Bc_sql::LOGGEDIN, "");
3361
}
3362
3363
########################
3364
sub display_todays_birthdays(;$$) {
3365
#*
3366
# generates a list of users whose birthday is today!
3367
#*
3368
my ($uid, $spacing) = @_; # a uid (optional, default = $Bc_sql::LOGGEDIN) && spacing for pretty printing HTML output (optional)
3369
if (!$spacing) { $spacing = ""; }
3370
3371
if (not $uid) { $uid = $Bc_sql::LOGGEDIN; }
3372
if ($spacing eq 0) { $spacing = ""; }
3373
my $debug_this = 0;
3374
3375
my $BDAY_TABLE_BORDER = 0;
3376
3377
my $output = "<!-- START TODAY'S BDAYS TEXT -->";
3378
$output .= "<table border=$BDAY_TABLE_BORDER cellpadding=0 cellspacing=0 height=100% width=100%><tr><td align=center class=subtitle height=1 valign=top>";
3379
3380
$output .= "<table border=$BDAY_TABLE_BORDER cellpadding=0 cellspacing=0><tr><td valign=top>";
3381
$output .= img("s=i&i=" . Bc_sql::get_constant("IMAGE_BDAY_ICON"), "", "", "", " ", 1) . Html2::small(" ");
3382
$output .= "</td><td class=subtitle align=right>";
3383
$output .= "B-day Suitors";
3384
$output .= "</td></tr></table>";
3385
3386
$output .= "</td></tr><tr><td height=1>" . Html2::hr() . "</td></tr><tr><td align=left valign=top>";
3387
3388
my $year = Date::get_today('y', 0);
3389
my $day = Date::get_today('d', 1);
3390
my $mon = Date::get_today('m', 0) + 1;
3391
if ($mon < 9) { $mon = "0$mon"; }
3392
my @everyone = Bc_sql::get_users(0, 0, $Bc_sql::LOGGEDIN);
3393
my @users = Search::search("showbday=2"); # this is a list of all users who "show" their bday
3394
3395
{ my %div;
3396
$div{tag} = "div";
3397
$div{class} = "centered center";
3398
$div{style} = "width: 100%;";
3399
$div{innerHTML} = "";
3400
3401
my $date = Date::get_today("db", 0);
3402
if ($debug_this) {
3403
{ my %small;
3404
$small{tag} = "div";
3405
$small{class} = "copyright";
3406
3407
$small{innerHTML} = "loggedin ID: " . Html2::embolden($Bc_sql::LOGGEDIN) . Html2::br() .
3408
"uid: " . Html2::embolden($uid) . Html2::br() .
3409
"today: " . Html2::embolden($date) . " ($year)" . Html2::br() .
3410
Html2::embolden(@everyone) . " users total" . Html2::br() .
3411
Html2::embolden(@users) . " users match bday" . Html2::br() .
3412
Html2::hr();
3413
3414
$div{innerHTML} .= Html2::tag(\%small);
3415
} # end debug div
3416
} # end if $debug_this
3417
3418
my $bdays_str = "";
3419
foreach my $bday_uid (@users) {
3420
my %ustats = User::get_user_stats($bday_uid);
3421
my $ubday = $ustats{dob};
3422
if ($debug_this) { $div{innerHTML} .= "$ubday to "; }
3423
if ($ubday) { $ubday =~ s/^....\-/$year-/; }
3424
if ($debug_this) { $div{innerHTML} .= "$ubday: "; }
3425
if ($ubday and $ubday eq $date) {
3426
if ($debug_this) {
3427
my %font;
3428
$font{tag} = "font";
3429
$font{class} = "notice";
3430
$font{innerHTML} = "Match!";
3431
3432
$div{innerHTML} .= Html2::tag(\%font) . Html2::br();
3433
}
3434
my $short_nick = substr($ustats{nickname}, 0, 14);
3435
if ($short_nick ne $ustats{nickname}) { $short_nick .= "..."; }
3436
{ my %link;
3437
$link{tag} = "a";
3438
$link{onclick} = "showDiv('hiddenbdaydiv_$bday_uid');";
3439
$link{class} = "pointer";
3440
$link{title} = "User's Nickname";
3441
$link{innerHTML} = $short_nick;
3442
3443
$bdays_str .= Html2::tag(\%link) . Html2::br();
3444
} # end show bday div link
3445
3446
$bdays_str .= "<table border=$BDAY_TABLE_BORDER id=hiddenbdaydiv_$bday_uid style=\"display: none; max-width: 170px;\"><tr><td width=10></td><td nowrap>";
3447
{ my %link;
3448
$link{$Bc_sql::QUERY_UID} = $bday_uid;
3449
$link{title} = "Visit $ustats{nickname}";
3450
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_PROFILE_ICON"), "", "", "", "", 1);
3451
3452
$bdays_str .= Html2::profile_link(\%link);
3453
} # end profile link
3454
3455
if (User::isUserSubscriber($Bc_sql::LOGGEDIN)) {
3456
# if an fma for $Bc_sql::LOGGEDIN from $alertref->{UID} does NOT exist, then we need this link
3457
if (fma_exists($Bc_sql::LOGGEDIN, $bday_uid)) {
3458
my %link;
3459
$link{tag} = "a";
3460
$link{href} = "/fma.pl?$Bc_sql::QUERY_UID=$bday_uid&r=1&e=2";
3461
$link{class} = "pointed";
3462
$link{title} = "Send " . User::get_user_stat($bday_uid, "nickname") . " Fuck Me Alert";
3463
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_HARDON_ICON"), "", "", "", "", 1);
3464
3465
$bdays_str .= Html2::tag(\%link);
3466
}
3467
# if $bday_uid is a fuck buddy of loggedin show a remove fuck buddy icon, otherwise, show add fuck buddy icon!
3468
# show a msg user icon only if they are a fuck buddy.
3469
{ my %link;
3470
$link{tag} = "a";
3471
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_COMPOSE_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_TO") . "=$ustats{ID}";
3472
$link{title} = "Send message to $ustats{nickname}";
3473
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_COMPOSE_ICON"), "", "", "", "", 1);
3474
3475
$bdays_str .= Html2::tag(\%link);
3476
} # end mail link
3477
3478
{ my %link;
3479
$link{tag} = "a";
3480
$link{class} = "pointed";
3481
$link{href} = "addfriend.pl?" . $Bc_sql::QUERY_UID . "=$ustats{ID}";
3482
3483
if (isFriend($ustats{ID})) {
3484
$link{href} .= "&r=1";
3485
$link{title} = "Remove $ustats{nickname} as Fuck Buddy";
3486
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_DELETE_ICON"), "", "", "", "", 1);
3487
} else {
3488
$link{title} = "Add $ustats{nickname} as Fuck Buddy";
3489
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_ADD_ICON"), "", "", "", "", 1);
3490
}
3491
3492
$bdays_str .= Html2::tag(\%link);
3493
} # end add/remove friend link
3494
} # end if User::isUserSubscriber
3495
3496
# we should check to see if this ID is blocked or not, and display the appropriate icon
3497
{ my %link;
3498
$link{tag} = "a";
3499
$link{href} = "block.pl?" . $Bc_sql::QUERY_UID . "=$ustats{ID}";
3500
$link{class} = "pointed";
3501
3502
if (blockedUser($ustats{ID})) {
3503
$link{href} .= "&r=1";
3504
$link{title} = "Block $ustats{nickname}";
3505
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_REMOVE_BLOCK_ICON"), "", "", "", "", 1);
3506
} else {
3507
$link{title} = "Block $ustats{nickname}";
3508
$link{innerHTML} = img("s=s&i=" . Bc_sql::get_constant("IMAGE_ADD_BLOCK_ICON"), "", "", "", "", 1);
3509
}
3510
3511
$bdays_str .= Html2::tag(\%link);
3512
} # end block link
3513
$bdays_str .= "</td></tr></table>";
3514
} else {
3515
if ($debug_this) {
3516
my %font;
3517
$font{tag} = "font";
3518
$font{class} = "danger";
3519
$font{innerHTML} = "No Match!";
3520
3521
$div{innerHTML} .= Html2::tag(\%font) . Html2::br();
3522
}
3523
}
3524
3525
if ($debug_this) { $div{innerHTML} .= Html2::small(Html2::br()); }
3526
}
3527
3528
if ($bdays_str) {
3529
$div{class} .= " scrolling_vertical";
3530
$div{innerHTML} .= $bdays_str;
3531
} else {
3532
my %notice;
3533
$notice{tag} = "div";
3534
$notice{class} = "yellow-panel";
3535
$notice{innerHTML} = "none";
3536
3537
$div{innerHTML} .= Html2::tag(\%notice);
3538
}
3539
3540
{ my %container;
3541
$container{tag} = "div";
3542
$container{class} = "flexboxed";
3543
$container{style} = "height: 100%;";
3544
$container{innerHTML} = Html2::tag(\%div);
3545
3546
$output .= Html2::tag(\%container);
3547
}
3548
}
3549
$output .= "</td></tr></table>";
3550
$output .= "<!-- END TODAYS BDAYS -->";
3551
3552
return $output; # today's birthdays in a scalar
3553
#usage: my $bdays = display_todays_birthdays($Bc_sql::LOGGEDIN, "");
3554
}
3555
3556
########################
3557
sub display_chat(;$$) {
3558
#*
3559
# a lovely ajax msg'r
3560
# !this function is under development
3561
#*
3562
my ($uid, $spacing) = @_; # a UID (optional, default = $Bc_sql::LOGGEDIN) (deprecated) && spacing for pretty printing HTML output (optional)
3563
if (!$spacing) { $spacing = ""; }
3564
3565
$uid = $Bc_sql::LOGGEDIN;
3566
3567
$TABLE_BORDER = 0;
3568
3569
my $output = "<table border=$TABLE_BORDER align=center cellpadding=0 cellspacing=0 class=subnavbar height=315 width=100%><tr><td align=center class=subtitle height=1 width=100%>";
3570
$output .= "Chat";
3571
3572
{ my %script;
3573
$script{tag} = "script";
3574
$script{async} = 1;
3575
$script{innerHTML} = "var refresh_rate = 500;\n" .
3576
"var toUID = 0;\n" .
3577
"var fromUID = 0;\n" .
3578
"var loggedin = \"" . $Bc_sql::LOGGEDIN . "\";\n" . # so NOT a good way to do this! but, for now...
3579
"var scrolled = false;\n" .
3580
"var chatBlank = true;\n" .
3581
"var toFunc = 0;\n" .
3582
"\n" .
3583
"function chat(uid, nickname) {\n" .
3584
" var list = document.getElementById('friends_list');\n" .
3585
" var chatbox = document.getElementById('chatbox');\n" .
3586
" var msg = document.getElementById('msg');\n" .
3587
" var uidhi = document.getElementById('to_uid');\n" . # the hi in uidhi = hidden input
3588
" var nn = document.getElementById('nickname');\n" .
3589
" var msgs = document.getElementById('msgsbox');\n" .
3590
" var dc = document.getElementById('del_chat_button');\n" .
3591
"\n" .
3592
" list.style.display = 'none';\n" .
3593
" msg.value = '';\n" .
3594
" uidhi.value = uid;\n" .
3595
" nn.innerHTML = nickname;\n" .
3596
" msgs.innerHTML = 'Getting Loaded...';\n" .
3597
" dc.style.display = 'inline-block';\n" .
3598
" dc.style.width = '50%';\n" .
3599
"\n" .
3600
" msg.focus();\n" .
3601
" getmsgs(uid, 'msgsbox');\n" .
3602
" scrolled = false;\n" .
3603
" chatBlank = true;\n" .
3604
" chatbox.style.display = 'block';\n" .
3605
"\n" .
3606
" //console.log('chat: ' + scrolled);\n" .
3607
"}\n" .
3608
"\n" .
3609
"function unchat(eid) {\n" .
3610
" var chat = document.getElementById(eid);\n" .
3611
" var list = document.getElementById('friends_list');\n" .
3612
" var chatbox = document.getElementById('chatbox');\n" .
3613
" var msg = document.getElementById('msg');\n" .
3614
" var uidhi = document.getElementById('to_uid');\n" .
3615
" var nn = document.getElementById('nickname');\n" .
3616
" var dc = document.getElementById('del_chat_button');\n" .
3617
"\n" .
3618
" list.style.display = 'block';\n" .
3619
" chatbox.style.display = 'none';\n" .
3620
" msg.value = '';\n" .
3621
" uidhi.value = 0;\n" .
3622
" nn.innerHTML = '';\n" .
3623
" dc.style.display = 'none';\n" .
3624
" dc.style.width = '0';\n" .
3625
"\n" .
3626
" clearTimeout(toFunc);\n" .
3627
" toFunc = 0;\n" .
3628
" scrolled = false;\n" .
3629
" chatBlank = true;\n" .
3630
"}\n" .
3631
"\n" .
3632
"function chkscroll(eid) {\n" .
3633
" var e = document.getElementById(eid);\n" .
3634
" var isScrolledToBottom = e.scrollHeight - e.clientHeight <= e.scrollTop + 1;\n" .
3635
" if (scrolled) {\n" .
3636
" if (isScrolledToBottom) { scrolled = false; }\n" .
3637
" } else {\n" .
3638
" if (!isScrolledToBottom) { scrolled = true; }\n" .
3639
" }\n" .
3640
"\n" .
3641
" //console.log('scrolled: ' + scrolled);\n" .
3642
"}\n" .
3643
"\n" .
3644
"function getmsgs(uid, eid) {\n" .
3645
" var e = document.getElementById(eid);\n" .
3646
" chat_get_msgs(uid, e);\n" .
3647
" toFunc = setTimeout(function() { getmsgs(uid, eid); }, refresh_rate);\n" .
3648
"\n" .
3649
" if (!scrolled && e.innerHTML !== \"\") {\n" .
3650
" var isScrolledToBottom = e.scrollHeight - e.clientHeight <= e.scrollTop;// + 1;\n" .
3651
" if (!isScrolledToBottom) { e.scrollTop = e.scrollHeight - e.clientHeight; }\n" .
3652
" //console.log('chat: ' + scrolled);\n" .
3653
" }\n" .
3654
"}\n" .
3655
"\n" .
3656
"function keycheck(e) {\n" .
3657
" if (e.keyCode == 13) {\n" .
3658
" chat_send_msg();\n" .
3659
" re" . "turn false;\n" .
3660
" }\n" .
3661
"\n" .
3662
" re" . "turn true;\n" .
3663
"}\n";
3664
3665
$output .= Html2::tag(\%script);
3666
} # end javascript
3667
3668
$output .= "</td></tr><tr><td align=left>";
3669
3670
{ my %div;
3671
$div{tag} = "div";
3672
$div{class} = "scrolling_vertical";
3673
$div{id} = "friends_list";
3674
$div{style} = "height: 250px; text-align: left; width: 210px;";
3675
$div{innerHTML} = "";
3676
3677
my @friends = User::get_user_friends();
3678
if (@friends) {
3679
foreach my $friend (@friends) {
3680
my $fn = Bc_misc::shorten_str(User::get_user_stat($friend, "nickname"), 20);
3681
my %link;
3682
$link{tag} = "a";
3683
$link{onclick} = "chat('$friend', '$fn');";
3684
$link{title} = "Chat with $fn";
3685
$link{innerHTML} = $fn;
3686
3687
$div{innerHTML} .= Html2::tag(\%link) . Html2::br();
3688
}
3689
}
3690
3691
$output .= Html2::tag(\%div);
3692
}
3693
3694
{ my %div;
3695
$div{tag} = "div";
3696
$div{id} = "chatbox";
3697
$div{style} = "height: 250px; text-align: left; display: none; width: 100%;";
3698
3699
$div{innerHTML} = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 height=100% width=100%><tr><td align=right style=\"height: 25px;\" valign=top>";
3700
{ my %input;
3701
$input{tag} = "input";
3702
$input{type} = "hidden";
3703
$input{name} = "subject";
3704
$input{id} = "subject";
3705
$input{value} = "chatbox msg";
3706
3707
$div{innerHTML} .= Html2::tag(\%input);
3708
} # end subject input
3709
3710
{ my %input;
3711
$input{tag} = "a";
3712
$input{type} = "hidden";
3713
$input{name} = $Bc_sql::QUERY_UID;
3714
$input{id} = "to_uid";
3715
3716
$div{innerHTML} .= Html2::tag(\%input);
3717
}
3718
3719
$div{innerHTML} .= "<table border=$TABLE_BORDER cellspacing=0 cellpadding=0 width=100%><tr><td align=left valign=top>";
3720
{ my %nn;
3721
$nn{tag} = "div";
3722
$nn{class} = "centered-left";
3723
$nn{id} = "nickname";
3724
3725
$div{innerHTML} .= Html2::tag(\%nn);
3726
} # end nickname
3727
3728
$div{innerHTML} .= "</td><td width=1 style='white-space: nowrap;'>";
3729
{ my %button;
3730
$button{tag} = "button";
3731
$button{type} = "button";
3732
$button{class} = "cancel";
3733
$button{title} = "Close this Chatbox";
3734
$button{onclick} = "unchat(\"msgsbox\");";
3735
$button{innerHTML} = "x";
3736
3737
$div{innerHTML} .= Html2::tag(\%button);
3738
} # end close chat button
3739
3740
$div{innerHTML} .= "</td></tr></table>";
3741
$div{innerHTML} .= "</td></tr><tr><td height=100% valign=top>";
3742
{ my %loading;
3743
$loading{tag} = "div";
3744
$loading{class} = "scrolling_vertical bordered";
3745
$loading{id} = "msgsbox";
3746
$loading{onscroll} = "chkscroll('msgsbox');";
3747
$loading{style} = "height: 100%;";
3748
$loading{innerHTML} = "Getting Loaded ...";
3749
3750
$div{innerHTML} .= Html2::tag(\%loading);
3751
} # end getting loaded ...
3752
$div{innerHTML} .= "</td></tr><tr><td>";
3753
$div{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td align=left>";
3754
{ my %input;
3755
$input{tag} = "input";
3756
$input{type} = "";
3757
$input{name} = "msg";
3758
$input{id} = "msg";
3759
$input{onkeypress} = "ret" . "urn keycheck(event);";
3760
$input{placeholder} = "Type Message Here";
3761
$input{style} = "width: 90%;";
3762
3763
$div{innerHTML} .= Html2::tag(\%input);
3764
} # end
3765
$div{innerHTML} .= "</td><td width=60 align=right valign=bottom>";
3766
{ my %button;
3767
$button{tag} = "button";
3768
$button{type} = "button";
3769
$button{class} = "green";
3770
$button{onclick} = "chat_send_msg();";
3771
$button{title} = "Send Message";
3772
$button{innerHTML} = "Send";
3773
3774
$div{innerHTML} .= Html2::tag(\%button);
3775
} # end send msg button
3776
$div{innerHTML} .= "</td></tr></table>";
3777
$div{innerHTML} .= "</td></tr></table>";
3778
3779
$output .= Html2::tag(\%div);
3780
}
3781
3782
$output .= "</td></tr><tr><td class=spacery>";
3783
$output .= "</td></tr><tr><td class=subnavbar_dark_inset height=22>";
3784
{ my %div;
3785
$div{tag} = "div";
3786
$div{id} = "chat_buttons";
3787
3788
$div{innerHTML} = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td align=left>";
3789
{ my %button;
3790
$button{tag} = "button";
3791
$button{type} = "button";
3792
$button{class} = "yellow";
3793
$button{onclick} = "";
3794
$button{title} = "Toggle Sound On/Off";
3795
$button{innerHTML} = "";
3796
3797
{ my %img;
3798
$img{tag} = "img";
3799
$img{src} = "/images/site/sound_mute.png";
3800
$img{height} = "20";
3801
3802
$button{innerHTML} .= Html2::tag(\%img);
3803
}
3804
3805
$div{innerHTML} .= Html2::tag(\%button);
3806
} # end toggle sound button
3807
$div{innerHTML} .= "</td><td align=right>";
3808
3809
{ my %button;
3810
$button{tag} = "button";
3811
$button{type} = "button";
3812
$button{class} = "red";
3813
$button{onclick} = "chat_del_msgs(); ret" . "urn false;";
3814
$button{id} = "del_chat_button";
3815
$button{style} = "display: none;";
3816
3817
{ my %img;
3818
$img{tag} = "img";
3819
$img{src} = "/images/site/delete_chat.png";
3820
$img{height} = "20";
3821
$img{title} = "Delete Chat";
3822
3823
$button{innerHTML} .= Html2::tag(\%img);
3824
}
3825
3826
$div{innerHTML} .= Html2::tag(\%button);
3827
} # end del chat button
3828
$div{innerHTML} .= "</td></tr></table>";
3829
3830
$output .= Html2::tag(\%div);
3831
} # end chat_buttons div
3832
$output .= "</td></tr></table>";
3833
3834
return $output; # the chat in a scalar
3835
#usage: print display_chat($Bc_sql::LOGGEDIN, "");
3836
}
3837
3838
########################
3839
sub display_homepage(;$$$) {
3840
#*
3841
# retrieves the homepage text for the currently
3842
# logged in user or guest user, and wraps it in
3843
# a lovely HTML'ized layout
3844
# $eorn must be "e=your words here"
3845
# or "n=your words here"
3846
#*
3847
my ($spacing, $DEBUG, $eorn) = @_; # spacing for pretty printing HTML output (optional) && debug mode (optional, default = 0) && error/notice text (optional)
3848
if (!$spacing) { $spacing = ""; }
3849
if ($spacing eq 0) { $spacing = ""; }
3850
my $HOMEPAGE_BORDERS = 0;
3851
3852
my $output = "";
3853
my $hp = Bc_sql::get_home_page("", 0, 0, $DEBUG);
3854
3855
if ($Bc_sql::LOGGEDIN) {
3856
my $num_fb_requests = User::get_user_friend_requests();
3857
my $fuck_buddy_requests = "You have ";
3858
if ($num_fb_requests > 1) {
3859
$fuck_buddy_requests .= Html2::embolden($num_fb_requests);
3860
} elsif ($num_fb_requests == 0) {
3861
$fuck_buddy_requests .= Html2::embolden("no");
3862
} else {
3863
$fuck_buddy_requests .= Html2::embolden("one");
3864
}
3865
$fuck_buddy_requests .= " ";
3866
3867
{ my %link;
3868
$link{tag} = "a";
3869
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("FRIENDS_PAGE");
3870
$link{innerHTML} = "Fuck Buddy";
3871
3872
$fuck_buddy_requests .= Html2::tag(\%link);
3873
}
3874
$fuck_buddy_requests .= Bc_misc::pluralize(" request", $num_fb_requests);
3875
3876
$hp =~ s/\[FBR\]/$fuck_buddy_requests/;
3877
3878
{ my %link;
3879
$link{tag} = "a";
3880
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("BROWSE_PAGE");
3881
$link{title} = "Browse";
3882
$link{innerHTML} = "Browse Users";
3883
3884
my $browseLink = Html2::tag(\%link);
3885
$hp =~ s/\[BROWSE\]/$browseLink/;
3886
}
3887
3888
if ($hp =~ /\[MAIL\]/) {
3889
# first, check the user's mail box for unread msgs
3890
my $msgs = User::get_user_unread_messages($Bc_sql::LOGGEDIN);
3891
my $numUnreadMsgs = 0;
3892
if (ref $msgs eq "HASH") {
3893
$numUnreadMsgs = 1;
3894
} elsif (ref $msgs eq "ARRAY") {
3895
$numUnreadMsgs = @$msgs;
3896
}
3897
3898
my $email .= "<table border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0><tr><td class=yellow-panel>";
3899
my $msg = "You have ";
3900
{ my %link;
3901
$link{tag} = "a";
3902
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE");
3903
$link{title} = "Mailbox";
3904
3905
if ($numUnreadMsgs > 1) {
3906
$link{innerHTML} = Html2::embolden($numUnreadMsgs);
3907
$msg .= Html2::tag(\%link);
3908
} elsif ($numUnreadMsgs == 1) {
3909
$link{innerHTML} = Html2::embolden("one");
3910
$msg .= Html2::tag(\%link);
3911
} else {
3912
$link{innerHTML} = Html2::embolden("no");
3913
$msg .= Html2::tag(\%link);
3914
}
3915
3916
$msg .= " unread " . Bc_misc::pluralize("message", $numUnreadMsgs) . "!";
3917
} # end mailbox link
3918
3919
my $clickme =Html2::hr({style=>"background: black;"});
3920
{ my %link;
3921
$link{tag} = "a";
3922
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE");
3923
$link{title} = "Mailbox";
3924
$link{innerHTML} = "Go to My Mailbox";
3925
3926
$clickme .= Html2::tag(\%link);
3927
}
3928
$email .= "$msg";
3929
$email .= "$clickme";
3930
$email .= "</td></tr><tr><td class=spacery_large>";
3931
$email .= "</td></tr><tr><td>";
3932
3933
my $numVisitors = Bc_sql::num_visitors($Bc_sql::LOGGEDIN);
3934
my $profileLink = Html2::profile_link($Bc_sql::LOGGEDIN);
3935
$email .= "$profileLink has ";
3936
if ($numVisitors > 1) {
3937
$email .= "been visited " . Html2::embolden($numVisitors) . " " . Bc_misc::pluralize("time", $numVisitors);
3938
} elsif ($numVisitors == 0) {
3939
$email .= Html2::embolden("never") . " been visited";
3940
} else {
3941
$email .= "been visited " . Html2::embolden("once");
3942
}
3943
if ($numVisitors < 100) { $email .= "."; }
3944
if ($numVisitors >= 100) { $email .= "!"; }
3945
if ($numVisitors >= 250) { $email .= "!"; }
3946
if ($numVisitors >= 500) { $email .= "! " . Html2::tag({tag=>"img", src=>"/images/site/wow.png", height=>"16", title=>"wow!"}); }
3947
3948
$email .= "</td></tr></table>";
3949
3950
$hp =~ s/\[MAIL\]/$email/;
3951
} # end if hp =~ [MAIL]
3952
} # end if loggedin
3953
3954
my @hpArray = split("\n", $hp);
3955
foreach my $line (@hpArray) { $line = $line; }
3956
$hp = join("\n", @hpArray);
3957
my $w = "15px";
3958
my $top10Width = "345px";
3959
my $scrollwidth = "330px";
3960
3961
if ($hp =~ /\[top10members\]/) {
3962
my %top10members;
3963
$top10members{tag} = "div";
3964
$top10members{class} = "top10members";
3965
$top10members{innerHTML} = "";
3966
3967
{ my %fs;
3968
$fs{tag} = "fieldset";
3969
$fs{style} = "width: $top10Width; max-width: $top10Width; min-width: $top10Width";
3970
$fs{innerHTML} = "";
3971
3972
{ my %legend;
3973
$legend{tag} = "legend";
3974
$legend{innerHTML} = Html2::italicize(Bc_misc::word_as_possessive($Bc_sql::SITE_NAME)) . " Top Ten Members";
3975
3976
$fs{innerHTML} .= Html2::tag(\%legend);
3977
}
3978
3979
$fs{innerHTML} .= "<table border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0 height=100% width=100%><tr><td align=center class=scrolling_horizontal style='width: $scrollwidth; max-width: $scrollwidth; height: 102px;'>";
3980
my @users = Bc_sql::get_top10_fma_counts();
3981
3982
if (@users) {
3983
my @special;
3984
foreach my $user (@users) {
3985
my $uFMACount = User::get_user_fuck_alert_count($user, 1);
3986
if ($uFMACount > 0) { push @special, "$uFMACount=$user"; }
3987
}
3988
3989
if (@special) {
3990
@special = sort @special;
3991
@special = reverse @special;
3992
$fs{innerHTML} .= "<table border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0><tr><td align=center nowrap>";
3993
my $howMany = @special;
3994
if ($howMany > 10) { $howMany = 10; }
3995
for (my $i = 0; $i < $howMany; $i++) {
3996
my ($count, $id) = split('=', $special[$i]);
3997
$fs{innerHTML} .= Html2::display_user_profile({uid=>$id, mini=>1});
3998
$fs{innerHTML} .= " with " . Html2::embolden($count) . " lifetime fuck alerts";
3999
if ($i < $howMany-1) { $fs{innerHTML} .= "</td><td style='max-width: $w; min-width: $w; width: $w;'></td><td align=center nowrap --USER CARD CONTAINER-- >"; }
4000
}
4001
$fs{innerHTML} .= "</td></tr></table>";
4002
} else {
4003
$fs{innerHTML} .= "<table border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0 height=100%><tr><td align=center>";
4004
$fs{innerHTML} .= "<table border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0><tr><td class=red-panel>No one - yet!</td></tr></table>";
4005
$fs{innerHTML} .= "</td></tr></table>";
4006
}
4007
} else {
4008
$fs{innerHTML} .= "<table border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0 height=100%><tr><td align=center>";
4009
$fs{innerHTML} .= "<table border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0><tr><td class=red-panel>No one - yet!</td></tr></table>";
4010
$fs{innerHTML} .= "</td></tr></table>";
4011
}
4012
$fs{innerHTML} .= "</td></tr></table>";
4013
4014
$top10members{innerHTML} .= Html2::tag(\%fs);
4015
} # end top 10 members fieldset
4016
4017
my $temp = Html2::tag(\%top10members);
4018
$hp =~ s/\[top10members\]/$temp/;
4019
} # end if $hp =~ [top10members]
4020
4021
if ($hp =~ /\[top10matches\]/) {
4022
if ($Bc_sql::LOGGEDIN) {
4023
my %stats = User::get_user_stats($Bc_sql::LOGGEDIN);
4024
my @users = Bc_sql::get_users();
4025
my @terms = (
4026
"age=" . User::get_user_age($Bc_sql::LOGGEDIN),
4027
"location=" . $stats{location},
4028
"seeking_gender=" . $stats{seeking_gender},
4029
"seeking=" . $stats{seeking}
4030
);
4031
my @search = Search::search(join("--", @terms));
4032
4033
{ my %top10;
4034
$top10{tag} = "fieldset";
4035
$top10{style} = "width: $top10Width; max-width: $top10Width; min-width: $top10Width";
4036
$top10{innerHTML} = "";
4037
4038
{ my %legend;
4039
$legend{tag} = "legend";
4040
$legend{align} = "right";
4041
$legend{innerHTML} = Html2::embolden("Your") . " top 10 matches!";
4042
4043
$top10{innerHTML} .= Html2::tag(\%legend);
4044
}
4045
4046
# and now, the "matches"
4047
{ my %div;
4048
$div{tag} = "div";
4049
$div{class} = "bordered";
4050
$div{style} = "display: flex;";
4051
}
4052
}
4053
4054
{ my %fs;
4055
$fs{tag} = "fieldset";
4056
$fs{style} = "width: $top10Width; max-width: $top10Width; min-width: $top10Width";
4057
$fs{innerHTML} = "";
4058
4059
{ my %legend;
4060
$legend{tag} = "legend";
4061
$legend{align} = "right";
4062
$legend{innerHTML} = Html2::italicize("Your") . " Top Ten Best Chances";
4063
4064
$fs{innerHTML} .= Html2::tag(\%legend);
4065
}
4066
4067
$fs{innerHTML} .= "<table align=center border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0 height=182px width=100%><tr><td align=center class=scrolling_horizontal style='width: $scrollwidth; max-width: $scrollwidth; height: 102px;'>";
4068
if (@search > 1) {
4069
$fs{innerHTML} .= "<table border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0><tr><td align=center nowrap>";
4070
4071
foreach my $uid (@search) {
4072
$fs{innerHTML} .= display_user_card_mini($uid, "", 1);
4073
if (@search > 1) {
4074
$fs{innerHTML} .= "</td><td style='max-width: $w; min-width: $w; width: $w;'></td><td>";
4075
}
4076
}
4077
4078
$fs{innerHTML} .= "</td></tr></table>";
4079
} else {
4080
$fs{innerHTML} .= "<table border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0 height=100%><tr><td align=center>";
4081
$fs{innerHTML} .= "<table border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0><tr><td class=red-panel>No one - yet!</td></tr></table>";
4082
$fs{innerHTML} .= "</td></tr></table>";
4083
}
4084
$fs{innerHTML} .= "</td></tr></table>";
4085
4086
my $temp = Html2::tag(\%fs);
4087
$hp =~ s/\[top10matches\]/$temp/;
4088
} # end top 10 matches fieldset
4089
} else {
4090
$hp =~ s/\[top10matches\]//; # visitors who are not logged in don't have matches (except for cigarettes, perhaps?)
4091
}
4092
} # end if $hp =~ [top10matches]
4093
4094
if ($hp =~ /\[BETA\]/) {
4095
my $beta = "";
4096
my $beta_time = 364;
4097
my $today = Date::get_today("db", 0);
4098
my $date = "2019-01-01";
4099
my $end_date = add_date($date, $beta_time, "d");
4100
my ($yr, $mo, $day) = split("-", $date);
4101
4102
if (isBeforeDate($today, $end_date)) {
4103
$beta .= Html2::br() . Html2::br() . "<table border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0><tr><td>";
4104
{ my %fs;
4105
$fs{tag} = "fieldset";
4106
$fs{class} = "subnavbar";
4107
$fs{innerHTML} = "";
4108
4109
{ my %legend;
4110
$legend{tag} = "legend";
4111
$legend{innerHTML} = "Beta Testing Phase";
4112
4113
$fs{innerHTML} .= Html2::tag(\%legend);
4114
}
4115
4116
$fs{innerHTML} .= "Opens: " . Html2::italicize(Date::expand_date($date)) . Html2::br();
4117
$fs{innerHTML} .= "Closes: " . Html2::italicize(Date::expand_date($end_date)) . Html2::br() . Html2::br();
4118
{ my %font;
4119
$font{tag} = "font";
4120
$font{class} = "subtitle";
4121
$font{innerHTML} = "Register as a Beta tester!";
4122
4123
$fs{innerHTML} .= Html2::tag(\%font) . Html2::br();
4124
}
4125
$fs{innerHTML} .= "<table align=center border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0><tr><td align=left colspan=3>";
4126
$fs{innerHTML} .= "Get 2 months of Premium Membership " . Html2::embolden("FREE");
4127
$fs{innerHTML} .= "and 50,000 coins to spend on a theme!" . Html2::br();
4128
$fs{innerHTML} .= "Opt-in as a moderator and get an additional month of Premium Membership " . Html2::embolden("FREE");
4129
$fs{innerHTML} .= "and another 25,000 coins!" . Html2::br() . Html2::br();
4130
$fs{innerHTML} .= "Report on bugs, and glitches. Improve usability!" . Html2::br();
4131
$fs{innerHTML} .= "Your name (nickname, or real, your choice) added to the credits!" . Html2::br();
4132
$fs{innerHTML} .= "As a moderator, you get to ensure the site remains cordial and friendly" . Html2::br() . Html2::br();
4133
$fs{innerHTML} .= "</td></tr><tr><td align=left>";
4134
{ my %button;
4135
$button{tag} = "button";
4136
$button{type} = "submit";
4137
$button{class} = "save";
4138
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("SIGNUP_PAGE") . "&beta=1\";";
4139
$button{innerHTML} = "Let's do it!";
4140
4141
$fs{innerHTML} .= Html2::tag(\%button);
4142
} # end save button;
4143
$fs{innerHTML} .= "</td><td class=spacerx></td><td align=right>";
4144
{ my %button;
4145
$button{tag} = "button";
4146
$button{class} = "red";
4147
$button{onclick} = "document.location=\"/?ip=su&a=0\";";
4148
$button{innerHTML} = "Not Interested";
4149
4150
$fs{innerHTML} .= Html2::tag(\%button);
4151
} # end not interested button
4152
$fs{innerHTML} .= "</td></tr></table>";
4153
4154
$beta .= Html2::tag(\%fs);
4155
} # end fieldset
4156
$beta .= "</td></tr></table>" . Html2::br();
4157
} else {
4158
$beta .= "</td></tr><tr><td class=spacery>";
4159
$beta .= "</td></tr><tr><td align=center>";
4160
$beta .= "<table border=$HOMEPAGE_BORDERS cellpadding=0 cellspacing=0><tr><td>";
4161
{ my %fs;
4162
$fs{tag} = "fieldset";
4163
$fs{class} = "red-panel";
4164
$fs{innerHTML} = "";
4165
4166
{ my %legend;
4167
$legend{tag} = "legend";
4168
$legend{class} = "notice";
4169
$legend{innerHTML} = "Beta Testing Phase";
4170
4171
$fs{innerHTML} .= Html2::tag(\%legend);
4172
}
4173
$fs{innerHTML} .= "Opens: " . $date . Html2::br();
4174
$fs{innerHTML} .= "Closes: " . $end_date . Html2::br() . Html2::br();
4175
4176
$beta .= Html2::tag(\%fs);
4177
} # end beta fieldset
4178
$beta .= "</td></tr></table>";
4179
$beta .= "</td></tr><tr><td>";
4180
}
4181
4182
# come back here
4183
$beta .= "</td></tr></table>";
4184
$hp =~ s/\[BETA\]/$beta/;
4185
} # end if hp =~ [BETA]
4186
4187
$output .= $hp;
4188
4189
return $output; # the home page in a scalar
4190
#usage: print display_homepage("");
4191
}
4192
4193
########################
4194
sub display_ppinfo_page(;$) {
4195
#*
4196
# display information about paypal IPN's
4197
#*
4198
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
4199
if (!$spacing) { $spacing = ""; }
4200
if ($spacing eq 0) { $spacing = ""; }
4201
4202
my $output = "ppinfo";
4203
4204
return $output; # the paypal info page in a scalar
4205
#usage: print display_ppinfo_page("");
4206
}
4207
4208
########################
4209
sub display_mods_page(;$$) {
4210
#*
4211
# display information about moderators
4212
#*
4213
my ($spacing, $includeAdmins) = @_; # spacing for pretty printing HTML output (optional) && include admins (optional, default = 0)
4214
if (!$spacing) { $spacing = ""; }
4215
if ($spacing eq 0) { $spacing = ""; }
4216
4217
#my @users = Bc_sql::get_users(1, 1);
4218
#my @mods = search_item(\@users, "security", get_config_fromWord("security", "moderator"));
4219
my $sql = "select * from users where";
4220
$sql .= " security=" . $Bc_sql::DB->quote(Bc_sql::get_security("moderator"));
4221
if ($includeAdmins) {
4222
$sql .= " or security=" . $Bc_sql::DB->quote(Bc_sql::get_security("administrator"));
4223
$sql .= " or security=" . $Bc_sql::DB->quote(Bc_sql::get_security("superadministrator"));
4224
}
4225
$sql .= " order by nickname";
4226
my $results = Bc_sql::sql_execute($sql, "bc_sql -> display_mods_page");
4227
4228
my $numMods = 0;
4229
my @users = ();
4230
if ($results) {
4231
if (ref $results eq "HASH") {
4232
$numMods = 1;
4233
push @users, $results;
4234
} else {
4235
$numMods = @$results;
4236
foreach my $mod (@$results) {
4237
push @users, $mod;
4238
}
4239
}
4240
}
4241
4242
my $output = "";
4243
4244
my %mods; {
4245
$mods{tag} = "div";
4246
4247
my %modtable; {
4248
$modtable{tag} = "table";
4249
#$modtable{border} = 1;
4250
4251
my %modtitletr; {
4252
$modtitletr{tag} = "tr";
4253
4254
my %modtitletd; {
4255
$modtitletd{tag} = "td";
4256
$modtitletd{colspan} = 3;
4257
$modtitletd{class} = "text-align-center";
4258
my %titlediv; {
4259
$titlediv{tag} = "div";
4260
$titlediv{class} = "subnavbar";
4261
$titlediv{innerHTML} = "Contact a Moderator";
4262
}
4263
$modtitletd{innerHTML} = Html2::tag(\%titlediv);
4264
}
4265
$modtitletr{innerHTML} = Html2::tag(\%modtitletd);
4266
}
4267
$modtable{innerHTML} .= Html2::tag(\%modtitletr);
4268
4269
my %modcounttr; {
4270
$modcounttr{tag} = "tr";
4271
4272
my %modcounttd; {
4273
$modcounttd{tag} = "td";
4274
$modcounttd{colspan} = 3;
4275
$modcounttd{class} = "text-align-center";
4276
my %div; {
4277
$div{tag} = "div";
4278
$div{class} = "subnavbar small";
4279
$div{innerHTML} = $numMods . " " . Bc_misc::pluralize("Moderator", $numMods) . " Found!";
4280
}
4281
$modcounttd{innerHTML} = Html2::tag(\%div);
4282
}
4283
$modcounttr{innerHTML} = Html2::tag(\%modcounttd);
4284
}
4285
$modtable{innerHTML} .= Html2::tag(\%modcounttr);
4286
4287
my %modspacertr; {
4288
$modspacertr{tag} = "tr";
4289
4290
my %modspacertd; {
4291
$modspacertd{tag} = "td";
4292
$modspacertd{colspan} = 3;
4293
$modspacertd{class} = "spacery";
4294
}
4295
$modspacertr{innerHTML} = Html2::tag(\%modspacertd);
4296
}
4297
$modtable{innerHTML} .= Html2::tag(\%modspacertr);
4298
4299
my %modtr; {
4300
$modtr{tag} = "tr";
4301
4302
my %modlogotd; {
4303
$modlogotd{tag} = "td";
4304
$modlogotd{valign} = "top";
4305
my %img; {
4306
$img{tag} = "img";
4307
$img{src} = "/images/site/sec_mod.png";
4308
}
4309
$modlogotd{innerHTML} = Html2::tag(\%img);
4310
}
4311
$modtr{innerHTML} .= Html2::tag(\%modlogotd);
4312
4313
my %modlogospacertd; {
4314
$modlogospacertd{tag} = "td";
4315
$modlogospacertd{class} = "spacerx";
4316
}
4317
$modtr{innerHTML} .= Html2::tag(\%modlogospacertd);
4318
4319
my %modstd; {
4320
$modstd{tag} = "td";
4321
$modstd{class} = "sunken scrolling_vertical";
4322
$modstd{style} = "max-width: 200px;";
4323
$modstd{valign} = "top";
4324
$modstd{align} = "left";
4325
4326
my %list; {
4327
$list{tag} = "table";
4328
#$list{border} = 1;
4329
$list{style} = "width: 100%; height: 100%;";
4330
4331
foreach my $mod (@users) {
4332
my %tr; {
4333
$tr{tag} = "tr";
4334
my %upictd; {
4335
$upictd{tag} = "td";
4336
$upictd{innerHTML} = User::get_user_pic($mod->{ID}, "t", "");
4337
}
4338
4339
my %spacertd; {
4340
$spacertd{tag} = "td";
4341
$spacertd{class} = "spacerx";
4342
}
4343
4344
my %linktd; {
4345
$linktd{tag} = "td";
4346
$linktd{align} = "left";
4347
$linktd{innerHTML} = Html2::profile_link($mod->{ID});
4348
}
4349
$tr{innerHTML} .= Html2::tag(\%upictd) .
4350
Html2::tag(\%spacertd) .
4351
Html2::tag(\%linktd);
4352
}
4353
$list{innerHTML} .= Html2::tag(\%tr);
4354
} # end for loop
4355
}
4356
$modstd{innerHTML} .= Html2::tag(\%list);
4357
}
4358
$modtr{innerHTML} .= Html2::tag(\%modstd);
4359
}
4360
$modtable{innerHTML} .= Html2::tag(\%modtr);
4361
}
4362
$mods{innerHTML} = Html2::tag(\%modtable);
4363
}
4364
$output .= Html2::tag(\%mods);
4365
4366
return $output; # the moderators list page in a scalar
4367
#usage: print display_mods_page("", 1);
4368
}
4369
4370
########################
4371
sub display_js_page(;$) {
4372
#*
4373
# display how to enable/disable javascript and cookies
4374
#*
4375
my ($spacing) = @_; # spacing for pretty printing HTML output
4376
if (!$spacing) { $spacing = ""; }
4377
if ($spacing eq 0) { $spacing = ""; }
4378
4379
my $output = "enable/disable js and cookies";
4380
4381
return $output; # the howto disable/enable js page in a scalar
4382
#usage: print display_js_page("");
4383
}
4384
4385
########################
4386
sub display_help_page($;$) {
4387
#*
4388
# to display the help page!
4389
#*
4390
my ($spacing, $target) = @_; # spacing for pretty printing HTML output && form target (optional)
4391
if (!$spacing) { $spacing = ""; }
4392
4393
my $rv = "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td align=center>";
4394
$rv .= "help page";
4395
$rv .= "</td></tr></table>";
4396
4397
return $rv; # the help page in a scalar
4398
#usage: print display_help_page("");
4399
}
4400
4401
########################
4402
sub subscribe_now(;$) {
4403
#*
4404
# displays a subscribe today page!
4405
#*
4406
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
4407
if (!$spacing) { $spacing = ""; }
4408
4409
my $rv = "<table border=0 cellpadding=0 cellspacing=0><tr><td align=center>";
4410
{ my %img;
4411
$img{tag} = "img";
4412
$img{src} = "/images/site/sub.png";
4413
$img{width} = "123";
4414
4415
$rv .= Html2::tag(\%img);
4416
} # end subscribe image
4417
$rv .= "</td><td class=spacerx_large></td><td align=center>";
4418
$rv .= "This page is for Premium Members only," . Html2::br() . Html2::br();
4419
$rv .= "or the requested page doesn't exist.";
4420
$rv .= "</td></tr><tr><td class=spacery_large colspan=3>";
4421
$rv .= "</td></tr><tr><td align=center colspan=3>";
4422
{ my %button;
4423
$button{tag} = "button";
4424
$button{type} = "button";
4425
$button{class} = "big_button";
4426
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("PAY_PAGE") . "\";";
4427
$button{title} = "Go Premium!";
4428
4429
$button{innerHTML} = "Click here to get your" . Html2::br();
4430
$button{innerHTML} .= Html2::italicize("Premium Membership") . " TODAY!";
4431
4432
$rv .= Html2::tag(\%button);
4433
} # end subscribe button
4434
$rv .= "</td></tr><tr><td class=spacery_large colspan=3>";
4435
$rv .= "</td></tr><tr><td align=center colspan=3>";
4436
$rv .= "Costs are dirt cheap" . Html2::br();
4437
$rv .= "Membership starts at just ";
4438
{ my %font;
4439
$font{tag} = "font";
4440
$font{class} = "notice";
4441
$font{innerHTML} = "\%1." . Html2::tag({tag=>"sup", innerHTML=>"00"});
4442
4443
$rv .= Html2::tag(\%font);
4444
} # end cost
4445
$rv .= " a month (CAD)!";
4446
$rv .= "</td></tr><tr><td class=spacery_largest colspan=3>";
4447
$rv .= "</td></tr><tr><td align=center colspan=3>";
4448
$rv .= "<table border=0 cellpadding=0 cellspacing=0><tr><td>";
4449
$rv .= Html2::italicize("Premium Membership") . " features access to:" . Html2::br();
4450
{ my %ul;
4451
$ul{tag} = "ul";
4452
$ul{innerHTML} = "";
4453
4454
{ my %li;
4455
$li{tag} = "li";
4456
$li{innerHTML} = "the store";
4457
4458
$ul{innerHTML} .= Html2::tag(\%li);
4459
}
4460
4461
{ my %li;
4462
$li{tag} = "li";
4463
$li{innerHTML} = "messaging";
4464
4465
$ul{innerHTML} .= Html2::tag(\%li);
4466
}
4467
4468
{ my %li;
4469
$li{tag} = "li";
4470
$li{innerHTML} = "fuck buddies";
4471
4472
$ul{innerHTML} .= Html2::tag(\%li);
4473
}
4474
4475
{ my %li;
4476
$li{tag} = "li";
4477
$li{innerHTML} = "photos";
4478
4479
$ul{innerHTML} .= Html2::tag(\%li);
4480
}
4481
4482
$rv .= Html2::tag(\%ul);
4483
}
4484
4485
{ my %font;
4486
$font{tag} = "font";
4487
$font{class} = "notice";
4488
$font{innerHTML} = "and more!";
4489
4490
$rv .= Html2::tag(\%font);
4491
}
4492
4493
$rv .= "</td></tr></table>";
4494
$rv .= "</td></tr></table>";
4495
4496
return $rv; # the subscribe today page in a scalar
4497
#usage: my $str = subscribe_now();
4498
}
4499
4500
########################
4501
sub display_pay_page(;$$) {
4502
#*
4503
# to display the subscribe page
4504
# this will check if the loggedin user is a subscriber or not
4505
# and display the appropriate page
4506
# form target will default to "_top" when not supplied
4507
# otherwise, you may use any valid html "target" you wish
4508
#*
4509
my ($spacing, $target) = @_; # spacing for pretty printing HTML output (optional) && form target (optional)
4510
if (!$spacing) { $spacing = ""; }
4511
if (not $target) { $target = "_top"; }
4512
4513
my $DEBUG_PP = Bc_sql::get_constant("DEBUG_PAYPAL");
4514
my $rv = "";
4515
4516
if (not $Bc_sql::LOGGEDIN) {
4517
$rv = subscribe_now($spacing);
4518
} else {
4519
4520
$rv = "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td align=center nowrap>";
4521
4522
if (User::isUserSubscriber($Bc_sql::LOGGEDIN)) {
4523
$rv .= "You are a subscriber!" . Html2::br() . Html2::br();
4524
$rv .= "Member Since: " . Html2::embolden($Bc_sql::USER_DATA->{enrolled}) . Html2::br();
4525
my $t = $Bc_sql::USER_DATA->{subscription_type};
4526
$rv .= "Premium Membership Term: " . Html2::embolden(ucfirst(get_config_asWord("membership_types", $t))) . Html2::br();
4527
my $d = $Bc_sql::USER_DATA->{subscription_date};
4528
if ($t eq 4) { $d = add_date($d, 1000, "y"); }
4529
elsif ($t eq 5) { $d = add_date($d, 6, "m"); }
4530
elsif ($t eq 3) { $d = add_date($d, 12, "m"); }
4531
elsif ($t eq 2) { $d = add_date($d, 1, "m"); }
4532
elsif ($t eq 6) { $d = add_date($d, 3, "m"); }
4533
$rv .= "Premium Expires: " . Html2::embolden($d) . Html2::br() . Html2::br();
4534
$rv .= Html2::small("Premium Membership cannot be cancelled");
4535
# end if User::isUserSubscriber
4536
} # end if User::isUserSubscriber($Bc_sql::LOGGEDIN)
4537
else {
4538
{ my %form;
4539
$form{tag} = "form";
4540
$form{method} = "post";
4541
$form{target} = "_top";
4542
$form{innerHTML} = "";
4543
4544
if (not $DEBUG_PP) {
4545
$form{action} = "https://www.paypal.com/cgi-bin/webscr";
4546
4547
$form{innerHTML} .= Html2::tag({tag=>"big", class=>"notsobig", innerHTML=>"By subscribing today, you unlock your inbox," . Html2::br() . "fuck buddies/blocked lists, and scoring/rating system!" . Html2::br() . Html2::br()});
4548
$form{innerHTML} .= "Upon clicking the buy now button, you will be taken" . Html2::br();
4549
$form{innerHTML} .= "to the paypal website - they will handle the transaction" . Html2::br();
4550
$form{innerHTML} .= "and tell us whether it completed, or declined." . Html2::br() . Html2::br();
4551
4552
$form{innerHTML} .= Html2::embolden("You can use your paypal funds, your bank account, or a major credit card!") . Html2::br() . Html2::br();
4553
4554
$form{innerHTML} .= "Select a subscription below, and click \"Buy Now\"" . Html2::br() . Html2::small(Html2::br());
4555
{ my %input;
4556
$input{tag} = "input";
4557
$input{type} = "hidden";
4558
$input{name} = "hosted_button_id";
4559
$input{value} = "38BA5XWM3H2VE";
4560
4561
$form{innerHTML} .= Html2::tag(\%input);
4562
}
4563
4564
# end if not $DEBUG_PP
4565
} else {
4566
$form{action} = "https://www.sandbox.paypal.com/cgi-bin/webscr";
4567
4568
$form{innerHTML} .= "<table border=$TABLE_BORDER class=subnavbar><tr><td class=subtitle>SANDBOX MODE</td></tr></table>" . Html2::br();
4569
4570
{ my %input;
4571
$input{tag} = "input";
4572
$input{type} = "hidden";
4573
$input{name} = "hosted_button_id";
4574
$input{value} = "4P55ABKA7ZE9S";
4575
4576
$form{innerHTML} .= Html2::tag(\%input);
4577
}
4578
# end else of if not $DEBUG_PP
4579
}
4580
4581
$form{innerHTML} .= "Choose a membership term below, and click the 'Buy Now' button" . Html2::br();
4582
$form{innerHTML} .= "Upon completing the PayPal process, PayPal will bring you to this page" . Html2::br();
4583
$form{innerHTML} .= "Your account here will " . Html2::embolden("not immediately") . " upgrade. Instead, PayPal" . Html2::br();
4584
$form{innerHTML} .= "will, after a minute or so, send Night Stand a special messsage stating" . Html2::br();
4585
$form{innerHTML} .= "whether the transaction was successful or not. If all went well," . Html2::br();
4586
$form{innerHTML} .= "Night Stand will update your profile and access to all Premium member" . Html2::br();
4587
$form{innerHTML} .= "pages will be made available." . Html2::br() . Html2::br();
4588
4589
{ my %input;
4590
$input{tag} = "input";
4591
$input{type} = "hidden";
4592
$input{name} = "cmd";
4593
$input{value} = "_s-xclick";
4594
4595
$form{innerHTML} .= Html2::tag(\%input);
4596
} # end hidden cmd input
4597
4598
{ my %input;
4599
$input{tag} = "input";
4600
$input{type} = "hidden";
4601
$input{name} = "custom";
4602
$input{value} = $Bc_sql::LOGGEDIN;
4603
4604
$form{innerHTML} .= Html2::tag(\%input);
4605
} # end hidden custom input
4606
4607
{ my %input;
4608
$input{tag} = "input";
4609
$input{type} = "hidden";
4610
$input{name} = "currency_code";
4611
$input{value} = "CAD";
4612
4613
$form{innerHTML} .= Html2::tag(\%input);
4614
} # end hidden currency input
4615
4616
{ my %input;
4617
$input{tag} = "input";
4618
$input{type} = "hidden";
4619
$input{name} = "on0";
4620
$input{value} = "subscription_type";
4621
4622
$form{innerHTML} .= Html2::tag(\%input);
4623
} # end hidden on0 input
4624
4625
{ my %select;
4626
$select{tag} = "select";
4627
$select{name} = "os0";
4628
$select{innerHTML} = "";
4629
4630
{ my %option;
4631
$option{tag} = "option";
4632
$option{value} = "monthly";
4633
$option{innerHTML} = "1 Month \$" . Bc_sql::get_constant("MONTLY_SUBSCRIPTION_COST");
4634
4635
$select{innerHTML} .= Html2::tag(\%option);
4636
} # end monthly option
4637
4638
{ my %option;
4639
$option{tag} = "option";
4640
$option{value} = "6months";
4641
$option{innerHTML} = "6 Months \$" . Bc_sql::get_constant("SEMI_YEARLY_SUBSCRIPTION_COST");
4642
4643
$select{innerHTML} .= Html2::tag(\%option);
4644
}
4645
4646
{ my %option;
4647
$option{tag} = "option";
4648
$option{value} = "yearly";
4649
$option{innerHTML} = "1 Year \$" . Bc_sql::get_constant("YEARLY_SUBSCRIPTION_COST");
4650
4651
$select{innerHTML} .= Html2::tag(\%option);
4652
}
4653
4654
$form{innerHTML} .= Html2::tag(\%select) . Html2::br() . Html2::small(Html2::br());
4655
} # end subscription type dropdown
4656
4657
{ my %input;
4658
$input{tag} = "input";
4659
$input{style} = "background: none; border: none; box-shadow: none;";
4660
$input{type} = "image";
4661
$input{src} = "https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif";
4662
$input{border} = "0";
4663
$input{name} = "submit";
4664
$input{alt} = "PayPal - The safer, easier way to pay online!";
4665
$input{title} = $input{alt};
4666
4667
$form{innerHTML} .= Html2::tag(\%input) . Html2::br();
4668
}
4669
4670
$form{innerHTML} .= Html2::italicize(Html2::embolden("Remember:") . " Please allow 1 to 6 minutes for delivery!") . " :)";
4671
4672
$rv .= Html2::tag(\%form);
4673
} # end form
4674
4675
if (get_param("pp") eq "1") {
4676
my $qp = $Bc_sql::QUERY_PAGE;
4677
my $wp = Bc_sql::get_constant("WELCOME_PAGE");
4678
$rv .= "You have returned from PayPal. We are now awaiting PayPal's message to confirm your transaction." . Html2::br();
4679
$rv .= "Please, wait a few seconds here while we wait for their message to come in. When it does, your";
4680
$rv .= "account will be updated, and this page will refresh.";
4681
4682
{ my %script;
4683
$script{tag} = "script";
4684
$script{innerHTML} = "\n" .
4685
"var time = 4000;\n" .
4686
"\n" .
4687
"function check() {\n" .
4688
" var xhttp = new XMLHttpRequest();\n" .
4689
" xhttp.onreadystatechange = function() {\n" .
4690
" if (xhttp.readyState == 4 && xhttp.status == 200) {\n" .
4691
" if (xhttp.responseText == 1) {\n" .
4692
" console_msg(\"premium member!\");\n" .
4693
" console_msg(\"redirecting...\");\n" .
4694
" document.location.href = \"/?$Bc_sql::QUERY_PAGE=$wp\"; // send to homepage...\n" .
4695
" } else {\n" .
4696
" console_msg(\"not premium member!\");\n" .
4697
" setTimeout(check, time);\n" .
4698
" }\n" .
4699
" }\n" .
4700
" }\n" .
4701
" xhttp.open(\"GET\", \"checkpremium.pl\", true);\n" .
4702
" xhttp.send();\n" .
4703
" console_msg(\"checking premium status...\");\n" .
4704
"}\n" .
4705
"\n" .
4706
"setTimeout(check, time);\n";
4707
4708
$rv .= Html2::tag(\%script);
4709
} # end javascript
4710
} # end if Bc_misc::get_param("pp") eq 1
4711
} # end else of if User::isUserSubscriber($Bc_sql::LOGGEDIN)
4712
4713
$rv .= "</td></tr></table>";
4714
}
4715
4716
return $rv; # the pay page in a scalar
4717
#usage: print display_pay_page(' ');
4718
}
4719
4720
########################
4721
sub display_photos_page(;$$) {
4722
#*
4723
# returns the loggedin user's photo page, and selected sub-page
4724
#*
4725
my ($subpage, $spacing) = @_; # a sub-page of the photos page (optional, default = PHOTOS_UPLOADED_PAGE) && spacing for pretty printing HTML output (optional)
4726
if (!$spacing) { $spacing = ""; }
4727
$spacing = spaces($spacing); # converts $spacing to actual spaces
4728
if (not $subpage) { $subpage = Bc_sql::get_constant("PHOTOS_UPLOADED_PAGE"); }
4729
4730
my $PHOTOS_DEBUG = 0;
4731
4732
if (
4733
$subpage ne Bc_sql::get_constant("PHOTOS_UPLOADED_PAGE") and
4734
$subpage ne Bc_sql::get_constant("PHOTOS_UPLOAD_PAGE") and
4735
$subpage ne Bc_sql::get_constant("PHOTOS_EDIT_PAGE")
4736
) {
4737
$subpage = Bc_sql::get_constant("PHOTOS_UPLOADED_PAGE");
4738
}
4739
4740
my $output = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td align=center>";
4741
4742
my $urlFN = "";
4743
if ($PHOTOS_DEBUG) { $urlFN = "&urlFN=debug.pl"; }
4744
4745
if ($subpage eq Bc_sql::get_constant("PHOTOS_UPLOAD_PAGE")) {
4746
$output .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=400><tr><td>";
4747
$output .= "Images you upload are allowed to contain nudity, but not graphic sexual content. All photos must contain an image of the account holder(s) (ie: no pictures of any child(ren))." . Html2::br() . Html2::br();
4748
4749
$output .= "Uploaded images remain your property and responsibility - Night Stand disclaims any liability. Night Stand only reserves the right to display user provided content. Any content deemed inappropriate, pornographic, illegal, or in anyway unacceptable will result in the content being removed. Repeated offenses could lead to your account being banned and/or reported to authorities.";
4750
$output .= "In the event your totally appropriate image is removed by mistake, simply re-upload it (as removed content is literally deleted from the site).";
4751
$output .= "</td></tr></table>" . Html2::br();
4752
4753
$output .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td class=subnavbar>";
4754
{ my %form;
4755
$form{tag} = "form";
4756
$form{action} = "/upload.pl";
4757
$form{method} = "post";
4758
$form{enctype} = "multipart/form-data";
4759
$form{innerHTML} = "";
4760
4761
{ my %input;
4762
$input{tag} = "input";
4763
$input{type} = "file";
4764
$input{name} = "pic";
4765
$input{accept} = "image/*";
4766
4767
$form{innerHTML} .= Html2::tag(\%input) . Html2::br();
4768
} # end file input
4769
4770
{ my %button;
4771
$button{tag} = "button";
4772
$button{type} = "submit";
4773
$button{class} = "green";
4774
$button{innerHTML} = "Upload";
4775
4776
$form{innerHTML} .= Html2::tag(\%button);
4777
} # end upload button
4778
4779
{ my %button;
4780
$button{tag} = "button";
4781
$button{type} = "button";
4782
$button{class} = "red";
4783
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("PHOTOS_PAGE") . "\";";
4784
$button{innerHTML} = "Cancel";
4785
4786
$form{innerHTML} .= Html2::tag(\%button);
4787
} # end cancel button
4788
4789
$output .= Html2::tag(\%form);
4790
} # end form
4791
$output .= "</td></tr></table>";
4792
} elsif ($subpage eq Bc_sql::get_constant("PHOTOS_EDIT_PAGE")) {
4793
# asdf
4794
} else {
4795
$output .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td class=subnavbar>";
4796
4797
{ my %button;
4798
$button{tag} = "button";
4799
$button{type} = "button";
4800
$button{class} = "blue";
4801
$button{onclick} = "document.location=\"/setdp.pl?c=1\";";
4802
$button{innerHTML} = "Clear Display Pic";
4803
4804
$output .= Html2::tag(\%button) . " " . Html2::embolden("|") . " ";
4805
} # end clear display pic button
4806
4807
{ my %button;
4808
$button{tag} = "button";
4809
$button{type} = "button";
4810
$button{class} = "green";
4811
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("PHOTOS_PAGE") . "&" . Bc_sql::get_constant("QUERY_PHOTOS_PAGE") . "=" . Bc_sql::get_constant("PHOTOS_UPLOAD_PAGE") . "\";";
4812
$button{innerHTML} = "Add Pic";
4813
4814
$output .= Html2::tag(\%button);
4815
} # end add pic button
4816
$output .= "</td></tr></table>";
4817
}
4818
4819
$output .= "</td></tr></table>" . Html2::br();
4820
4821
if ($subpage eq Bc_sql::get_constant("PHOTOS_UPLOADED_PAGE")) {
4822
# well, the next two lines really ought to be a function all their own, but for now, we'll just do it long-hand
4823
my $sql = "select ID from images where UID = " . $Bc_sql::DB->quote($Bc_sql::LOGGEDIN);
4824
my $ref = Bc_sql::sql_execute($sql, "display photos page");
4825
my @imgs = ();
4826
if (ref $ref eq "HASH") {
4827
push @imgs, $ref->{ID};
4828
} else {
4829
if (@$ref) {
4830
foreach my $idRef (@$ref) {
4831
push @imgs, $idRef->{ID};
4832
}
4833
}
4834
}
4835
4836
$output .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td align=left>";
4837
if (@imgs) {
4838
{ my %fs;
4839
$fs{tag} = "fieldset";
4840
$fs{innerHTML} = "";
4841
4842
{ my %legend;
4843
$legend{tag} = "legend";
4844
$legend{align} = "center";
4845
$legend{innerHTML} = Html2::embolden(scalar @imgs) . " " . Bc_misc::pluralize("photo", scalar @imgs);
4846
4847
$fs{innerHTML} .= Html2::tag(\%legend);
4848
} # end legend
4849
my $MAX_COLS = 4;
4850
my $colCount = 1; # first column
4851
my $count = 0;
4852
# scenario: size of @imgs = 2
4853
4854
{ my %div;
4855
$div{tag} = "div";
4856
$div{class} = "album";
4857
$div{innerHTML} = "";
4858
4859
foreach my $img (@imgs) {
4860
my $img_name = Bc_misc::shorten_str(get_photo_name($img), 10);
4861
my $img_desc = get_photo_desc($img);
4862
4863
if ($count < @imgs) {
4864
# first time:
4865
# $count = 0 here
4866
# $colCount = 1 here
4867
# second time:
4868
# $count = 1 here
4869
# $colCount = 2 here
4870
my $fid = is_flagged($Bc_sql::LOGGEDIN, $img, "i");
4871
$div{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 class='item'><tr><td align=center";
4872
if ($img_name) {
4873
$div{innerHTML} .= ">";
4874
$div{innerHTML} .= "$img_name";
4875
$div{innerHTML} .= "</td></tr><tr><td align=center height=66>";
4876
} else {
4877
$div{innerHTML} .= " height=66>";
4878
}
4879
4880
if (not $fid) {
4881
my %img;
4882
$img{tag} = "img";
4883
$img{src} = "/getimage.pl?id=$img";
4884
$img{title} = "View Image";
4885
4886
my $modal = display_modal("pic$img", "img,View image,/getimage.pl?id=$img&th=1", "", $img_name, Html2::tag(\%img), $img_desc, "");
4887
$div{innerHTML} .= $modal;
4888
} else {
4889
my %img;
4890
$img{tag} = "img";
4891
$img{src} = "/img.pl?i=site/flagged.png";
4892
$img{height} = "75";
4893
$img{style} = "border: 1px solid transparent;";
4894
$img{title} = "Image not displayed because it has been flagged as inappropriate";
4895
4896
$div{innerHTML} .= Html2::tag(\%img);
4897
}
4898
$div{innerHTML} .= "</td></tr><tr><td align=center>";
4899
if ($fid) {
4900
$div{innerHTML} .= "<table class='subnavbar_dark' style='padding: 0px; margin: 2px 0px 0px 0px;'><tr><td style='text-align: left;'>";
4901
$div{innerHTML} .= Html2::small(Html2::italicize("FLAGGED"));
4902
} else {
4903
$div{innerHTML} .= "<table class='subnavbar_dark' style='width: 100%; padding: 0px; margin: 3px 0px 0px 0px;'><tr><td width=65>";
4904
$div{innerHTML} .= "<table border=0 cellpadding=0 cellspacing=0 style='min-width: 100%;'><tr><td align=";
4905
if ($img != get_user_dpID()) {
4906
$div{innerHTML} .= "left>";
4907
{ my %link;
4908
$link{tag} = "a";
4909
$link{href} = "/setdp.pl?id=$img";
4910
$link{title} = "Set as Profile Image";
4911
$link{innerHTML} = "";
4912
4913
{ my %img;
4914
$img{tag} = "img";
4915
$img{src} = "/images/" . Bc_sql::get_constant("IMAGE_ASPROFILE_ICON");
4916
$img{height} = "16";
4917
$img{class} = "enlarge clickable";
4918
4919
$link{innerHTML} .= Html2::tag(\%img);
4920
}
4921
4922
$div{innerHTML} .= Html2::tag(\%link);
4923
} # end set as profile image link
4924
$div{innerHTML} .= "</td><td style='text-align: right;'>";
4925
} else {
4926
$div{innerHTML} .= "right>";
4927
}
4928
4929
{ my %link;
4930
$link{tag} = "a";
4931
$link{href} = "?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("PHOTOS_PAGE") . "&" . Bc_sql::get_constant("QUERY_PHOTOS_PAGE") . "=" . Bc_sql::get_constant("PHOTOS_EDIT_PAGE") . "&imgid=$img";
4932
$link{title} = "Edit Image";
4933
$link{innerHTML} = "";
4934
4935
{ my %img;
4936
$img{tag} = "img";
4937
$img{src} = "/images/" . Bc_sql::get_constant("IMAGE_EDIT_ICON");
4938
$img{height} = "16";
4939
$img{class} = "enlarge clickable";
4940
4941
$link{innerHTML} .= Html2::tag(\%img);
4942
}
4943
4944
$div{innerHTML} .= Html2::tag(\%link);
4945
} # end edit image link
4946
4947
{ my %link;
4948
$link{tag} = "a";
4949
$link{href} = "/delimage.pl?id=$img";
4950
$link{title} = "Instantly Delete this Image";
4951
$link{innerHTML} = "";
4952
4953
{ my %img;
4954
$img{tag} = "img";
4955
$img{src} = "/images/" . Bc_sql::get_constant("IMAGE_DELETE_ICON");
4956
$img{height} = "16";
4957
$img{class} = "enlarge clickable";
4958
4959
$link{innerHTML} .= Html2::tag(\%img);
4960
}
4961
4962
$div{innerHTML} .= Html2::tag(\%link);
4963
}
4964
$div{innerHTML} .= "</td></tr></table>";
4965
}
4966
$div{innerHTML} .= "</td></tr></table>";
4967
$div{innerHTML} .= "</td></tr></table>";
4968
$count++;
4969
4970
if ($colCount < $MAX_COLS) {
4971
$colCount++;
4972
} else {
4973
$colCount = 1;
4974
}
4975
}
4976
} # end foreach (@imgs)
4977
4978
$fs{innerHTML} .= Html2::tag(\%div);
4979
}
4980
4981
$fs{innerHTML} .= "</td></tr></table>";
4982
4983
$output .= Html2::tag(\%fs);
4984
} # end fieldset
4985
} else { # else of if @imgs
4986
$output .= "You have no images! ";
4987
4988
{ my %link;
4989
$link{tag} = "a";
4990
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("PHOTOS_PAGE") . "&" . Bc_sql::get_constant("QUERY_PHOTOS_PAGE") . "=" . Bc_sql::get_constant("PHOTOS_UPLOAD_PAGE");
4991
$link{title} = "Upload an Image";
4992
$link{innerHTML} = "Upload";
4993
4994
$output .= Html2::tag(\%link);
4995
} # end upload pic link
4996
4997
$output .= " one or two?" . Html2::br();
4998
} # end else of if @imgs
4999
5000
$output .= "</td></tr></table>";
5001
}
5002
5003
elsif ($subpage eq Bc_sql::get_constant("PHOTOS_EDIT_PAGE")) {
5004
my $img = Bc_misc::get_param("imgid");
5005
my $sql = "select * from images where UID = " . $Bc_sql::DB->quote($Bc_sql::LOGGEDIN) . " and ID = " . $Bc_sql::DB->quote($img);
5006
my $ref = Bc_sql::sql_execute($sql, "display photos page");
5007
my @imgs = ();
5008
if (ref $ref eq "HASH") {
5009
{ my %form;
5010
$form{tag} = "form";
5011
$form{action} = "/edit_photo.pl";
5012
$form{method} = "post";
5013
$form{innerHTML} = "";
5014
5015
$output .= "<table border=0 cellpadding=0 cellspacing=0><tr><td align=right height=1 class=copyright>";
5016
{ my %input;
5017
$input{tag} = "input";
5018
$input{type} = "hidden";
5019
$input{name} = "imgid";
5020
$input{value} = $ref->{ID};
5021
5022
$form{innerHTML} .= Html2::tag(\%input);
5023
} # end hidden imgid input
5024
$form{innerHTML} .= "Image ID: " . Html2::embolden($ref->{ID});
5025
$form{innerHTML} .= "</td></tr><tr><td height=1>";
5026
$form{innerHTML} .= "Title ";
5027
{ my %input;
5028
$input{tag} = "input";
5029
$input{name} = "imgname";
5030
$input{value} = $ref->{name};
5031
$input{size} = "25";
5032
5033
$form{innerHTML} .= Html2::tag(\%input);
5034
} # end img name input
5035
$form{innerHTML} .= "</td></tr><tr><td align=center height=1>";
5036
{ my %img;
5037
$img{tag} = "img";
5038
$img{src} = "/getimage.pl?id=$img&th=1";
5039
$img{height} = "200";
5040
$img{title} = "This Image is the Thumbnailed Version!";
5041
5042
$form{innerHTML} .= Html2::tag(\%img) . Html2::br();
5043
} # end img
5044
$form{innerHTML} .= "</td></tr><tr><td align=center height=1>";
5045
$form{innerHTML} .= "Description";
5046
$form{innerHTML} .= "</td></tr><tr><td align=center height=1>";
5047
{ my %ta;
5048
$ta{tag} = "textarea";
5049
$ta{name} = "imgdesc";
5050
$ta{rows} = "4";
5051
$ta{cols} = "30";
5052
$ta{innerHTML} = $ref->{desc};
5053
5054
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
5055
}
5056
$form{innerHTML} .= "</td></tr><tr><td align=center height=1>";
5057
$form{innerHTML} .= "<table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td align=left height=1 width=33%>";
5058
{ my %button;
5059
$button{tag} = "button";
5060
$button{type} = "button";
5061
$button{class} = "red";
5062
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("PHOTOS_PAGE") . "\";";
5063
$button{innerHTML} = "Cancel";
5064
5065
$form{innerHTML} .= Html2::tag(\%button);
5066
} # end cancel button
5067
$form{innerHTML} .= "</td><td align=center height=1 width=33%>";
5068
{ my %button;
5069
$button{tag} = "button";
5070
$button{type} = "reset";
5071
$button{class} = "yellow";
5072
$button{innerHTML} = "Reset";
5073
5074
$form{innerHTML} .= Html2::tag(\%button);
5075
} # end reset button
5076
$form{innerHTML} .= "</td><td align=right height=1 width=33%>";
5077
{ my %button;
5078
$button{tag} = "button";
5079
$button{type} = "submit";
5080
$button{class} = "green";
5081
$button{innerHTML} = "Save";
5082
5083
$form{innerHTML} .= Html2::tag(\%button);
5084
} # end save button
5085
$form{innerHTML} .= "</td></tr></table>";
5086
$form{innerHTML} .= "</td></tr></table>";
5087
5088
$output .= Html2::tag(\%form);
5089
} # end form
5090
} else {
5091
$output .= "invalid image ID" . Html2::br();
5092
}
5093
}
5094
5095
else {
5096
$output .= "no such sub-page in photos: $subpage" . Html2::br();
5097
}
5098
5099
return $output; # the photos page in a scalar
5100
#usage: print display_photos_page("", "");
5101
}
5102
5103
########################
5104
sub display_blocked(;$$) {
5105
#*
5106
# creates a list of blocked users, displaying each user in 'mini-card' format
5107
#*
5108
5109
my ($uid, $spacing) = @_; # uid (optional, default = $Bc_sql::LOGGEDIN) && spacing for pretty printing HTML output (optional)
5110
if (not $uid) { $uid = $Bc_sql::LOGGEDIN; }
5111
if (!$spacing) { $spacing = ""; }
5112
my $rv = "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td colspan=9 align=center>";
5113
$rv .= Html2::hr() . "</td></tr><tr>";
5114
my $maxwidth = 175;
5115
if (Bc_sql::user_exists($uid)) {
5116
my @blocks = User::get_user_blocked_users($uid); # an array to store blocked info
5117
# uh oh. this presents a problem, eh? lol
5118
# the above statement COULD result in either 0, array ref, or hash ref!
5119
# in any case, it will be a scalar.
5120
if (@blocks) {
5121
$rv .= "<td align=center colspan=7>";
5122
{ my %div;
5123
$div{tag} = "div";
5124
$div{class} = "title";
5125
$div{innerHTML} = "Your " . Html2::embolden(@blocks) . " " . Bc_misc::pluralize("Block", @blocks);
5126
5127
$rv .= Html2::tag(\%div) . Html2::hr();
5128
}
5129
$rv .= "</td></tr><tr><td valign=top width=$maxwidth>";
5130
5131
if (@blocks >= 1) {
5132
for (my $i = 0; $i < @blocks; $i++) {
5133
my $blocked = $blocks[$i];
5134
$rv .= display_user_card_mini($blocked, "", 0);
5135
5136
if ((modulo($i+1, 4))[0] ne 0) {
5137
if ($i < @blocks-1) {
5138
$rv .= "</td><td width=15></td><td valign=top width=$maxwidth>";
5139
} else {
5140
my $remainder = 4 - (modulo(@blocks, 4))[0];
5141
my $cols = $remainder * 2;
5142
$rv .= "</td><td colspan=$cols $remainder> ";
5143
}
5144
} else {
5145
$rv .= "</td></tr><tr><td colspan=9 height=9>";
5146
$rv .= "</td></tr><tr><td valign=top width=$maxwidth>";
5147
}
5148
}
5149
} else {
5150
$rv .= "Excellent! You have not blocked anyone.";
5151
}
5152
} else { # no blocks...
5153
$rv .= "<td valign=top align=center>";
5154
$rv .= "You have no blocks!" . Html2::br();
5155
}
5156
} else {
5157
$rv .= "<td valign=top align=center>No such user: $uid!";
5158
}
5159
5160
$rv .= "</td></tr></table>";
5161
5162
return $rv; # a scalar
5163
#usage: my $blockedList = display_blocked('123abc', ' ');
5164
}
5165
5166
########################
5167
sub display_browse(;$$) {
5168
#*
5169
# displays the browse page
5170
#*
5171
my ($uid, $spacing) = @_; # uid (optional, default = $Bc_sql::LOGGEDIN) && spacing for pretty printing HTML output (optional)
5172
if (not $uid) { $uid = $Bc_sql::LOGGEDIN; }
5173
if (!$spacing) { $spacing = ""; }
5174
5175
my $rv = "";
5176
5177
my $BRPAGE = Bc_sql::get_constant("BROWSE_PAGE");
5178
my $PPAGE = Bc_sql::get_constant("PROFILE_PAGE");
5179
my $SP = Bc_sql::get_constant("SEARCH_PAGE");
5180
my $QST = Bc_sql::get_constant("QUERY_SEARCH_TERMS");
5181
5182
# so, we need some parameters
5183
# if we get no parameters, display the "browse homepage"
5184
my $page = Bc_misc::get_param("bp");
5185
5186
my $subtitle = "Home";
5187
5188
if ($page) { $subtitle = ucfirst($page); }
5189
5190
# yes, check again!
5191
if ($page) {
5192
# show the page being browsed!
5193
$rv = "Browsing By " . $subtitle . " - ";
5194
{ my %link;
5195
$link{tag} = "a";
5196
$link{href} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE";
5197
$link{title} = "Browse Home";
5198
$link{innerHTML} = "Browse Home";
5199
5200
$rv .= Html2::tag(\%link);
5201
} # end browse link
5202
$rv .= Html2::br();
5203
if ($page eq "age") {
5204
$rv .= "not complete";
5205
# end if ($page eq "age")
5206
} elsif ($page eq "nickname") {
5207
# so? grab a list of user names, sorted alphabetically?
5208
# nay. create an alphabet, grab five users of each letter
5209
# create a link to a list of all user's whose name starts with
5210
# each letter
5211
my $letter = lc(get_param("letter"));
5212
if ($letter) {
5213
$rv .= "browsing by the letter " . Html2::embolden(uc($letter)) . Html2::br() . Html2::br() . Html2::br();
5214
my $sql = "select * from users where nickname like " . $Bc_sql::DB->quote($letter . "%") . " and not security='3' and not security='4'";
5215
my $r = Bc_sql::sql_execute($sql, "display browse");
5216
if (ref $r eq "HASH") {
5217
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5218
} else {
5219
if (@$r) {
5220
foreach my $u (@$r) {
5221
$rv .= Html2::profile_link($u->{ID}) . Html2::br();
5222
}
5223
}
5224
}
5225
} # end if $letter
5226
else {
5227
$rv .= Html2::br() . Html2::br();
5228
5229
{ my %flexbox;
5230
$flexbox{tag} = "div";
5231
$flexbox{class} = "bordered flexboxed";
5232
$flexbox{style} = "justify-content: center; gap: 8px;";
5233
$flexbox{innerHTML} = "";
5234
5235
for (my $i = 0; $i < 26; $i++) { # letters of the alphabet
5236
{ my %letter;
5237
$letter{tag} = "div";
5238
$letter{class} = "bordered nowrap normal-panel";
5239
$letter{innerHTML} = "";
5240
5241
my $c = chr(65+$i);
5242
my $sql = "select * from users where nickname like " . $Bc_sql::DB->quote($c . "%");
5243
my $r = Bc_sql::sql_execute($sql, "display browse");
5244
if ($r) {
5245
{ my %link;
5246
$link{tag} = "a";
5247
$link{href} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=nickname&letter=$c";
5248
$link{title} = "Browse by Letter";
5249
$link{innerHTML} = $c;
5250
5251
$letter{innerHTML} .= Html2::tag(\%link) . " ";
5252
}
5253
5254
{ my %bold;
5255
$bold{tag} = "b";
5256
$bold{innerHTML} = "";
5257
5258
my $num = 0;
5259
if (ref $r eq "ARRAY") {
5260
if (@$r) {
5261
$bold{innerHTML} .= @$r;
5262
} else {
5263
$bold{innerHTML} .= "0";
5264
}
5265
$num = @$r;
5266
} else {
5267
$bold{innerHTML} .= "1";
5268
$num = 1;
5269
}
5270
5271
$letter{innerHTML} .= Html2::tag(\%bold);
5272
5273
if ($num)
5274
{ $letter{innerHTML} .= Bc_misc::pluralize(" member", $num); } else
5275
{ $letter{innerHTML} .= Html2::embolden("0 ") . " members"; }
5276
} # end number of members for this letter
5277
5278
$letter{innerHTML} .= Html2::br();
5279
5280
{ my %ul;
5281
$ul{tag} = "ul";
5282
$ul{style} = "padding: 0px 0px 0px 20px;";
5283
$ul{innerHTML} = "";
5284
5285
if (ref $r eq "ARRAY") {
5286
if (@$r) {
5287
while (@$r > 5) { pop @$r; }
5288
5289
foreach my $u (@$r) {
5290
$ul{innerHTML} .= Html2::profile_link($u->{ID}) . Html2::br();
5291
}
5292
}
5293
} else {
5294
$ul{innerHTML} .= Html2::profile_link($r->{ID}) . Html2::br();
5295
}
5296
5297
$letter{innerHTML} .= Html2::tag(\%ul);
5298
}
5299
} # end if $r
5300
5301
$flexbox{innerHTML} .= Html2::tag(\%letter);
5302
} # end letter div
5303
} # end for (i = 0 .. < 26)
5304
5305
$rv .= Html2::tag(\%flexbox);
5306
} # end flexbox
5307
} # end else of if $letter
5308
# end elsif ($page eq "nickname")
5309
} elsif ($page eq "dob") {
5310
5311
# end elsif ($page eq "dob")
5312
} elsif ($page eq "race") {
5313
my $selected_race = Bc_misc::get_param("race");
5314
my @races = Bc_sql::get_config("races");
5315
if ($selected_race) {
5316
$rv .= @races[($selected_race-1)] . Html2::br() . Html2::br() . Html2::br();
5317
my $sql = "select * from users where race=" . $Bc_sql::DB->quote($selected_race);
5318
my $r = Bc_sql::sql_execute($sql, "display browse");
5319
if (ref $r eq "HASH") {
5320
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5321
} else {
5322
foreach my $u (@$r) {
5323
$rv .= Html2::profile_link($u->{ID}) . Html2::br();
5324
}
5325
}
5326
} else {
5327
$rv .= Html2::br() . Html2::br() . "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
5328
my $i = 1;
5329
foreach my $race (@races) {
5330
{ my %link;
5331
$link{tag} = "a";
5332
$link{href} = "/?$Bc_sql::QUERY_PAGE=$SP&sp=0&hpp=10&$QST=race,$i";
5333
$link{title} = "Search by Race";
5334
$link{innerHTML} = $race;
5335
5336
$rv .= Html2::tag(\%link);
5337
}
5338
my $sql = "select * from users where race=" . $Bc_sql::DB->quote($i);
5339
my $r = Bc_sql::sql_execute($sql, "display browse");
5340
5341
$rv .= "(";
5342
if (ref $r eq "HASH") {
5343
$rv .= Html2::embolden("1");
5344
} else {
5345
$rv .= Html2::embolden(scalar @$r);
5346
}
5347
$rv .= ")" . Html2::br();
5348
5349
{ my %ul;
5350
$ul{tag} = "ul";
5351
$ul{style} = "padding: 0px 0px 0px 20px;";
5352
$ul{innerHTML} = "";
5353
5354
if (ref $r eq "HASH") {
5355
$ul{innerHTML} .= Html2::profile_link($r->{ID}) . Html2::br();
5356
} else {
5357
if (@$r) {
5358
while (@$r > 5) { pop @$r; }
5359
foreach my $u (@$r) {
5360
$ul{innerHTML} .= Html2::profile_link($u->{ID}) . Html2::br();
5361
}
5362
} else {
5363
$ul{innerHTML} .= "none!" . Html2::br();
5364
}
5365
}
5366
$i++;
5367
5368
$rv .= Html2::tag(\%ul) . Html2::br();
5369
} # end ul
5370
}
5371
$rv .= "</td></tr></table>";
5372
}
5373
# end elsif ($page eq "race")
5374
} elsif ($page eq "boy") {
5375
my $sql = "select * from users where gender='1'";
5376
my $r = Bc_sql::sql_execute($sql, "display browse");
5377
if (ref $r eq "HASH") {
5378
$rv .= Html2::embolden("1") . " Guy" . Html2::br() . Html2::br();
5379
my %link;
5380
$link{tag} = "a";
5381
$link{href} = "/?$Bc_sql::QUERY_PAGE=$PPAGE&$Bc_sql::QUERY_UID=$r->{ID}";
5382
$link{title} = "User's Profile";
5383
$link{innerHTML} = $r->{nickname};
5384
5385
$rv .= Html2::tag(\%link) . Html2::br();
5386
} else {
5387
$rv .= Html2::embolden(scalar @$r) . " Guys" . Html2::br() . Html2::br();
5388
if (@$r) {
5389
foreach my $u (@$r) {
5390
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5391
}
5392
} else {
5393
$rv .= "none" . Html2::br();
5394
}
5395
}
5396
# end elsif ($page eq "boy")
5397
} elsif ($page eq "girl") {
5398
my $sql = "select * from users where gender='2'";
5399
my $r = Bc_sql::sql_execute($sql, "display browse");
5400
if (ref $r eq "HASH") {
5401
$rv .= Html2::embolden("1") . " Gal" . Html2::br() . Html2::br();
5402
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5403
} else {
5404
$rv .= Html2::embolden(scalar @$r) . " Gals" . Html2::br() . Html2::br();
5405
if (@$r) {
5406
foreach my $u (@$r) {
5407
$rv .= Html2::profile_link($u->{ID}) . Html2::br();
5408
}
5409
} else {
5410
$rv .= "none" . Html2::br();
5411
}
5412
}
5413
# end elsif ($page eq "girl")
5414
} elsif ($page eq "location") {
5415
$rv .= Html2::br() . Html2::br() . "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
5416
my @users = Bc_sql::get_users();
5417
my @cities = Bc_sql::get_cities();
5418
my @countries = Bc_sql::get_countries();
5419
5420
foreach my $country (@countries) {
5421
# first, display the country's name as a link to search for everyone in that country
5422
#$rv .= $country . Html2::br();
5423
my ($countrysLoc, $countrysName) = split("=", $country);
5424
5425
my $cFlag = get_country_name($countrysLoc);
5426
$cFlag =~ s/ /_/g;
5427
{ my %img;
5428
$img{tag} = "img";
5429
$img{src} = "/images/flags/flag_" . lc($cFlag) . ".png";
5430
$img{width} = "32";
5431
5432
$cFlag = Html2::tag(\%img);
5433
}
5434
$rv .= Html2::embolden($cFlag);
5435
5436
my $countrysLink = href("/?$Bc_sql::QUERY_PAGE=$Bc_sql::SEARCH_PAGE&sp=0&hpp=10&$Bc_sql::QUERY_SEARCH_TERMS=location,$countrysLoc-999", $countrysName, "", "", "style='font-size: 16pt;'", "");
5437
$rv .= $countrysLink . Html2::br(); # yes, not linked...yet
5438
5439
# now, let's get a list of cities for this country!
5440
my $cCount = 0;
5441
foreach my $citysData (@cities) {
5442
my ($coords, $citysName) = split("=", $citysData);
5443
my ($citysCountrysLoc, $citysLoc) = split("-", $coords);
5444
5445
if ($citysCountrysLoc eq $countrysLoc and
5446
$cCount < 5) {
5447
# finally, display the city's name as a link to search for everyone in that city
5448
#$rv .= " $cityData" . Html2::br();
5449
my $citysLink = href("/?$Bc_sql::QUERY_PAGE=$Bc_sql::SEARCH_PAGE&sp=0&hpp=10&$Bc_sql::QUERY_SEARCH_TERMS=location,$countrysLoc-$citysLoc", $citysName, "", "", "", "");
5450
$rv .= " $citysLink" . Html2::br();
5451
$cCount++;
5452
}
5453
}
5454
5455
$rv .= Html2::br();
5456
}
5457
5458
$rv =~ s/\,$//;
5459
$rv .= "</td></tr></table>";
5460
# end elsif ($page eq "location")
5461
} elsif ($page eq "orientation") {
5462
my @orientations = Bc_sql::get_config("orientations");
5463
my $o = Bc_misc::get_param("o");
5464
if ($o) {
5465
$rv .= @orientations[($o-1)] . Html2::br() . Html2::br() . Html2::br();
5466
my $sql = "select * from users where orientation=" . $Bc_sql::DB->quote($o);
5467
my $r = Bc_sql::sql_execute($sql, "display browse");
5468
if (ref $r eq "HASH") {
5469
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5470
} else {
5471
if (@$r) {
5472
foreach my $u (@$r) {
5473
$rv .= Html2::profile_link($u->{ID}) . Html2::br();
5474
}
5475
} else {
5476
$rv .= "none!" . Html2::br();
5477
}
5478
}
5479
} else {
5480
$rv .= Html2::br() . Html2::br();
5481
my $i = 1;
5482
$rv .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
5483
foreach my $ori (@orientations) {
5484
my $sql = "select * from users where orientation=" . $Bc_sql::DB->quote($i);
5485
my $r = Bc_sql::sql_execute($sql, "display browse");
5486
my $m = "member";
5487
if (ref $r eq "ARRAY") { $m .= "s"; }
5488
{ my %link;
5489
$link{tag} = "a";
5490
$link{href} = "/?$Bc_sql::QUERY_PAGE=$SP&sp=0&hpp=10&$QST=orientation,$i";
5491
$link{title} = "Search by Orientation";
5492
$link{innerHTML} = $ori;
5493
5494
$rv .= Html2::tag(\%link);
5495
}
5496
$rv .= "(" . Html2::embolden(scalar @$r) . ") $m" . Html2::br();
5497
5498
{ my %ul;
5499
$ul{tag} = "ul";
5500
$ul{style} = "padding: 0px 0px 0px 20px;";
5501
$ul{innerHTML} = "";
5502
5503
if (ref $r eq "ARRAY") {
5504
while (@$r > 5) { pop @$r; }
5505
foreach my $u (@$r) {
5506
$ul{innerHTML} .= Html2::profile_link($r->{ID}) . Html2::br();
5507
}
5508
}
5509
5510
$rv .= Html2::tag(\%ul) . Html2::br();
5511
} # end ul
5512
$i++;
5513
}
5514
$rv .= "</td></tr></table>";
5515
}
5516
# end elsif ($page eq "orientation")
5517
} elsif ($page eq "seeking") {
5518
my $selected_race = Bc_misc::get_param("seeking");
5519
my @races = Bc_sql::get_config("styles");
5520
if ($selected_race) {
5521
$rv .= @races[($selected_race-1)] . Html2::br() . Html2::br();
5522
my $sql = "select * from users where seeking=" . $Bc_sql::DB->quote($selected_race);
5523
my $r = Bc_sql::sql_execute($sql, "display browse");
5524
if (ref $r eq "HASH") {
5525
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5526
} else {
5527
foreach my $u (@$r) {
5528
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5529
}
5530
}
5531
} else {
5532
$rv .= Html2::br() . Html2::br() . "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
5533
my $i = 1;
5534
foreach my $race (@races) {
5535
{ my %link;
5536
$link{tag} = "a";
5537
$link{href} = "/?$Bc_sql::QUERY_PAGE=$SP&sp=0&hpp=10&$QST=seeking,$i";
5538
$link{title} = "Search by Style";
5539
$link{innerHTML} = $race;
5540
5541
$rv .= Html2::tag(\%link) . Html2::br();
5542
}
5543
my $sql = "select * from users where seeking=" . $Bc_sql::DB->quote($i);
5544
my $r = Bc_sql::sql_execute($sql, "display browse");
5545
$rv .= "(";
5546
if (ref $r eq "HASH") {
5547
$rv .= Html2::embolden("1") . " member";
5548
} else {
5549
$rv .= Html2::embolden(scalar @$r) . " members";
5550
}
5551
$rv .= ")" . Html2::br();
5552
5553
{ my %ul;
5554
$ul{tag} = "ul";
5555
$ul{style} = "padding: 0px 0px 0px 20px;";
5556
$ul{innerHTML} = "";
5557
5558
if (ref $r eq "HASH") {
5559
$ul{innerHTML} .= Html2::profile_link($r->{ID}) . Html2::br();
5560
} else {
5561
if (@$r) {
5562
while (@$r > 5) { pop @$r; }
5563
foreach my $u (@$r) {
5564
$ul{innerHTML} .= Html2::profile_link($u->{ID}) . Html2::br();
5565
}
5566
} else {
5567
$ul{innerHTML} .= "none!";
5568
}
5569
}
5570
$i++;
5571
5572
$rv .= Html2::tag(\%ul) . Html2::br();
5573
} # end ul
5574
}
5575
$rv .= "</td></tr></table>";
5576
}
5577
# end elsif ($page eq "seeking")
5578
} elsif ($page eq "erection") {
5579
my $selected_race = Bc_misc::get_param("erection");
5580
my @races = Bc_sql::get_config("erections");
5581
if ($selected_race) {
5582
$rv .= @races[($selected_race-1)] . Html2::br() . Html2::br() . Html2::br();
5583
my $sql = "select * from users where gender='1' and erection=" . $Bc_sql::DB->quote($selected_race);
5584
my $r = Bc_sql::sql_execute($sql, "display browse");
5585
if (ref $r eq "HASH") {
5586
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5587
} else {
5588
foreach my $u (@$r) {
5589
$rv .= Html2::profile_link($u->{ID}) . Html2::br();
5590
}
5591
}
5592
} # end if ($selected_race)
5593
else {
5594
$rv .= Html2::br() . Html2::br() . "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
5595
my $i = 1;
5596
foreach my $race (@races) {
5597
{ my %link;
5598
$link{tag} = "a";
5599
$link{href} = "/?$Bc_sql::QUERY_PAGE=$SP&sp=0&hpp=10&$QST=erection,$i--gender,1";
5600
$link{title} = "Search by Erection Size";
5601
$link{innerHTML} = $race;
5602
5603
$rv .= Html2::tag(\%link) . Html2::br();
5604
}
5605
my $sql = "select * from users where gender='1' and erection=" . $Bc_sql::DB->quote($i);
5606
my $r = Bc_sql::sql_execute($sql, "display browse");
5607
$rv .= "(";
5608
if (ref $r eq "HASH") {
5609
$rv .= Html2::embolden("1") . " member";
5610
} else {
5611
$rv .= Html2::embolden(scalar @$r) . " members";
5612
}
5613
$rv .= ")" . Html2::br();
5614
5615
{ my %ul;
5616
$ul{tag} = "ul";
5617
$ul{style} = "padding: 0px 0px 0px 20px;";
5618
5619
if (ref $r eq "HASH") {
5620
$ul{innerHTML} .= Html2::profile_link($r->{ID}) . Html2::br();
5621
} else {
5622
if (@$r) {
5623
while (@$r > 5) { pop @$r; }
5624
5625
foreach my $u (@$r) {
5626
$ul{innerHTML} .= Html2::profile_link($u->{ID}) . Html2::br();
5627
}
5628
} else {
5629
$ul{innerHTML} .= "none!" . Html2::br();
5630
}
5631
}
5632
$i++;
5633
5634
$rv .= Html2::tag(\%ul) . Html2::br();
5635
} # end ul
5636
} # end foreach erection size
5637
$rv .= "</td></tr></table>";
5638
} # end else of if ($selected_race)
5639
5640
} # end elsif ($page eq "erection")
5641
elsif ($page eq "bust") {
5642
my $selected_race = Bc_misc::get_param("bust");
5643
my @races = Bc_sql::get_config("busts");
5644
if ($selected_race) {
5645
$rv .= @races[($selected_race-1)] . Html2::br() . Html2::br() . Html2::br();
5646
my $sql = "select * from users where gender='2' and bust=" . $Bc_sql::DB->quote($selected_race);
5647
my $r = Bc_sql::sql_execute($sql, "display browse");
5648
if (ref $r eq "HASH") {
5649
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5650
} else {
5651
foreach my $u (@$r) {
5652
$rv .= Html2::profile_link($u->{ID}) . Html2::br();
5653
}
5654
}
5655
} else {
5656
$rv .= Html2::br() . Html2::br() . "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
5657
my $i = 1;
5658
foreach my $race (@races) {
5659
{ my %link;
5660
$link{tag} = "a";
5661
$link{href} = "/?$Bc_sql::QUERY_PAGE=$SP&sp=0&hpp=10&$QST=bust,$i--gender,2";
5662
$link{title} = "Search by Bust";
5663
$link{innerHTML} = $race;
5664
5665
$rv .= Html2::tag(\%link);
5666
}
5667
my $sql = "select * from users where gender='2' and bust=" . $Bc_sql::DB->quote($i);
5668
my $r = Bc_sql::sql_execute($sql, "display browse");
5669
$rv .= "(";
5670
if (ref $r eq "HASH") {
5671
$rv .= Html2::embolden("1") . " member";
5672
} else {
5673
$rv .= Html2::embolden(scalar @$r) . " members";
5674
}
5675
$rv .= ")" . Html2::br();
5676
5677
{ my %ul;
5678
$ul{tag} = "ul";
5679
$ul{style} = "padding: 0px 0px 0px 20px;";
5680
$ul{innerHTML} = "";
5681
5682
if (ref $r eq "HASH") {
5683
$ul{innerHTML} .= Html2::profile_link($r->{ID}) . Html2::br();
5684
} else {
5685
if (@$r) {
5686
while (@$r > 5) { pop @$r; }
5687
foreach my $u (@$r) {
5688
$ul{innerHTML} .= Html2::profile_link($r->{ID}) . Html2::br();
5689
}
5690
} else {
5691
$ul{innerHTML} .= "none!" . Html2::br();
5692
}
5693
}
5694
$i++;
5695
5696
$rv .= Html2::tag(\%ul) . Html2::br();
5697
}
5698
}
5699
$rv .= "</td></tr></table>";
5700
}
5701
# end elsif ($page eq "bust")
5702
} elsif ($page eq "eye_clr") {
5703
my $selected_race = Bc_misc::get_param("eye_clr");
5704
my @races = Bc_sql::get_config("eyes");
5705
if ($selected_race) {
5706
$rv .= @races[($selected_race-1)] . Html2::br() . Html2::br() . Html2::br();
5707
my $sql = "select * from users where eye_clr=" . $Bc_sql::DB->quote($selected_race);
5708
my $r = Bc_sql::sql_execute($sql, "display browse");
5709
if (ref $r eq "HASH") {
5710
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5711
} else {
5712
foreach my $u (@$r) {
5713
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5714
}
5715
}
5716
} else {
5717
$rv .= Html2::br() . Html2::br() . "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
5718
my $i = 1;
5719
foreach my $race (@races) {
5720
{ my %link;
5721
$link{tag} = "a";
5722
$link{href} = "/?$Bc_sql::QUERY_PAGE=$SP&sp=0&hpp=10&$QST=eye_clr,$i";
5723
$link{title} = "Search by Eye Colour";
5724
$link{innerHTML} = $race;
5725
5726
$rv .= Html2::tag(\%link);
5727
}
5728
my $sql = "select * from users where eye_clr=" . $Bc_sql::DB->quote($i);
5729
my $r = Bc_sql::sql_execute($sql, "display browse");
5730
$rv .= "(";
5731
if (ref $r eq "HASH") {
5732
$rv .= Html2::embolden("1") . " member";
5733
} else {
5734
$rv .= Html2::embolden(scalar @$r) . " members";
5735
}
5736
$rv .= ")" . Html2::br();
5737
5738
{ my %ul;
5739
$ul{tag} = "ul";
5740
$ul{style} = "padding: 0px 0px 0px 20px;";
5741
$ul{innerHTML} = "";
5742
5743
if (ref $r eq "HASH") {
5744
$ul{innerHTML} .= Html2::profile_link($r->{ID}) . Html2::br();
5745
} else {
5746
if (@$r) {
5747
while (@$r > 5) { pop @$r; }
5748
foreach my $u (@$r) {
5749
$ul{innerHTML} .= Html2::profile_link($u->{ID}) . Html2::br();
5750
}
5751
} else {
5752
$ul{innerHTML} .= "none!" . Html2::br();
5753
}
5754
}
5755
$i++;
5756
5757
$rv .= Html2::tag(\%ul) . Html2::br();
5758
} # end ul
5759
}
5760
$rv .= "</td></tr></table>";
5761
}
5762
# end elsif ($page eq "eye_clr")
5763
} elsif ($page eq "hair_clr") {
5764
my $selected_race = Bc_misc::get_param("hair_clr");
5765
my @races = Bc_sql::get_config("hair");
5766
if ($selected_race) {
5767
$rv .= @races[($selected_race-1)] . Html2::br() . Html2::br() . Html2::br();
5768
my $sql = "select * from users where hair_clr=" . $Bc_sql::DB->quote($selected_race);
5769
my $r = Bc_sql::sql_execute($sql, "display browse");
5770
if (ref $r eq "HASH") {
5771
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5772
} else {
5773
foreach my $u (@$r) {
5774
$rv .= Html2::profile_link($u->{ID}) . Html2::br();
5775
}
5776
}
5777
} else {
5778
$rv .= Html2::br() . Html2::br() . "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
5779
my $i = 1;
5780
foreach my $race (@races) {
5781
{ my %link;
5782
$link{tag} = "a";
5783
$link{href} = "/?$Bc_sql::QUERY_PAGE=$SP&sp=0&hpp=10&$QST=hair_clr,$i";
5784
$link{title} = "Search by Hair Colour";
5785
$link{innerHTML} = $race;
5786
5787
$rv .= Html2::tag(\%link);
5788
}
5789
my $sql = "select * from users where hair_clr=" . $Bc_sql::DB->quote($i);
5790
my $r = Bc_sql::sql_execute($sql, "display browse");
5791
$rv .= "(";
5792
if (ref $r eq "HASH") {
5793
$rv .= Html2::embolden("1") . " member";
5794
} else {
5795
$rv .= Html2::embolden(scalar @$r) . " members";
5796
}
5797
$rv .= ")" . Html2::br();
5798
5799
{ my %ul;
5800
$ul{tag} = "ul";
5801
$ul{style} = "padding: 0px 0px 0px 20px;";
5802
$ul{innerHTML} = "";
5803
5804
if (ref $r eq "HASH") {
5805
$ul{innerHTML} .= Html2::profile_link($r->{ID}) . Html2::br();
5806
} else {
5807
if (@$r) {
5808
while (@$r > 5) { pop @$r; }
5809
foreach my $u (@$r) {
5810
$ul{innerHTML} .= Html2::profile_link($u->{ID}) . Html2::br();
5811
}
5812
} else {
5813
$ul{innerHTML} .= "none!" . Html2::br();
5814
}
5815
}
5816
$i++;
5817
5818
$rv .= Html2::tag(\%ul) . Html2::br();
5819
}
5820
}
5821
$rv .= "</td></tr></table>";
5822
}
5823
# end elsif ($page eq "hair_clr")
5824
} elsif ($page eq "weight") {
5825
my $selected_race = Bc_misc::get_param("weight");
5826
my @races = Bc_sql::get_config("weights");
5827
if ($selected_race) {
5828
$rv .= @races[($selected_race-1)] . Html2::br() . Html2::br() . Html2::br();
5829
my $sql = "select * from users where weight=" . $Bc_sql::DB->quote($selected_race);
5830
my $r = Bc_sql::sql_execute($sql, "display browse");
5831
if (ref $r eq "HASH") {
5832
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5833
} else {
5834
foreach my $u (@$r) {
5835
$rv .= Html2::profile_link($u->{ID}) . Html2::br();
5836
}
5837
}
5838
} else {
5839
$rv .= Html2::br() . Html2::br() . "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
5840
my $i = 1;
5841
foreach my $race (@races) {
5842
{ my %link;
5843
$link{tag} = "a";
5844
$link{href} = "/?$Bc_sql::QUERY_PAGE=$SP&sp=0&hpp=10&$QST=weight,$i";
5845
$link{title} = "Search by Weight";
5846
$link{innerHTML} = $race;
5847
5848
$rv .= Html2::tag(\%link);
5849
}
5850
my $sql = "select * from users where weight=" . $Bc_sql::DB->quote($i);
5851
my $r = Bc_sql::sql_execute($sql, "display browse");
5852
$rv .= "(";
5853
if (ref $r eq "HASH") {
5854
$rv .= Html2::embolden("1") . " member";
5855
} else {
5856
$rv .= Html2::embolden(scalar @$r) . " members";
5857
}
5858
$rv .= ")" . Html2::br();
5859
5860
{ my %ul;
5861
$ul{tag} = "ul";
5862
$ul{style} = "padding: 0px 0px 0px 20px;";
5863
$ul{innerHTML} = "";
5864
5865
if (ref $r eq "HASH") {
5866
$ul{innerHTML} .= Html2::profile_link($r->{ID}) . Html2::br();
5867
} else {
5868
if (@$r) {
5869
while (@$r > 5) { pop @$r; }
5870
foreach my $u (@$r) {
5871
$ul{innerHTML} .= Html2::profile_link($u->{ID}) . Html2::br();
5872
}
5873
} else {
5874
$ul{innerHTML} .= "none!" . Html2::br();
5875
}
5876
}
5877
$i++;
5878
5879
$rv .= Html2::tag(\%ul) . Html2::br();
5880
} # end ul
5881
}
5882
$rv .= "</td></tr></table>";
5883
}
5884
# end elsif ($page eq "weight")
5885
} elsif ($page eq "height") {
5886
my $selected_race = Bc_misc::get_param("height");
5887
my @races = Bc_sql::get_config("heights");
5888
if ($selected_race) {
5889
$rv .= @races[($selected_race-1)] . Html2::br() . Html2::br() . Html2::br();
5890
my $sql = "select * from users where height=" . $Bc_sql::DB->quote($selected_race);
5891
my $r = Bc_sql::sql_execute($sql, "display browse");
5892
if (ref $r eq "HASH") {
5893
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5894
} else {
5895
foreach my $u (@$r) {
5896
$rv .= Html2::profile_link($u->{ID}) . Html2::br();
5897
}
5898
}
5899
} else {
5900
$rv .= Html2::br() . Html2::br() . "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
5901
my $i = 1;
5902
foreach my $race (@races) {
5903
{ my %link;
5904
$link{tag} = "a";
5905
$link{href} = "/?$Bc_sql::QUERY_PAGE=$SP&sp=0&hpp=10&$QST=height,$i";
5906
$link{title} = "Search by Height";
5907
$link{innerHTML} = $race;
5908
5909
$rv .= Html2::tag(\%link);
5910
}
5911
my $sql = "select * from users where height=" . $Bc_sql::DB->quote($i);
5912
my $r = Bc_sql::sql_execute($sql, "display browse");
5913
$rv .= "(";
5914
if (ref $r eq "HASH") {
5915
$rv .= Html2::embolden("1") . " member";
5916
} else {
5917
$rv .= Html2::embolden(scalar @$r) . " members";
5918
}
5919
$rv .= ")" . Html2::br();
5920
5921
{ my %ul;
5922
$ul{tag} = "ul";
5923
$ul{style} = "padding: 0px 0px 0px 20px;";
5924
$ul{innerHTML} = "";
5925
5926
if (ref $r eq "HASH") {
5927
$ul{innerHTML} .= Html2::profile_link($r->{ID}) . Html2::br();
5928
} else {
5929
if (@$r) {
5930
while (@$r > 5) { pop @$r; }
5931
foreach my $u (@$r) {
5932
$ul{innerHTML} .= Html2::profile_link($u->{ID}) . Html2::br();
5933
}
5934
} else {
5935
$ul{innerHTML} .= "none!" . Html2::br();
5936
}
5937
}
5938
$i++;
5939
5940
$rv .= Html2::tag(\%ul) . Html2::br();
5941
} # end ul
5942
}
5943
$rv .= "</td></tr></table>";
5944
}
5945
# end elsif ($page eq "height")
5946
} elsif ($page eq "body") {
5947
my $selected_race = Bc_misc::get_param("body");
5948
my @races = Bc_sql::get_config("bodies");
5949
if ($selected_race) {
5950
$rv .= @races[($selected_race-1)] . Html2::br() . Html2::br() . Html2::br();
5951
my $sql = "select * from users where body=" . $Bc_sql::DB->quote($selected_race);
5952
my $r = Bc_sql::sql_execute($sql, "display browse");
5953
if (ref $r eq "HASH") {
5954
$rv .= Html2::profile_link($r->{ID}) . Html2::br();
5955
} else {
5956
foreach my $u (@$r) {
5957
$rv .= Html2::profile_link($u->{ID}) . Html2::br();
5958
}
5959
}
5960
} else {
5961
$rv .= Html2::br() . Html2::br() . "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
5962
my $i = 1;
5963
foreach my $race (@races) {
5964
{ my %link;
5965
$link{tag} = "a";
5966
$link{href} = "/?$Bc_sql::QUERY_PAGE=$SP&sp=0&hpp=10&$QST=body,$i";
5967
$link{title} = "Search by Body Type";
5968
$link{innerHTML} = $race;
5969
5970
$rv .= Html2::tag(\%link);
5971
}
5972
my $sql = "select * from users where body=" . $Bc_sql::DB->quote($i);
5973
my $r = Bc_sql::sql_execute($sql, "display browse");
5974
$rv .= "(";
5975
if (ref $r eq "HASH") {
5976
$rv .= Html2::embolden("1") . " member";
5977
} else {
5978
$rv .= Html2::embolden(scalar @$r) . " members";
5979
}
5980
$rv .= ")" . Html2::br();
5981
5982
{ my %ul;
5983
$ul{tag} = "ul";
5984
$ul{style} = "padding: 0px 0px 0px 20px;";
5985
$ul{innerHTML} = "";
5986
5987
if (ref $r eq "HASH") {
5988
$ul{innerHTML} .= Html2::profile_link($r->{ID}) . Html2::br();
5989
} else {
5990
if (@$r) {
5991
while (@$r > 5) { pop @$r; }
5992
foreach my $u (@$r) {
5993
$ul{innerHTML} .= Html2::profile_link($u->{ID}) . Html2::br();
5994
}
5995
} else {
5996
$ul{innerHTML} .= "none!" . Html2::br();
5997
}
5998
}
5999
$i++;
6000
6001
$rv .= Html2::tag(\%ul) . Html2::br();
6002
} # end ul
6003
}
6004
$rv .= "</td></tr></table>";
6005
}
6006
# end elsif ($page eq "body")
6007
} else {
6008
$rv .= "no such category?" . Html2::br();
6009
# end else of too many to list
6010
}
6011
} else {
6012
# show the home page!
6013
{ my %flexbox;
6014
$flexbox{tag} = "div";
6015
$flexbox{class} = "flexboxed normal-panel";
6016
$flexbox{style} = "justify-content: center;";
6017
$flexbox{innerHTML} = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
6018
6019
{ my %link;
6020
$link{tag} = "a";
6021
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=location";
6022
$link{title} = "Browse by Location";
6023
$link{innerHTML} = "Location";
6024
6025
$flexbox{innerHTML} .= Html2::tag(\%link) . Html2::br();
6026
}
6027
{ my %link;
6028
$link{tag} = "a";
6029
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=nickname";
6030
$link{title} = "Browse by Nickname";
6031
$link{innerHTML} = "Nickname";
6032
6033
$flexbox{innerHTML} .= Html2::tag(\%link) . Html2::br();
6034
}
6035
{ my %link;
6036
$link{tag} = "a";
6037
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=race";
6038
$link{title} = "Browse by Ethnicity";
6039
$link{innerHTML} = "Ethnicity";
6040
6041
$flexbox{innerHTML} .= Html2::tag(\%link) . Html2::br();
6042
}
6043
{ my %link;
6044
$link{tag} = "a";
6045
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=orientation";
6046
$link{title} = "Browse by Orientation";
6047
$link{innerHTML} = "Orientation";
6048
6049
$flexbox{innerHTML} .= Html2::tag(\%link) . Html2::br();
6050
}
6051
{ my %link;
6052
$link{tag} = "a";
6053
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=seeking";
6054
$link{title} = "Browse by Seeking";
6055
$link{innerHTML} = "Seeking";
6056
6057
$flexbox{innerHTML} .= Html2::tag(\%link) . Html2::br();
6058
}
6059
{ my %link;
6060
$link{tag} = "a";
6061
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=erection";
6062
$link{title} = "Browse by Erection";
6063
$link{innerHTML} = "Erection";
6064
6065
$flexbox{innerHTML} .= Html2::tag(\%link) . Html2::br();
6066
}
6067
6068
$flexbox{innerHTML} .= "</td><td class=spacerx_largest></td><td align=right valign=top>";
6069
6070
{ my %link;
6071
$link{tag} = "a";
6072
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=bust";
6073
$link{title} = "Browse by Bust";
6074
$link{innerHTML} = "Bust";
6075
6076
$flexbox{innerHTML} .= Html2::tag(\%link) . Html2::br();
6077
}
6078
{ my %link;
6079
$link{tag} = "a";
6080
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=eye_clr";
6081
$link{title} = "Browse by Eye Colour";
6082
$link{innerHTML} = "Eye Colour";
6083
6084
$flexbox{innerHTML} .= Html2::tag(\%link) . Html2::br();
6085
}
6086
{ my %link;
6087
$link{tag} = "a";
6088
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=hair_clr";
6089
$link{title} = "Browse by Hair Colour";
6090
$link{innerHTML} = "Hair Colour";
6091
6092
$flexbox{innerHTML} .= Html2::tag(\%link) . Html2::br();
6093
}
6094
{ my %link;
6095
$link{tag} = "a";
6096
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=weight";
6097
$link{title} = "Browse by Weight";
6098
$link{innerHTML} = "Weight";
6099
6100
$flexbox{innerHTML} .= Html2::tag(\%link) . Html2::br();
6101
}
6102
{ my %link;
6103
$link{tag} = "a";
6104
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=height";
6105
$link{title} = "Browse by Height";
6106
$link{innerHTML} = "Height";
6107
6108
$flexbox{innerHTML} .= Html2::tag(\%link) . Html2::br();
6109
}
6110
{ my %link;
6111
$link{tag} = "a";
6112
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$BRPAGE&bp=body";
6113
$link{title} = "Browse by Body Type";
6114
$link{innerHTML} = "Body Type";
6115
6116
$flexbox{innerHTML} .= Html2::tag(\%link) . Html2::br();
6117
}
6118
6119
$flexbox{innerHTML} .= "</td></tr><tr><td align=center colspan=3>" . Html2::hr();
6120
$flexbox{innerHTML} .= "</td></tr><tr><td align=center colspan=3>";
6121
6122
{ my %link;
6123
$link{tag} = "a";
6124
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$SP&sp=0&hpp=10&$QST=gender,1";
6125
$link{title} = "Browse by Guys";
6126
$link{innerHTML} = "Guys";
6127
6128
$flexbox{innerHTML} .= Html2::tag(\%link);
6129
}
6130
6131
$flexbox{innerHTML} .= " or ";
6132
6133
{ my %link;
6134
$link{tag} = "a";
6135
$link{innerHTML} = "/?$Bc_sql::QUERY_PAGE=$SP&sp=0&hpp=10&$QST=gender,2";
6136
$link{title} = "Browse by Gals";
6137
$link{innerHTML} = "Gals";
6138
6139
$flexbox{innerHTML} .= Html2::tag(\%link);
6140
}
6141
$flexbox{innerHTML} .= "</td></tr></table>";
6142
6143
$rv .= Html2::tag(\%flexbox);
6144
} # end flexbox
6145
}
6146
6147
return $rv; # the browse page in a scalar
6148
#usage: print display_browse();
6149
}
6150
6151
########################
6152
sub display_friends(;$$) {
6153
#*
6154
# creates a list of fuck buddies, displaying each user in 'mini-card' format
6155
#*
6156
my ($uid, $spacing) = @_; # uid (optional, default = $Bc_sql::LOGGEDIN) && spacing for pretty printing HTML output (optional)
6157
if (!$uid) { $uid = $Bc_sql::LOGGEDIN; }
6158
if (!$spacing) { $spacing = ""; }
6159
6160
my $rv = "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0 width><tr><td";
6161
my $maxwidth = 175;
6162
if (Bc_sql::user_exists($uid)) {
6163
my @friends = get_user_friends($uid); # an array to store fuck buddy ID's
6164
# this array contains a list of all FID's associated with UID, whether
6165
# declined, accepted, or pending!
6166
my @pending = User::get_user_friend_requests();
6167
6168
if (@friends) {
6169
$rv .= " align=center colspan=7>";
6170
{ my %div;
6171
$div{tag} = "div";
6172
$div{class} = "title";
6173
$div{innerHTML} = "Your " . Html2::embolden(scalar @friends) . Bc_misc::pluralize(" Fuck Buddy", @friends);
6174
6175
$rv .= Html2::tag(\%div) . Html2::hr() . Html2::br();
6176
}
6177
$rv .= "</td></tr><tr><td valign=top class='friends-list'>";
6178
6179
for (my $i = 0; $i < @friends; $i++) {
6180
my $friend = $friends[$i];
6181
my $sql = "select * from friends where UID=" . $Bc_sql::DB->quote($uid) . " and FID=" . $Bc_sql::DB->quote($friend) . " and declined='3'";
6182
my $data = Bc_sql::sql_execute($sql, "display friends");
6183
# now, $data->{declined} will be 1, 2, or 3
6184
# 1 means fuck buddy has done nothing with the request
6185
# 2 means fuck buddy has declined request
6186
# 3 means fuck buddy has accepted request
6187
{ my %div;
6188
$div{tag} = "div";
6189
$div{class} = "item";
6190
$div{innerHTML} = Html2::display_user_profile({$Bc_sql::QUERY_UID=>$friend, mini=>1});
6191
6192
$rv .= Html2::tag(\%div);
6193
}
6194
}
6195
} else { # no fuck buddies...
6196
my %div;
6197
$div{tag} = "div";
6198
$div{class} = "item";
6199
$div{innerHTML} = "You have no fuck buddies!" . Html2::br();
6200
6201
{ my %link;
6202
$link{tag} = "a";
6203
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("SEARCH_PAGE");
6204
$link{title} = "Search";
6205
$link{innerHTML} = "Find";
6206
6207
$div{innerHTML} .= Html2::tag(\%link);
6208
}
6209
6210
$div{innerHTML} .= " a fuck buddy!";
6211
6212
$rv .= Html2::tag(\%div);
6213
}
6214
6215
# now, check if there are any pending fuck buddy requests
6216
if (@pending) {
6217
$rv .= "</td></tr><tr><td>";
6218
$rv .= Html2::br() . Html2::hr() . Html2::br();
6219
$rv .= "</td></tr><tr><td align=center>";
6220
$rv .= "you have " . @pending . " pending fuck buddy " . Bc_misc::pluralize("request", @pending) . Html2::br() . Html2::br();
6221
$rv .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
6222
foreach my $pid (@pending) {
6223
my %pidstats = User::get_user_stats($pid);
6224
$rv .= Html2::profile_link($pid) . " ";
6225
{ my %accept;
6226
$accept{tag} = "a";
6227
$accept{href} = "/addfriend.pl?$Bc_sql::QUERY_UID=$pid";
6228
$accept{title} = "Accept Fuck Buddy Request";
6229
$accept{innerHTML} = "";
6230
6231
{ my %img;
6232
$img{tag} = "img";
6233
$img{src} = "/images/site/accept.png";
6234
$img{height} = "16";
6235
6236
$accept{innerHTML} .= Html2::tag(\%img);
6237
}
6238
6239
$rv .= Html2::tag(\%accept) . " or ";
6240
}
6241
6242
{ my %decline;
6243
$decline{tag} = "div";
6244
$decline{href} = "/addfriend.pl?$Bc_sql::QUERY_UID=$pid&i=1";
6245
$decline{title} = "Decline Fuck Buddy Request";
6246
$decline{innerHTML} = "";
6247
6248
{ my %img;
6249
$img{tag} = "img";
6250
$img{src} = "/images/site/delete.png";
6251
$img{height} = "16";
6252
6253
$decline{innerHTML} .= Html2::tag(\%img);
6254
}
6255
6256
$rv .= Html2::tag(\%decline) . Html2::br();
6257
}
6258
} # end foreach friend request
6259
6260
$rv .= "</td></tr></table>";
6261
}
6262
6263
# and finally, list any sent fuck buddy requests
6264
my $sql = "select * from friends where UID=" . $Bc_sql::DB->quote($Bc_sql::LOGGEDIN) . " and not declined='3'";
6265
my $results = Bc_sql::sql_execute($sql, "display friends");
6266
if (ref $results eq "HASH") {
6267
$rv .= "</td></tr><tr><td colspan=9>";
6268
$rv .= Html2::br() . Html2::hr() . Html2::br();
6269
$rv .= "</td></tr><tr><td colspan=9 align=center>";
6270
$rv .= "you have sent 1 fuck buddy request" . Html2::br() . Html2::br();
6271
$rv .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
6272
$rv .= Html2::profile_link($results->{FID});
6273
{ my %link;
6274
$link{tag} = "a";
6275
$link{href} = "/addfriend.pl?$Bc_sql::QUERY_UID=$results->{FID}&r=1";
6276
$link{title} = "Send Fuck Buddy Request";
6277
$link{innerHTML} = "";
6278
6279
{ my %img;
6280
$img{tag} = "img";
6281
$img{src} = "";
6282
$img{height} = "16";
6283
6284
$link{innerHTML} .= Html2::tag(\%img);
6285
}
6286
6287
$rv .= Html2::tag(\%link) . Html2::br();
6288
}
6289
$rv .= "</td></tr></table>";
6290
} else {
6291
if (@$results) {
6292
$rv .= "</td></tr><tr><td colspan=9>";
6293
$rv .= Html2::br() . Html2::hr() . Html2::br();
6294
$rv .= "</td></tr><tr><td colspan=9 align=center>";
6295
$rv .= "you have sent " . @$results . " fuck buddy " . Bc_misc::pluralize("request", @$results) . Html2::br() . Html2::br();
6296
$rv .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
6297
foreach my $r (@$results) {
6298
my $pid = $r->{FID};
6299
my %pidstats = User::get_user_stats($pid);
6300
$rv .= Html2::profile_link($pid);
6301
{ my %link;
6302
$link{tag} = "a";
6303
$link{href} = "/addfriend.pl?$Bc_sql::QUERY_UID=$pid&r=1";
6304
$link{title} = "Send Fuck Buddy Request";
6305
$link{innerHTML} = "";
6306
6307
{ my %img;
6308
$img{tag} = "img";
6309
$img{src} = "/images/site/delete.png";
6310
$img{height} = "16";
6311
6312
$link{innerHTML} .= Html2::tag(\%img);
6313
}
6314
6315
$rv .= Html2::tag(\%link) . Html2::br();
6316
}
6317
}
6318
6319
$rv .= "</td></tr></table>";
6320
}
6321
}
6322
6323
} else {
6324
$rv .= "<td valign=top align=center>No such user: $uid!";
6325
}
6326
6327
$rv =~ s/\<td colspan(.)*$//;
6328
$rv .= "</td></tr></table>";
6329
6330
return $rv; # a scalar
6331
#usage: my $friendsList = display_friends('123abc', ' ');
6332
}
6333
6334
########################
6335
sub display_stats_page(;$$$) {
6336
#*
6337
# displays a specified stats page for the supplied uid
6338
# uid is now deprecated, but will be left in to ease searching
6339
# through thousands of lines to make changes.
6340
#*
6341
my ($uid_deprecated, $page, $spacing) = @_; # uid (deprecated, optional default = $Bc_sql::LOGGEDIN) && sub-page (optional, default = STATS_PAGE_BIO) && spacing for pretty printing HTML output (optional)
6342
#if (not $uid_deprecated and not User::isUserAdmin()) { $uid = $Bc_sql::LOGGEDIN; } # k, that's weird
6343
if (!$spacing) { $spacing = ""; }
6344
6345
if (not $page) {
6346
$page = Bc_misc::get_param(Bc_sql::get_constant("QUERY_STATS_PAGE"));
6347
if (not $page) { $page = Bc_sql::get_constant("STATS_BIO_PAGE"); }
6348
}
6349
6350
my $statsHeight = 310;
6351
my $statsWidth = 300;
6352
my $rv = "";
6353
6354
{ my %form; # stats form
6355
$form{tag} = "form";
6356
$form{action} = "/setstats.pl";
6357
$form{method} = "post";
6358
6359
{ my %fs;
6360
$fs{tag} = "fieldset";
6361
$fs{align} = "left";
6362
$fs{class} = "small";
6363
$fs{style} = "min-height: $statsHeight" . "px; max-height: $statsHeight" . "px; min-width: $statsWidth" . "px; max-width: $statsWidth" . "px;";
6364
6365
{ my %legend;
6366
$legend{tag} = "legend";
6367
$legend{class} = "subnavbar_dark settings-nav padded";
6368
$legend{innerHTML} = "";
6369
6370
{ my %div;
6371
$div{tag} = "div";
6372
$div{class} = "bio-nav";
6373
$div{innerHTML} = "";
6374
6375
if ($page eq Bc_sql::get_constant("STATS_BIO_PAGE")) {
6376
{ my %script;
6377
$script{tag} = "script";
6378
$script{async} = 1;
6379
$script{innerHTML} = "lastElementToggled = \"bio\";";
6380
6381
$div{innerHTML} .= Html2::tag(\%script);
6382
}
6383
6384
{ my %link;
6385
$link{tag} = "a";
6386
$link{onclick} = "toggle_display_element(\"bio\", \"biolink\");";
6387
$link{id} = "biolink";
6388
$link{class} = "pointer";
6389
$link{innerHTML} = "";
6390
6391
{ my %linkdiv;
6392
$linkdiv{tag} = "div";
6393
$linkdiv{class} = "navbutton_selected";
6394
$linkdiv{id} = "biodiv";
6395
$linkdiv{innerHTML} = "Bio";
6396
6397
$link{innerHTML} .= Html2::tag(\%linkdiv);
6398
}
6399
6400
$div{innerHTML} .= Html2::tag(\%link);
6401
}
6402
} else {
6403
my %link;
6404
$link{tag} = "a";
6405
$link{onclick} = "toggle_display_element('bio', 'biolink');";
6406
$link{id} = "biolink";
6407
$link{class} = "pointer";
6408
$link{innerHTML} = "";
6409
6410
{ my %innerdiv;
6411
$innerdiv{tag} = "div";
6412
$innerdiv{class} = "navbutton";
6413
$innerdiv{innerHTML} = "Bio";
6414
6415
$link{innerHTML} .= Html2::tag(\%innerdiv);
6416
}
6417
6418
$div{innerHTML} .= Html2::tag(\%link);
6419
}
6420
6421
$legend{innerHTML} .= Html2::tag(\%div);
6422
}
6423
6424
{ my %div;
6425
$div{tag} = "div";
6426
$div{class} = "vitals-nav";
6427
6428
if ($page eq Bc_sql::get_constant("STATS_VITALS_PAGE")) {
6429
{ my %script;
6430
$script{tag} = "script";
6431
$script{async} = 1;
6432
$script{innerHTML} = "lastElementToggled = \"vit\";";
6433
6434
$div{innerHTML} .= Html2::tag(\%script);
6435
}
6436
6437
{ my %link;
6438
$link{tag} = "a";
6439
$link{onclick} = "toggle_display_element(\"vit\", \"vitlink\");";
6440
$link{id} = "vitlink";
6441
$link{class} = "pointer";
6442
$link{innerHTML} = "";
6443
6444
{ my %linkdiv;
6445
$linkdiv{tag} = "div";
6446
$linkdiv{class} = "navbutton_selected";
6447
$linkdiv{id} = "vitdiv";
6448
$linkdiv{innerHTML} = "Bitals";
6449
6450
$link{innerHTML} .= Html2::tag(\%linkdiv);
6451
}
6452
6453
$div{innerHTML} .= Html2::tag(\%link);
6454
}
6455
} else {
6456
my %link;
6457
$link{tag} = "a";
6458
$link{onclick} = "toggle_display_element('vit', 'vitlink');";
6459
$link{id} = "vitlink";
6460
$link{class} = "pointer";
6461
$link{innerHTML} = "";
6462
6463
{ my %linkdiv;
6464
$linkdiv{tag} = "div";
6465
$linkdiv{class} = "navbutton";
6466
$linkdiv{id} = "vitdiv";
6467
$linkdiv{innerHTML} = "Vitals";
6468
6469
$link{innerHTML} .= Html2::tag(\%linkdiv);
6470
}
6471
6472
$div{innerHTML} .= Html2::tag(\%link);
6473
}
6474
6475
$legend{innerHTML} .= Html2::tag(\%div);
6476
}
6477
6478
{ my %div;
6479
$div{tag} = "div";
6480
$div{class} = "loc-nav";
6481
6482
if ($page eq Bc_sql::get_constant("STATS_LOC_PAGE")) {
6483
{ my %script;
6484
$script{tag} = "script";
6485
$script{async} = 1;
6486
$script{innerHTML} = "lastElementToggled = \"loc\";";
6487
6488
$div{innerHTML} .= Html2::tag(\%script);
6489
}
6490
6491
{ my %link;
6492
$link{tag} = "a";
6493
$link{onclick} = "toggle_display_element(\"loc\", \"loclink\");";
6494
$link{id} = "loclink";
6495
$link{class} = "pointer";
6496
$link{innerHTML} = "";
6497
6498
{ my %linkdiv;
6499
$linkdiv{tag} = "div";
6500
$linkdiv{class} = "navbutton_selected";
6501
$linkdiv{id} = "locdiv";
6502
$linkdiv{innerHTML} = "Location";
6503
6504
$link{innerHTML} .= Html2::tag(\%linkdiv);
6505
}
6506
6507
$div{innerHTML} .= Html2::tag(\%link);
6508
}
6509
} else {
6510
my %link;
6511
$link{tag} = "a";
6512
$link{onclick} = "toggle_display_element('loc', 'loclink');";
6513
$link{id} = "loclink";
6514
$link{class} = "pointer";
6515
$link{innerHTML} = "";
6516
6517
{ my %linkdiv;
6518
$linkdiv{tag} = "div";
6519
$linkdiv{class} = "navbutton";
6520
$linkdiv{id} = "locdiv";
6521
$linkdiv{innerHTML} = "Location";
6522
6523
$link{innerHTML} .= Html2::tag(\%linkdiv);
6524
}
6525
6526
$div{innerHTML} .= Html2::tag(\%link);
6527
}
6528
6529
$legend{innerHTML} .= Html2::tag(\%div);
6530
}
6531
6532
{ my %div;
6533
$div{tag} = "div";
6534
$div{class} = "desc-nav";
6535
6536
if ($page eq Bc_sql::get_constant("STATS_DESC_PAGE")) {
6537
{ my %script;
6538
$script{tag} = "script";
6539
$script{async} = 1;
6540
$script{innerHTML} = "lastElementToggled = \"desc\";";
6541
6542
$div{innerHTML} .= Html2::tag(\%script);
6543
}
6544
6545
{ my %link;
6546
$link{tag} = "a";
6547
$link{onclick} = "toggle_display_element(\"desc\", \"desclink\");";
6548
$link{id} = "desclink";
6549
$link{class} = "pointer";
6550
$link{innerHTML} = "";
6551
6552
{ my %linkdiv;
6553
$linkdiv{tag} = "div";
6554
$linkdiv{class} = "navbutton_selected";
6555
$linkdiv{id} = "descdiv";
6556
$linkdiv{innerHTML} = "Description";
6557
6558
$link{innerHTML} .= Html2::tag(\%linkdiv);
6559
}
6560
6561
$div{innerHTML} .= Html2::tag(\%link);
6562
}
6563
} else {
6564
my %link;
6565
$link{tag} = "a";
6566
$link{onclick} = "toggle_display_element('desc', 'desclink');";
6567
$link{id} = "desclink";
6568
$link{class} = "pointer";
6569
$link{innerHTML} = "";
6570
6571
{ my %linkdiv;
6572
$linkdiv{tag} = "div";
6573
$linkdiv{class} = "navbutton";
6574
$linkdiv{id} = "descdiv";
6575
$linkdiv{innerHTML} = "Description";
6576
6577
$link{innerHTML} .= Html2::tag(\%linkdiv);
6578
}
6579
6580
$div{innerHTML} .= Html2::tag(\%link);
6581
}
6582
6583
$legend{innerHTML} .= Html2::tag(\%div);
6584
}
6585
6586
{ my %div;
6587
$div{tag} = "div";
6588
$div{class} = "password-nav";
6589
6590
if ($page eq Bc_sql::get_constant("STATS_PASS_PAGE")) {
6591
{ my %script;
6592
$script{tag} = "script";
6593
$script{async} = 1;
6594
$script{innerHTML} = "lastElementToggled = \"pw\";";
6595
6596
$div{innerHTML} .= Html2::tag(\%script);
6597
}
6598
6599
{ my %link;
6600
$link{tag} = "a";
6601
$link{onclick} = "toggle_display_element(\"pw\", \"pwlink\");";
6602
$link{id} = "pwlink";
6603
$link{class} = "pointer";
6604
$link{innerHTML} = "";
6605
6606
{ my %linkdiv;
6607
$linkdiv{tag} = "div";
6608
$linkdiv{class} = "navbutton_selected";
6609
$linkdiv{id} = "pwdiv";
6610
$linkdiv{innerHTML} = "Password";
6611
6612
$link{innerHTML} .= Html2::tag(\%linkdiv);
6613
}
6614
6615
$div{innerHTML} .= Html2::tag(\%link);
6616
}
6617
} else {
6618
my %link;
6619
$link{tag} = "a";
6620
$link{onclick} = "toggle_display_element('pw', 'pwlink');";
6621
$link{id} = "pwlink";
6622
$link{class} = "pointer";
6623
$link{innerHTML} = "";
6624
6625
{ my %linkdiv;
6626
$linkdiv{tag} = "div";
6627
$linkdiv{class} = "navbutton";
6628
$linkdiv{id} = "pwdiv";
6629
$linkdiv{innerHTML} = "Password";
6630
6631
$link{innerHTML} .= Html2::tag(\%linkdiv);
6632
}
6633
6634
$div{innerHTML} .= Html2::tag(\%link);
6635
}
6636
6637
$legend{innerHTML} .= Html2::tag(\%div);
6638
}
6639
6640
{ my %div;
6641
$div{tag} = "div";
6642
$div{class} = "theme-nav";
6643
6644
if ($page eq Bc_sql::get_constant("STATS_THEME_PAGE")) {
6645
{ my %script;
6646
$script{tag} = "script";
6647
$script{async} = 1;
6648
$script{innerHTML} = "lastElementToggled = \"th\";";
6649
6650
$div{innerHTML} .= Html2::tag(\%script);
6651
}
6652
6653
{ my %link;
6654
$link{tag} = "a";
6655
$link{onclick} = "toggle_display_element(\"th\", \"thlink\");";
6656
$link{id} = "thlink";
6657
$link{class} = "pointer";
6658
$link{innerHTML} = "";
6659
6660
{ my %linkdiv;
6661
$linkdiv{tag} = "div";
6662
$linkdiv{class} = "navbutton_selected";
6663
$linkdiv{id} = "thdiv";
6664
$linkdiv{innerHTML} = "Theme";
6665
6666
$link{innerHTML} .= Html2::tag(\%linkdiv);
6667
}
6668
6669
$div{innerHTML} .= Html2::tag(\%link);
6670
}
6671
} else {
6672
my %link;
6673
$link{tag} = "a";
6674
$link{onclick} = "toggle_display_element('th', 'thlink');";
6675
$link{id} = "thlink";
6676
$link{class} = "pointer";
6677
$link{innerHTML} = "";
6678
6679
{ my %linkdiv;
6680
$linkdiv{tag} = "div";
6681
$linkdiv{class} = "navbutton";
6682
$linkdiv{id} = "thdiv";
6683
$linkdiv{innerHTML} = "Theme";
6684
6685
$link{innerHTML} .= Html2::tag(\%linkdiv);
6686
}
6687
6688
$div{innerHTML} .= Html2::tag(\%link);
6689
}
6690
6691
$legend{innerHTML} .= Html2::tag(\%div);
6692
}
6693
6694
{ my %div;
6695
$div{tag} = "div";
6696
$div{class} = "membership-nav";
6697
6698
if ($page eq Bc_sql::get_constant("STATS_PAY_PAGE")) {
6699
{ my %script;
6700
$script{tag} = "script";
6701
$script{async} = 1;
6702
$script{innerHTML} = "lastElementToggled = \"su\";";
6703
6704
$div{innerHTML} .= Html2::tag(\%script);
6705
}
6706
6707
{ my %link;
6708
$link{tag} = "a";
6709
$link{onclick} = "toggle_display_element(\"su\", \"sulink\");";
6710
$link{id} = "sulink";
6711
$link{class} = "pointer";
6712
$link{innerHTML} = "";
6713
6714
{ my %linkdiv;
6715
$linkdiv{tag} = "div";
6716
$linkdiv{class} = "navbutton_selected";
6717
$linkdiv{id} = "sudiv";
6718
$linkdiv{innerHTML} = "Membership";
6719
6720
$link{innerHTML} .= Html2::tag(\%linkdiv);
6721
}
6722
6723
$div{innerHTML} .= Html2::tag(\%link);
6724
}
6725
} else {
6726
my %link;
6727
$link{tag} = "a";
6728
$link{onclick} = "toggle_display_element('su', 'sulink');";
6729
$link{id} = "sulink";
6730
$link{class} = "pointer";
6731
$link{innerHTML} = "";
6732
6733
{ my %linkdiv;
6734
$linkdiv{tag} = "div";
6735
$linkdiv{class} = "navbutton";
6736
$linkdiv{id} = "sudiv";
6737
$linkdiv{innerHTML} = "Membership";
6738
6739
$link{innerHTML} .= Html2::tag(\%linkdiv);
6740
}
6741
$div{innerHTML} .= Html2::tag(\%link);
6742
}
6743
6744
$legend{innerHTML} .= Html2::tag(\%div);
6745
}
6746
6747
{ my %div;
6748
$div{tag} = "div";
6749
$div{class} = "coins-nav";
6750
6751
if (User::isUserSubscriber($Bc_sql::LOGGEDIN)) {
6752
if ($page eq Bc_sql::get_constant("STATS_COINS_PAGE")) {
6753
{ my %script;
6754
$script{tag} = "script";
6755
$script{async} = 1;
6756
$script{innerHTML} = "lastElementToggled = \"sp\";";
6757
6758
$div{innerHTML} .= Html2::tag(\%script);
6759
}
6760
6761
{ my %link;
6762
$link{tag} = "a";
6763
$link{onclick} = "toggle_display_element(\"sp\", \"splink\");";
6764
$link{id} = "splink";
6765
$link{class} = "pointer";
6766
$link{innerHTML} = "";
6767
6768
{ my %linkdiv;
6769
$linkdiv{tag} = "div";
6770
$linkdiv{class} = "navbutton";
6771
$linkdiv{id} = "spdiv";
6772
$linkdiv{innerHTML} = "Coins";
6773
6774
$link{innerHTML} .= Html2::tag(\%linkdiv);
6775
}
6776
6777
$div{innerHTML} .= Html2::tag(\%link);
6778
}
6779
} else {
6780
my %link;
6781
$link{tag} = "a";
6782
$link{onclick} = "toggle_display_element('sp', 'splink');";
6783
$link{id} = "splink";
6784
$link{class} = "pointer";
6785
$link{innerHTML} = "";
6786
6787
{ my %linkdiv;
6788
$linkdiv{tag} = "div";
6789
$linkdiv{class} = "navbutton";
6790
$linkdiv{id} = "spdiv";
6791
$linkdiv{innerHTML} = "Coins";
6792
6793
$link{innerHTML} .= Html2::tag(\%linkdiv);
6794
}
6795
6796
$div{innerHTML} .= Html2::tag(\%link);
6797
}
6798
}
6799
6800
$legend{innerHTML} .= Html2::tag(\%div);
6801
}
6802
6803
{ my %div;
6804
$div{tag} = "div";
6805
$div{class} = "blocks-nav";
6806
6807
if ($page eq Bc_sql::get_constant("STATS_BLOCKED_PAGE")) {
6808
{ my %script;
6809
$script{tag} = "script";
6810
$script{async} = 1;
6811
$script{innerHTML} = "lastElementToggled = \"bl\";";
6812
6813
$div{innerHTML} .= Html2::tag(\%script);
6814
}
6815
6816
{ my %link;
6817
$link{tag} = "a";
6818
$link{onclick} = "toggle_display_element(\"bl\", \"bllink\");";
6819
$link{id} = "bllink";
6820
$link{class} = "pointer";
6821
$link{innerHTML} = "";
6822
6823
{ my %linkdiv;
6824
$linkdiv{tag} = "div";
6825
$linkdiv{class} = "navbutton_selected";
6826
$linkdiv{id} = "bldiv";
6827
$linkdiv{innerHTML} = "Blocks";
6828
6829
$link{innerHTML} .= Html2::tag(\%linkdiv);
6830
}
6831
6832
$div{innerHTML} .= Html2::tag(\%link);
6833
}
6834
} else {
6835
my %link;
6836
$link{tag} = "a";
6837
$link{onclick} = "toggle_display_element('bl', 'bllink');";
6838
$link{id} = "bllink";
6839
$link{class} = "pointer";
6840
$link{innerHTML} = "";
6841
6842
{ my %linkdiv;
6843
$linkdiv{tag} = "div";
6844
$linkdiv{class} = "navbutton";
6845
$linkdiv{id} = "bldiv";
6846
$linkdiv{innerHTML} = "Blocks";
6847
6848
$link{innerHTML} .= Html2::tag(\%linkdiv);
6849
}
6850
6851
$div{innerHTML} .= Html2::tag(\%link);
6852
}
6853
6854
$legend{innerHTML} .= Html2::tag(\%div);
6855
} # end div
6856
6857
$fs{innerHTML} .= Html2::tag(\%legend);
6858
} # end legend
6859
6860
##### THE DIV's ####
6861
{ my %container;
6862
$container{tag} = "div";
6863
$container{class} = "stats-container";
6864
$container{innerHTML} = "";
6865
6866
{ my %statsdivs;
6867
$statsdivs{tag} = "div";
6868
$statsdivs{class} = "stats-divs";
6869
$statsdivs{innerHTML} = "";
6870
6871
my %ustats = User::get_user_stats($Bc_sql::LOGGEDIN);
6872
6873
{ my %biodiv;
6874
my $dob = Date::expand_date($ustats{dob});
6875
my @zodiacs = Bc_sql::get_zodiacs();
6876
my $zodiac = Date::determine_zodiac($ustats{dob}, "w");
6877
my $zodiacIcon = get_zodiac_icon($ustats{dob}, "s");
6878
$zodiacIcon =~ s/>$/ height=12>/;
6879
my @races = Bc_sql::get_config("races");
6880
my @orientations = Bc_sql::get_config("orientations");
6881
my @seeking = Bc_sql::get_config("styles");
6882
my @genders = Bc_sql::get_config("genders");
6883
6884
$biodiv{tag} = "div";
6885
$biodiv{class} = "centered center";
6886
if ($page ne Bc_sql::get_constant("STATS_BIO_PAGE")) { $biodiv{style} .= "display: none;"; }
6887
$biodiv{id} = "bio";
6888
$biodiv{innerHTML} = "";
6889
6890
$biodiv{innerHTML} .= "Nickname: ";
6891
{ my %nninput;
6892
$nninput{tag} = "input";
6893
$nninput{type} = "hidden";
6894
$nninput{id} = "nickname";
6895
$nninput{name} = "nickname";
6896
$nninput{value} = uri_unescape($ustats{nickname});
6897
6898
$biodiv{innerHTML} .= Html2::tag(\%nninput);
6899
}
6900
$biodiv{innerHTML} .= Html2::embolden(uri_unescape($ustats{nickname}));
6901
$biodiv{innerHTML} .= "(";
6902
if ($ustats{gender} eq 1) { $biodiv{innerHTML} .= Html2::embolden("Male"); } else { $biodiv{innerHTML} .= Html2::embolden("Female"); }
6903
$biodiv{innerHTML} .= ", ";
6904
$biodiv{innerHTML} .= Html2::embolden(Bc_sql::get_race_asWord($ustats{race})) . ")" . Html2::br();
6905
$biodiv{innerHTML} .= "Email: ";
6906
{ my %emailinput;
6907
$emailinput{tag} = "input";
6908
$emailinput{type} = "hidden";
6909
$emailinput{id} = "email";
6910
$emailinput{name} = "email";
6911
$emailinput{value} = $ustats{email};
6912
6913
$biodiv{innerHTML} .= Html2::tag(\%emailinput);
6914
$biodiv{innerHTML} .= Html2::embolden(uri_unescape($ustats{email}));
6915
}
6916
6917
{ my %button;
6918
$button{tag} = "button";
6919
$button{type} = "button";
6920
$button{class} = "yellow";
6921
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("CHANGE_EMAIL_PAGE") . "\";";
6922
$button{innerHTML} = "Change";
6923
6924
$biodiv{innerHTML} .= Html2::tag(\%button) . Html2::br();
6925
}
6926
6927
$biodiv{innerHTML} .= "Birthday: " . Html2::embolden($dob) . " " . Html2::tag({tag=>"div", class=>"blue-panel", innerHTML=>" $zodiacIcon"}) . " ($zodiac)" . Html2::br();
6928
$biodiv{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td align=right width=100%></td><td width=1>";
6929
6930
{ my %cb;
6931
$cb{tag} = "input";
6932
$cb{type} = "checkbox";
6933
$cb{name} = "show_bday";
6934
$cb{id} = "show_bday";
6935
if ($ustats{showbday} eq 2) { $cb{checked} = 1; }
6936
6937
$biodiv{innerHTML} .= Html2::tag(\%cb);
6938
}
6939
6940
$biodiv{innerHTML} .= "</td><td>";
6941
6942
{ my %label;
6943
$label{tag} = "label";
6944
$label{for} = "show_bday";
6945
$label{class} = "nowrap";
6946
$label{innerHTML} = " Make Birthday Public";
6947
6948
$biodiv{innerHTML} .= Html2::tag(\%label);
6949
}
6950
6951
$biodiv{innerHTML} .= "</td></tr></table>";
6952
$biodiv{innerHTML} .= dropdown("orientation", "Orientation: ", $ustats{orientation}, "", "", "", "name=orientation style='margin: 5px; font-size: 8pt;'", "", \@orientations);
6953
$biodiv{innerHTML} .= Html2::br();
6954
$biodiv{innerHTML} .= dropdown("seeking_gender", "Seeking a ", $ustats{seeking_gender}, "", "", "", "name=seeking_gender style=\"font-size: 8pt;\"", "", \@genders);
6955
$biodiv{innerHTML} .= dropdown("seeking", " for: ", $ustats{seeking}, "", "", "", "name=seeking style=\"font-size: 8pt;\"", Html2::br(), \@seeking);
6956
6957
$statsdivs{innerHTML} .= Html2::tag(\%biodiv);
6958
} # end bio div
6959
6960
{ my %vitdiv;
6961
my @eyes = Bc_sql::get_config("eyes");
6962
my @hair = Bc_sql::get_config("hair");
6963
my @heights = Bc_sql::get_config("heights");
6964
my @weights = Bc_sql::get_config("weights");
6965
my @lengths = Bc_sql::get_config("erections");
6966
my @busts = Bc_sql::get_config("busts");
6967
my @bodies = Bc_sql::get_config("bodies");
6968
my @yesno = Bc_sql::get_config("yesno");
6969
6970
$vitdiv{tag} = "div";
6971
$vitdiv{class} = "centered center";
6972
$vitdiv{id} = "vit";
6973
$vitdiv{style} = "text-align: center;";
6974
if ($page ne Bc_sql::get_constant("STATS_VITALS_PAGE")) { $vitdiv{style} .= " display: none;"; }
6975
$vitdiv{innerHTML} .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0 style=\"white-space: nowrap;\"><tr><td align=center colspan=3>";
6976
my $uEyesRef = Bc_sql::sql_execute("select value from eyes where ID = " . $Bc_sql::DB->quote($ustats{eye_clr}), "Html.pm - display stats page, 2");
6977
$vitdiv{innerHTML} .= Html2::embolden($uEyesRef->[0]) . " $ustats{eye_clr} eyes and ";
6978
my $uHairRef = Bc_sql::sql_execute("select value from hair where ID = " . $Bc_sql::DB->quote($ustats{hair_clr}), "Html.pm - display stats page, 3");
6979
my %uHair = %$uHairRef;
6980
$vitdiv{innerHTML} .= Html2::embolden($uHair{value}) . " hair" . Html2::br();
6981
$vitdiv{innerHTML} .= "</td></tr><tr><td height=5 colspan=3>";
6982
$vitdiv{innerHTML} .= "</td></tr><tr><td align=right>";
6983
$vitdiv{innerHTML} .= dropdown("height", "Height:", $ustats{height}, "", "", "", "name=height style=\"font-size: 8pt;\"", Html2::br(), \@heights, 2);
6984
$vitdiv{innerHTML} .= dropdown("weight", "Weight:", $ustats{weight}, "", "", "", "name=weight style=\"font-size: 8pt;\"", Html2::br(), \@weights, 2);
6985
$vitdiv{innerHTML} .= Html2::br();
6986
if ($ustats{gender} eq 1)
6987
{ $vitdiv{innerHTML} .= dropdown("erection", "Erection:", $ustats{erection}, "", "", "", "name=length style=\"font-size: 8pt;\"", Html2::br(), \@lengths, 2); } else
6988
{ $vitdiv{innerHTML} .= dropdown("bust", "Bust:", $ustats{bust}, "", "", "", "name=bust style=\"font-size: 8pt;\"", Html2::br(), \@busts, 2); }
6989
$vitdiv{innerHTML} .= dropdown("body", "Body:", $ustats{body}, "", "", "", "name=body style='width: 55px; font-size: 8pt;'", Html2::br(), \@bodies, 2);
6990
$vitdiv{innerHTML} .= Html2::br();
6991
$vitdiv{innerHTML} .= dropdown("wheels", "Can Drive: ", $ustats{wheels}, "", "", "", "name=wheels style=\"font-size: 8pt;\"", Html2::br(), \@yesno, 2);
6992
$vitdiv{innerHTML} .= dropdown("smoker", "Smoking ok: ", $ustats{smoker}, "", "", "", "name=smoker style=\"font-size: 8pt;\"", Html2::br(), \@yesno, 2);
6993
$vitdiv{innerHTML} .= Html2::br();
6994
$vitdiv{innerHTML} .= dropdown("drinker", "Alcohol Ok: ", $ustats{drinker}, "", "", "", "name=drinker style=\"font-size: 8pt;\"", Html2::br(), \@yesno, 2);
6995
$vitdiv{innerHTML} .= dropdown("drugs", "420 friendly: ", $ustats{drugs}, "", "", "", "name=drugs style=\"font-size: 8pt;\"", Html2::br(), \@yesno, 2);
6996
$vitdiv{innerHTML} .= "</td></tr><tr><td align=center colspan=3>";
6997
$vitdiv{innerHTML} .= dropdown("can_host", "Can Host: ", $ustats{can_host}, "", "", "", "name=can_host style=\"font-size: 8pt;\"", Html2::br(), \@yesno, 2);
6998
$vitdiv{innerHTML} .= "</td></tr></table>";
6999
7000
$statsdivs{innerHTML} .= Html2::tag(\%vitdiv);
7001
} # end vitals div
7002
7003
{ my %locdiv;
7004
$locdiv{tag} = "div";
7005
$locdiv{class} = "centered center";
7006
$locdiv{id} = "loc";
7007
$locdiv{style} = "text-align: center;";
7008
if ($page ne Bc_sql::get_constant("STATS_LOC_PAGE")) { $locdiv{style} .= " display: none;"; }
7009
7010
$locdiv{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td align=center style='white-space: nowrap;' width=1>";
7011
$locdiv{innerHTML} .= "Current Location" . Html2::br();
7012
7013
my $cFlag = Bc_sql::get_country_name($ustats{location});
7014
$cFlag =~ s/ /_/g;
7015
{ my %img;
7016
$img{tag} = "img";
7017
$img{src} = "/images/flags/flag_" . lc($cFlag) . ".png";
7018
$img{width} = "64";
7019
7020
$cFlag = Html2::tag(\%img);
7021
}
7022
$locdiv{innerHTML} .= Html2::embolden($cFlag) . Html2::br();
7023
7024
my ($city, $country, $more) = split(", ", Bc_sql::get_location($ustats{location}));
7025
my $loc = "$city," . Html2::br() . "$country";
7026
if ($more) { $loc .= ", $more"; }
7027
7028
$locdiv{innerHTML} .= Html2::embolden($loc) . Html2::br();
7029
$locdiv{innerHTML} .= "</td><td class=spacerx_largest></td><td align=right>";
7030
7031
$locdiv{innerHTML} .= display_city_names_asDropdown(User::get_user_stat($Bc_sql::LOGGEDIN, "location", "country"), # country
7032
User::get_user_stat($Bc_sql::LOGGEDIN, "location", "city"), # selected
7033
"user_city", # id
7034
"", # title
7035
"alert('?');", # onchange
7036
"", # spacing
7037
Html2::br() . "City" . Html2::br(), # separator
7038
1, # add999
7039
"style=\"width: 100px;\"" # extra html attributes
7040
);
7041
7042
$locdiv{innerHTML} .= display_country_names_asDropdown(User::get_user_stat($Bc_sql::LOGGEDIN, "location", "country"), # selected
7043
"user_country", # id
7044
"", # title
7045
"populate_with_cities('user_country', 'user_city', 0);", # onchange
7046
"", # spacing
7047
Html2::br() . "Country" . Html2::br(), # separator
7048
1, # add999
7049
"style=\"width: 100px; margin-top: 10px;\"" # extra html attributes
7050
);
7051
$locdiv{innerHTML} .= "</td></tr></table>";
7052
7053
$statsdivs{innerHTML} .= Html2::tag(\%locdiv);
7054
} # end loc div
7055
7056
{ my %descdiv;
7057
$descdiv{tag} = "div";
7058
$descdiv{class} = "centered center";
7059
$descdiv{id} = "desc";
7060
$descdiv{style} = "text-align: center;";
7061
if ($page ne Bc_sql::get_constant("STATS_DESC_PAGE")) { $descdiv{style} .= " display: none;"; }
7062
7063
{ my %ta;
7064
$ta{tag} = "textarea";
7065
$ta{name} = "desc";
7066
$ta{placeholder} = "you should have a description!";
7067
$ta{rows} = "9";
7068
$ta{style} = "min-width: 234px;";
7069
$ta{innerHTML} = uri_unescape($ustats{description});
7070
7071
$descdiv{innerHTML} .= Html2::tag(\%ta);
7072
}
7073
7074
$statsdivs{innerHTML} .= Html2::tag(\%descdiv);
7075
} # end description div
7076
7077
{ my %pwdiv;
7078
$pwdiv{tag} = "div";
7079
$pwdiv{class} = "centered center";
7080
$pwdiv{id} = "pw";
7081
$pwdiv{style} = "text-align: center;";
7082
if ($page ne Bc_sql::get_constant("STATS_PASS_PAGE")) { $pwdiv{style} .= " display: none;"; }
7083
$pwdiv{innerHTML} = "";
7084
7085
if (not Security::banned($Bc_sql::LOGGEDIN)) {
7086
$pwdiv{innerHTML} .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0 style=\"white-space: nowrap;\"><tr><td align=right>";
7087
7088
$pwdiv{innerHTML} .= "Current: ";
7089
{ my %input;
7090
$input{tag} = "input";
7091
$input{type} = "password";
7092
$input{name} = "currentpw";
7093
$input{placeholder} = "Current Password";
7094
7095
$pwdiv{innerHTML} .= Html2::tag(\%input) . Html2::br();
7096
}
7097
7098
$pwdiv{innerHTML} .= "New: ";
7099
{ my %input;
7100
$input{tag} = "input";
7101
$input{type} = "password";
7102
$input{name} = "newpw";
7103
$input{placeholder} = "New Password";
7104
7105
$pwdiv{innerHTML} .= Html2::tag(\%input) . Html2::br();
7106
}
7107
7108
$pwdiv{innerHTML} .= "Re-Type New: ";
7109
{ my %input;
7110
$input{tag} = "input";
7111
$input{type} = "password";
7112
$input{name} = "retypedpw";
7113
$input{placeholder} = "Retype New Password";
7114
7115
$pwdiv{innerHTML} .= Html2::tag(\%input) . Html2::br();
7116
}
7117
$pwdiv{innerHTML} .= "</td></tr></table>" . Html2::br();
7118
7119
{ my %link;
7120
$link{tag} = "a";
7121
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("FORGOT_PAGE");
7122
$link{title} = "Reset Password";
7123
$link{innerHTML} = "Forgot Protection";
7124
7125
$pwdiv{innerHTML} .= Html2::tag(\%link) . Html2::br();
7126
}
7127
$pwdiv{innerHTML} .= Html2::small("Passwords are encrypted" . Html2::br() . "and cannot be decrypted!" . Html2::br());
7128
} else {
7129
my %font;
7130
$font{tag} = "font";
7131
$font{class} = "error";
7132
$font{innerHTML} = "Banned Account!";
7133
7134
$pwdiv{innerHTML} .= Html2::tag(\%font);
7135
}
7136
7137
$statsdivs{innerHTML} .= Html2::tag(\%pwdiv);
7138
} # end password div
7139
7140
{ my %themediv;
7141
$themediv{tag} = "div";
7142
$themediv{class} = "centered center";
7143
$themediv{id} = "th";
7144
$themediv{style} = "text-align: center;";
7145
if ($page ne Bc_sql::get_constant("STATS_THEME_PAGE")) { $themediv{style} .= " display: none;"; }
7146
7147
$themediv{innerHTML} = "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
7148
$themediv{innerHTML} .= display_theme_names_asDropdown("user_theme", $ustats{TID}, "", "name=TID style='background-image: none; width: 125px; height: 100px;' size=2 onchange=\"preview_theme();\"", "", "");
7149
$themediv{innerHTML} .= "</td><td class=spacerx>";
7150
$themediv{innerHTML} .= "</td><td class=small valign=center>";
7151
{ my %link;
7152
$link{tag} = "a";
7153
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("STORE_PAGE");
7154
$link{innerHTML} = "Buy";
7155
7156
$themediv{innerHTML} .= Html2::tag(\%link);
7157
$themediv{innerHTML} .= " a premium theme!" . Html2::br() . Html2::small(Html2::br());
7158
}
7159
$themediv{innerHTML} .= "Premium themes come" . Html2::br() . "with";
7160
$themediv{innerHTML} .= "tasteful backgrounds" . Html2::br() . "and";
7161
$themediv{innerHTML} .= "can be seen on" . Html2::br() . "searches and";
7162
$themediv{innerHTML} .= "your profile!";
7163
$themediv{innerHTML} .= "</td></tr><tr><td align=center colspan=3>" . Html2::br();
7164
$themediv{innerHTML} .= Html2::embolden({class=>"red-button", innerHTML=>"click"});
7165
$themediv{innerHTML} .= " ";
7166
{ my %button;
7167
$button{tag} = "button";
7168
$button{type} = "button";
7169
$button{class} = "green";
7170
$button{innerHTML} = "Save";
7171
$button{title} = "Well, okay, the other green save button!";
7172
7173
$themediv{innerHTML} .= Html2::tag(\%button);
7174
}
7175
$themediv{innerHTML} .= " ";
7176
$themediv{innerHTML} .= Html2::embolden("for your theme selection to apply!");
7177
$themediv{innerHTML} .= "</td></tr></table>";
7178
7179
$statsdivs{innerHTML} .= Html2::tag(\%themediv);
7180
} # end theme div
7181
7182
{ my %subdiv;
7183
$subdiv{tag} = "div";
7184
$subdiv{id} = "su";
7185
$subdiv{class} = "centered center";
7186
$subdiv{style} = "text-align: center;";
7187
if ($page ne Bc_sql::get_constant("STATS_PAY_PAGE")) { $subdiv{style} .= " display: none;"; }
7188
$subdiv{innerHTML} = "";
7189
7190
if (not Security::banned($Bc_sql::LOGGEDIN)) {
7191
$subdiv{innerHTML} .= "Security Level: " . Html2::embolden(Bc_sql::get_config_asWord("sec_levels", $ustats{security}, "friendly_name")) . Html2::br() . Html2::br();
7192
$subdiv{innerHTML} .= "Member since: " . Html2::embolden(Date::expand_date($ustats{enrolled})) . Html2::br();
7193
$subdiv{innerHTML} .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td align=center rowspan=4>";
7194
$subdiv{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td align=center>";
7195
if ($ustats{subscriber} eq 1) {
7196
$subdiv{innerHTML} .= "Become a " . Html2::embolden("Premium Member") . " and gain access to chat, alerts, points and ratings and " . Html2::italicize("more!");
7197
} else {
7198
if (User::isUserBeta() and not User::isUserSuperAdmin()) {
7199
$subdiv{innerHTML} .= "You are a BETA tester!" . Html2::br();
7200
{ my %button;
7201
$button{tag} = "button";
7202
$button{type} = "button";
7203
$button{class} = "red";
7204
$button{onclick} = "alert(\"We're sorry, this function is not yet complete\");";
7205
$button{innerHTML} = "Opt Out";
7206
7207
$subdiv{innerHTML} .= Html2::tag(\%button) . Html2::br();
7208
}
7209
}
7210
7211
if (not User::isUserSubscriber()) {
7212
$subdiv{innerHTML} .= "As a " . Html2::embolden("Premium Member") . " you have access to communications";
7213
$subdiv{innerHTML} .= "and more!";
7214
} else {
7215
if (User::isUserSuperAdmin()) {
7216
$subdiv{innerHTML} .= "Welcome," . Html2::br() . "System Administrator!";
7217
} elsif (User::isUserAdmin()) {
7218
$subdiv{innerHTML} .= "Welcome," . Html2::br() . "Administrator!";
7219
} elsif (User::isUserModerator()) {
7220
$subdiv{innerHTML} .= "Welcome," . Html2::br() . "Moderator!";
7221
} elsif (User::isUserBeta()) {
7222
$subdiv{innerHTML} .= "Welcome," . Html2::br() . "Beta Tester!";
7223
} elsif (User::isUserSubscriber()) {
7224
$subdiv{innerHTML} .= "Welcome," . Html2::br() . "Subscriber!";
7225
} else {
7226
# this shouldn't ever appear, but...just in case, cuz...computers.
7227
$subdiv{innerHTML} .= "Welcome!";
7228
}
7229
}
7230
}
7231
$subdiv{innerHTML} .= "</td><td class=spacerx_large>";
7232
$subdiv{innerHTML} .= "</td></tr></table>";
7233
$subdiv{innerHTML} .= "</td></tr><tr><td height=5>";
7234
$subdiv{innerHTML} .= "</td></tr><tr><td align=center nowrap>";
7235
$subdiv{innerHTML} .= "Status" . Html2::hr();
7236
$subdiv{innerHTML} .= "</td></tr><tr><td align=center valign=top nowrap>";
7237
$subdiv{innerHTML} .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td align=center colspan=3 nowrap>";
7238
$subdiv{innerHTML} .= "Expires" . Html2::br();
7239
my $exp;
7240
if ($ustats{subscription_type} eq 4) { $exp = "NEVER"; } else { $exp = $ustats{subscription_date}; }
7241
$subdiv{innerHTML} .= Html2::embolden($exp);
7242
$subdiv{innerHTML} .= "</td><td width=20 style='min-width: 10px;'>";
7243
$subdiv{innerHTML} .= "</td><td align=center valign=top nowrap>";
7244
$subdiv{innerHTML} .= "Type" . Html2::br();
7245
$subdiv{innerHTML} .= Html2::embolden(ucfirst(Bc_sql::get_config_asWord("membership_types", $ustats{subscription_type}))) . Html2::br();
7246
$subdiv{innerHTML} .= "</td></tr></table>";
7247
$subdiv{innerHTML} .= "</td></tr></table>";
7248
7249
if ($ustats{subscriber} eq 1) {
7250
{ my %font;
7251
$font{tag} = "font";
7252
$font{class} = "notice";
7253
$font{innerHTML} = "Get Your ";
7254
7255
{ my %link;
7256
$link{tag} = "a";
7257
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("PAY_PAGE");
7258
$link{innerHTML} = "Premium Membership";
7259
7260
$font{innerHTML} .= Html2::tag(\%link);
7261
}
7262
7263
$font{innerHTML} .= Html2::embolden("TODAY") . "!";
7264
7265
$subdiv{innerHTML} .= Html2::tag(\%font);
7266
}
7267
} else {
7268
if (not User::isUserAdmin()) {
7269
$subdiv{innerHTML} .= Html2::small(Html2::italicize({class=>"notice", innerHTML=>"Premium Membership cannot be canceled"}));
7270
}
7271
}
7272
} else {
7273
$subdiv{innerHTML} .= Html2::tag({tag=>"font", class=>"error", innerHTML=>"Banned Account!"});
7274
}
7275
7276
$statsdivs{innerHTML} .= Html2::tag(\%subdiv);
7277
} # end subscriber div
7278
7279
{ my %coinsdiv;
7280
$coinsdiv{tag} = "div";
7281
$coinsdiv{id} = "sp";
7282
$coinsdiv{class} = "centered center";
7283
$coinsdiv{style} = "text-align: center;";
7284
if ($page ne Bc_sql::get_constant("STATS_COINS_PAGE")) { $coinsdiv{style} .= " display: none;"; }
7285
$coinsdiv{innerHTML} = "";
7286
7287
$coinsdiv{innerHTML} .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td align=center>";
7288
my @items = User::get_user_inventory($Bc_sql::LOGGEDIN);
7289
my $invWidth = "300px";
7290
$coinsdiv{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td height=1>";
7291
my $upoints = User::get_user_points($Bc_sql::LOGGEDIN);
7292
$coinsdiv{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td align=center nowrap>";
7293
$coinsdiv{innerHTML} .= "You have";
7294
$coinsdiv{innerHTML} .= "</td></tr><tr><td class=spacery></td></tr><tr><td align=center nowrap>";
7295
$coinsdiv{innerHTML} .= Html2::big(Html2::embolden(Bc_misc::commafied($upoints)));
7296
$coinsdiv{innerHTML} .= "</td></tr><tr><td class=spacery></td></tr><tr><td align=center nowrap>";
7297
{ my %img;
7298
$img{tag} = "img";
7299
$img{src} = "/images/" . Bc_sql::get_constant("IMAGE_COIN_ICON");
7300
$img{width} = "24";
7301
7302
$coinsdiv{innerHTML} .= Html2::tag(\%img);
7303
}
7304
$coinsdiv{innerHTML} .= "coins!";
7305
$coinsdiv{innerHTML} .= "</td></tr></table>";
7306
$coinsdiv{innerHTML} .= "</td></tr><tr><td class=spacery>";
7307
$coinsdiv{innerHTML} .= "</td></tr><tr><td align=center height=1>";
7308
7309
{ my %link;
7310
$link{tag} = "a";
7311
$link{href} = "/?$Bc_sql::QUERY_PAGE=";
7312
7313
my $verb = "Spend";
7314
if ($upoints)
7315
{ $link{href} .= Bc_sql::get_constant("STORE_PAGE"); } else
7316
{ $verb = "Earn"; $link{href} .= Bc_sql::get_constant("BROWSE_PAGE"); }
7317
$link{innerHTML} = "$verb some!";
7318
7319
$coinsdiv{innerHTML} .= Html2::tag(\%link);
7320
}
7321
7322
$coinsdiv{innerHTML} .= Html2::br();
7323
$coinsdiv{innerHTML} .= "</td></tr></table>";
7324
$coinsdiv{innerHTML} .= "</td></tr></table>";
7325
7326
$statsdivs{innerHTML} .= Html2::tag(\%coinsdiv);
7327
} # end coins div
7328
7329
{ my %blocksdiv;
7330
my @blocked = User::get_user_blocked_users($Bc_sql::LOGGEDIN);
7331
my $bw = 180;
7332
my $bh = 125;
7333
7334
$blocksdiv{tag} = "div";
7335
$blocksdiv{id} = "bl";
7336
$blocksdiv{class} = "centered center";
7337
$blocksdiv{style} = "text-align: center;";
7338
if ($page ne Bc_sql::get_constant("STATS_BLOCKED_PAGE")) {
7339
$blocksdiv{style} .= " display: none;";
7340
if (@blocked) { $blocksdiv{style} .= " height: 100%;"; }
7341
}
7342
7343
$blocksdiv{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100% height=100%><tr><td align=center>";
7344
if (@blocked) {
7345
foreach my $uid (@blocked) {
7346
my $nn = Bc_misc::shorten_str(User::get_user_stat($uid, "nickname"), 15);
7347
$blocksdiv{innerHTML} .= Html2::profile_link($uid) . " - ";
7348
{ my %button;
7349
$button{tag} = "button";
7350
$button{type} = "button";
7351
$button{class} = "green";
7352
$button{onclick} = "document.location=\"/block.pl?$Bc_sql::QUERY_UID=$uid&r=1\";";
7353
$button{title} = "Unblock Member";
7354
$button{innerHTML} = " x ";
7355
7356
$blocksdiv{innerHTML} .= Html2::tag(\%button);
7357
}
7358
$blocksdiv{innerHTML} .= Html2::br();
7359
}
7360
} else {
7361
$blocksdiv{innerHTML} .= "No Blocked Members" . Html2::br() . Html2::embolden("Good Job!");
7362
}
7363
$blocksdiv{innerHTML} .= "</td></tr></table>";
7364
7365
$statsdivs{innerHTML} .= Html2::tag(\%blocksdiv);
7366
}
7367
7368
$container{innerHTML} .= Html2::tag(\%statsdivs);
7369
} # end statsdivs
7370
7371
{ my %buttonsdiv;
7372
$buttonsdiv{tag} = "div";
7373
$buttonsdiv{class} = "centered center stats-buttons";
7374
7375
$buttonsdiv{innerHTML} = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td align=center height=1><hr style='margin-bottom: 4px;'><table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td align=left>";
7376
{ my %button;
7377
$button{tag} = "button";
7378
$button{type} = "reset";
7379
$button{class} = "yellow nowrap";
7380
$button{title} = "Undo Changes";
7381
$button{onclick} = "restore_theme();";
7382
$button{innerHTML} = "Undo";
7383
7384
$buttonsdiv{innerHTML} .= Html2::tag(\%button);
7385
}
7386
$buttonsdiv{innerHTML} .= "</td><td width=20%></td><td align=center width=20%>";
7387
if (not Security::banned($Bc_sql::LOGGEDIN)) {
7388
{ my %input;
7389
$input{tag} = "input";
7390
$input{type} = "hidden";
7391
$input{id} = "statpage";
7392
$input{name} = Bc_sql::get_constant("QUERY_STATS_PAGE");
7393
$input{value} = $page;
7394
7395
$buttonsdiv{innerHTML} .= Html2::tag(\%input);
7396
}
7397
if (not User::isUserSuperAdmin()) {
7398
{ my %button;
7399
$button{tag} = "button";
7400
$button{type} = "submit";
7401
$button{class} = "green";
7402
$button{title} = "Apply Changes";
7403
$button{innerHTML} = "Save";
7404
7405
$buttonsdiv{innerHTML} .= Html2::tag(\%button);
7406
}
7407
7408
$buttonsdiv{innerHTML} .= "</td><td width=20%></td><td align=right width=20%>";
7409
7410
{ my %button;
7411
$button{tag} = "button";
7412
$button{type} = "button";
7413
$button{class} = "red nowrap";
7414
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("CLOSE_PAGE") . "\";";
7415
$button{title} = "Close Your Account";
7416
$button{innerHTML} = "Beat it";
7417
7418
$buttonsdiv{innerHTML} .= Html2::tag(\%button);
7419
}
7420
} else {
7421
$buttonsdiv{innerHTML} .= "</td><td width=20%></td><td align=right width=20%>";
7422
7423
{ my %button;
7424
$button{tag} = "button";
7425
$button{type} = "submit";
7426
$button{class} = "green";
7427
$button{title} = "Apply Changes";
7428
$button{innerHTML} = "Save";
7429
7430
$buttonsdiv{innerHTML} .= Html2::tag(\%button);
7431
}
7432
}
7433
} else {
7434
my %font;
7435
$font{tag} = "font";
7436
$font{class} = "error";
7437
$font{innerHTML} = "Banned Account!";
7438
7439
$buttonsdiv{innerHTML} .= Html2::tag(\%font);
7440
}
7441
$buttonsdiv{innerHTML} .= "</td></tr></table></td></tr></table>";
7442
7443
$container{innerHTML} .= Html2::tag(\%buttonsdiv);
7444
}
7445
7446
$fs{innerHTML} .= Html2::tag(\%container);
7447
} # end stats-container
7448
7449
$form{innerHTML} .= Html2::tag(\%fs);
7450
} # emd fieldset
7451
7452
$rv .= Html2::tag(\%form);
7453
} # end form
7454
7455
return $rv; # a scalar
7456
#usage: print display_stats_page(0, ' ');
7457
}
7458
7459
########################
7460
sub display_city_names($$$$$$) {
7461
#*
7462
# just an unordered list of all city names and coords of a given country
7463
# not highly useful, it's more for debugging purposes than anything else, really
7464
#*
7465
my ($countryID, $title, $class, $spacing, $separator) = @_; # a country ID to list cities for && a title for the list && a class && spacing for pretty printing HTML output && an ending
7466
if (!$spacing) { $spacing = ""; }
7467
7468
if ($spacing eq 0) { $spacing = ""; }
7469
if ($separator eq 0) { $separator = ""; }
7470
7471
my $output;
7472
{ my %div;
7473
$div{tag} = "div";
7474
if ($class) { $div{class} = $class; }
7475
$div{innerHTML} = "";
7476
7477
if ($title) {
7478
my %tdiv;
7479
$tdiv{tag} = "div";
7480
$tdiv{class} = "subtitle";
7481
$tdiv{innerHTML} = $title;
7482
7483
$div{innerHTML} .= Html2::tag(\%tdiv);
7484
} # end if title
7485
7486
{ my %ul;
7487
$ul{tag} = "ul";
7488
$ul{innerHTML} = "";
7489
7490
my @cities = Bc_sql::sql_execute("select * from cities", "Html.pm - display city names");
7491
foreach my $city (@cities) {
7492
my @city_data = split("=", $city);
7493
my $city_loc = $city_data[0];
7494
my $city_name = $city_data[1];
7495
my $country_id = $city_loc;
7496
$country_id =~ s/\.(.)*$//;
7497
if ($country_id eq $countryID) {
7498
my %li;
7499
$li{tag} = "li";
7500
$li{innerHTML} = $city_loc - $city_name;
7501
7502
$ul{innerHTML} .= Html2::tag(\%li) . Html2::br();
7503
} # end if country_id eq countryID
7504
} # end foreach
7505
7506
$div{innerHTML} .= Html2::tag(\%ul);
7507
} # end ul
7508
7509
$output .= Html2::tag(\%div);
7510
} # end div
7511
7512
return $output; # a scalar
7513
#usage: my $cityList = display_city_names(31, "Cities", "css", "", "");
7514
}
7515
7516
########################
7517
sub display_city_names_asDropdown($$$$$$$;$$) {
7518
#*
7519
# creates a dropdown of all cities in a given country
7520
#*
7521
my ($country, $selected, $id, $title, $onchange, $spacing, $separator, $add999, $extras) = @_; # a country to list cities for && a selected value && an id and name for the dropdown && a title before the dropdown && HTML onchange event && spacing for pretty printing HTML output && an ending for after the dropdown && add "999=--Any--"? (optional) && extra html attributes (optional)
7522
if (!$spacing) { $spacing = ""; }
7523
7524
if ($spacing eq 0) { $spacing = ""; }
7525
if ($separator eq 0) { $separator = ""; }
7526
7527
my $output = "";
7528
if ($title) { $output .= $title . " "; }
7529
7530
{ my %select;
7531
$select{tag} = "select";
7532
if ($id) { $select{id} = $id; $select{name} = $id; }
7533
if ($onchange) { $select{onchange} = $onchange; }
7534
if ($spacing =~ s/^style=//) { $select{style} = $spacing; }
7535
if ($selected == -1) {
7536
{ my %option;
7537
$option{tag} = "option";
7538
$option{value} = "";
7539
$option{selected} = 1;
7540
$option{disabled} = 1;
7541
$option{innerHTML} = "Pick One";
7542
7543
$select{innerHTML} .= Html2::tag(\%option);
7544
} # end option
7545
} # end if selected == -1
7546
7547
if ($country != -1) {
7548
if ($add999 == 1) {
7549
my %option;
7550
$option{tag} = "option";
7551
$option{value} = "999";
7552
$option{innerHTML} = "--Any City--";
7553
7554
$select{innerHTML} .= Html2::tag(\%option);
7555
} # end if add999
7556
7557
my @cities = Bc_sql::get_cities();
7558
if (@cities) {
7559
foreach my $city (@cities) {
7560
# $city = "31-123=Edmonton";
7561
my ($city_loc, $city_name) = split(/=/, $city);
7562
my ($country_id, $city_id) = split(/-/, $city_loc);
7563
if ($country_id eq $country) {
7564
{ my %option;
7565
$option{tag} = "option";
7566
$option{value} = $city_id;
7567
if ($selected eq $city_id) { $option{selected} = 1; }
7568
$option{innerHTML} = $city_name;
7569
7570
$select{innerHTML} .= Html2::tag(\%option);
7571
} # end option
7572
} # end if country_id eq country
7573
} # end foreach city
7574
} # end if @cities
7575
else {
7576
my %option;
7577
$option{tag} = "option";
7578
$option{value} = "";
7579
$option{innerHTML} = "(no data)";
7580
7581
$select{innerHTML} .= Html2::tag(\%option);
7582
} # end else of if @cities
7583
} # end if country ne -1
7584
else {
7585
my %option;
7586
$option{tag} = "option";
7587
$option{value} = "";
7588
$option{selected} = 1;
7589
$option{disabled} = 1;
7590
$option{innerHTML} = "City";
7591
7592
$select{innerHTML} .= Html2::tag(\%option);
7593
} # end else of if country ne -1
7594
7595
$output .= Html2::tag(\%select);
7596
} # end select
7597
7598
if ($separator) { $output .= $separator; }
7599
if ($extras) { $output =~ s/>/ $extras>/; }
7600
7601
return $output; # a scalar
7602
#usage: <small>my $cities_dropdown = display_city_names_asDropdown(31, "cities", "Cities", "alert('selection changed');", "", "");</small>
7603
}
7604
7605
########################
7606
sub display_country_names($$$$) {
7607
#*
7608
# just a list of all country names n coords
7609
# not highly useful, it's more for debugging purposes than anything else, really
7610
# this function is broken. for the time being anyway
7611
#*
7612
my ($title, $class, $spacing, $separator) = @_; # a title for the list && a class && spacing for pretty printing HTML output && an ending
7613
if (!$spacing) { $spacing = ""; }
7614
7615
if ($spacing eq 0) { $spacing = ""; }
7616
if ($separator eq 0) { $separator = ""; }
7617
7618
my $output = "";
7619
7620
{ my %div;
7621
$div{tag} = "div";
7622
if ($class) { $div{class} = $class; }
7623
$div{innerHTML} = "";
7624
7625
if ($title) {
7626
my %title;
7627
$title{tag} = "div";
7628
$title{class} = "subtitle";
7629
$title{innerHTML} = $title;
7630
7631
$div{innerHTML} .= Html2::tag(\%title);
7632
}
7633
7634
{ my %ul;
7635
$ul{tag} = "ul";
7636
$ul{innerHTML} = "";
7637
7638
my @countries = Bc_sql::get_countries();
7639
foreach my $country (@countries) {
7640
my @country_data = split("=", $country);
7641
my $country_loc = $country_data[0];
7642
my $country_name = $country_data[1];
7643
my %li;
7644
$li{tag} = "li";
7645
$li{innerHTML} = "$country_loc - $country_name";
7646
7647
$ul{innerHTML} .= Html2::tag(\%li) . Html2::br();
7648
}
7649
7650
$div{innerHTML} .= Html2::tag(\%ul);
7651
}
7652
7653
$output .= Html2::tag(\%div);
7654
}
7655
7656
return $output; # a scalar
7657
#usage: my $countryList = display_country_names("Countries", "css", "", "");
7658
}
7659
7660
########################
7661
sub display_country_names_asDropdown($$$$$$;$$) {
7662
#*
7663
# creates a dropdown of all countries
7664
# this function is broken. for now.
7665
#*
7666
my ($selected, $id, $title, $onchange, $spacing, $separator, $add999, $extras) = @_; # a selected country ID && an id and name for the dropdown && a title before the dropdown && HTML onchange event && spacing for pretty printing HTML output && an ending for after the dropdown && add "999=--Any--"? (optional) && extra html attributes (optional)
7667
if (!$spacing) { $spacing = ""; }
7668
7669
if ($spacing eq 0) { $spacing = ""; }
7670
if ($separator eq 0) { $separator = ""; }
7671
7672
my $output = "";
7673
if ($title) { $output .= "$title "; }
7674
7675
{ my %select;
7676
$select{tag} = "select";
7677
if ($id) { $select{id} = $id; $select{name} = $id; }
7678
if ($onchange) { $select{onchange} = $onchange; }
7679
if ($selected == -1) { $select{required} = 1; }
7680
$select{innerHTML} = "";
7681
7682
if ($selected == -1) {
7683
my %option;
7684
$option{tag} = "option";
7685
$option{value} = "";
7686
$option{selected} = 1;
7687
$option{disabled} = 1;
7688
$option{innerHTML} = "Country";
7689
7690
$select{innerHTML} .= Html2::tag(\%option);
7691
}
7692
7693
if ($add999) {
7694
my %option;
7695
$option{tag} = "option";
7696
$option{value} = "999";
7697
$option{innerHTML} = "--Any Country--";
7698
7699
$select{innerHTML} .= Html2::tag(\%option);
7700
}
7701
7702
my @countries = Bc_sql::get_countries(); #@$cRef;
7703
foreach my $country (@countries) {
7704
my @country_data = split("=", $country);
7705
my $country_loc = $country_data[0];
7706
my $country_name = $country_data[1];
7707
7708
my %option;
7709
$option{tag} = "option";
7710
$option{value} = $country_loc;
7711
if ($selected eq $country_loc) { $option{selected} = 1; }
7712
$option{innerHTML} = $country_name;
7713
7714
$select{innerHTML} .= Html2::tag(\%option);
7715
}
7716
7717
$output .= Html2::tag(\%select);
7718
}
7719
7720
if ($separator) { $output .= $separator; }
7721
if ($extras) { $output =~ s/>/ $extras>/; }
7722
7723
return $output; # a scalar
7724
#usage: <small>my $countries_dropdown = display_country_names_asDropdown(31, "countries", "Countries", "alert('selection changed');","", "", 0);</small>
7725
}
7726
7727
########################
7728
sub display_admin_page(;$$) {
7729
#*
7730
# display a specified administration page (default = admin home page)
7731
# this subroutine is large!
7732
# $page values should be passed in by a Bc_sql::get_constant("...") call,
7733
# instead of passing a value directly (eg: avoid setting $page to "b")
7734
#*
7735
my ($page, $spacing) = @_; # a sub-page of admin (optional, default = ADMIN_HOME) && spacing for pretty printing HTML output (optional)
7736
if (not $page or $page eq "") { $page = Bc_sql::get_constant("ADMIN_HOME"); }
7737
if (!$spacing) { $spacing = ""; }
7738
7739
my $rv = "";
7740
my $allowed = 0;
7741
7742
if (User::isUserModerator() and not User::isUserAdmin()) {
7743
if (
7744
$page eq Bc_sql::get_constant("ADMIN_USER_EDITOR_PAGE") or
7745
$page eq Bc_sql::get_constant("ADMIN_BANNED_USERS_PAGE") or
7746
$page eq Bc_sql::get_constant("ADMIN_FEEDBACK_INBOX_PAGE") or
7747
$page eq Bc_sql::get_constant("ADMIN_THEME_EDITOR_PAGE")
7748
) {
7749
$allowed = 1;
7750
}
7751
} elsif (User::isUserAdmin()) {
7752
$allowed = 1;
7753
}
7754
7755
if ($allowed) {
7756
my $title = "";
7757
my $content = "";
7758
my $tab = Bc_misc::get_param("t");
7759
7760
if ($page eq Bc_sql::get_constant("ADMIN_CONTENT_EDITOR_PAGE") and User::isUserSuperAdmin($Bc_sql::LOGGEDIN)) { $tab = "about"; }
7761
elsif ($page eq Bc_sql::get_constant("ADMIN_USER_EDITOR_PAGE") and User::isUserSuperAdmin($Bc_sql::LOGGEDIN)) { $tab = "stats"; }
7762
elsif (
7763
$page eq Bc_sql::get_constant("ADMIN_SYSTEM_PAGE") and
7764
User::isUserSuperAdmin($Bc_sql::LOGGEDIN) and
7765
not $tab
7766
) {
7767
$tab = "bodies";
7768
}
7769
7770
if ($tab) {
7771
{ my %godlyScript;
7772
$godlyScript{tag} = "script";
7773
$godlyScript{innerHTML} .= "function myGod() {\n";
7774
$godlyScript{innerHTML} .= " lastElementToggled = \"$tab\";\n";
7775
$godlyScript{innerHTML} .= " //console.log(\"tab=$tab\\n and\\nlastElementToggled=\" + lastElementToggled);\n";
7776
$godlyScript{innerHTML} .= "}\n";
7777
$godlyScript{innerHTML} .= "\n";
7778
$godlyScript{innerHTML} .= "setTimeout(myGod, 1234);\n";
7779
7780
$rv .= Html2::tag(\%godlyScript);
7781
}
7782
}
7783
7784
$rv .= "<table border=0 cellpadding=0 cellspacing=0><tr><td class='center normal-panel' width=100% style='margin-bottom: 10px;'>";
7785
7786
###
7787
if ($page eq Bc_sql::get_constant("ADMIN_HOME")) {
7788
my $height = "200px"; # height of panels
7789
my $width = "230px"; # width of panels
7790
$title .= "Administration Home";
7791
7792
$content .= "<table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td class='none admin-home-container'>";
7793
7794
{ my %activity;
7795
$activity{tag} = "div";
7796
$activity{class} = "activity center";
7797
$activity{innerHTML} = "";
7798
7799
{ my %activitytitle;
7800
$activitytitle{tag} = "font";
7801
$activitytitle{class} = "subtitle";
7802
$activitytitle{innerHTML} = "Activity";
7803
7804
$activity{innerHTML} .= Html2::tag(\%activitytitle);
7805
}
7806
7807
$activity{innerHTML} .= Html2::hr();
7808
7809
{ my %newestaccounts;
7810
$newestaccounts{tag} = "div";
7811
$newestaccounts{class} = "subnavbar_dark";
7812
$newestaccounts{innerHTML} = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td align=center height=1>";
7813
7814
{ my %newaccountstitle;
7815
$newaccountstitle{tag} = "font";
7816
$newaccountstitle{class} = "minititle";
7817
$newaccountstitle{style} = "padding: 2px;";
7818
$newaccountstitle{innerHTML} = "Newest 100" . Html2::br() . "Accounts";
7819
7820
$newestaccounts{innerHTML} .= Html2::tag(\%newaccountstitle);
7821
}
7822
7823
$newestaccounts{innerHTML} .= "</td></tr><tr>";
7824
{ my %td;
7825
$td{tag} = "td";
7826
$td{height} = "1";
7827
$td{innerHTML} = Html2::hr({class=>"tiny"});
7828
$newestaccounts{innerHTML} .= Html2::tag(\%td);
7829
}
7830
$newestaccounts{innerHTML} .= "</tr><tr><td align=left>";
7831
7832
my @new_members = Bc_sql::get_latest_memberships(1); # include new premium memberships
7833
my $last_date = 0;
7834
if (@new_members) {
7835
foreach my $memberRef (@new_members) {
7836
my %memberStats = User::get_user_stats($memberRef->{ID});
7837
if ($last_date ne $memberStats{enrolled}) {
7838
if ($last_date) { $newestaccounts{innerHTML} .= Html2::br(); }
7839
$newestaccounts{innerHTML} .= Html2::embolden($memberStats{enrolled}) . Html2::br();
7840
}
7841
7842
$newestaccounts{innerHTML} .= Html2::profile_link($memberStats{ID});
7843
7844
$last_date = $memberStats{enrolled};
7845
$newestaccounts{innerHTML} .= Html2::br();
7846
}
7847
} else {
7848
my %none;
7849
$none{tag} = "font";
7850
$none{class} = "minititle";
7851
$none{innerHTML} = "No New Members!";
7852
7853
$newestaccounts{innerHTML} .= Html2::tag(\%none);
7854
}
7855
$newestaccounts{innerHTML} .= "</td></tr></table>";
7856
7857
$activity{innerHTML} .= Html2::tag(\%newestaccounts);
7858
} # end newest accounts div
7859
7860
$activity{innerHTML} .= Html2::hr();
7861
7862
{ my %betatesters;
7863
$betatesters{tag} = "div";
7864
$betatesters{class} = "subnavbar_dark";
7865
$betatesters{style} = "margin-bottom: 8px;";
7866
$betatesters{innerHTML} = "";
7867
7868
{ my %betatitle;
7869
$betatitle{tag} = "font";
7870
$betatitle{class} = "minititle";
7871
$betatitle{innerHTML} = "Beta Testers (" . Bc_sql::get_beta_users(1) . ")";
7872
7873
$betatesters{innerHTML} .= Html2::tag(\%betatitle) . Html2::br();
7874
}
7875
7876
{ my %supers;
7877
$supers{tag} = "font";
7878
$supers{class} = "description notice small";
7879
$supers{style} = "margin-bottom: 4px;";
7880
$supers{innerHTML} = "Admins and Super Admins" . Html2::br() .
7881
"are considered beta testers," . Html2::br() .
7882
"but are NOT counted!";
7883
7884
$betatesters{innerHTML} .= Html2::tag(\%supers) . Html2::br();
7885
}
7886
7887
$betatesters{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td>";
7888
$betatesters{innerHTML} .= Html2::hr({class=>"tiny"});
7889
$betatesters{innerHTML} .= "</td></tr><tr><td";
7890
my $betas = Bc_sql::get_beta_users();
7891
if (@$betas) {
7892
$betatesters{innerHTML} .= " style='text-align: left;'";
7893
if (@$betas > 10) { $betatesters{innerHTML} .= " class=scrolling_vertical"; }
7894
$betatesters{innerHTML} .= ">";
7895
7896
foreach my $uid (@$betas) {
7897
my %account = User::get_user_stats($uid);
7898
if ($account{nickname}) {
7899
$betatesters{innerHTML} .= Html2::profile_link($account{ID});
7900
} else {
7901
$betatesters{innerHTML} .= "UID " . $uid . " doesn't exist!";
7902
}
7903
7904
$betatesters{innerHTML} .= Html2::br();
7905
}
7906
} else {
7907
$betatesters{innerHTML} .= " style='text-align: center !important;'>";
7908
$betatesters{innerHTML} .= Html2::embolden({class=>"notice", innerHTML=>"none"});
7909
}
7910
7911
$betatesters{innerHTML} .= "</td></tr></table>";
7912
7913
$activity{innerHTML} .= Html2::tag(\%betatesters);
7914
} # end beta testers
7915
7916
$content .= Html2::tag(\%activity);
7917
} # end activity div
7918
7919
{ my %control;
7920
$control{tag} = "div";
7921
$control{class} = "control";
7922
$control{innerHTML} = "";
7923
7924
{ my %font;
7925
$font{tag} = "font";
7926
$font{class} = "subtitle";
7927
7928
if (User::isUserSuperAdmin($Bc_sql::LOGGEDIN))
7929
{ $font{innerHTML} .= "Site Control"; } else
7930
{ $font{innerHTML} .= "Site Status"; }
7931
7932
$control{innerHTML} .= Html2::tag(\%font) . Html2::hr();
7933
}
7934
7935
if (User::isUserSuperAdmin($Bc_sql::LOGGEDIN)) {
7936
if ($Bc_sql::CONSTANTS{GOT_LOADED} eq 2) {
7937
$control{innerHTML} .= "constants got totally loaded!" . Html2::br();
7938
} else {
7939
$control{innerHTML} .= "no fuckin' constants!?" . Html2::br();
7940
}
7941
}
7942
my $ucount = Bc_sql::get_users(1);
7943
$control{innerHTML} .= "There are " . Html2::embolden(Bc_misc::commafied($ucount)) . Bc_misc::pluralize(" user", $ucount) . Html2::br();
7944
if (User::isUserSuperAdmin($Bc_sql::LOGGEDIN)) {
7945
$control{innerHTML} .= Html2::br() . "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td align=center>";
7946
7947
{ my %rudiv;
7948
$rudiv{tag} = "div";
7949
$rudiv{class} = "subnavbar_dark";
7950
$rudiv{innerHTML} = "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td class='minititle'>";
7951
7952
{ my %form;
7953
$form{tag} = "form";
7954
$form{method} = "post";
7955
$form{action} = "/new_random_user.pl";
7956
7957
$form{innerHTML} = "Create Random User(s)";
7958
$form{innerHTML} .= "</td></tr><tr><td>";
7959
$form{innerHTML} .=Html2::hr({class=>"tiny"});
7960
$form{innerHTML} .= "</td></tr><tr><td>";
7961
$form{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td>";
7962
my @c = ();
7963
push @c, "1=1";
7964
push @c, "10=10";
7965
push @c, "100=100";
7966
push @c, "1000=1,000";
7967
push @c, "10000=10,000";
7968
push @c, "100000=100,000";
7969
push @c, "500000=500,000";
7970
push @c, "1000000=1,000,000";
7971
$form{innerHTML} .= dropdown(
7972
'c',
7973
"",
7974
-1,
7975
"",
7976
"",
7977
"",
7978
"required style='max-width: 88px; min-width: 88px; width: 88px;'",
7979
Html2::br(),
7980
\@c,
7981
);
7982
$form{innerHTML} .= "</td><td class=spacerx></td><td>";
7983
{ my %button;
7984
$button{tag} = "button";
7985
$button{class} = "red";
7986
$button{innerHTML} = "Generate";
7987
7988
$form{innerHTML} .= Html2::tag(\%button);
7989
} # end submit button
7990
$form{innerHTML} .= "</td></tr><tr><td class=spacery colspan=3>";
7991
$form{innerHTML} .= "</td></tr><tr><td align=center colspan=3>";
7992
{ my %notice;
7993
$notice{tag} = "font";
7994
$notice{class} = "copyright notice";
7995
$notice{innerHTML} = "This " . Html2::embolden("can") . " take a while!";
7996
7997
$form{innerHTML} .= Html2::tag(\%notice) . Html2::br();
7998
} # end notice
7999
$form{innerHTML} .= "</td></tr><tr><td class=spacery colspan=3>";
8000
$form{innerHTML} .= "</td></tr><tr><td align=center colspan=3>";
8001
$form{innerHTML} .= "</td></tr></table>";
8002
$form{innerHTML} .= "</td></tr><tr><td class=spacery colspan=3>";
8003
8004
$rudiv{innerHTML} .= Html2::tag(\%form);
8005
} # end form
8006
8007
$rudiv{innerHTML} .= "</td></tr></table>";
8008
$control{innerHTML} .= Html2::tag(\%rudiv);
8009
} # end create random users div
8010
8011
$control{innerHTML} .= "</td></tr></table>" . Html2::br();
8012
}
8013
8014
$control{innerHTML} .= "maintenence mode is" .
8015
Html2::br() .
8016
"currently ";
8017
8018
{ my %link;
8019
if (User::isUserSuperAdmin($Bc_sql::LOGGEDIN))
8020
{ $link{tag} .= "a"; } else
8021
{ $link{tag} = "font"; $link{class} = "yellow-text embolden"; }
8022
$link{href} = "/mm.pl";
8023
$link{innerHTML} = "";
8024
8025
if (Bc_sql::in_maint())
8026
{ $link{innerHTML} .= "enabled"; } else
8027
{ $link{innerHTML} .= "disabled"; }
8028
8029
$control{innerHTML} .= Html2::tag(\%link);
8030
}
8031
$control{innerHTML} .= Html2::br() . Html2::br();
8032
8033
if (User::isUserSuperAdmin($Bc_sql::LOGGEDIN)) {
8034
{ my %div;
8035
$div{tag} = "div";
8036
$div{class} = "subnavbar_dark";
8037
$div{style} = "margin-bottom: 8px; width: calc(100% - 25px);";
8038
8039
$div{innerHTML} = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td class='minititle' colspan=4 nowrap>";
8040
$div{innerHTML} .= "Debug Access";
8041
$div{innerHTML} .= "</td></tr><tr><td>";
8042
$div{innerHTML} .=Html2::hr({class=>"tiny"});
8043
$div{innerHTML} .= "</td></tr><tr><td class='flexboxed'>";
8044
$div{innerHTML} .= "<table cellpadding=0 cellspacing=0 class='centered'><tr><td colspan=2>";
8045
8046
{ my %form;
8047
$form{tag} = "form";
8048
$form{id} = "debugForm";
8049
$form{method} = "post";
8050
$form{action} = "/add_debug_user.pl";
8051
$form{innerHTML} = "";
8052
8053
my @users = Bc_sql::get_users_forDropdowns(1, 1, Bc_sql::get_constant("SITE_ADMIN"), 0, 0);
8054
my @selectList = get_debug_users();
8055
$form{innerHTML} .= dropdown_for_users(
8056
$Bc_sql::QUERY_UID,
8057
0,
8058
-1,
8059
"",
8060
"selectTitleToSelectedText('$Bc_sql::QUERY_UID'); selectBgImageToUserDisplayPic('$Bc_sql::QUERY_UID')",
8061
"",
8062
"",
8063
"",
8064
0,
8065
\@selectList,
8066
"",
8067
1,
8068
1
8069
);
8070
undef @users;
8071
8072
$form{innerHTML} .= "</td></tr><tr><td>";
8073
8074
{ my %button;
8075
$button{tag} = "button";
8076
$button{type} = "submit";
8077
$button{class} = "green";
8078
$button{innerHTML} = "Save";
8079
8080
$form{innerHTML} .= Html2::tag(\%button);
8081
} # end save button
8082
8083
$form{innerHTML} .= "</td><td align=right>";
8084
8085
{ my %button;
8086
$button{tag} = "button";
8087
$button{type} = "submit";
8088
$button{class} = "red";
8089
$button{name} = "d";
8090
$button{value} = "1";
8091
$button{innerHTML} = "Disallow";
8092
8093
$form{innerHTML} .= Html2::tag(\%button);
8094
} # end cancel button
8095
8096
$div{innerHTML} .= Html2::tag(\%form);
8097
} # end form
8098
8099
$div{innerHTML} .= "</td></tr><tr><td colspan=2>";
8100
{ my %notice;
8101
$notice{tag} = "div";
8102
$notice{class} = "notice centered small";
8103
$notice{innerHTML} = Html2::embolden(User::get_user_stat(Bc_sql::get_constant("SITE_ADMIN"), "nickname")) . " always has access";
8104
8105
$div{innerHTML} .= Html2::tag(\%notice);
8106
} # end notice
8107
$div{innerHTML} .= "</td></tr><tr><td class=spacery colspan=2>";
8108
$div{innerHTML} .= "</td></tr><tr><td colspan=2>";
8109
{ my %link;
8110
$link{tag} = "a";
8111
$link{href} = "/debug.pl";
8112
$link{target} = "_blank";
8113
$link{innerHTML} = "";
8114
8115
{ my %img;
8116
$img{tag} = "img";
8117
$img{src} = "/images/site/admin/debug.png";
8118
$img{height} = "20";
8119
8120
$link{innerHTML} .= Html2::tag(\%img);
8121
}
8122
8123
$link{innerHTML} .= " Open DeBugger";
8124
8125
$div{innerHTML} .= Html2::tag(\%link);
8126
} # end open DeBugger link
8127
$div{innerHTML} .= "</td></tr></table>";
8128
$div{innerHTML} .= "</td></tr></table>";
8129
8130
$control{innerHTML} .= Html2::tag(\%div);
8131
} # end of div
8132
} # end of if User::isUserSuperAdmin($Bc_sql::LOGGEDIN)
8133
8134
$content .= Html2::tag(\%control);
8135
} # end control div
8136
8137
{ my %flagged;
8138
$flagged{tag} = "div";
8139
$flagged{class} = "flagged center";
8140
$flagged{innerHTML} = "";
8141
8142
my $flagsHeight = "100%";
8143
$flagged{innerHTML} .= Html2::tag({tag=>"font", class=>"subtitle", innerHTML=>"Flagged Content"}) . Html2::br();
8144
$flagged{innerHTML} .= Html2::hr();
8145
my $sql = "select * from flagged where not status='trashed'";
8146
my $results = Bc_sql::sql_execute($sql, "display admin page");
8147
if (ref $results eq "HASH") {
8148
if (not Bc_sql::user_exists($results->{UID})) {
8149
my %link;
8150
$link{tag} = "a";
8151
$link{class} = "red-button";
8152
$link{href} = "/flag.pl?id=$results->{content_ID}&ignore=1&" . Bc_sql::get_constant("FLAG_ID") . "=$results->{ID}";
8153
$link{title} = "User does not exist, delete this flag!";
8154
8155
$flagged{innerHTML} .= Html2::tag(\%link) . " ";
8156
} else {
8157
my $flag_info = Bc_misc::word_as_possessive(shorten_str(User::get_user_stat($results->{UID}, "nickname"), 10));
8158
8159
if ($results->{status} ne "resolved") {
8160
my %img;
8161
$img{tag} = "img";
8162
$img{width} = "16";
8163
$img{title} = "Flag ID: $results->{ID}";
8164
8165
if ($results->{type} eq "i") {
8166
$img{src} = "/images/site/flag_img.png'";
8167
{ my %link;
8168
$link{tag} = "a";
8169
$link{href} = "/getimage.pl?id=$results->{content_ID}&a=$Bc_sql::LOGGEDIN&" . Bc_sql::get_constant("FLAG_ID") . "=$results->{ID}";
8170
$link{innerHTML} = "image";
8171
8172
$flag_info .= Html2::tag(\%link);
8173
}
8174
}
8175
elsif ($results->{type} eq "n") {
8176
$img{src} = "/images/site/flag_nn.png";
8177
$flag_info .= Html2::profile_link($results->{UID});
8178
}
8179
elsif ($results->{type} eq "d") {
8180
$img{src} = "/images/site/flag_desc.png";
8181
$flag_info .= Html2::profile_link({UID=>$results->{UID}, innerHTML=>"description"});
8182
}
8183
elsif ($results->{type} eq "m") {
8184
$img{src} = "/images/site/flag_msg.png";
8185
$flag_info .= " message";
8186
}
8187
else {
8188
$img{src} = "/images/site/404.png";
8189
$flag_info .= "OTHER?? ($results->{status})";
8190
}
8191
8192
$flagged{innerHTML} .= Html2::tag(\%img);
8193
} else {
8194
$flag_info .= " resolved";
8195
}
8196
8197
$flagged{innerHTML} .= $flag_info;
8198
}
8199
} # end if ref $results eq "HASH"
8200
else {
8201
my $ftype = Bc_misc::get_param("ftype");
8202
8203
if (@$results) {
8204
foreach my $flag (@$results) {
8205
$flagged{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td class=copyright nowrap>";
8206
if (not Bc_sql::user_exists($flag->{UID})) {
8207
my %link;
8208
$link{tag} = "a";
8209
$link{href} = "/flag.pl?id=$flag->{content_ID}&ignore=1&" . Bc_sql::get_constant("FLAG_ID") . "=$flag->{ID}";
8210
$link{class} = "red-button";
8211
$link{innerHTML} = "x";
8212
8213
$flagged{innerHTML} .= Html2::tag(\%link);
8214
} # end if not Bc_sql::user_exists
8215
else {
8216
my $flag_info = Bc_misc::word_as_possessive(User::get_user_stat($flag->{UID}, "nickname")) . " ";
8217
8218
if ($flag->{status} ne "resolved") {
8219
my %link;
8220
$link{tag} = "a";
8221
8222
if ($flag->{type} eq "i") { $link{href} = "getimage.pl?id=$flag->{content_ID}&a=$Bc_sql::LOGGEDIN&" . Bc_sql::get_constant("FLAG_ID") . "=$flag->{ID}"; $link{innerHTML} = "image"; }
8223
elsif ($flag->{type} eq "n") { $link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("PROFILE_PAGE") . "&$Bc_sql::QUERY_UID=$flag->{UID}"; $link{innerHTML} = "nickname"; }
8224
elsif ($flag->{type} eq "d") { $link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("PROFILE_PAGE") . "&$Bc_sql::QUERY_UID=$flag->{UID}"; $link{innerHTML} = "description"; }
8225
elsif ($flag->{type} eq "m") { $link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE") . "&" . Bc_sql::get_constant("QUERY_MSGID") . "=$flag->{content_ID}"; $link{innerHTML} = "message"; }
8226
else { $link{tag} = "font"; $link{innerHTML} = "OTHER?? ($flag->{type})"; }
8227
8228
$flag_info .= Html2::tag(\%link) . " ($flag->{status})";
8229
} else {
8230
$flag_info .= "resolved";
8231
}
8232
8233
$flagged{innerHTML} .= $flag_info;
8234
} # end else of if not Bc_sql::user_exists
8235
8236
$flagged{innerHTML} .= "</td></tr><tr><td height=1>" . Html2::hr() . "</td></tr></table>";
8237
} # end foreach flagged item
8238
} # end if @$results
8239
else {
8240
my %none;
8241
$none{tag} = "div";
8242
$none{class} = "notice";
8243
$none{innerHTML} = "No Flagged Content!";
8244
8245
$flagged{innerHTML} .= Html2::tag(\%none);
8246
} # end else of if @$results
8247
} # end else of if ref $results eq "HASH"
8248
8249
$content .= Html2::tag(\%flagged);
8250
} # end flagged content
8251
$content .= "</td></tr></table>";
8252
8253
8254
} # end if ($page eq Bc_sql::get_constant("ADMIN_HOME"))
8255
elsif ($page eq Bc_sql::get_constant("ADMIN_USER_EDITOR_PAGE")) {
8256
8257
my $w = 430;
8258
my $uw = 215;
8259
my $h = 375;
8260
8261
$title .= "User Editor";
8262
# 3 cols by 7 rows
8263
# 2nd col and 2nd 4th and 6th rows are spacers
8264
# 3rd col spans all 7 rows
8265
my @users = ();
8266
my $uc = Bc_sql::get_user_count();
8267
8268
$content .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0 height=100%><tr><td align=center width=1 valign=top>";
8269
8270
{ my %userlisttitle;
8271
$userlisttitle{tag} = "div";
8272
$userlisttitle{class} = "subtitle";
8273
$userlisttitle{innerHTML} = "User List";
8274
8275
$content .= dropdown("users", Html2::tag(\%userlisttitle), Bc_misc::get_param($Bc_sql::QUERY_UID), "", "update_admin_users_pages();", "", "size=15 style=\"background-image: none; height: " . ($h-65) . "px; max-height: " . ($h-65) . "px; max-width: " . $uw . "px; min-height: " . ($h-65) . "px; min-width: " . $uw . "px;\"", "", \@users) . "";
8276
} # end user list title
8277
8278
{ my %userlistbuttons;
8279
$userlistbuttons{tag} = "div";
8280
$userlistbuttons{id} = "user_list_buttons";
8281
$userlistbuttons{innerHTML} = "";
8282
8283
$userlistbuttons{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td width=40%>";
8284
8285
{ my %button;
8286
$button{tag} = "button";
8287
$button{type} = "button";
8288
$button{class} = "blue";
8289
$button{onclick} = "document.location.href=\"/new_random_user.pl\";";
8290
$button{innerHTML} = "";
8291
8292
{ my %img;
8293
$img{tag} = "img";
8294
$img{src} = "images/site/default_guest.png";
8295
$img{height} = "12";
8296
$img{title} = "Create a randomly generated user";
8297
8298
$button{innerHTML} .= Html2::tag(\%img);
8299
} # end img (innerHTML of button)
8300
8301
$userlistbuttons{innerHTML} .= Html2::tag(\%button);
8302
} # end button
8303
8304
$userlistbuttons{innerHTML} .= "</td><td align=center width=1 class=nowrap>";
8305
8306
{ my %script;
8307
$script{tag} = "script";
8308
$script{innerHTML} = "function nav(offset) {\n" .
8309
" var p = document.getElementById('upn');\n" .
8310
" var oldOffset = userDropDownOffset;\n" .
8311
"\n" .
8312
" if (userDropDownOffset + offset < 0) { userDropDownOffset = 0; }\n" .
8313
" else if (userDropDownOffset + offset > $uc) { userDropDownOffset = $uc - ($uc - 1000 * (p.value - 1)); }\n" .
8314
" else { userDropDownOffset += offset; }\n" .
8315
"\n" .
8316
" if (userDropDownOffset / 1000 > 0)\n" .
8317
" { p.value = parseInt(userDropDownOffset / 1000) + 1; } else\n" .
8318
" { p.value = 1; }\n" .
8319
"\n" .
8320
" if (userDropDownOffset !== oldOffset) { Bc_sql::get_users_forDropdowns('users', userDropDownOffset); }\n" .
8321
"}\n";
8322
8323
$userlistbuttons{innerHTML} .= Html2::tag(\%script);
8324
} # end script
8325
8326
{ my %button;
8327
$button{tag} = "button";
8328
$button{type} = "button";
8329
$button{class} = "btn_onechar";
8330
$button{onclick} = "nav(-1000);";
8331
$button{innerHTML} = "<";
8332
8333
$userlistbuttons{innerHTML} .= Html2::tag(\%button);
8334
}
8335
8336
{ my %input;
8337
$input{tag} = "input";
8338
$input{id} = "upn";
8339
$input{name} = "upn";
8340
$input{size} = 2;
8341
$input{value} = 1;
8342
$input{class} = "text-align-center";
8343
8344
$userlistbuttons{innerHTML} .= Html2::tag(\%input);
8345
}
8346
8347
{ my %button;
8348
$button{tag} = "button";
8349
$button{type} = "button";
8350
$button{class} = "btn_onechar";
8351
$button{onclick} = "nav(1000);";
8352
$button{innerHTML} = ">";
8353
8354
$userlistbuttons{innerHTML} .= Html2::tag(\%button);
8355
}
8356
8357
$userlistbuttons{innerHTML} .= "</td><td align=right width=40%>";
8358
8359
{ my %button;
8360
$button{tag} = "button";
8361
$button{type} = "button";
8362
$button{class} = "blue";
8363
$button{onclick} = "Bc_sql::get_users_forDropdowns('users', userDropDownOffset);";
8364
$button{title} = "Reload user list";
8365
$button{innerHTML} = "";
8366
8367
{ my %img;
8368
$img{tag} = "img";
8369
$img{src} = "/img.pl?i=green/arrow_refresh.png&s=s";
8370
8371
$button{innerHTML} .= Html2::tag(\%img);
8372
}
8373
8374
$userlistbuttons{innerHTML} .= Html2::tag(\%button);
8375
}
8376
8377
$userlistbuttons{innerHTML} .= "</td></tr></table>";
8378
8379
if ($Bc_sql::LOGGEDIN ne Bc_sql::get_constant("SITE_ADMIN")) { $uc--; }
8380
$userlistbuttons{innerHTML} .= Html2::embolden($uc) . Bc_misc::pluralize(" member", $uc) . Html2::br() . "(sans " . User::get_user_stat(Bc_sql::get_constant("SITE_ADMIN"), "nickname");
8381
if ($Bc_sql::LOGGEDIN ne Bc_sql::get_constant("SITE_ADMIN")) { $userlistbuttons{innerHTML} .= " and you"; }
8382
$userlistbuttons{innerHTML} .= ")";
8383
8384
$content .= Html2::tag(\%userlistbuttons);
8385
} # end user list buttons
8386
8387
$content .= "</td><td style=\"min-width: 5;\" width=5></td><td align=left valign=top height=1>";
8388
$content .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 height=100% width=100%><tr><td height=1 width=25%>";
8389
{ my %statstoggle;
8390
$statstoggle{tag} = "a";
8391
$statstoggle{id} = "statslink";
8392
$statstoggle{onclick} = "toggle_display_element('stats', 'statslink');";
8393
$statstoggle{class} = "pointer";
8394
$statstoggle{innerHTML} = "";
8395
8396
my %fakebutton;
8397
$fakebutton{tag} = "div";
8398
$fakebutton{class} = "navbutton_selected";
8399
$fakebutton{id} = "statsdiv";
8400
$fakebutton{style} = "height: 100%;";
8401
$fakebutton{innerHTML} = "Stats";
8402
8403
$statstoggle{innerHTML} .= Html2::tag(\%fakebutton);
8404
8405
$content .= Html2::tag(\%statstoggle);
8406
} # end stats toggle
8407
8408
$content .= "</td><td width=3></td><td width=25%>";
8409
8410
{ my %photostoggle;
8411
$photostoggle{tag} = "a";
8412
$photostoggle{onclick} = "toggle_display_element('photos', 'photoslink');";
8413
$photostoggle{id} = "photoslink";
8414
$photostoggle{class} = "pointer";
8415
$photostoggle{innerHTML} = "";
8416
8417
my %fakebutton;
8418
$fakebutton{tag} = "div";
8419
$fakebutton{class} = "navbutton";
8420
$fakebutton{id} = "photosdiv";
8421
$fakebutton{style} = "height: 100%;";
8422
$fakebutton{innerHTML} = "Photos";
8423
8424
$photostoggle{innerHTML} .= Html2::tag(\%fakebutton);
8425
8426
$content .= Html2::tag(\%photostoggle);
8427
} # end photos toggle
8428
8429
$content .= "</td><td width=3></td><td width=25%>";
8430
8431
{ my %flagstoggle;
8432
$flagstoggle{tag} = "a";
8433
$flagstoggle{onclick} = "toggle_display_element('flags', 'flagslink');";
8434
$flagstoggle{id} = "flagslink";
8435
$flagstoggle{class} = "pointer";
8436
$flagstoggle{innerHTML} = "";
8437
8438
my %fakebutton;
8439
$fakebutton{tag} = "div";
8440
$fakebutton{class} = "navbutton";
8441
$fakebutton{id} = "flagsdiv";
8442
$fakebutton{style} = "height: 100%;";
8443
$fakebutton{innerHTML} = "Flags";
8444
8445
$flagstoggle{innerHTML} .= Html2::tag(\%fakebutton);
8446
8447
$content .= Html2::tag(\%flagstoggle);
8448
} # end flags toggle
8449
8450
if (User::isUserAdmin()) {
8451
$content .= "</td><td width=3></td><td width=25%>";
8452
8453
{ my %messagestoggle;
8454
$messagestoggle{tag} = "a";
8455
$messagestoggle{onclick} = "toggle_display_element('messages', 'messageslink');";
8456
$messagestoggle{id} = "messageslink";
8457
$messagestoggle{class} = "pointer";
8458
$messagestoggle{innerHTML} = "";
8459
8460
my %fakebutton;
8461
$fakebutton{tag} = "div";
8462
$fakebutton{class} = "navbutton";
8463
$fakebutton{id} = "messagesdiv";
8464
$fakebutton{style} = "height: 100%;";
8465
$fakebutton{innerHTML} = "Messages";
8466
8467
$messagestoggle{innerHTML} .= Html2::tag(\%fakebutton);
8468
8469
$content .= Html2::tag(\%messagestoggle);
8470
}
8471
}
8472
8473
$content .= "</td></tr><tr><td colspan=7 style=\"min-height: 5; max-height: 5;\" height=5>";
8474
$content .= "</td></tr><tr><td colspan=7 valign=top height=100%>";
8475
8476
{ my %statsiframediv;
8477
$statsiframediv{tag} = "div";
8478
$statsiframediv{id} = "stats";
8479
$statsiframediv{style} = "height: 100%;";
8480
$statsiframediv{innerHTML} = "";
8481
8482
{ my %iframe;
8483
$iframe{tag} = "iframe";
8484
$iframe{class} = "rounded";
8485
$iframe{id} = "edit_ustats";
8486
$iframe{height} = $h;
8487
$iframe{width} = $w;
8488
$iframe{innerHTML} = "";
8489
8490
my $edit_uid = Bc_misc::get_param($Bc_sql::QUERY_UID);
8491
if ($edit_uid) {
8492
if (get_param("msg")) {
8493
$iframe{src} = "/sendmsg.pl?$Bc_sql::QUERY_UID=$edit_uid";
8494
} else {
8495
$iframe{src} = "/edit_ustats.pl?$Bc_sql::QUERY_UID=$edit_uid&framed=1";
8496
}
8497
} # end if $edit_uid
8498
else {
8499
if (get_param("msg")) {
8500
$iframe{src} = "/sendmsg.pl";
8501
} else {
8502
$iframe{src} = "/edit_ustats.pl?framed=1";
8503
}
8504
} # end else of if $edit_uid
8505
8506
$statsiframediv{innerHTML} .= Html2::tag(\%iframe);
8507
} # end iframe
8508
8509
$content .= Html2::tag(\%statsiframediv);
8510
} # end stats editor iframe div
8511
8512
{ my %photosiframediv;
8513
$photosiframediv{tag} = "div";
8514
$photosiframediv{id} = "photos";
8515
$photosiframediv{style} = "display: none; height: 100%;";
8516
$photosiframediv{innerHTML} = "";
8517
8518
{ my %iframe;
8519
$iframe{tag} = "iframe";
8520
$iframe{class} = "rounded";
8521
$iframe{id} = "edit_uphotos";
8522
$iframe{height} = $h;
8523
$iframe{width} = $w;
8524
8525
$photosiframediv{innerHTML} .= Html2::tag(\%iframe);
8526
} # end iframe
8527
8528
$content .= Html2::tag(\%photosiframediv);
8529
} # end photos editor iframe div
8530
8531
{ my %flagsiframediv;
8532
$flagsiframediv{tag} = "div";
8533
$flagsiframediv{id} = "flags";
8534
$flagsiframediv{style} = "display: none; height: 100%;";
8535
$flagsiframediv{innerHTML} = "";
8536
8537
{ my %iframe;
8538
$iframe{tag} = "iframe";
8539
$iframe{class} = "rounded";
8540
$iframe{id} = "edit_uflags";
8541
$iframe{height} = $h;
8542
$iframe{width} = $w;
8543
8544
$flagsiframediv{innerHTML} .= Html2::tag(\%iframe);
8545
} # end iframe
8546
8547
$content .= Html2::tag(\%flagsiframediv);
8548
} # end flags editor iframe div
8549
8550
if (User::isUserAdmin()) {
8551
my %messagesiframediv;
8552
$messagesiframediv{tag} = "div";
8553
$messagesiframediv{id} = "messages";
8554
$messagesiframediv{style} = "display: none; height: 100%;";
8555
$messagesiframediv{innerHTML} = "";
8556
8557
{ my %iframe;
8558
$iframe{tag} = "iframe";
8559
$iframe{class} = "rounded";
8560
$iframe{id} = "edit_umsgs";
8561
$iframe{height} = $h;
8562
$iframe{width} = $w;
8563
8564
$messagesiframediv{innerHTML} .= Html2::tag(\%iframe);
8565
}
8566
8567
$content .= Html2::tag(\%messagesiframediv);
8568
}
8569
8570
$content .= "</td></tr></table>";
8571
$content .= "</td></tr></table>";
8572
8573
{ my %script;
8574
$script{tag} = "script";
8575
$script{async} = 1;
8576
$script{defer} = 1;
8577
$script{innerHTML} = "setTimeout(function() { Bc_sql::get_users_forDropdowns(\"users\"); }, 10);";
8578
8579
$content .= Html2::tag(\%script);
8580
}
8581
8582
8583
} # end elsif ($page eq Bc_sql::get_constant("ADMIN_USER_EDITOR_PAGE"))
8584
elsif ($page eq Bc_sql::get_constant("ADMIN_THEME_EDITOR_PAGE")) {
8585
8586
my @themes = (""); #get_themes_forDropdowns();
8587
my $width = "180px"; # width of theme list
8588
my $height = "450px"; # height of theme editor iframe
8589
my $tsheight = "425px"; # height of theme list
8590
$title .= "Theme Editor";
8591
$content .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 style=\"min-width: 789px; min-height: 430px;\"><tr><td align=center width=1 valign=top>";
8592
$content .= dropdown("themes", "", "", "", "var f = document.getElementById('edit_frame').contentWindow.document; f.innerHTML = ''; f.location = 'theme_editor.pl?tid=' + this.value;", "", "style='background-image: none; min-height: $tsheight; max-width: $width; min-width: $width; margin: 0;' size=2", "", \@themes);
8593
8594
{ my %themelistbuttons;
8595
$themelistbuttons{tag} = "div";
8596
$themelistbuttons{id} = "theme_list_buttons";
8597
$themelistbuttons{innerHTML} = "";
8598
8599
$themelistbuttons{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=100%><tr><td width=40%>";
8600
{ my %save;
8601
$save{tag} = "button";
8602
$save{class} = "green";
8603
$save{onclick} = "document.getElementById(\"edit_frame\").contentWindow.location.href=\"theme_editor.pl?tid=1111111111\"; re" . "turn false;";
8604
$save{innerHTML} = img("i=site/add.png&s=s", "", "", "", "", 1);
8605
8606
$themelistbuttons{innerHTML} .= Html2::tag(\%save);
8607
} # end save button
8608
8609
$themelistbuttons{innerHTML} .= "</td><td align=center width=1>";
8610
8611
{ my %applytheme;
8612
$applytheme{tag} = "button";
8613
$applytheme{type} = "button";
8614
$applytheme{class} = "blue onechar_btn";
8615
$applytheme{onclick} = "apply_theme(document.getElementById(\"edit_frame\").contentWindow.location.href);";
8616
$applytheme{innerHTML} = "";
8617
8618
{ my %img;
8619
$img{tag} = "img";
8620
$img{src} = "/img.pl?i=site/read.png&s=s";
8621
8622
$applytheme{innerHTML} .= Html2::tag(\%img);
8623
}
8624
8625
$themelistbuttons{innerHTML} .= Html2::tag(\%applytheme);
8626
} # end apply theme button
8627
8628
$themelistbuttons{innerHTML} .= "</td><td align=right width=40%>";
8629
8630
{ my %reload;
8631
$reload{tag} = "button";
8632
$reload{type} = "button";
8633
$reload{class} = "yellow";
8634
$reload{onclick} = "get_themes_forDropdowns(\"themes\", 1);";
8635
$reload{innerHTML} = img("i=" . Bc_sql::get_constant("IMAGE_RELOAD_ICON") . "&s=s", "", "", "", "", 1);
8636
8637
$themelistbuttons{innerHTML} .= Html2::tag(\%reload);
8638
} # end reload button
8639
8640
$themelistbuttons{innerHTML} .= "</td></tr></table>";
8641
8642
$content .= Html2::tag(\%themelistbuttons);
8643
} # end theme list buttons
8644
8645
$content .= "</td><td class=spacerx>";
8646
$content .= "</td><td valign=top width=100%>";
8647
8648
{ my %editor;
8649
$editor{tag} = "iframe";
8650
$editor{class} = "rounded";
8651
$editor{id} = "edit_frame";
8652
$editor{scrolling} = "no";
8653
$editor{style} = "height: $height; min-height: $height; min-width: 100%;";
8654
$editor{onload} = "get_themes_forDropdowns('themes', 1);";
8655
8656
my $firstTID = $themes[0];
8657
if ($firstTID) { $firstTID =~ s/\=(.)*//; } else { $firstTID = ""; }
8658
$editor{src} = "/theme_editor.pl?tid=$firstTID";
8659
8660
$content .= Html2::tag(\%editor);
8661
}
8662
8663
$content .= "</td></tr></table>";
8664
8665
8666
} # end elsif ($page eq Bc_sql::get_constant("ADMIN_THEME_EDITOR_PAGE"))
8667
elsif ($page eq Bc_sql::get_constant("ADMIN_CONTENT_EDITOR_PAGE") and User::isUserSuperAdmin($Bc_sql::LOGGEDIN)) {
8668
8669
8670
my $DEBUG_CONTENT_EDITOR = 0;
8671
$title .= "Content Editor";
8672
$tab = Bc_misc::get_param($tab);
8673
if (not $tab) { $tab = "about"; }
8674
{ my %script;
8675
$script{tag} = "script";
8676
$script{innerHTML} = "lastElementToggled = \"$tab\";";
8677
8678
$content .= Html2::tag(\%script);
8679
}
8680
$content .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
8681
$content .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 style='margin: 0 0 5px 0;'><tr><td>";
8682
{ my %link;
8683
$link{tag} = "a";
8684
$link{onclick} = "toggle_display_element('about', 'aboutlink');";
8685
$link{id} = "aboutlink";
8686
$link{class} = "pointer";
8687
$link{innerHTML} = "";
8688
8689
{ my %linkdiv;
8690
$linkdiv{tag} = "div";
8691
$linkdiv{class} = "navbutton_selected";
8692
$linkdiv{id} = "aboutdiv";
8693
$linkdiv{width} = "100%";
8694
$linkdiv{height} = "100%";
8695
$linkdiv{innerHTML} = "About";
8696
8697
$link{innerHTML} .= Html2::tag(\%linkdiv);
8698
} # end div
8699
8700
$content .= Html2::tag(\%link);
8701
} # end about link
8702
$content .= "</td><td width=3></td><td>";
8703
{ my %link;
8704
$link{tag} = "a";
8705
$link{onclick} = "toggle_display_element('help', 'helplink');";
8706
$link{id} = "helplink";
8707
$link{class} = "pointer";
8708
$link{innerHTML} = "";
8709
8710
{ my %linkdiv;
8711
$linkdiv{tag} = "div";
8712
$linkdiv{class} = "navbutton";
8713
$linkdiv{id} = "helpdiv";
8714
$linkdiv{width} = "100%";
8715
$linkdiv{height} = "100%";
8716
$linkdiv{innerHTML} = "Help";
8717
8718
$link{innerHTML} .= Html2::tag(\%linkdiv);
8719
} # end div
8720
8721
$content .= Html2::tag(\%link);
8722
} # end help link
8723
$content .= "</td><td width=3></td><td>";
8724
{ my %link;
8725
$link{tag} = "a";
8726
$link{onclick} = "toggle_display_element('homepage', 'homepagelink');";
8727
$link{id} = "homepagelink";
8728
$link{class} = "pointer";
8729
$link{innerHTML} = "";
8730
8731
{ my %linkdiv;
8732
$linkdiv{tag} = "div";
8733
$linkdiv{class} = "navbutton";
8734
$linkdiv{id} = "homepagediv";
8735
$linkdiv{width} = "100%";
8736
$linkdiv{height} = "100%";
8737
$linkdiv{innerHTML} = "Homepage";
8738
8739
$link{innerHTML} .= Html2::tag(\%linkdiv);
8740
} # end div
8741
8742
$content .= Html2::tag(\%link);
8743
} # end homepage link
8744
$content .= "</td><td width=3></td><td>";
8745
{ my %link;
8746
$link{tag} = "a";
8747
$link{onclick} = "toggle_display_element('phrases', 'phraseslink');";
8748
$link{id} = "phraseslink";
8749
$link{class} = "pointer";
8750
$link{innerHTML} = "";
8751
8752
{ my %linkdiv;
8753
$linkdiv{tag} = "div";
8754
$linkdiv{class} = "navbutton";
8755
$linkdiv{id} = "phrasesdiv";
8756
$linkdiv{width} = "100%";
8757
$linkdiv{height} = "100%";
8758
$linkdiv{innerHTML} = "Phrases";
8759
8760
$link{innerHTML} .= Html2::tag(\%linkdiv);
8761
} # end div
8762
8763
$content .= Html2::tag(\%link);
8764
} # end phrases link
8765
$content .= "</td><td width=3></td><td>";
8766
{ my %link;
8767
$link{tag} = "a";
8768
$link{onclick} = "toggle_display_element('terms', 'termslink');";
8769
$link{id} = "termslink";
8770
$link{class} = "pointer";
8771
$link{innerHTML} = "";
8772
8773
{ my %linkdiv;
8774
$linkdiv{tag} = "div";
8775
$linkdiv{class} = "navbutton";
8776
$linkdiv{id} = "termsdiv";
8777
$linkdiv{width} = "100%";
8778
$linkdiv{height} = "100%";
8779
$linkdiv{innerHTML} = "Terms";
8780
8781
$link{innerHTML} .= Html2::tag(\%linkdiv);
8782
} # end div
8783
8784
$content .= Html2::tag(\%link);
8785
} # end terms link
8786
$content .= "</td><td width=3></td><td>";
8787
{ my %link;
8788
$link{tag} = "a";
8789
$link{onclick} = "toggle_display_element('data_policy', 'data_policylink');";
8790
$link{id} = "data_policylink";
8791
$link{class} = "pointer";
8792
$link{innerHTML} = "";
8793
8794
{ my %linkdiv;
8795
$linkdiv{tag} = "div";
8796
$linkdiv{class} = "navbutton";
8797
$linkdiv{id} = "data_policydiv";
8798
$linkdiv{width} = "100%";
8799
$linkdiv{height} = "100%";
8800
$linkdiv{innerHTML} = "Data Policy";
8801
8802
$link{innerHTML} .= Html2::tag(\%linkdiv);
8803
} # end div
8804
8805
$content .= Html2::tag(\%link);
8806
} # end data policy link
8807
$content .= "</td><td width=3></td><td>";
8808
{ my %link;
8809
$link{tag} = "a";
8810
$link{onclick} = "toggle_display_element('legals', 'legalslink');";
8811
$link{id} = "legalslink";
8812
$link{class} = "pointer";
8813
$link{innerHTML} = "";
8814
8815
{ my %linkdiv;
8816
$linkdiv{tag} = "div";
8817
$linkdiv{class} = "navbutton";
8818
$linkdiv{id} = "legalsdiv";
8819
$linkdiv{width} = "100%";
8820
$linkdiv{height} = "100%";
8821
$linkdiv{innerHTML} = "Legals";
8822
8823
$link{innerHTML} .= Html2::tag(\%linkdiv);
8824
} # end div
8825
8826
$content .= Html2::tag(\%link);
8827
} # end legals link
8828
$content .= "</td><td width=3></td><td>";
8829
{ my %link;
8830
$link{tag} = "a";
8831
$link{onclick} = "toggle_display_element('privacy', 'privacylink');";
8832
$link{id} = "privacylink";
8833
$link{class} = "pointer";
8834
$link{innerHTML} = "";
8835
8836
{ my %linkdiv;
8837
$linkdiv{tag} = "div";
8838
$linkdiv{class} = "navbutton";
8839
$linkdiv{id} = "privacydiv";
8840
$linkdiv{width} = "100%";
8841
$linkdiv{height} = "100%";
8842
$linkdiv{innerHTML} = "Privacy";
8843
8844
$link{innerHTML} .= Html2::tag(\%linkdiv);
8845
} # end div
8846
8847
$content .= Html2::tag(\%link);
8848
} # end privacy link
8849
$content .= "</td><td width=3></td><td>";
8850
{ my %link;
8851
$link{tag} = "a";
8852
$link{onclick} = "toggle_display_element('refunds', 'refundslink');";
8853
$link{id} = "refundslink";
8854
$link{class} = "pointer";
8855
$link{innerHTML} = "";
8856
8857
{ my %linkdiv;
8858
$linkdiv{tag} = "div";
8859
$linkdiv{class} = "navbutton";
8860
$linkdiv{id} = "refundsdiv";
8861
$linkdiv{width} = "100%";
8862
$linkdiv{height} = "100%";
8863
$linkdiv{innerHTML} = "Refunds Policy";
8864
8865
$link{innerHTML} .= Html2::tag(\%linkdiv);
8866
} # end div
8867
8868
$content .= Html2::tag(\%link);
8869
} # end refunds link
8870
$content .= "</td></tr></table>";
8871
8872
my $cols = 95;
8873
my $rows = 12;
8874
{ my %div;
8875
$div{tag} = "div";
8876
$div{id} = "about";
8877
$div{innerHTML} = "";
8878
8879
{ my %form;
8880
$form{tag} = "form";
8881
$form{action} = "/admin_update_about.pl";
8882
$form{method} = "post";
8883
$form{innerHTML} = "";
8884
8885
{ my %ta;
8886
$ta{tag} = "textarea";
8887
$ta{name} = "about";
8888
$ta{cols} = $cols;
8889
$ta{rows} = $rows;
8890
$ta{class} = "nowrap";
8891
$ta{innerHTML} = get_about_page();
8892
$ta{innerHTML} =~ s/</</g;
8893
$ta{innerHTML} =~ s/>/>/g;
8894
8895
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
8896
}
8897
8898
{ my %button;
8899
$button{tag} = "button";
8900
$button{type} = "submit";
8901
$button{class} = "green";
8902
$button{innerHTML} = "Save";
8903
8904
$form{innerHTML} .= Html2::tag(\%button);
8905
} # end save button
8906
8907
{ my %button;
8908
$button{tag} = "button";
8909
$button{type} = "reset";
8910
$button{class} = "yellow";
8911
$button{innerHTML} = "Reset";
8912
8913
$form{innerHTML} .= Html2::tag(\%button);
8914
} # end reset button
8915
8916
$content .= Html2::tag(\%form);
8917
} # end form
8918
8919
$content .= Html2::tag(\%div);
8920
} # end about div
8921
8922
{ my %div;
8923
$div{tag} = "div";
8924
$div{id} = "help";
8925
$div{style} = "display: none;";
8926
$div{innerHTML} = "";
8927
8928
{ my %form;
8929
$form{tag} = "form";
8930
$form{action} = "/admin_update_help.pl";
8931
$form{method} = "post";
8932
$form{innerHTML} = "";
8933
8934
{ my %ta;
8935
$ta{tag} = "textarea";
8936
$ta{name} = "help";
8937
$ta{cols} = $cols;
8938
$ta{rows} = $rows;
8939
$ta{class} = "nowrap";
8940
$ta{innerHTML} = get_help_page();
8941
$ta{innerHTML} =~ s/</</g;
8942
$ta{innerHTML} =~ s/>/>/g;
8943
8944
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
8945
} # end textarea
8946
8947
{ my %button;
8948
$button{tag} = "button";
8949
$button{type} = "submit";
8950
$button{class} = "green";
8951
$button{innerHTML} = "Save";
8952
8953
$form{innerHTML} .= Html2::tag(\%button);
8954
} # end save button
8955
8956
{ my %button;
8957
$button{tag} = "button";
8958
$button{type} = "reset";
8959
$button{class} = "yellow";
8960
$button{innerHTML} = "Reset";
8961
8962
$form{innerHTML} .= Html2::tag(\%button);
8963
} # end reset button
8964
8965
$div{innerHTML} .= Html2::tag(\%form);
8966
} # end form
8967
8968
$content .= Html2::tag(\%div);
8969
} # end help div
8970
8971
{ my %div;
8972
$div{tag} = "div";
8973
$div{id} = "homepage";
8974
$div{style} = "display: none;";
8975
$div{innerHTML} = "";
8976
8977
{ my %form;
8978
$form{tag} = "form";
8979
$form{action} = "/admin_update_homepage.pl";
8980
$form{method} = "post";
8981
$form{innerHTML} = "";
8982
8983
if ($DEBUG_CONTENT_EDITOR) {
8984
$form{innerHTML} .= "<table border=0 cellpadding=0 cellspacing=0><tr><td align=center colspan=3>";
8985
$form{innerHTML} .= Html2::small("(DEBUG MODE ENABLED)");
8986
$form{innerHTML} .= "</td></tr><tr><td class=spacery colspan=3></td></tr><tr><td colspan=3>";
8987
{ my %input;
8988
$input{tag} = "input";
8989
$input{type} = "hidden";
8990
$input{name} = "dce";
8991
$input{value} = "1";
8992
8993
$form{innerHTML} .= Html2::tag(\%input);
8994
}
8995
$form{innerHTML} .= "debug info here";
8996
$form{innerHTML} .= "</td></tr><tr><td class=spacery colspan=3></td></tr><tr><td align=center>";
8997
} else {
8998
$form{innerHTML} .= "<table border=0 cellpadding=0 cellspacing=0><tr><td align=center>";
8999
}
9000
9001
$form{innerHTML} .= Html2::embolden({class=>"notice", innerHTML=>"Guest"});
9002
$form{innerHTML} .= "</td><td class=spacerx></td><td align=center>";
9003
$form{innerHTML} .= Html2::embolden({class=>"notice", innerHTML=>"Logged In"});
9004
$form{innerHTML} .= "</td></tr><tr><td class=spacery colspan=3></td></tr><tr><td>";
9005
9006
{ my %ta;
9007
$ta{tag} = "textarea";
9008
$ta{name} = "guest";
9009
$ta{cols} = (int($cols / 2) - 1);
9010
$ta{rows} = $rows;
9011
$ta{class} = "nowrap";
9012
$ta{innerHTML} = Bc_sql::get_home_page("", 1, "GUEST");
9013
$ta{innerHTML} =~ s/</</g;
9014
$ta{innerHTML} =~ s/>/>/g;
9015
9016
$form{innerHTML} .= Html2::tag(\%ta);
9017
} # end guest textarea
9018
$form{innerHTML} .= "</td><td class=spacerx></td><td>";
9019
9020
{ my %ta;
9021
$ta{tag} = "textarea";
9022
$ta{name} = "loggedin";
9023
$ta{cols} = (int($cols / 2) - 1);
9024
$ta{rows} = $rows;
9025
$ta{class} = "nowrap";
9026
$ta{innerHTML} = Bc_sql::get_home_page("", 1, "LOGGEDIN");
9027
$ta{innerHTML} =~ s/</</g;
9028
$ta{innerHTML} =~ s/>/>/g;
9029
9030
$form{innerHTML} .= Html2::tag(\%ta);
9031
} # end loggedin textarea
9032
$form{innerHTML} .= "</td></tr><tr><td class=spacery colspan=3></td></tr><tr><td colspan=3 align=center>";
9033
9034
{ my %button;
9035
$button{tag} = "button";
9036
$button{type} = "submit";
9037
$button{class} = "green";
9038
$button{innerHTML} = "Save";
9039
9040
$form{innerHTML} .= Html2::tag(\%button);
9041
} # end save button
9042
9043
{ my %button;
9044
$button{tag} = "button";
9045
$button{type} = "reset";
9046
$button{class} = "yellow";
9047
$button{innerHTML} = "Reset";
9048
9049
$form{innerHTML} .= Html2::tag(\%button);
9050
} # end reset button
9051
$form{innerHTML} .= "</td></tr></table>";
9052
9053
$div{innerHTML} .= Html2::tag(\%form);
9054
} # end form
9055
9056
$content .= Html2::tag(\%div);
9057
} # end homepage div
9058
9059
{ my %div;
9060
$div{tag} = "div";
9061
$div{id} = "phrases";
9062
$div{style} = "display: none;";
9063
$div{innerHTML} = "";
9064
9065
{ my %form;
9066
$form{tag} = "form";
9067
$form{action} = "/admin_update_phrases.pl";
9068
$form{method} = "post";
9069
$form{innerHTML} = "";
9070
9071
{ my %ta;
9072
$ta{tag} = "textarea";
9073
$ta{name} = "phrases";
9074
$ta{cols} = $cols;
9075
$ta{rows} = $rows;
9076
$ta{class} = "nowrap";
9077
$ta{innerHTML} = "";
9078
9079
my @phrases = Bc_sql::get_config("phrases");
9080
foreach my $pLine (@phrases) { $ta{innerHTML} .= $pLine; }
9081
$ta{innerHTML} =~ s/</</g;
9082
$ta{innerHTML} =~ s/>/>/g;
9083
9084
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
9085
} # end textarea
9086
9087
{ my %button;
9088
$button{tag} = "button";
9089
$button{type} = "submit";
9090
$button{class} = "green";
9091
$button{innerHTML} = "Save";
9092
9093
$form{innerHTML} .= Html2::tag(\%button);
9094
} # end save button
9095
9096
{ my %button;
9097
$button{tag} = "button";
9098
$button{type} = "reset";
9099
$button{class} = "yellow";
9100
$button{innerHTML} = "Reset";
9101
9102
$form{innerHTML} .= Html2::tag(\%button);
9103
} # end reset button
9104
9105
$div{innerHTML} .= Html2::tag(\%form);
9106
} # end form
9107
9108
$content .= Html2::tag(\%div);
9109
} # end phrases div
9110
9111
{ my %div;
9112
$div{tag} = "div";
9113
$div{id} = "terms";
9114
$div{style} = "display: none;";
9115
$div{innerHTML} = "";
9116
9117
{ my %form;
9118
$form{tag} = "form";
9119
$form{action} = "/admin_update_terms.pl";
9120
$form{method} = "post";
9121
9122
{ my %ta;
9123
$ta{tag} = "textarea";
9124
$ta{name} = "terms";
9125
$ta{cols} = $cols;
9126
$ta{rows} = $rows;
9127
$ta{class} = "nowrap";
9128
$ta{innerHTML} = get_terms_page();
9129
$ta{innerHTML} =~ s/</</g;
9130
$ta{innerHTML} =~ s/>/>/g;
9131
9132
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
9133
}
9134
9135
{ my %button;
9136
$button{tag} = "button";
9137
$button{type} = "submit";
9138
$button{class} = "green";
9139
$button{innerHTML} = "Save";
9140
9141
$form{innerHTML} .= Html2::tag(\%button);
9142
}
9143
9144
{ my %button;
9145
$button{tag} = "button";
9146
$button{type} = "reset";
9147
$button{class} = "yellow";
9148
$button{innerHTML} = "Reset";
9149
9150
$form{innerHTML} .= Html2::tag(\%button);
9151
}
9152
9153
$div{innerHTML} .= Html2::tag(\%form);
9154
} # end form
9155
9156
$content .= Html2::tag(\%div);
9157
} # end terms div
9158
9159
{ my %div;
9160
$div{tag} = "div";
9161
$div{id} = "data_policy";
9162
$div{style} = "display: none;";
9163
$div{innerHTML} = "";
9164
9165
{ my %form;
9166
$form{tag} = "form";
9167
$form{action} = "/admin_update_data_policy.pl";
9168
$form{method} = "post";
9169
$form{innerHTML} = "";
9170
9171
{ my %ta;
9172
$ta{tag} = "textarea";
9173
$ta{name} = "data_policy";
9174
$ta{cols} = $cols;
9175
$ta{rows} = $rows;
9176
$ta{class} = "nowrap";
9177
$ta{innerHTML} = get_data_policy_page();
9178
$ta{innerHTML} =~ s/</</g;
9179
$ta{innerHTML} =~ s/>/>/g;
9180
9181
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
9182
}
9183
9184
{ my %button;
9185
$button{tag} = "button";
9186
$button{type} = "submit";
9187
$button{class} = "green";
9188
$button{innerHTML} = "Save";
9189
9190
$form{innerHTML} .= Html2::tag(\%button);
9191
} # end save button
9192
9193
{ my %button;
9194
$button{tag} = "div";
9195
$button{type} = "reset";
9196
$button{class} = "yellow";
9197
$button{innerHTML} = "Reset";
9198
9199
$form{innerHTML} .= Html2::tag(\%button);
9200
} # end reset button
9201
9202
$div{innerHTML} .= Html2::tag(\%form);
9203
} # end form
9204
9205
$content .= Html2::tag(\%div);
9206
} # end data policy div
9207
9208
{ my %div;
9209
$div{tag} = "div";
9210
$div{id} = "refunds";
9211
$div{style} = "display: none;";
9212
$div{innerHTML} = "";
9213
9214
{ my %form;
9215
$form{tag} = "form";
9216
$form{action} = "/admin_update_refunds.pl";
9217
$form{method} = "post";
9218
$form{innerHTML} = "";
9219
9220
{ my %ta;
9221
$ta{tag} = "textarea";
9222
$ta{name} = "refunds";
9223
$ta{cols} = $cols;
9224
$ta{rows} = $rows;
9225
$ta{class} = "nowrap";
9226
$ta{innerHTML} = get_refunds_page();
9227
$ta{innerHTML} =~ s/</</g;
9228
$ta{innerHTML} =~ s/>/>/g;
9229
9230
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
9231
}
9232
9233
{ my %button;
9234
$button{tag} = "button";
9235
$button{type} = "submit";
9236
$button{class} = "green";
9237
$button{innerHTML} = "Save";
9238
9239
$form{innerHTML} .= Html2::tag(\%button);
9240
} # end save button
9241
9242
{ my %button;
9243
$button{tag} = "div";
9244
$button{type} = "reset";
9245
$button{class} = "yellow";
9246
$button{innerHTML} = "Reset";
9247
9248
$form{innerHTML} .= Html2::tag(\%button);
9249
} # end reset button
9250
9251
$div{innerHTML} .= Html2::tag(\%form);
9252
} # end form
9253
9254
$content .= Html2::tag(\%div);
9255
} # end refunds div
9256
9257
{ my %div;
9258
$div{tag} = "div";
9259
$div{id} = "privacy";
9260
$div{style} = "display: none;";
9261
9262
{ my %form;
9263
$form{tag} = "form";
9264
$form{action} = "/admin_update_privacy.pl";
9265
$form{method} = "post";
9266
9267
{ my %ta;
9268
$ta{tag} = "textarea";
9269
$ta{name} = "privacy";
9270
$ta{cols} = $cols;
9271
$ta{rows} = $rows;
9272
$ta{class} = "nowrap";
9273
$ta{innerHTML} = get_privacy_page();
9274
$ta{innerHTML} =~ s/</</g;
9275
$ta{innerHTML} =~ s/>/>/g;
9276
9277
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
9278
}
9279
9280
{ my %button;
9281
$button{tag} = "button";
9282
$button{type} = "submit";
9283
$button{class} = "green";
9284
$button{innerHTML} = "Save";
9285
9286
$form{innerHTML} .= Html2::tag(\%button);
9287
} # end save button
9288
9289
{ my %button;
9290
$button{tag} = "div";
9291
$button{type} = "reset";
9292
$button{class} = "yellow";
9293
$button{innerHTML} = "Reset";
9294
9295
$form{innerHTML} .= Html2::tag(\%button);
9296
} # end reset button
9297
9298
$div{innerHTML} .= Html2::tag(\%form);
9299
} # end form
9300
9301
$content .= Html2::tag(\%div);
9302
} # end privacy div
9303
9304
{ my %div;
9305
$div{tag} = "div";
9306
$div{id} = "legals";
9307
$div{style} = "display: none;";
9308
$div{innerHTML} = "";
9309
9310
{ my %form;
9311
$form{tag} = "form";
9312
$form{action} = "/admin_update_legals.pl";
9313
$form{method} = "post";
9314
$form{innerHTML} = "";
9315
9316
{ my %ta;
9317
$ta{tag} = "textarea";
9318
$ta{name} = "legals";
9319
$ta{cols} = $cols;
9320
$ta{rows} = $rows;
9321
$ta{class} = "nowrap";
9322
$ta{innerHTML} = get_legals_page();
9323
$ta{innerHTML} =~ s/</</g;
9324
$ta{innerHTML} =~ s/>/>/g;
9325
9326
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
9327
}
9328
9329
{ my %button;
9330
$button{tag} = "button";
9331
$button{type} = "submit";
9332
$button{class} = "green";
9333
$button{innerHTML} = "Save";
9334
9335
$form{innerHTML} .= Html2::tag(\%button);
9336
} # end save button
9337
9338
{ my %button;
9339
$button{tag} = "div";
9340
$button{type} = "reset";
9341
$button{class} = "yellow";
9342
$button{innerHTML} = "Reset";
9343
9344
$form{innerHTML} .= Html2::tag(\%button);
9345
} # end reset button
9346
9347
$div{innerHTML} .= Html2::tag(\%form);
9348
} # end form
9349
9350
$content .= Html2::tag(\%div);
9351
} # end legals div
9352
9353
9354
} # end elsif ($page eq Bc_sql::get_constant("ADMIN_CONTENT_EDITOR_PAGE") and User::isUserSuperAdmin($Bc_sql::LOGGEDIN))
9355
elsif ($page eq Bc_sql::get_constant("ADMIN_BANNED_USERS_PAGE")) {
9356
9357
9358
$title .= "Banned Users";
9359
my $sql = "select * from bans";
9360
my $r = Bc_sql::sql_execute($sql, "display admin page");
9361
if (ref $r eq "HASH") {
9362
my $uid = $r->{BID};
9363
my $uname = User::get_user_stat($uid, "nickname");
9364
$content .= Html2::embolden("1") . " banned user" . Html2::hr();
9365
$content .= Html2::profile_link($uid) . Html2::br();
9366
} else {
9367
if (@$r) {
9368
$content .= "<table border=0 cellpadding=0 cellspacing=0 style='height: 234px; width: 456px; max-height: 234px; max-width: 456px;' height=234 width=456><tr><td align=center height=1>";
9369
$content .= Html2::embolden(scalar @$r) . " banned users";
9370
$content .= Html2::hr();
9371
$content .= "</td></tr><tr><td valign=top nowrap>";
9372
9373
{ my %div;
9374
$div{tag} = "div";
9375
$div{style} = "clear: both; overflow-x: scroll; overflow-y: scroll; float: left; text-align: left !important; height: 100%; width: 100%;";
9376
$div{innerHTML} = "";
9377
9378
foreach my $ban (@$r) {
9379
my $uid = $ban->{BID};
9380
my $reason = $ban->{why};
9381
my $bannedBy = $ban->{ByID};
9382
$div{innerHTML} .= Html2::profile_link($uid) . " was banned by " . Html2::profile_link($bannedBy) . " (reason: $reason)" . Html2::br();
9383
} # end foreach
9384
9385
$content .= Html2::tag(\%div);
9386
} # end div
9387
$content .= "</td></tr></table>";
9388
} # end if @$r
9389
else {
9390
$content .= "Sweet! " . Html2::embolden("no") . " banned users!" . Html2::br();
9391
} # end else of if @$r
9392
}
9393
9394
9395
} # end elsif ($page eq Bc_sql::get_constant("ADMIN_BANNED_USERS_PAGE"))
9396
elsif ($page eq Bc_sql::get_constant("ADMIN_FEEDBACK_INBOX_PAGE")) {
9397
9398
9399
my $fb_page = Bc_misc::get_param("fbp");
9400
9401
if (not $fb_page) {
9402
$title .= "Feedback Inbox";
9403
my $fb_sql = "select * from mod_messages";
9404
my $r = Bc_sql::sql_execute($fb_sql, "display admin page", 1);
9405
9406
if (@$r) {
9407
$content .= "There " . Bc_misc::pluralize("is", @$r) . " " . Html2::embolden(scalar @$r) . " " . Bc_misc::pluralize("message", @$r) . Html2::hr();
9408
9409
foreach my $ref (@$r) {
9410
my $fromID = $ref->{UID};
9411
my $fromName = User::get_user_stat($fromID, "nickname");
9412
my $subject = Bc_misc::shorten_str($ref->{subject}, 35);
9413
my $msg = Bc_misc::shorten_str($ref->{msg}, 35);
9414
my $d = $ref->{date};
9415
my $seen = $ref->{seen};
9416
my $seenByID = $ref->{seenByID};
9417
if ($seen eq 1) {
9418
$content .= "$d from $fromName: $subject" . Html2::br();
9419
} else {
9420
$content .= "$d from $fromName (seen): $subject" . Html2::br();
9421
}
9422
} # end foreach msg
9423
} # end if @$r
9424
else {
9425
$content .= "yahoo! no feedback messages were found" . Html2::br();
9426
} # end else of if @$r
9427
} # end if not $fb_page
9428
else {
9429
$title .= "View Feedback Message";
9430
} # end else of if not $fb_page
9431
9432
9433
} # end elsif ($page eq Bc_sql::get_constant("ADMIN_FEEDBACK_INBOX_PAGE"))
9434
elsif ($page eq Bc_sql::get_constant("ADMIN_SYSTEM_PAGE") and User::isUserSuperAdmin($Bc_sql::LOGGEDIN)) {
9435
9436
9437
$title .= "System Configuration Editor";
9438
9439
{ my %script;
9440
if (not $tab) { $tab = "bodies"; }
9441
$script{tag} = "script";
9442
$script{async} = 1;
9443
$script{defer} = 1;
9444
$script{innerHTML} = "lastElementToggled = \"$tab\";";
9445
9446
$content .= Html2::tag(\%script);
9447
} # end script
9448
9449
{ my %div;
9450
$div{tag} = "div";
9451
$div{style} = "display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 5px; margin-bottom: 10px;";
9452
$div{innerHTML} = "";
9453
9454
{ my %link; # bodies toggler
9455
$link{tag} = "a";
9456
$link{onclick} = "toggle_display_element('bodies', 'bodieslink');";
9457
$link{id} = "bodieslink";
9458
$link{class} = "pointer";
9459
9460
{ my %linkdiv;
9461
$linkdiv{tag} = "div";
9462
$linkdiv{id} = "bodiesdiv";
9463
$linkdiv{class} = "navbutton";
9464
if ($tab eq "bodies") { $linkdiv{class} .= "_selected"; }
9465
$linkdiv{innerHTML} = "Bodies";
9466
9467
$link{innerHTML} .= Html2::tag(\%linkdiv);
9468
} # end linkdiv
9469
9470
$div{innerHTML} .= Html2::tag(\%link);
9471
} # end bodies toggle
9472
9473
{ my %link; # busts toggler
9474
$link{tag} = "a";
9475
$link{onclick} = "toggle_display_element('busts', 'bustslink');";
9476
$link{id} = "bustslink";
9477
$link{class} = "pointer";
9478
9479
{ my %linkdiv;
9480
$linkdiv{tag} = "div";
9481
$linkdiv{id} = "bustsdiv";
9482
$linkdiv{class} = "navbutton";
9483
if ($tab eq "busts") { $linkdiv{class} .= "_selected"; }
9484
$linkdiv{innerHTML} = "Busts";
9485
9486
$link{innerHTML} .= Html2::tag(\%linkdiv);
9487
} # end linkdiv
9488
9489
$div{innerHTML} .= Html2::tag(\%link);
9490
} # end busts toggle
9491
9492
{ my %link; # constants toggler
9493
$link{tag} = "a";
9494
$link{onclick} = "toggle_display_element('const', 'constlink');";
9495
$link{id} = "constlink";
9496
$link{class} = "pointer";
9497
9498
{ my %linkdiv;
9499
$linkdiv{tag} = "div";
9500
$linkdiv{id} = "constdiv";
9501
$linkdiv{class} = "navbutton";
9502
if ($tab eq "const") { $linkdiv{class} .= "_selected"; }
9503
$linkdiv{innerHTML} = "Constants";
9504
9505
$link{innerHTML} .= Html2::tag(\%linkdiv);
9506
} # end linkdiv
9507
9508
$div{innerHTML} .= Html2::tag(\%link);
9509
} # end constants toggle
9510
9511
{ my %link; # days toggler
9512
$link{tag} = "a";
9513
$link{onclick} = "toggle_display_element('days', 'dayslink');";
9514
$link{id} = "dayslink";
9515
$link{class} = "pointer";
9516
9517
{ my %linkdiv;
9518
$linkdiv{tag} = "div";
9519
$linkdiv{id} = "daysdiv";
9520
$linkdiv{class} = "navbutton";
9521
if ($tab eq "days") { $linkdiv{class} .= "_selected"; }
9522
$linkdiv{innerHTML} = "Days";
9523
9524
$link{innerHTML} .= Html2::tag(\%linkdiv);
9525
} # end linkdiv
9526
9527
$div{innerHTML} .= Html2::tag(\%link);
9528
} # end days toggle
9529
9530
{ my %link; # default stats toggler
9531
$link{tag} = "a";
9532
$link{onclick} = "toggle_display_element('defstats', 'defstatslink');";
9533
$link{id} = "defstatslink";
9534
$link{class} = "pointer";
9535
9536
{ my %linkdiv;
9537
$linkdiv{tag} = "div";
9538
$linkdiv{id} = "defstatsdiv";
9539
$linkdiv{class} = "navbutton";
9540
if ($tab eq "defstats") { $linkdiv{class} .= "_selected"; }
9541
$linkdiv{innerHTML} = "Default Stats";
9542
9543
$link{innerHTML} .= Html2::tag(\%linkdiv);
9544
} # end linkdiv
9545
9546
$div{innerHTML} .= Html2::tag(\%link);
9547
} # end default stats toggle
9548
9549
{ my %link; # default themes toggler
9550
$link{tag} = "a";
9551
$link{onclick} = "toggle_display_element('defthemes', 'defthemeslink');";
9552
$link{id} = "defthemeslink";
9553
$link{class} = "pointer";
9554
9555
{ my %linkdiv;
9556
$linkdiv{tag} = "div";
9557
$linkdiv{id} = "defthemesdiv";
9558
$linkdiv{class} = "navbutton";
9559
if ($tab eq "defthemes") { $linkdiv{class} .= "_selected"; }
9560
$linkdiv{innerHTML} = "Default Themes";
9561
9562
$link{innerHTML} .= Html2::tag(\%linkdiv);
9563
} # end linkdiv
9564
9565
$div{innerHTML} .= Html2::tag(\%link);
9566
} # end default themes toggle
9567
9568
{ my %link; # errors toggler
9569
$link{tag} = "a";
9570
$link{onclick} = "toggle_display_element('err', 'errlink');";
9571
$link{id} = "errlink";
9572
$link{class} = "pointer";
9573
9574
{ my %linkdiv;
9575
$linkdiv{tag} = "div";
9576
$linkdiv{id} = "errdiv";
9577
$linkdiv{class} = "navbutton";
9578
if ($tab eq "err") { $linkdiv{class} .= "_selected"; }
9579
$linkdiv{innerHTML} = "Errors";
9580
9581
$link{innerHTML} .= Html2::tag(\%linkdiv);
9582
} # end linkdiv
9583
9584
$div{innerHTML} .= Html2::tag(\%link);
9585
} # end errors toggle
9586
9587
{ my %link; # eyes toggler
9588
$link{tag} = "a";
9589
$link{onclick} = "toggle_display_element('eyes', 'eyeslink');";
9590
$link{id} = "eyeslink";
9591
$link{class} = "pointer";
9592
9593
{ my %linkdiv;
9594
$linkdiv{tag} = "div";
9595
$linkdiv{id} = "eyesdiv";
9596
$linkdiv{class} = "navbutton";
9597
if ($tab eq "eyes") { $linkdiv{class} .= "_selected"; }
9598
$linkdiv{innerHTML} = "Eyes";
9599
9600
$link{innerHTML} .= Html2::tag(\%linkdiv);
9601
} # end linkdiv
9602
9603
$div{innerHTML} .= Html2::tag(\%link);
9604
} # end eyes toggle
9605
9606
{ my %link; # genders toggler
9607
$link{tag} = "a";
9608
$link{onclick} = "toggle_display_element('sex', 'sexlink');";
9609
$link{id} = "sexlink";
9610
$link{class} = "pointer";
9611
9612
{ my %linkdiv;
9613
$linkdiv{tag} = "div";
9614
$linkdiv{id} = "sexdiv";
9615
$linkdiv{class} = "navbutton";
9616
if ($tab eq "sex") { $linkdiv{class} .= "_selected"; }
9617
$linkdiv{innerHTML} = "Genders";
9618
9619
$link{innerHTML} .= Html2::tag(\%linkdiv);
9620
} # end linkdiv
9621
9622
$div{innerHTML} .= Html2::tag(\%link);
9623
} # end genders toggle
9624
9625
{ my %link; # hair toggler
9626
$link{tag} = "a";
9627
$link{onclick} = "toggle_display_element('hair', 'hairlink');";
9628
$link{id} = "hairlink";
9629
$link{class} = "pointer";
9630
9631
{ my %linkdiv;
9632
$linkdiv{tag} = "div";
9633
$linkdiv{id} = "hairdiv";
9634
$linkdiv{class} = "navbutton";
9635
if ($tab eq "hair") { $linkdiv{class} .= "_selected"; }
9636
$linkdiv{innerHTML} = "Hair";
9637
9638
$link{innerHTML} .= Html2::tag(\%linkdiv);
9639
} # end linkdiv
9640
9641
$div{innerHTML} .= Html2::tag(\%link);
9642
} # end hair toggle
9643
9644
{ my %link; # heights toggler
9645
$link{tag} = "a";
9646
$link{onclick} = "toggle_display_element('height', 'heightlink');";
9647
$link{id} = "heightlink";
9648
$link{class} = "pointer";
9649
9650
{ my %linkdiv;
9651
$linkdiv{tag} = "div";
9652
$linkdiv{id} = "heightdiv";
9653
$linkdiv{class} = "navbutton";
9654
if ($tab eq "height") { $linkdiv{class} .= "_selected"; }
9655
$linkdiv{innerHTML} = "Heights";
9656
9657
$link{innerHTML} .= Html2::tag(\%linkdiv);
9658
} # end linkdiv
9659
9660
$div{innerHTML} .= Html2::tag(\%link);
9661
} # end heights toggle
9662
9663
{ my %link; # erection sizes toggler
9664
$link{tag} = "a";
9665
$link{onclick} = "toggle_display_element('len', 'lenlink');";
9666
$link{id} = "lenlink";
9667
$link{class} = "pointer";
9668
9669
{ my %linkdiv;
9670
$linkdiv{tag} = "div";
9671
$linkdiv{id} = "lendiv";
9672
$linkdiv{class} = "navbutton";
9673
if ($tab eq "len") { $linkdiv{class} .= "_selected"; }
9674
$linkdiv{innerHTML} = "Erection Sizes";
9675
9676
$link{innerHTML} .= Html2::tag(\%linkdiv);
9677
} # end linkdiv
9678
9679
$div{innerHTML} .= Html2::tag(\%link);
9680
} # end erection sizes toggle
9681
9682
{ my %link; # months toggler
9683
$link{tag} = "a";
9684
$link{onclick} = "toggle_display_element('mon', 'monlink');";
9685
$link{id} = "monlink";
9686
$link{class} = "pointer";
9687
9688
{ my %linkdiv;
9689
$linkdiv{tag} = "div";
9690
$linkdiv{id} = "mondiv";
9691
$linkdiv{class} = "navbutton";
9692
if ($tab eq "mon") { $linkdiv{class} .= "_selected"; }
9693
$linkdiv{innerHTML} = "Months";
9694
9695
$link{innerHTML} .= Html2::tag(\%linkdiv);
9696
} # end linkdiv
9697
9698
$div{innerHTML} .= Html2::tag(\%link);
9699
} # end months toggle
9700
9701
{ my %link; # new theme data toggler
9702
$link{tag} = "a";
9703
$link{onclick} = "toggle_display_element('newtheme', 'newthemelink');";
9704
$link{id} = "newthemelink";
9705
$link{class} = "pointer";
9706
9707
{ my %linkdiv;
9708
$linkdiv{tag} = "div";
9709
$linkdiv{id} = "newthemediv";
9710
$linkdiv{class} = "navbutton";
9711
if ($tab eq "newtheme") { $linkdiv{class} .= "_selected"; }
9712
$linkdiv{innerHTML} = "New Theme";
9713
9714
$link{innerHTML} .= Html2::tag(\%linkdiv);
9715
} # end linkdiv
9716
9717
$div{innerHTML} .= Html2::tag(\%link);
9718
} # end errors toggle
9719
9720
{ my %link; # orientations toggler
9721
$link{tag} = "a";
9722
$link{onclick} = "toggle_display_element('orientation', 'orientationlink');";
9723
$link{id} = "orientationlink";
9724
$link{class} = "pointer";
9725
9726
{ my %linkdiv;
9727
$linkdiv{tag} = "div";
9728
$linkdiv{id} = "orientationdiv";
9729
$linkdiv{class} = "navbutton";
9730
if ($tab eq "orientation") { $linkdiv{class} .= "_selected"; }
9731
$linkdiv{innerHTML} = "Orientations";
9732
9733
$link{innerHTML} .= Html2::tag(\%linkdiv);
9734
} # end linkdiv
9735
9736
$div{innerHTML} .= Html2::tag(\%link);
9737
} # end orientations toggle
9738
9739
{ my %link; # security levels toggler
9740
$link{tag} = "a";
9741
$link{onclick} = "toggle_display_element('sec', 'seclink');";
9742
$link{id} = "seclink";
9743
$link{class} = "pointer";
9744
9745
{ my %linkdiv;
9746
$linkdiv{tag} = "div";
9747
$linkdiv{id} = "secdiv";
9748
$linkdiv{class} = "navbutton";
9749
if ($tab eq "sec") { $linkdiv{class} .= "_selected"; }
9750
$linkdiv{innerHTML} = "Security Levels";
9751
9752
$link{innerHTML} .= Html2::tag(\%linkdiv);
9753
} # end linkdiv
9754
9755
$div{innerHTML} .= Html2::tag(\%link);
9756
} # end security levels toggle
9757
9758
{ my %link; # races toggler
9759
$link{tag} = "a";
9760
$link{onclick} = "toggle_display_element('race', 'racelink');";
9761
$link{id} = "racelink";
9762
$link{class} = "pointer";
9763
9764
{ my %linkdiv;
9765
$linkdiv{tag} = "div";
9766
$linkdiv{id} = "racediv";
9767
$linkdiv{class} = "navbutton";
9768
if ($tab eq "race") { $linkdiv{class} .= "_selected"; }
9769
$linkdiv{innerHTML} = "Races";
9770
9771
$link{innerHTML} .= Html2::tag(\%linkdiv);
9772
} # end linkdiv
9773
9774
$div{innerHTML} .= Html2::tag(\%link);
9775
} # end races toggle
9776
9777
{ my %link; # styles toggler
9778
$link{tag} = "a";
9779
$link{onclick} = "toggle_display_element('style', 'stylelink');";
9780
$link{id} = "stylelink";
9781
$link{class} = "pointer";
9782
9783
{ my %linkdiv;
9784
$linkdiv{tag} = "div";
9785
$linkdiv{id} = "stylediv";
9786
$linkdiv{class} = "navbutton";
9787
if ($tab eq "style") { $linkdiv{class} .= "_selected"; }
9788
$linkdiv{innerHTML} = "Styles";
9789
9790
$link{innerHTML} .= Html2::tag(\%linkdiv);
9791
} # end linkdiv
9792
9793
$div{innerHTML} .= Html2::tag(\%link);
9794
} # end styles toggle
9795
9796
{ my %link; # valid characters toggler
9797
$link{tag} = "a";
9798
$link{onclick} = "toggle_display_element('chars', 'charslink');";
9799
$link{id} = "charslink";
9800
$link{class} = "pointer";
9801
9802
{ my %linkdiv;
9803
$linkdiv{tag} = "div";
9804
$linkdiv{id} = "charsdiv";
9805
$linkdiv{class} = "navbutton";
9806
if ($tab eq "chars") { $linkdiv{class} .= "_selected"; }
9807
$linkdiv{innerHTML} = "Valid Chars";
9808
9809
$link{innerHTML} .= Html2::tag(\%linkdiv);
9810
} # end linkdiv
9811
9812
$div{innerHTML} .= Html2::tag(\%link);
9813
} # end valid chars toggle
9814
9815
{ my %link; # weights toggler
9816
$link{tag} = "a";
9817
$link{onclick} = "toggle_display_element('weight', 'weightlink');";
9818
$link{id} = "weightlink";
9819
$link{class} = "pointer";
9820
9821
{ my %linkdiv;
9822
$linkdiv{tag} = "div";
9823
$linkdiv{id} = "weightdiv";
9824
$linkdiv{class} = "navbutton";
9825
if ($tab eq "weight") { $linkdiv{class} .= "_selected"; }
9826
$linkdiv{innerHTML} = "Weights";
9827
9828
$link{innerHTML} .= Html2::tag(\%linkdiv);
9829
} # end linkdiv
9830
9831
$div{innerHTML} .= Html2::tag(\%link);
9832
} # end weights toggle
9833
9834
{ my %link; # zodiacs toggler
9835
$link{tag} = "a";
9836
$link{onclick} = "toggle_display_element('zodiac', 'zodiaclink');";
9837
$link{id} = "zodiaclink";
9838
$link{class} = "pointer";
9839
9840
{ my %linkdiv;
9841
$linkdiv{tag} = "div";
9842
$linkdiv{id} = "zodiacdiv";
9843
$linkdiv{class} = "navbutton";
9844
if ($tab eq "zodiac") { $linkdiv{class} .= "_selected"; }
9845
$linkdiv{innerHTML} = "Zodiacs";
9846
9847
$link{innerHTML} .= Html2::tag(\%linkdiv);
9848
} # end linkdiv
9849
9850
$div{innerHTML} .= Html2::tag(\%link);
9851
} # end zodiacs toggle
9852
9853
{ my %link; # mod msgs toggler
9854
$link{tag} = "a";
9855
$link{onclick} = "toggle_display_element('modmsgs', 'modmsgslink');";
9856
$link{id} = "modmsgslink";
9857
$link{class} = "pointer";
9858
9859
{ my %linkdiv;
9860
$linkdiv{tag} = "div";
9861
$linkdiv{id} = "modmsgsdiv";
9862
$linkdiv{class} = "navbutton";
9863
if ($tab eq "modmsgs") { $linkdiv{class} .= "_selected"; }
9864
$linkdiv{innerHTML} = "Mod Msgs";
9865
9866
$link{innerHTML} .= Html2::tag(\%linkdiv);
9867
} # end linkdiv
9868
9869
$div{innerHTML} .= Html2::tag(\%link);
9870
} # end moderator messages toggle
9871
9872
{ my %link; # locations toggler
9873
$link{tag} = "a";
9874
$link{onclick} = "toggle_display_element('location', 'locationlink');";
9875
$link{id} = "locationlink";
9876
$link{class} = "pointer";
9877
9878
{ my %linkdiv;
9879
$linkdiv{tag} = "div";
9880
$linkdiv{id} = "locationdiv";
9881
$linkdiv{class} = "navbutton";
9882
if ($tab eq "location") { $linkdiv{class} .= "_selected"; }
9883
$linkdiv{innerHTML} = "Locations";
9884
9885
$link{innerHTML} .= Html2::tag(\%linkdiv);
9886
} # end linkdiv
9887
9888
$div{innerHTML} .= Html2::tag(\%link);
9889
} # end locations toggle
9890
9891
{ my %link; # bad words toggler
9892
$link{tag} = "a";
9893
$link{onclick} = "toggle_display_element('badnames', 'badnameslink');";
9894
$link{id} = "badnameslink";
9895
$link{class} = "pointer";
9896
9897
{ my %linkdiv;
9898
$linkdiv{tag} = "div";
9899
$linkdiv{id} = "badnamesdiv";
9900
$linkdiv{class} = "navbutton";
9901
if ($tab eq "badnames") { $linkdiv{class} .= "_selected"; }
9902
$linkdiv{innerHTML} = "Bad Words";
9903
9904
$link{innerHTML} .= Html2::tag(\%linkdiv);
9905
} # end linkdiv
9906
9907
$div{innerHTML} .= Html2::tag(\%link);
9908
} # end errors toggle
9909
9910
$content .= Html2::tag(\%div);
9911
} # end toggles div
9912
9913
$content .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0 width=95%><tr><td align=center>";
9914
$content .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td align=center>";
9915
9916
# @bodies will be reused for more than just "bodies"
9917
# such as "orientations" or "weights"
9918
my @bodies = Bc_sql::get_config("bodies");
9919
9920
# bodies
9921
{ my %div;
9922
$div{tag} = "div";
9923
$div{id} = "bodies";
9924
if ($tab ne "bodies") { $div{style} = "display: none;"; }
9925
$div{innerHTML} = "";
9926
9927
{ my %form;
9928
$form{tag} = "form";
9929
$form{method} = "post";
9930
$form{action} = "/edit_config.pl";
9931
$form{innerHTML} = "";
9932
9933
{ my %input;
9934
$input{tag} = "input";
9935
$input{type} = "hidden";
9936
$input{name} = "t";
9937
$input{value} = "bodies";
9938
9939
$form{innerHTML} .= Html2::tag(\%input);
9940
}
9941
9942
{ my %ta;
9943
$ta{tag} = "textarea";
9944
$ta{name} = "v";
9945
$ta{cols} = "30";
9946
$ta{rows} ="8";
9947
$ta{innerHTML} = "";
9948
9949
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
9950
$ta{innerHTML} =~ s/</</;
9951
$ta{innerHTML} =~ s/</>/;
9952
9953
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
9954
} # end textarea
9955
9956
{ my %button;
9957
$button{tag} = "button";
9958
$button{type} = "submit";
9959
$button{class} = "green";
9960
$button{innerHTML} = "Save";
9961
9962
$form{innerHTML} .= Html2::tag(\%button);
9963
}
9964
9965
$div{innerHTML} .= Html2::tag(\%form);
9966
} # end form
9967
9968
$content .= Html2::tag(\%div);
9969
} # end bodies div
9970
9971
# busts
9972
{ my %div;
9973
$div{tag} = "div";
9974
$div{id} = "busts";
9975
if ($tab ne "busts") { $div{style} .= "display: none;"; }
9976
$div{innerHTML} = "";
9977
9978
{ my %form;
9979
$form{tag} = "form";
9980
$form{method} = "post";
9981
$form{action} = "/edit_config.pl";
9982
$form{innerHTML} = "";
9983
9984
{ my %input;
9985
$input{tag} = "input";
9986
$input{type} = "hidden";
9987
$input{name} = "t";
9988
$input{value} = "busts";
9989
9990
$form{innerHTML} .= Html2::tag(\%input);
9991
} # end hidden "t" input
9992
9993
{ my %ta;
9994
$ta{tag} = "textarea";
9995
$ta{name} = "v";
9996
$ta{cols} = "30";
9997
$ta{rows} = "8";
9998
$ta{innerHTML} = "";
9999
10000
@bodies = Bc_sql::get_config("busts");
10001
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
10002
$ta{innerHTML} =~ s/</</;
10003
$ta{innerHTML} =~ s/>/>/;
10004
10005
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
10006
} # end textarea
10007
10008
{ my %button;
10009
$button{tag} = "button";
10010
$button{type} = "submit";
10011
$button{class} = "green";
10012
$button{innerHTML} = "Save";
10013
10014
$form{innerHTML} .= Html2::tag(\%button);
10015
} # end submit button
10016
10017
$div{innerHTML} .= Html2::tag(\%form);
10018
} # end form
10019
10020
$content .= Html2::tag(\%div);
10021
} # end busts div
10022
10023
# constants
10024
{ my %div;
10025
my @consts = Bc_sql::get_constants();
10026
10027
$div{tag} = "div";
10028
$div{id} = "const";
10029
if ($tab ne "const") { $div{style} .= " display: none;"; }
10030
$div{innerHTML} = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td align=center colspan=4>";
10031
10032
{ my %form;
10033
$form{tag} = "form";
10034
$form{action} = "/edit_constant.pl";
10035
$form{method} = "post";
10036
$form{innerHTML} = "";
10037
$form{style} = "width: min-content;";
10038
10039
{ my %fs;
10040
$fs{tag} = "fieldset";
10041
$fs{class} = "nowrap";
10042
$fs{innerHTML} = Html2::embolden("Add New Constant") . Html2::br();
10043
10044
{ my %input;
10045
$input{tag} = "input";
10046
$input{type} = "hidden";
10047
$input{name} = "t";
10048
$input{value} = "const";
10049
10050
$fs{innerHTML} .= Html2::tag(\%input);
10051
} # end hidden "t" input
10052
10053
{ my %input;
10054
$input{tag} = "input";
10055
$input{name} = "n";
10056
10057
$fs{innerHTML} .= Html2::tag(\%input) . " ";
10058
} # end name input
10059
10060
{ my %input;
10061
$input{tag} = "input";
10062
$input{name} = "v";
10063
10064
$fs{innerHTML} .= Html2::tag(\%input) . " ";
10065
} # end value input
10066
10067
{ my %button;
10068
$button{tag} = "button";
10069
$button{type} = "submit";
10070
$button{class} = "blue";
10071
$button{innerHTML} = "Add";
10072
10073
$fs{innerHTML} .= Html2::tag(\%button);
10074
} # end submit button
10075
10076
{ my %button;
10077
$button{tag} = "button";
10078
$button{type} = "reset";
10079
$button{class} = "yellow";
10080
$button{innerHTML} = "Reset";
10081
10082
$fs{innerHTML} .= Html2::tag(\%button);
10083
} # end reset button
10084
10085
$form{innerHTML} .= Html2::tag(\%fs);
10086
} # end fieldset
10087
10088
$div{innerHTML} .= Html2::tag(\%form);
10089
} # end add constant form
10090
10091
$div{innerHTML} .= "</td></tr><tr><td class=spacery_large colspan=4>";
10092
$div{innerHTML} .= "</td></tr><tr><td nowrap>";
10093
10094
{ my %fs;
10095
$fs{tag} = "fieldset";
10096
$fs{class} = "scrolling_vertical-auto";
10097
$fs{style} = "max-height: 400px;";
10098
$fs{innerHTML} = "";
10099
10100
my $constCount = 1;
10101
foreach my $constRef (@consts) {
10102
$fs{innerHTML} .= "<table align=right border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
10103
10104
{ my %form;
10105
$form{tag} = "form";
10106
$form{action} = "/edit_constant.pl";
10107
$form{method} = "post";
10108
$form{innerHTML} = "";
10109
10110
{ my %input;
10111
$input{tag} = "input";
10112
$input{type} = "hidden";
10113
$input{name} = "t";
10114
$input{value} = "const";
10115
10116
$form{innerHTML} .= Html2::tag(\%input) . " ";
10117
}
10118
10119
{ my %input;
10120
$input{tag} = "input";
10121
$input{type} = "hidden";
10122
$input{name} = "n";
10123
$input{value} = $constRef->{name};
10124
10125
$form{innerHTML} .= Html2::tag(\%input) . Html2::embolden($constRef->{name});
10126
}
10127
10128
$form{innerHTML} .= "</td><td class=spacerx></td><td>";
10129
10130
{ my %input;
10131
$input{tag} = "input";
10132
$input{name} = "v";
10133
$input{value} = $constRef->{value};
10134
10135
$form{innerHTML} .= Html2::tag(\%input);
10136
}
10137
10138
$form{innerHTML} .= "</td><td>";
10139
10140
{ my %button;
10141
$button{tag} = "button";
10142
$button{type} = "submit";
10143
$button{class} = "green";
10144
$button{innerHTML} = "Update";
10145
10146
$form{innerHTML} .= Html2::tag(\%button);
10147
} # end submit button
10148
10149
$form{innerHTML} .= "</td><td class=spacerx></td><td>";
10150
10151
{ my %button;
10152
$button{tag} = "button";
10153
$button{type} = "reset";
10154
$button{class} = "yellow";
10155
$button{innerHTML} = "Reset";
10156
10157
$form{innerHTML} .= Html2::tag(\%button);
10158
} # end reset button
10159
10160
$fs{innerHTML} .= Html2::tag(\%form);
10161
} # end update constant form
10162
10163
$fs{innerHTML} .= "</td><td class=spacerx></td><td>";
10164
10165
{ my %form;
10166
$form{tag} = "form";
10167
$form{action} = "/edit_constant.pl";
10168
$form{method} = "post";
10169
$form{innerHTML} = "";
10170
10171
{ my %input;
10172
$input{tag} = "input";
10173
$input{type} = "hidden";
10174
$input{name} = "DELETE_CONSTANT";
10175
$input{value} = $constRef->{name};
10176
10177
$form{innerHTML} .= Html2::tag(\%input);
10178
} # end hidden DELETE_CONSTANT input
10179
10180
{ my %input;
10181
$input{tag} = "input";
10182
$input{type} = "hidden";
10183
$input{name} = "t";
10184
$input{value} = "const";
10185
10186
$form{innerHTML} .= Html2::tag(\%input);
10187
} # end hidden "t" input
10188
10189
{ my %button;
10190
$button{tag} = "button";
10191
$button{type} = "button";
10192
$button{class} = "yellow";
10193
$button{innerHTML} = " x ";
10194
$button{onclick} = "";
10195
10196
$form{innerHTML} .= Html2::tag(\%button);
10197
} # end cancel button
10198
10199
$fs{innerHTML} .= Html2::tag(\%form);
10200
} # end delete constant form
10201
10202
$fs{innerHTML} .= "</td></tr></table>" . Html2::br(); # why do i need the <br> here??
10203
} # end foreach constant
10204
10205
$div{innerHTML} .= Html2::tag(\%fs);
10206
} # end fieldset
10207
10208
$div{innerHTML} .= "</td></tr><tr><td class=spacery colspan=4>";
10209
$div{innerHTML} .= "</td></tr></table>";
10210
10211
$content .= Html2::tag(\%div);
10212
} # end constants div
10213
10214
# days
10215
{ my %div;
10216
$div{tag} = "div";
10217
$div{id} = "days";
10218
if ($tab ne "days") { $div{style} = "display: none;"; }
10219
$div{innerHTML} = "";
10220
10221
{ my %form;
10222
$form{tag} = "form";
10223
$form{action} = "/edit_config.pl";
10224
$form{method} = "post";
10225
$form{innerHTML} = "";
10226
10227
{ my %input;
10228
$input{tag} = "input";
10229
$input{type} = "hidden";
10230
$input{name} = "t";
10231
$input{value} = "days";
10232
10233
$form{innerHTML} .= Html2::tag(\%input);
10234
} # end hidden "t" input
10235
10236
{ my %ta;
10237
$ta{tag} = "textarea";
10238
$ta{name} = "v";
10239
$ta{cols} = "30";
10240
$ta{rows} = "8";
10241
$ta{innerHTML} = "";
10242
10243
@bodies = Bc_sql::get_config("days");
10244
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
10245
$ta{innerHTML} =~ s/</</;
10246
$ta{innerHTML} =~ s/>/>/;
10247
10248
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
10249
} # end textarea
10250
10251
{ my %button;
10252
$button{tag} = "button";
10253
$button{type} = "submit";
10254
$button{class} = "green";
10255
$button{innerHTML} = "Save";
10256
10257
$form{innerHTML} .= Html2::tag(\%button);
10258
} # end submit button
10259
10260
$div{innerHTML} .= Html2::tag(\%form);
10261
}
10262
10263
$content .= Html2::tag(\%div);
10264
} # end of days div
10265
10266
# default stats
10267
{ my %div;
10268
$div{tag} = "div";
10269
$div{id} = "defstats";
10270
if ($tab ne "defstats") { $div{style} .= "display: none;"; }
10271
$div{innerHTML} = "";
10272
10273
{ my %form;
10274
$form{tag} = "form";
10275
$form{action} = "/edit_defstats.pl";
10276
$form{method} = "post";
10277
$form{innerHTML} = "";
10278
10279
{ my %ta;
10280
my $sql = "select * from defaults where name='STATS'";
10281
my $results = Bc_sql::sql_execute($sql, "display admin page");
10282
10283
$ta{tag} = "textarea";
10284
$ta{name} = "v";
10285
$ta{cols} = "30";
10286
$ta{rows} = "8";
10287
$ta{innerHTML} = "";
10288
10289
if (ref $results eq "HASH") { $ta{innerHTML} .= $results->{value}; }
10290
$ta{innerHTML} =~ s/</</g;
10291
$ta{innerHTML} =~ s/>/>/g;
10292
10293
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
10294
} # end textarea
10295
10296
{ my %button;
10297
$button{tag} = "button";
10298
$button{type} = "submit";
10299
$button{class} = "green";
10300
$button{innerHTML} = "Save";
10301
10302
$form{innerHTML} .= Html2::tag(\%button);
10303
} # end submit button
10304
10305
$div{innerHTML} .= Html2::tag(\%form);
10306
} # end form
10307
10308
$content .= Html2::tag(\%div);
10309
} # end default stats
10310
10311
# default themes
10312
{ my %div;
10313
$div{tag} = "div";
10314
$div{id} = "defthemes";
10315
if ($tab ne "defthemes") { $div{style} = "display: none;"; }
10316
$div{innerHTML} = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td align=center>";
10317
10318
{ my %form;
10319
$form{tag} = "form";
10320
$form{action} = "/edit_defthemes.pl";
10321
$form{method} = "post";
10322
$form{innerHTML} = "Only three theme ID's are necessary. More than that will get dropped." . Html2::br();
10323
$form{innerHTML} .= "One TID per line, no spaces." . Html2::br() . Html2::br();
10324
$form{innerHTML} .= Html2::tag({tag=>"font", class=>"red-button", innerHTML=>"Ensure TID is valid!"}) . Html2::br() . Html2::br();
10325
my $sql = "select * from defaults where name='THEMES'";
10326
my $results = Bc_sql::sql_execute($sql, "display admin page");
10327
10328
{ my %ta;
10329
$ta{tag} = "textarea";
10330
$ta{name} = "v";
10331
$ta{cols} = "10";
10332
$ta{rows} = "3";
10333
$ta{innerHTML} = "";
10334
10335
if (ref $results eq "HASH") { $ta{innerHTML} .= $results->{value}; }
10336
$ta{innerHTML} =~ s/</</;
10337
$ta{innerHTML} =~ s/>/>/;
10338
10339
$form{innerHTML} .= Html2::tag(\%ta);
10340
} # end textarea
10341
10342
$form{innerHTML} .= "</td></tr><tr><td height=5 style='min-height: 5px;'>";
10343
$form{innerHTML} .= "</td></tr><tr><td align=center>";
10344
10345
{ my %button;
10346
$button{tag} = "button";
10347
$button{type} = "submit";
10348
$button{class} = "green";
10349
$button{innerHTML} = "Save";
10350
10351
$form{innerHTML} .= Html2::tag(\%button);
10352
} # end submit button
10353
10354
$div{innerHTML} .= Html2::tag(\%form);
10355
} # end form
10356
10357
$div{innerHTML} .= "</td></tr></table>";
10358
10359
$content .= Html2::tag(\%div);
10360
} # end default themes div
10361
10362
# designer
10363
{ my %div;
10364
my $miscSQL = "select * from misc where name='designer'";
10365
my $misc = Bc_sql::sql_execute($miscSQL, "display admin page");
10366
10367
$div{tag} = "div";
10368
$div{id} = "designer";
10369
if ($tab ne "designer") { $div{style} = "display: none;"; }
10370
$div{innerHTML} = "";
10371
10372
if (ref $misc eq "HASH") {
10373
my %form;
10374
$form{tag} = "form";
10375
$form{action} = "/edit_misc.pl";
10376
$form{method} = "post";
10377
$form{innerHTML} = "";
10378
10379
{ my %input;
10380
$input{tag} = "input";
10381
$input{type} = "hidden";
10382
$input{name} = "t";
10383
$input{value} = "designer";
10384
10385
$form{innerHTML} .= Html2::tag(\%input);
10386
} # end hidden "t" input
10387
10388
{ my %input;
10389
$input{tag} = "input";
10390
$input{type} = "hidden";
10391
$input{name} = "n";
10392
$input{value} = "designer";
10393
10394
$form{innerHTML} .= Html2::tag(\%input);
10395
} # end hidden "n" input
10396
10397
{ my %ta;
10398
$ta{tag} = "textarea";
10399
$ta{name} = "v";
10400
$ta{cols} = "45";
10401
$ta{rows} = "4";
10402
$ta{innerHTML} = $misc->{value};
10403
} # end text area
10404
10405
{ my %button;
10406
$button{tag} = "button";
10407
$button{type} = "submit";
10408
$button{class} = "green";
10409
$button{innerHTML} = "Save";
10410
10411
$form{innerHTML} .= Html2::tag(\%button);
10412
} # end submit button
10413
10414
$div{innerHTML} .= Html2::tag(\%form);
10415
} else {
10416
$div{innerHTML} .= "Unable to load site designer data";
10417
}
10418
10419
$content .= Html2::tag(\%div);
10420
}
10421
10422
# errors
10423
{ my %div;
10424
$div{tag} = "div";
10425
$div{id} = "err";
10426
if ($tab ne "err") { $div{style} = "display: none;"; }
10427
$div{innerHTML} = "";
10428
10429
{ my %form;
10430
$form{tag} = "form";
10431
$form{action} = "/edit_error.pl";
10432
$form{method} = "post";
10433
$form{class} = "padded subnavbar_dark";
10434
$form{innerHTML} = "";
10435
10436
{ my %input;
10437
$input{tag} = "input";
10438
$input{type} = "hidden";
10439
$input{name} = "add";
10440
$input{value} = "1";
10441
10442
$form{innerHTML} .= Html2::tag(\%input);
10443
} # end hidden "add" input
10444
10445
{ my %input;
10446
$input{tag} = "input";
10447
$input{type} = "hidden";
10448
$input{name} = "t";
10449
$input{value} = "err";
10450
10451
$form{innerHTML} .= Html2::tag(\%input);
10452
} # end hidden "t" input
10453
10454
$form{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td colspan=5>";
10455
$form{innerHTML} .= "Add New Error Code";
10456
$form{innerHTML} .= "</td></tr><tr><td>";
10457
10458
{ my %input;
10459
$input{tag} = "input";
10460
$input{name} = "name";
10461
$input{placeholder} = "SOME_NAME";
10462
$input{required} = 1;
10463
10464
$form{innerHTML} .= Html2::tag(\%input);
10465
} # end name input
10466
10467
$form{innerHTML} .= "</td><td></td><td>";
10468
10469
{ my %input;
10470
$input{tag} = "input";
10471
$input{name} = "code";
10472
$input{placeholder} = "-1234";
10473
$input{required} = 1;
10474
10475
$form{innerHTML} .= Html2::tag(\%input);
10476
} # end code input
10477
10478
$form{innerHTML} .= "</td><td></td><td>";
10479
10480
{ my %input;
10481
$input{tag} = "input";
10482
$input{name} = "desc";
10483
$input{placeholder} = "Description";
10484
$input{required} = 1;
10485
10486
$form{innerHTML} .= Html2::tag(\%input);
10487
} # end description input
10488
10489
$form{innerHTML} .= "</td></tr><tr><td align=right class=copyright>";
10490
$form{innerHTML} .= "unique";
10491
$form{innerHTML} .= "</td><td class=spacerx></td><td align=right class=copyright>";
10492
$form{innerHTML} .= "unique";
10493
$form{innerHTML} .= "</td><td class=spacerx></td><td align=right class=copyright>";
10494
$form{innerHTML} .= "doesn't fuckin' matter!";
10495
$form{innerHTML} .= "</td></tr><tr><td align=center class=spacery_large colspan=5>";
10496
$form{innerHTML} .= "</td></tr><tr><td align=center colspan=5>";
10497
10498
{ my %button;
10499
$button{tag} = "button";
10500
$button{type} = "submit";
10501
$button{class} = "blue";
10502
$button{innerHTML} = "Add";
10503
10504
$form{innerHTML} .= Html2::tag(\%button);
10505
} # end submit button
10506
10507
{ my %button;
10508
$button{tag} = "button";
10509
$button{type} = "reset";
10510
$button{class} = "yellow";
10511
$button{innerHTML} = "Reset";
10512
10513
$form{innerHTML} .= Html2::tag(\%button);
10514
} # end reset button
10515
$form{innerHTML} .= "</td></tr></table>";
10516
10517
$div{innerHTML} .= Html2::tag(\%form) . Html2::br() . Html2::br();
10518
} # end form
10519
10520
{ my %listdiv;
10521
$listdiv{tag} = "div";
10522
$listdiv{class} = "padded sunken scrolling_vertical-auto";
10523
$listdiv{style} = "max-height: 350px;";
10524
10525
$listdiv{innerHTML} = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
10526
$listdiv{innerHTML} .= "Internal Name";
10527
$listdiv{innerHTML} .= "</td><td></td><td>";
10528
$listdiv{innerHTML} .= "Code";
10529
$listdiv{innerHTML} .= "</td><td></td><td>";
10530
$listdiv{innerHTML} .= "Description";
10531
$listdiv{innerHTML} .= "</td></tr><tr><td class=spacery colspan=5></td><tr>";
10532
10533
my $errors = get_errors();
10534
foreach my $error (@$errors) {
10535
$listdiv{innerHTML} .= "<tr><td>";
10536
10537
{ my %form;
10538
$form{tag} = "form";
10539
$form{action} = "/edit_error.pl";
10540
$form{method} = "post";
10541
$form{innerHTML} = "";
10542
10543
{ my %input;
10544
$input{tag} = "input";
10545
$input{type} = "hidden";
10546
$input{name} = "t";
10547
$input{value} = "err";
10548
10549
$form{innerHTML} .= Html2::tag(\%input);
10550
} # end hidden "t" input
10551
10552
{ my %input;
10553
$input{tag} = "input";
10554
$input{type} = "hidden";
10555
$input{name} = "ID";
10556
$input{value} = $error->{ID};
10557
10558
$form{innerHTML} .= Html2::tag(\%input);
10559
} # end hidden error ID input
10560
10561
{ my %input;
10562
$input{tag} = "input";
10563
$input{name} = "name";
10564
$input{value} = $error->{name};
10565
10566
$form{innerHTML} .= Html2::tag(\%input);
10567
} # end error name input
10568
10569
$form{innerHTML} .= "</td><td class=spacerx></td><td class=nowrap>";
10570
10571
{ my %input;
10572
$input{tag} = "input";
10573
$input{name} = "code";
10574
$input{value} = $error->{code};
10575
$input{required} = 1;
10576
$input{style} = "width: 60px;";
10577
10578
$form{innerHTML} .= Html2::tag(\%input);
10579
} # end code input
10580
$form{innerHTML} .= "</td><td class=spacerx></td><td align=center class=nowrap>";
10581
10582
{ my %input;
10583
$input{tag} = "input";
10584
$input{name} = "desc";
10585
$input{value} = $error->{desc};
10586
$input{required} = 1;
10587
10588
$form{innerHTML} .= Html2::tag(\%input);
10589
} # end desc input
10590
10591
{ my %button;
10592
$button{tag} = "button";
10593
$button{type} = "submit";
10594
$button{class} = "red";
10595
$button{name} = "d";
10596
$button{value} = "1";
10597
$button{innerHTML} = "x";
10598
10599
$form{innerHTML} .= Html2::tag(\%button);
10600
} # end delete button
10601
10602
{ my %button;
10603
$button{tag} = "button";
10604
$button{type} = "reset";
10605
$button{class} = "yellow";
10606
$button{innerHTML} = "Reset";
10607
10608
$form{innerHTML} .= Html2::tag(\%button);
10609
}
10610
10611
{ my %button;
10612
$button{tag} = "button";
10613
$button{type} = "submit";
10614
$button{class} = "green";
10615
$button{innerHTML} = "Save";
10616
10617
$form{innerHTML} .= Html2::tag(\%button);
10618
}
10619
10620
$listdiv{innerHTML} .= Html2::tag(\%form);
10621
} # end form
10622
$listdiv{innerHTML} .= "</td></tr>";
10623
} # end foreach error
10624
$listdiv{innerHTML} .= "</table>";
10625
10626
$div{innerHTML} .= Html2::tag(\%listdiv);
10627
} # end listdiv
10628
10629
$content .= Html2::tag(\%div);
10630
} # end errors div
10631
10632
# eyes
10633
{ my %div;
10634
$div{tag} = "div";
10635
$div{id} = "eyes";
10636
if ($tab ne "eyes") { $div{style} = "display: none;"; }
10637
$div{innerHTML} = "";
10638
10639
{ my %form;
10640
$form{tag} = "form";
10641
$form{action} = "/edit_config.pl";
10642
$form{method} = "post";
10643
$form{innerHTML} = "";
10644
10645
{ my %input;
10646
$input{tag} = "input";
10647
$input{type} = "hidden";
10648
$input{name} = "t";
10649
$input{value} = "eyes";
10650
10651
$form{innerHTML} .= Html2::tag(\%input);
10652
} # end hidden "t" input
10653
10654
{ my %ta;
10655
$ta{tag} = "textarea";
10656
$ta{name} = "v";
10657
$ta{cols} = "30";
10658
$ta{rows} = "8";
10659
$ta{innerHTML} = "";
10660
10661
@bodies = Bc_sql::get_config("eyes");
10662
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
10663
$ta{innerHTML} =~ s/</</g;
10664
$ta{innerHTML} =~ s/>/>/g;
10665
10666
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
10667
}
10668
10669
{ my %button;
10670
$button{tag} = "button";
10671
$button{type} = "submit";
10672
$button{class} = "green";
10673
$button{innerHTML} = "Save";
10674
10675
$form{innerHTML} .= Html2::tag(\%button);
10676
}
10677
10678
$div{innerHTML} .= Html2::tag(\%form);
10679
} # end form
10680
10681
$content .= Html2::tag(\%div);
10682
} # end eyes div
10683
10684
# genders
10685
{ my %div;
10686
$div{tag} = "div";
10687
$div{id} = "sex";
10688
$div{innerHTML} = "";
10689
if ($tab ne "sex") { $div{style} = "display: none;"; }
10690
10691
{ my %form;
10692
$form{tag} = "form";
10693
$form{action} = "/edit_config.pl";
10694
$form{method} = "post";
10695
$form{innerHTML} = "";
10696
10697
{ my %input;
10698
$input{tag} = "input";
10699
$input{type} = "hidden";
10700
$input{name} = "t";
10701
$input{value} = "sex";
10702
10703
$form{innerHTML} .= Html2::tag(\%input);
10704
}
10705
10706
{ my %ta;
10707
$ta{tag} = "textarea";
10708
$ta{name} = "v";
10709
$ta{cols} = "30";
10710
$ta{rows} = "8";
10711
$ta{innerHTML} = "";
10712
10713
@bodies = Bc_sql::get_config("genders");
10714
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
10715
$ta{innerHTML} =~ s/</</g;
10716
$ta{innerHTML} =~ s/>/>/g;
10717
10718
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
10719
}
10720
10721
{ my %button;
10722
$button{tag} = "button";
10723
$button{type} = "submit";
10724
$button{class} = "green";
10725
$button{innerHTML} = "Save";
10726
10727
$form{innerHTML} .= Html2::tag(\%button);
10728
}
10729
10730
$div{innerHTML} .= Html2::tag(\%form);
10731
} # end form
10732
10733
$content .= Html2::tag(\%div);
10734
} # end genders div
10735
10736
# hair
10737
{ my %div;
10738
$div{tag} = "div";
10739
$div{id} = "hair";
10740
if ($tab ne "hair") { $div{style} = "display: none;"; }
10741
$div{innerHTML} = "";
10742
10743
{ my %form;
10744
$form{tag} = "form";
10745
$form{action} = "/edit_config.pl";
10746
$form{method} = "post";
10747
$form{innerHTML} = "";
10748
10749
{ my %input;
10750
$input{tag} = "input";
10751
$input{type} = "hidden";
10752
$input{name} = "t";
10753
$input{value} = "hair";
10754
10755
$form{innerHTML} .= Html2::tag(\%input);
10756
} # end hidden "t" input
10757
10758
{ my %ta;
10759
$ta{tag} = "textarea";
10760
$ta{name} = "v";
10761
$ta{cols} = "30";
10762
$ta{rows} = "8";
10763
$ta{innerHTML} = "";
10764
10765
@bodies = Bc_sql::get_config("hair");
10766
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
10767
$ta{innerHTML} =~ s/</</g;
10768
$ta{innerHTML} =~ s/>/>/g;
10769
10770
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
10771
} # end textarea
10772
10773
{ my %button;
10774
$button{tag} = "button";
10775
$button{type} = "submit";
10776
$button{class} = "green";
10777
$button{innerHTML} = "Save";
10778
10779
$form{innerHTML} .= Html2::tag(\%button);
10780
} # end submit button
10781
10782
$div{innerHTML} .= Html2::tag(\%form);
10783
} # end form
10784
10785
$content .= Html2::tag(\%div);
10786
} # end hair div
10787
10788
# heights
10789
{ my %div;
10790
$div{tag} = "div";
10791
$div{id} = "height";
10792
if ($tab ne "height") { $div{style} = "display: none;"; }
10793
$div{innerHTML} = "";
10794
10795
{ my %form;
10796
$form{tag} = "form";
10797
$form{action} = "/edit_config.pl";
10798
$form{method} = "post";
10799
$form{innerHTML} = "";
10800
10801
{ my %input;
10802
$input{tag} = "input";
10803
$input{type} = "hidden";
10804
$input{name} = "t";
10805
$input{value} = "height";
10806
10807
$form{innerHTML} .= Html2::tag(\%input);
10808
} # end hidden "t" input
10809
10810
{ my %ta;
10811
$ta{tag} = "textarea";
10812
$ta{name} = "v";
10813
$ta{cols} = "30";
10814
$ta{rows} = "8";
10815
10816
@bodies = Bc_sql::get_config("heights");
10817
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
10818
$ta{innerHTML} =~ s/</</g;
10819
$ta{innerHTML} =~ s/>/>/g;
10820
10821
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
10822
} # end textarea
10823
10824
{ my %button;
10825
$button{tag} = "button";
10826
$button{type} = "submit";
10827
$button{class} = "green";
10828
$button{innerHTML} = "Save";
10829
10830
$form{innerHTML} .= Html2::tag(\%button);
10831
} # end submit button
10832
10833
$div{innerHTML} .= Html2::tag(\%form);
10834
}
10835
10836
$content .= Html2::tag(\%div);
10837
} # end heights div
10838
10839
# image server
10840
{ my %div;
10841
$div{tag} = "div";
10842
$div{id} = "imgsrv";
10843
if ($tab ne "imgsrv") { $div{style} .= "display: none;"; }
10844
$div{innerHTML} = "";
10845
10846
{my %form;
10847
$form{tag} = "form";
10848
$form{action} = "/edit_constant.pl";
10849
$form{method} = "post";
10850
10851
{ my %input;
10852
$input{tag} = "input";
10853
$input{type} = "hidden";
10854
$input{name} = "t";
10855
$input{value} = "imgsrv";
10856
10857
$form{innerHTML} .= Html2::tag(\%input);
10858
}
10859
10860
{ my %input;
10861
$input{tag} = "input";
10862
$input{type} = "hidden";
10863
$input{name} = "n";
10864
$input{value} = "IMAGE_SERVER";
10865
10866
$form{innerHTML} .= Html2::tag(\%input);
10867
}
10868
10869
{ my %input;
10870
$input{tag} = "input";
10871
$input{name} = "v";
10872
$input{value} = Bc_sql::get_constant("IMAGE_SERVER");
10873
10874
$form{innerHTML} .= Html2::tag(\%input);
10875
}
10876
10877
{ my %button;
10878
$button{tag} = "button";
10879
$button{type} = "submit";
10880
$button{class} = "green";
10881
$button{innerHTML} = "Save";
10882
10883
$form{innerHTML} .= Html2::tag(\%button);
10884
}
10885
10886
$div{innerHTML} .= Html2::tag(\%form);
10887
} # end form
10888
10889
$content .= Html2::tag(\%div);
10890
} # end image server div
10891
10892
# penis lengths
10893
{ my %div;
10894
$div{tag} = "div";
10895
$div{id} = "len";
10896
if ($tab ne "len") { $div{style} = "display: none;"; }
10897
$div{innerHTML} = "";
10898
10899
{ my %form;
10900
$form{tag} = "form";
10901
$form{action} = "/edit_config.pl";
10902
$form{method} = "post";
10903
10904
{ my %input;
10905
$input{tag} = "input";
10906
$input{type} = "hidden";
10907
$input{name} = "t";
10908
$input{value} = "len";
10909
10910
$form{innerHTML} .= Html2::tag(\%input);
10911
} # end hidden "t" input
10912
10913
{ my %ta;
10914
$ta{tag} = "textarea";
10915
$ta{name} = "v";
10916
$ta{cols} = "30";
10917
$ta{rows} = "8";
10918
$ta{innerHTML} = "";
10919
10920
@bodies = Bc_sql::get_config("erections");
10921
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
10922
$ta{innerHTML} =~ s/</</g;
10923
$ta{innerHTML} =~ s/>/>/g;
10924
10925
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
10926
} # end textarea
10927
10928
{ my %button;
10929
$button{tag} = "button";
10930
$button{type} = "submit";
10931
$button{class} = "green";
10932
$button{innerHTML} = "Save";
10933
10934
$form{innerHTML} .= Html2::tag(\%button);
10935
} # end submit button
10936
10937
$div{innerHTML} .= Html2::tag(\%form);
10938
} # end form
10939
10940
$content .= Html2::tag(\%div);
10941
} # end penis lengths div
10942
10943
# months
10944
{ my %div;
10945
$div{tag} = "div";
10946
$div{id} = "mon";
10947
if ($tab ne "mon") { $div{style} = "display: none;"; }
10948
$div{innerHTML} = "";
10949
10950
{ my %form;
10951
$form{tag} = "form";
10952
$form{action} = "/edit_config.pl";
10953
$form{method} = "post";
10954
$form{innerHTML} = "";
10955
10956
{ my %input;
10957
$input{tag} = "input";
10958
$input{type} = "hidden";
10959
$input{name} = "t";
10960
$input{value} = "mon";
10961
10962
$form{innerHTML} .= Html2::tag(\%input);
10963
} # end hidden "t" input
10964
10965
{ my %ta;
10966
$ta{tag} = "textarea";
10967
$ta{name} = "v";
10968
$ta{cols} = "30";
10969
$ta{rows} = "8";
10970
$ta{innerHTML} = "";
10971
10972
@bodies = Bc_sql::get_config("months");
10973
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
10974
$ta{innerHTML} =~ s/</</g;
10975
$ta{innerHTML} =~ s/>/>/g;
10976
10977
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
10978
} # end textarea
10979
10980
{ my %button;
10981
$button{tag} = "button";
10982
$button{type} = "submit";
10983
$button{class} = "green";
10984
$button{innerHTML} = "Save";
10985
10986
$form{innerHTML} .= Html2::tag(\%button);
10987
} # end submit button
10988
10989
$div{innerHTML} .= Html2::tag(\%form);
10990
} # end form
10991
10992
$content .= Html2::tag(\%div);
10993
} # end months div
10994
10995
# default new theme data
10996
{ my %div;
10997
$div{tag} = "div";
10998
$div{id} = "newtheme";
10999
if ($tab ne "newtheme") { $div{style} = "display: none;"; }
11000
$div{innerHTML} = "";
11001
11002
{ my %form;
11003
$form{tag} = "form";
11004
$form{action} = "/edit_default.pl";
11005
$form{method} = "post";
11006
$form{innerHTML} = "";
11007
11008
{ my %ta;
11009
$ta{tag} = "textarea";
11010
$ta{name} = "v";
11011
$ta{cols} = "30";
11012
$ta{rows} = "8";
11013
$ta{innerHTML} = "";
11014
11015
my $sql = "select * from defaults where name='THEME'";
11016
my $results = Bc_sql::sql_execute($sql, "display admin page");
11017
if (ref $results eq "HASH") { $ta{innerHTML} .= $results->{value}; }
11018
$ta{innerHTML} =~ s/</</g;
11019
$ta{innerHTML} =~ s/>/>/g;
11020
11021
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
11022
} # end textarea
11023
11024
{ my %button;
11025
$button{tag} = "button";
11026
$button{type} = "submit";
11027
$button{class} = "green";
11028
$button{innerHTML} = "Save";
11029
11030
$form{innerHTML} .= Html2::tag(\%button);
11031
} # end submit button
11032
11033
$div{innerHTML} .= Html2::tag(\%form);
11034
}
11035
11036
$content .= Html2::tag(\%div);
11037
} # end new theme data div
11038
11039
# orientations
11040
{ my %div;
11041
$div{tag} = "div";
11042
$div{id} = "orientation";
11043
if ($tab ne "orientation") { $div{style} = "display: none;"; }
11044
$div{innerHTML} = "";
11045
11046
{ my %form;
11047
$form{tag} = "form";
11048
$form{action} = "/edit_config.pl";
11049
$form{method} = "post";
11050
$form{innerHTML} = "";
11051
11052
{ my %input;
11053
$input{tag} = "input";
11054
$input{type} = "hidden";
11055
$input{name} = "t";
11056
$input{value} = "orientation";
11057
11058
$form{innerHTML} .= Html2::tag(\%input);
11059
} # end hidden "t" input
11060
11061
{ my %ta;
11062
$ta{tag} = "textarea";
11063
$ta{name} = "v";
11064
$ta{cols} = "30";
11065
$ta{rows} = "8";
11066
$ta{innerHTML} = "";
11067
11068
@bodies = Bc_sql::get_config("orientations");
11069
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
11070
$ta{innerHTML} =~ s/</</g;
11071
$ta{innerHTML} =~ s/>/>/g;
11072
11073
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
11074
} # end textarea
11075
11076
{ my %button;
11077
$button{tag} = "button";
11078
$button{type} = "submit";
11079
$button{class} = "green";
11080
$button{innerHTML} = "Save";
11081
11082
$form{innerHTML} .= Html2::tag(\%button);
11083
} # end submit button
11084
11085
$div{innerHTML} .= Html2::tag(\%form);
11086
} # end form
11087
11088
$content .= Html2::tag(\%div);
11089
} # end orientations div
11090
11091
# races
11092
{ my %div;
11093
$div{tag} = "div";
11094
$div{id} = "race";
11095
if ($tab ne "race") { $div{style} = "display: none;"; }
11096
$div{innerHTML} = "";
11097
11098
{ my %form;
11099
$form{tag} = "form";
11100
$form{action} = "/edit_config.pl";
11101
$form{method} = "post";
11102
$form{innerHTML} = "";
11103
11104
{ my %input;
11105
$input{tag} = "input";
11106
$input{type} = "hidden";
11107
$input{name} = "t";
11108
$input{value} = "race";
11109
11110
$form{innerHTML} .= Html2::tag(\%input);
11111
} # end hidden "t" input
11112
11113
{ my %ta;
11114
$ta{tag} = "textarea";
11115
$ta{name} = "v";
11116
$ta{cols} = "30";
11117
$ta{rows} = "8";
11118
$ta{innerHTML} = "";
11119
11120
@bodies = Bc_sql::get_config("races");
11121
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
11122
$ta{innerHTML} =~ s/</</g;
11123
$ta{innerHTML} =~ s/>/>/g;
11124
11125
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
11126
} # end textarea
11127
11128
{ my %button;
11129
$button{tag} = "button";
11130
$button{type} = "submit";
11131
$button{class} = "green";
11132
$button{innerHTML} = "Save";
11133
11134
$form{innerHTML} .= Html2::tag(\%button);
11135
} # end submit button
11136
11137
$div{innerHTML} .= Html2::tag(\%form);
11138
} # end form
11139
11140
$content .= Html2::tag(\%div);
11141
} # end race div
11142
11143
# styles
11144
{ my %div;
11145
$div{tag} = "div";
11146
$div{id} = "style";
11147
if ($tab ne "style") { $div{style} = "display: none;"; }
11148
$div{innerHTML} = "";
11149
11150
{ my %form;
11151
$form{tag} = "form";
11152
$form{action} = "/edit_config.pl";
11153
$form{method} = "post";
11154
$form{innerHTML} = "";
11155
11156
{ my %input;
11157
$input{tag} = "input";
11158
$input{type} = "hidden";
11159
$input{name} = "t";
11160
$input{value} = "style";
11161
11162
$form{innerHTML} .= Html2::tag(\%input);
11163
} # end hidden "t" input
11164
11165
{ my %ta;
11166
$ta{tag} = "textarea";
11167
$ta{name} = "v";
11168
$ta{cols} = "30";
11169
$ta{rows} = "8";
11170
$ta{innerHTML} = "";
11171
11172
@bodies = Bc_sql::get_config("styles");
11173
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
11174
$ta{innerHTML} =~ s/</</g;
11175
$ta{innerHTML} =~ s/>/>/g;
11176
11177
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
11178
} # end textarea
11179
11180
{ my %button;
11181
$button{tag} = "button";
11182
$button{type} = "submit";
11183
$button{class} = "green";
11184
$button{innerHTML} = "Save";
11185
11186
$form{innerHTML} .= Html2::tag(\%button);
11187
} # end submit button
11188
11189
$div{innerHTML} .= Html2::tag(\%form);
11190
} # end form
11191
11192
$content .= Html2::tag(\%div);
11193
} # end styles div
11194
11195
# valid characters
11196
{ my %div;
11197
$div{tag} = "div";
11198
$div{id} = "chars";
11199
if ($tab ne "chars") { $div{style} = "display: none;"; }
11200
$div{innerHTML} = "";
11201
11202
my $miscSQL = "select * from misc where name='valid_chars'";
11203
my $misc = Bc_sql::sql_execute($miscSQL, "display admin page");
11204
if (ref $misc eq "HASH") {
11205
{ my %form;
11206
$form{tag} = "form";
11207
$form{action} = "/edit_misc.pl";
11208
$form{method} = "post";
11209
$form{innerHTML} = "";
11210
11211
{ my %input;
11212
$input{tag} = "input";
11213
$input{type} = "hidden";
11214
$input{name} = "t";
11215
$input{value} = "chars";
11216
11217
$form{innerHTML} .= Html2::tag(\%input);
11218
} # end hidden "t" input
11219
11220
{ my %input;
11221
$input{tag} = "input";
11222
$input{type} = "hidden";
11223
$input{name} = "n";
11224
$input{value} = "valid_chars";
11225
11226
$form{innerHTML} .= Html2::tag(\%input);
11227
} # end hidden "n" input
11228
11229
{ my %ta;
11230
$ta{tag} = "textarea";
11231
$ta{name} = "v";
11232
$ta{cols} = "30";
11233
$ta{rows} = "8";
11234
$ta{innerHTML} = "";
11235
11236
$ta{innerHTML} .= $misc->{value};
11237
$ta{innerHTML} =~ s/</</g;
11238
$ta{innerHTML} =~ s/>/>/g;
11239
11240
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
11241
} # end textarea
11242
11243
{ my %button;
11244
$button{tag} = "button";
11245
$button{type} = "submit";
11246
$button{class} = "green";
11247
$button{innerHTML} = "Save";
11248
11249
$form{innerHTML} .= Html2::tag(\%button);
11250
} # end submit button
11251
11252
$div{innerHTML} .= Html2::tag(\%form);
11253
} # end form
11254
} else {
11255
$content .= "Unable to load valid chars data";
11256
}
11257
11258
$content .= Html2::tag(\%div);
11259
} # end valid characters div
11260
11261
# weights
11262
{ my %div;
11263
$div{tag} = "div";
11264
$div{id} = "weight";
11265
if ($tab ne "weight") { $div{style} = "display: none;"; }
11266
$div{innerHTML} = "";
11267
11268
{ my %form;
11269
$form{tag} = "form";
11270
$form{action} = "/edit_config.pl";
11271
$form{method} = "post";
11272
$form{innerHTML} = "";
11273
11274
{ my %input;
11275
$input{tag} = "input";
11276
$input{type} = "hidden";
11277
$input{name} = "t";
11278
$input{value} = "weight";
11279
11280
$form{innerHTML} .= Html2::tag(\%input);
11281
} # end hidden "t" input
11282
11283
{ my %input;
11284
$input{tag} = "input";
11285
$input{type} = "hidden";
11286
$input{name} = "n";
11287
$input{value} = "weight";
11288
11289
$form{innerHTML} .= Html2::tag(\%input);
11290
} # end hidden "n" input
11291
11292
{ my %ta;
11293
$ta{tag} = "textarea";
11294
$ta{name} = "v";
11295
$ta{cols} = "30";
11296
$ta{rows} = "8";
11297
$ta{innerHTML} = "";
11298
11299
@bodies = Bc_sql::get_config("weights");
11300
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
11301
$ta{innerHTML} =~ s/</</g;
11302
$ta{innerHTML} =~ s/>/>/g;
11303
11304
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
11305
} # end textarea
11306
11307
{ my %button;
11308
$button{tag} = "button";
11309
$button{type} = "submit";
11310
$button{class} = "green";
11311
$button{innerHTML} = "Save";
11312
11313
$form{innerHTML} .= Html2::tag(\%button);
11314
} # end submit button
11315
11316
$div{innerHTML} .= Html2::tag(\%form);
11317
} # end form
11318
11319
$content .= Html2::tag(\%div);
11320
} # end weights div
11321
11322
# zodiacs
11323
{ my %div;
11324
$div{tag} = "div";
11325
$div{id} = "zodiac";
11326
if ($tab ne "zodiac") { $div{style} = "display: none;"; }
11327
$div{innerHTML} = "";
11328
11329
{ my %form;
11330
$form{tag} = "form";
11331
$form{action} = "/edit_config.pl";
11332
$form{method} = "post";
11333
$form{innerHTML} = "";
11334
11335
{ my %input;
11336
$input{tag} = "input";
11337
$input{type} = "hidden";
11338
$input{name} = "t";
11339
$input{value} = "zodiac";
11340
11341
$form{innerHTML} .= Html2::tag(\%input);
11342
} # end hidden "t" input
11343
11344
{ my %ta;
11345
$ta{tag} = "textarea";
11346
$ta{name} = "v";
11347
$ta{cols} = "30";
11348
$ta{rows} = "8";
11349
$ta{innerHTML} = "";
11350
11351
@bodies = Bc_sql::get_config("zodiacs");
11352
foreach my $body (@bodies) { $ta{innerHTML} .= $body; }
11353
$ta{innerHTML} =~ s/</</g;
11354
$ta{innerHTML} =~ s/>/>/g;
11355
11356
$form{innerHTML} .= Html2::tag(\%ta) . Html2::br();
11357
} # end textarea
11358
11359
{ my %button;
11360
$button{tag} = "button";
11361
$button{type} = "submit";
11362
$button{class} = "green";
11363
$button{innerHTML} = "Save";
11364
11365
$form{innerHTML} .= Html2::tag(\%button);
11366
} # end submit button
11367
11368
$div{innerHTML} .= Html2::tag(\%form);
11369
} # end form
11370
11371
$content .= Html2::tag(\%div);
11372
} # end zodiacs div
11373
11374
{ my %style;
11375
$style{tag} = "style";
11376
$style{innerHTML} = "\n" .
11377
".wordsgrid {\n" .
11378
" display: grid;\n" .
11379
" grid-template-areas: 'wordstitle' 'addword' 'wordslist';\n" .
11380
" grid-template-columns: 240px;\n" .
11381
" grid-template-rows: min-content min-content 1fr;\n" .
11382
" grid-gap: 10px;\n" .
11383
" max-height: 300px;\n" .
11384
"}\n" .
11385
"\n" .
11386
"\n";
11387
11388
$content .= Html2::tag(\%style);
11389
}
11390
11391
# bad names editor
11392
{ my %div;
11393
$div{tag} = "div";
11394
$div{id} = "badnames";
11395
if ($tab ne "badnames") { $div{style} = "display: none;"; }
11396
$div{class} = "wordsgrid";
11397
$div{innerHTML} = "";
11398
11399
{ my %title;
11400
$title{tag} = "div";
11401
$title{class} = "subnavbar block subtitle";
11402
$title{style} = "grid-area: 'wordstitle';";
11403
$title{innerHTML} = "Bad Words Editor";
11404
11405
$div{innerHTML} .= Html2::tag(\%title);
11406
}
11407
11408
{ my %form; # new bad name form
11409
$form{tag} = "form";
11410
$form{method} = "post";
11411
$form{class} = "normal-panel padded";
11412
$form{style} = "grid-area: 'addword';";
11413
$form{action} = "/addbadname.pl";
11414
$form{innerHTML} = "";
11415
11416
{ my %title;
11417
$title{tag} = "div";
11418
$title{class} = "subnavbar_dark block margins";
11419
$title{innerHTML} = "Add Bad Word";
11420
11421
$form{innerHTML} .= Html2::tag(\%title);
11422
}
11423
11424
{ my %newbad;
11425
$newbad{tag} = "input";
11426
$newbad{name} = "newbad";
11427
$newbad{placeholder} = "fuck";
11428
$newbad{required} = 1;
11429
$newbad{style} = "width: 123px;";
11430
11431
$form{innerHTML} .= Html2::tag(\%newbad);
11432
} # end newbad
11433
11434
{ my %button;
11435
$button{tag} = "button";
11436
$button{type} = "submit";
11437
$button{class} = "green";
11438
$button{title} = "Add Bad Word";
11439
$button{innerHTML} = "+";
11440
11441
$form{innerHTML} .= Html2::tag(\%button);
11442
} # end button
11443
11444
$div{innerHTML} .= Html2::tag(\%form);
11445
} # end new bad name form
11446
11447
# get a list of "bad names"
11448
my $listsql = "select * from badnames order by name";
11449
my $list = Bc_sql::sql_execute($listsql, "", 1); # always return an array ref
11450
if (@$list) {
11451
my %listdiv;
11452
$listdiv{tag} = "div";
11453
$listdiv{class} = "scrolling_vertical-auto sunken";
11454
$listdiv{style} = "grid-area: 'wordslist';";
11455
$listdiv{innerHTML} = "";
11456
11457
foreach my $name (@$list) {
11458
{ my %form; # update form
11459
$form{tag} = "form";
11460
$form{method} = "post";
11461
$form{action} = "/addbadname.pl";
11462
$form{class} = "hoverborder rounded";
11463
$form{innerHTML} = "";
11464
11465
{ my %input; # hidden input for ID
11466
$input{tag} = "input";
11467
$input{type} = "hidden";
11468
$input{name} = "ID";
11469
$input{value} = $name->{ID};
11470
11471
$form{innerHTML} .= Html2::tag(\%input);
11472
} # end hidden input
11473
11474
{ my %input;
11475
$input{tag} = "input";
11476
$input{type} = "text";
11477
$input{name} = "name";
11478
$input{required} = 1;
11479
$input{style} = "width: 123px;";
11480
$input{value} = $name->{name};
11481
11482
$form{innerHTML} .= Html2::tag(\%input);
11483
}
11484
11485
{ my %button; # update button
11486
$button{tag} = "button";
11487
$button{type} = "submit";
11488
$button{class} = "green";
11489
$button{title} = "Update Entry";
11490
$button{innerHTML} = $checkmark;
11491
11492
$form{innerHTML} .= Html2::tag(\%button);
11493
} # end delete button
11494
11495
{ my %button; # delete button
11496
$button{tag} = "button";
11497
$button{type} = "submit";
11498
$button{class} = "red";
11499
$button{onclick} = "console.log('delete bad name');";
11500
$button{name} = "d";
11501
$button{value} = "1";
11502
$button{title} = "Delete Entry";
11503
$button{innerHTML} = "x";
11504
11505
$form{innerHTML} .= Html2::tag(\%button);
11506
} # end delete button
11507
11508
$listdiv{innerHTML} .= Html2::tag(\%form);
11509
} # end update form
11510
} # end foreach
11511
11512
$div{innerHTML} .= Html2::tag(\%listdiv);
11513
} # end if (@$list)
11514
else {
11515
$div{innerHTML} .= "no bad words found!";
11516
} # end else of if (@$list)
11517
11518
$content .= Html2::tag(\%div);
11519
} # end bad words editor div
11520
11521
# moderator messages editor
11522
{ my %div;
11523
$div{tag} = "div";
11524
$div{id} = "modmsgs";
11525
if ($tab ne "modmsgs") { $div{style} = "display: none;"; }
11526
$div{innerHTML} = Html2::mod_messages_editor(get_param(Bc_sql::get_constant("QUERY_MSGID")));
11527
11528
$content .= Html2::tag(\%div);
11529
} # end moderator messages editor div
11530
11531
# location editor
11532
{ my %div;
11533
$div{tag} = "div";
11534
$div{id} = "location";
11535
if ($tab ne "location") { $div{style} = "display: none;"; }
11536
$div{innerHTML} = "";
11537
11538
{ my %editordiv;
11539
$editordiv{tag} = "div";
11540
$editordiv{class} = "locationeditorbody";
11541
$editordiv{innerHTML} = "";
11542
11543
{ my %editorcss;
11544
$editorcss{tag} = "style";
11545
$editorcss{innerHTML} = ".locationeditorbody {\n" .
11546
" display: grid;\n" .
11547
" grid-gap: 8px;\n" .
11548
" grid-template-areas: 'title title title' 'country cities editor';\n" .
11549
" grid-template-columns: min-content min-content min-content;\n" .
11550
" grid-template-rows: min-content min-content;\n" .
11551
"}\n" .
11552
"\n";
11553
11554
$editordiv{innerHTML} .= Html2::tag(\%editorcss);
11555
}
11556
11557
{ my %title;
11558
$title{tag} = "div";
11559
$title{style} = "grid-area: title;";
11560
$title{class} = "subnavbar subtitle";
11561
$title{innerHTML} = "Location Editor";
11562
11563
$editordiv{innerHTML} .= Html2::tag(\%title);
11564
}
11565
11566
{ my %country;
11567
$country{tag} = "div";
11568
$country{class} = "subnavbar flexboxed";
11569
$country{style} = "justify-content: center;";
11570
$country{innerHTML} = "";
11571
11572
{ my %js;
11573
$js{tag} = "script";
11574
$js{innerHTML} = "function countrychanged() {\n" .
11575
" let country = document.getElementById('labelpickcountry');\n" .
11576
" let city = document.getElementById('labelpickcity');\n" .
11577
" let cityinput = document.getElementById('addnewcityinput');\n" .
11578
" let citybutton = document.getElementById('addnewcitybutton');\n" .
11579
" let arrow = document.getElementById('arrow');\n" .
11580
" let cityinput_country = document.getElementById('addnewcityinput_country');\n" .
11581
" let countrydd = document.getElementById('countrydd');\n" .
11582
"\n" .
11583
" country.style.display = 'none';\n" .
11584
" city.style.display = 'flex';\n" .
11585
" cityinput.disabled = false;\n" .
11586
" citybutton.disabled = false;\n" .
11587
" citybutton.classList.add('green');\n" .
11588
"\n" .
11589
" if (arrow.style.display === 'none') {\n" .
11590
" let pane = document.getElementById('editpane');\n" .
11591
" arrow.style.display = 'inline';\n" .
11592
" pane.style.display = 'none';\n" .
11593
" }\n" .
11594
"\n" .
11595
" populate_with_cities('countrydd', 'citydd');\n" .
11596
" cityinput_country.value = countrydd.options[countrydd.selectedIndex].value;\n" .
11597
"\n" .
11598
"}\n" .
11599
"\n";
11600
11601
11602
$country{innerHTML} .= Html2::tag(\%js);
11603
}
11604
11605
my $onchange = "countrychanged();";
11606
$country{innerHTML} .= display_country_names_asDropdown(-2, "countrydd", "Country", $onchange, "", "", "", "size=2 style='height: 100px; min-width: 123px; max-width: 123px; width: 123px;' class='small'");
11607
11608
{ my %newform;
11609
$newform{tag} = "form";
11610
$newform{method} = "post";
11611
$newform{action} = "/addlocation.pl";
11612
$newform{class} = "nowrap padding-none margins-none";
11613
11614
{ my %input;
11615
$input{tag} = "input";
11616
$input{class} = "margins-none";
11617
$input{type} = "text";
11618
$input{name} = "newcountry";
11619
$input{size} = 8;
11620
$input{placeholder} = "Country Name";
11621
11622
$newform{innerHTML} .= Html2::tag(\%input);
11623
}
11624
11625
{ my %button;
11626
$button{tag} = "button";
11627
$button{type} = "submit";
11628
$button{class} = "green margins-none";
11629
$button{title} = "Add Country";
11630
$button{innerHTML} = "+";
11631
11632
$newform{innerHTML} .= Html2::tag(\%button);
11633
}
11634
11635
$country{innerHTML} .= Html2::tag(\%newform);
11636
}
11637
11638
$editordiv{innerHTML} .= Html2::tag(\%country);
11639
}
11640
11641
{ my %city;
11642
$city{tag} = "div";
11643
$city{class} = "subnavbar flexboxed";
11644
$city{style} = "justify-content: center;";
11645
$city{innerHTML} = "";
11646
11647
{ my %cityjs;
11648
$cityjs{tag} = "script";
11649
$cityjs{innerHTML} = "function citychanged() {\n" .
11650
" document.getElementById('labelpickcity').style.display = 'none';\n" .
11651
" document.getElementById('arrow').style.display = 'none';\n" .
11652
"\n" .
11653
" let c = document.getElementById('editpanediv');\n" .
11654
" let e = document.getElementById('editpane');\n" .
11655
" c.classList.remove('centered');\n" .
11656
" e.style.display = 'grid';\n" .
11657
"\n" .
11658
" let countryinput = document.getElementById('country_input');\n" .
11659
" let cityinput = document.getElementById('city_input');\n" .
11660
" let coordsinput = document.getElementById('coords_input');\n" .
11661
"\n" .
11662
" let countrydd = document.getElementById('countrydd');\n" .
11663
" let citydd = document.getElementById('citydd');\n" .
11664
"\n" .
11665
" countryinput.value = countrydd.options[countrydd.selectedIndex].innerHTML;\n" .
11666
" cityinput.value = citydd.options[citydd.selectedIndex].innerHTML;\n" .
11667
" coordsinput.value = citydd.options[citydd.selectedIndex].value;\n" .
11668
"\n" .
11669
" let d = document.getElementById('delbutton');\n" .
11670
" d.setAttribute(\"onclick\", \"document.location='/addlocation.pl?d=1&coords=\" + coordsinput.value + \"';\");\n" .
11671
" //console.log(d);\n" .
11672
"}\n" .
11673
"\n";
11674
11675
$city{innerHTML} .= Html2::tag(\%cityjs);
11676
}
11677
11678
my $onchange = "citychanged();";
11679
$city{innerHTML} .= display_city_names_asDropdown(0, 0, "citydd", "City", $onchange, "", "", "", "size=2 style='height: 100px; min-width: 123px; max-width: 123px; width: 123px;' class='small'");
11680
11681
{ my %newform;
11682
$newform{tag} = "form";
11683
$newform{method} = "post";
11684
$newform{action} = "/addlocation.pl";
11685
$newform{class} = "nowrap padding-none margins-none";
11686
11687
{ my %input;
11688
$input{tag} = "input";
11689
$input{class} = "margins-none";
11690
$input{type} = "hidden";
11691
$input{name} = "newcity_country";
11692
$input{id} = "addnewcityinput_country";
11693
11694
$newform{innerHTML} .= Html2::tag(\%input);
11695
}
11696
11697
{ my %input;
11698
$input{tag} = "input";
11699
$input{class} = "margins-none";
11700
$input{type} = "text";
11701
$input{name} = "newcity";
11702
$input{id} = "addnewcityinput";
11703
$input{disabled} = 1;
11704
$input{size} = 8;
11705
$input{placeholder} = "City Name";
11706
11707
$newform{innerHTML} .= Html2::tag(\%input);
11708
}
11709
11710
{ my %button;
11711
$button{tag} = "button";
11712
$button{type} = "submit";
11713
$button{class} = "margins-none";
11714
$button{title} = "Add City";
11715
$button{id} = "addnewcitybutton";
11716
$button{disabled} = 1;
11717
$button{innerHTML} = "+";
11718
11719
$newform{innerHTML} .= Html2::tag(\%button);
11720
}
11721
11722
$city{innerHTML} .= Html2::tag(\%newform);
11723
}
11724
11725
$editordiv{innerHTML} .= Html2::tag(\%city);
11726
}
11727
11728
{ my %editpanecontainer;
11729
$editpanecontainer{tag} = "div";
11730
$editpanecontainer{id} = "editpanediv";
11731
$editpanecontainer{class} = "subnavbar_dark";
11732
$editpanecontainer{style} = "display: flex; min-width: 190px; justify-content: center;";
11733
$editpanecontainer{innerHTML} = "";
11734
11735
{ my %centereddiv;
11736
$centereddiv{tag} = "div";
11737
$centereddiv{style} = "display: flex; align-items: center; width: 100%; justify-content: center;";
11738
11739
{ my %img;
11740
$img{tag} = "img";
11741
$img{id} = "arrow";
11742
$img{style} = "min-width: 32px; max-width: 32px; min-height: 32px; max-height: 32px; margin-right: 5px;";
11743
$img{src} = "/img.pl?i=site/prev.png&s=dpm";
11744
11745
$centereddiv{innerHTML} .= Html2::tag(\%img);
11746
} # end img
11747
11748
{ my %labelpickcountry;
11749
$labelpickcountry{tag} = "div";
11750
$labelpickcountry{style} = "display: flex;";
11751
$labelpickcountry{id} = "labelpickcountry";
11752
$labelpickcountry{innerHTML} = "Pick a Country";
11753
11754
$centereddiv{innerHTML} .= Html2::tag(\%labelpickcountry);
11755
} # end label pick country
11756
11757
{ my %labelpickcity;
11758
$labelpickcity{tag} = "div";
11759
$labelpickcity{id} = "labelpickcity";
11760
$labelpickcity{style} = "display: none;";
11761
$labelpickcity{innerHTML} = "Pick a City";
11762
11763
$centereddiv{innerHTML} .= Html2::tag(\%labelpickcity);
11764
} # end label pick city
11765
11766
{ my %editpane;
11767
$editpane{tag} = "form";
11768
$editpane{method} = "post";
11769
$editpane{action} = "/addlocation.pl";
11770
$editpane{class} = "editpanegrid";
11771
$editpane{id} = "editpane";
11772
$editpane{style} = "display: none; width: 100%; height: 100%;";
11773
$editpane{innerHTML} = "";
11774
11775
{ my %css;
11776
$css{tag} = "style";
11777
$css{innerHTML} = ".editpanegrid {\n" .
11778
" display: grid;\n" .
11779
" grid-template-areas: 'inputdiv' 'buttonsdiv';\n" .
11780
" grid-template-columns: 1fr;\n" .
11781
" grid-template-rows: 1fr min-content;\n" .
11782
"}\n" .
11783
"\n" .
11784
".inputsgrid {\n" .
11785
" display: grid;\n" .
11786
" grid-template-areas: 'countrylabel countryinput' 'citylabel cityinput' 'coordslabel coordsinput';\n" .
11787
" grid-template-columns: 1fr 1fr;\n" .
11788
" grid-template-rows: min-content min-content min-content;\n" .
11789
" align-content: center;\n" .
11790
"}\n" .
11791
"\n";
11792
11793
$editpane{innerHTML} .= Html2::tag(\%css);
11794
} # end css
11795
11796
# needed: labels, inputs, buttons
11797
# country, city, and coordinates inputs
11798
# save and delete buttons
11799
11800
{ my %inputsdiv;
11801
$inputsdiv{tag} = "div";
11802
$inputsdiv{class} = "inputsgrid";
11803
$inputsdiv{style} = "grid-area: inputdiv; display: grid;";
11804
$inputsdiv{innerHTML} = "";
11805
11806
my %countryinput; {
11807
$countryinput{tag} = "input";
11808
$countryinput{type} = "text";
11809
$countryinput{style} = "grid-area: countryinput; width: 80px;";
11810
$countryinput{name} = "country_input";
11811
$countryinput{id} = "country_input";
11812
11813
my %countrylabel; {
11814
$countrylabel{tag} = "font";
11815
$countrylabel{style} = "grid-area: countrylabel; text-align: right;";
11816
$countrylabel{innerHTML} = "Country";
11817
11818
$inputsdiv{innerHTML} .= Html2::tag(\%countrylabel);
11819
}
11820
11821
$inputsdiv{innerHTML} .= Html2::tag(\%countryinput);
11822
}
11823
11824
my %cityinput; {
11825
$cityinput{tag} = "input";
11826
$cityinput{type} = "text";
11827
$cityinput{style} = "grid-area: cityinput; width: 80px;";
11828
$cityinput{name} = "city_input";
11829
$cityinput{id} = "city_input";
11830
11831
my %citylabel; {
11832
$citylabel{tag} = "font";
11833
$citylabel{style} = "grid-area: citylabel; text-align: right;";
11834
$citylabel{innerHTML} = "City";
11835
11836
$inputsdiv{innerHTML} .= Html2::tag(\%citylabel);
11837
}
11838
11839
$inputsdiv{innerHTML} .= Html2::tag(\%cityinput);
11840
}
11841
11842
my %coordsinput; {
11843
$coordsinput{tag} = "input";
11844
$coordsinput{type} = "hidden";
11845
$coordsinput{style} = "grid-area: coordsinput; width: 80px;";
11846
$coordsinput{name} = "coords_input";
11847
$coordsinput{id} = "coords_input";
11848
11849
$inputsdiv{innerHTML} .= Html2::tag(\%coordsinput);
11850
}
11851
11852
$editpane{innerHTML} .= Html2::tag(\%inputsdiv);
11853
}
11854
11855
{ my %buttonsdiv;
11856
$buttonsdiv{tag} = "div";
11857
$buttonsdiv{style} = "grid-area: buttonsdiv; display: flex; justify-content: space-between;";
11858
$buttonsdiv{innerHTML} = "";
11859
11860
{ my %button;
11861
$button{tag} = "button";
11862
$button{type} = "submit";
11863
$button{class} = "green";
11864
$button{innerHTML} = $checkmark;
11865
$button{title} = "Update this location";
11866
11867
$buttonsdiv{innerHTML} .= Html2::tag(\%button);
11868
}
11869
11870
{ my %button;
11871
$button{tag} = "button";
11872
$button{type} = "button";
11873
$button{id} = "delbutton";
11874
$button{class} = "red";
11875
$button{innerHTML} = "x";
11876
$button{onclick} = "document.location='/addlocation.pl?d=1&loc=';";
11877
$button{title} = "Delete this location";
11878
11879
$buttonsdiv{innerHTML} .= Html2::tag(\%button);
11880
}
11881
11882
$editpane{innerHTML} .= Html2::tag(\%buttonsdiv);
11883
}
11884
11885
$centereddiv{innerHTML} .= Html2::tag(\%editpane);
11886
} # end edit pane
11887
11888
$editpanecontainer{innerHTML} .= Html2::tag(\%centereddiv);
11889
} # end container
11890
11891
$editordiv{innerHTML} .= Html2::tag(\%editpanecontainer);
11892
} # end edit pane container
11893
11894
$div{innerHTML} .= Html2::tag(\%editordiv);
11895
} # end editor div
11896
11897
$content .= Html2::tag(\%div);
11898
} # end location editor div
11899
11900
# security levels
11901
{ my %div;
11902
$div{tag} = "div";
11903
$div{id} = "sec";
11904
if ($tab ne "sec") { $div{style} = "display: none;"; }
11905
$div{innerHTML} = "";
11906
11907
{ my %style;
11908
$style{tag} = "style";
11909
$style{innerHTML} = "\n" .
11910
".newseclevel {\n" .
11911
" display: grid;\n" .
11912
" grid-template-areas: 'newtitle newtitle newtitle' " .
11913
"'newinputID newinputInternal newinputFriendly' " .
11914
"'newIDLabel newInternalLabel newFriendlyLabel' " .
11915
"'buttons buttons buttons';\n" .
11916
" grid-template-columns: 50px 123px 123px;\n" .
11917
" grid-template-rows: min-content min-content min-content min-content;\n" .
11918
"\n" .
11919
"\n" .
11920
"\n" .
11921
"}\n" .
11922
"\n" .
11923
"\n";
11924
11925
$div{innerHTML} .= Html2::tag(\%style);
11926
} # end css
11927
11928
{ my %form;
11929
$form{tag} = "form";
11930
$form{class} = "padded normal-panel newseclevel min-content";
11931
$form{method} = "post";
11932
$form{action} = "/edit_security.pl";
11933
$form{style} = "margin-bottom: 15px;";
11934
$form{innerHTML} = "";
11935
11936
{ my %title;
11937
$title{tag} = "div";
11938
$title{class} = "subtitle";
11939
$title{style} = "grid-area: newtitle; margin-bottom: 10px;";
11940
$title{innerHTML} = "Add New Security Level";
11941
11942
$form{innerHTML} = Html2::tag(\%title);
11943
}
11944
11945
{ my %input;
11946
$input{tag} = "input";
11947
$input{style} = "grid-area: newinputID;";
11948
$input{name} = "ID";
11949
$input{placeholder} = "123";
11950
$input{style} = "width: 50px;";
11951
$input{type} = "number";
11952
$input{required} = 1;
11953
11954
$form{innerHTML} .= Html2::tag(\%input);
11955
}
11956
11957
{ my %input;
11958
$input{tag} = "input";
11959
$input{style} = "grid-area: newinputInternal;";
11960
$input{name} = "value";
11961
$input{placeholder} = "internal name";
11962
$input{required} = 1;
11963
11964
$form{innerHTML} .= Html2::tag(\%input);
11965
}
11966
11967
{ my %input;
11968
$input{tag} = "input";
11969
$input{style} = "grid-area: newinputFriendly;";
11970
$input{name} = "friendly_name";
11971
$input{placeholder} = "Friendly Name";
11972
$input{required} = 1;
11973
11974
$form{innerHTML} .= Html2::tag(\%input);
11975
}
11976
11977
{ my %label;
11978
$label{tag} = "div";
11979
$label{class} = "small text-align-right";
11980
$label{style} = "grid-area: newIDLabel;";
11981
$label{innerHTML} = "unique";
11982
11983
$form{innerHTML} .= Html2::tag(\%label);
11984
}
11985
11986
{ my %label;
11987
$label{tag} = "div";
11988
$label{class} = "small text-align-right";
11989
$label{style} = "grid-area: newInternalLabel;";
11990
$label{innerHTML} = "unique";
11991
11992
$form{innerHTML} .= Html2::tag(\%label);
11993
}
11994
11995
{ my %label;
11996
$label{tag} = "div";
11997
$label{class} = "small text-align-right";
11998
$label{style} = "grid-area: newFriendlyLabel;";
11999
$label{innerHTML} = "anything";
12000
12001
$form{innerHTML} .= Html2::tag(\%label);
12002
}
12003
12004
{ my %buttons;
12005
$buttons{tag} = "div";
12006
$buttons{style} = "grid-area: buttons; margin-top: 5px;";
12007
$buttons{innerHTML} = "";
12008
12009
{ my %input;
12010
$input{tag} = "input";
12011
$input{type} = "hidden";
12012
$input{name} = "t";
12013
$input{value} = "sec";
12014
12015
$buttons{innerHTML} .= Html2::tag(\%input);
12016
}
12017
12018
{ my %button;
12019
$button{tag} = "button";
12020
$button{type} = "submit";
12021
$button{class} = "blue";
12022
$button{innerHTML} = "Add";
12023
12024
$buttons{innerHTML} .= Html2::tag(\%button);
12025
}
12026
12027
{ my %button;
12028
$button{tag} = "button";
12029
$button{type} = "reset";
12030
$button{class} = "yellow";
12031
$button{innerHTML} = "Clear";
12032
12033
$buttons{innerHTML} .= Html2::tag(\%button);
12034
}
12035
12036
$form{innerHTML} .= Html2::tag(\%buttons);
12037
}
12038
12039
$div{innerHTML} .= Html2::tag(\%form);
12040
} # end new sec level form
12041
12042
{ my %listdiv;
12043
$listdiv{tag} = "div";
12044
$listdiv{class} = "padded sunken scrolling_vertical-auto";
12045
$listdiv{style} = "max-height: 200px; height: min-content;";
12046
12047
my $securities = Bc_sql::get_security();
12048
foreach my $sec (@$securities) {
12049
my %form;
12050
$form{tag} = "form";
12051
$form{action} = "/edit_security.pl";
12052
$form{method} = "post";
12053
$form{class} = "seclevel translucent-faded";
12054
$form{innerHTML} = "";
12055
12056
{ my %input;
12057
$input{tag} = "input";
12058
$input{type} = "number";
12059
$input{name} = "ID";
12060
$input{value} = $sec->{ID};
12061
$input{style} = "width: 50px;";
12062
$input{required} = 1;
12063
12064
$form{innerHTML} .= Html2::tag(\%input);
12065
}
12066
12067
{ my %input;
12068
$input{tag} = "input";
12069
$input{type} = "text";
12070
$input{name} = "value";
12071
$input{value} = $sec->{value};
12072
$input{required} = 1;
12073
12074
$form{innerHTML} .= Html2::tag(\%input);
12075
}
12076
12077
{ my %input;
12078
$input{tag} = "input";
12079
$input{type} = "text";
12080
$input{name} = "friendly_name";
12081
$input{value} = $sec->{friendly_name};
12082
$input{required} = 1;
12083
12084
$form{innerHTML} .= Html2::tag(\%input);
12085
}
12086
12087
{ my %input;
12088
$input{tag} = "input";
12089
$input{type} = "hidden";
12090
$input{name} = "t";
12091
$input{value} = "sec";
12092
12093
$form{innerHTML} .= Html2::tag(\%input);
12094
}
12095
12096
{ my %button;
12097
$button{tag} = "button";
12098
$button{type} = "button";
12099
$button{class} = "red";
12100
$button{innerHTML} = "x";
12101
$button{onclick} = ""; # needs javascripting
12102
12103
$form{innerHTML} .= Html2::tag(\%button);
12104
}
12105
12106
{ my %button;
12107
$button{tag} = "button";
12108
$button{type} = "reset";
12109
$button{class} = "yellow";
12110
$button{innerHTML} = "Reset";
12111
12112
$form{innerHTML} .= Html2::tag(\%button);
12113
}
12114
12115
{ my %button;
12116
$button{tag} = "button";
12117
$button{type} = "submit";
12118
$button{class} = "green";
12119
$button{innerHTML} = "Save";
12120
12121
$form{innerHTML} .= Html2::tag(\%button);
12122
}
12123
12124
$listdiv{innerHTML} .= Html2::tag(\%form);
12125
}
12126
12127
$div{innerHTML} .= Html2::tag(\%listdiv);
12128
} # end list div
12129
12130
$content .= Html2::tag(\%div);
12131
} # end security levels div
12132
12133
$content .= "</td></tr></table>";
12134
$content .= "</td></tr></table>";
12135
12136
12137
} # end elsif ($page eq Bc_sql::get_constant("ADMIN_SYSTEM_PAGE") and User::isUserSuperAdmin($Bc_sql::LOGGEDIN))
12138
elsif ($page eq Bc_sql::get_constant("ADMIN_LOGS_PAGE") and User::isUserSuperAdmin($Bc_sql::LOGGEDIN)) {
12139
12140
12141
$title .= "Server Logs";
12142
$content .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
12143
12144
{ my %script;
12145
if (not $tab) { $tab = "err"; }
12146
$script{tag} = "script";
12147
$script{defer} = 1;
12148
$script{innerHTML} = "lastElementToggled = \"$tab\";";
12149
12150
$content .= Html2::tag(\%script);
12151
} # end script
12152
12153
{ my %link;
12154
$link{tag} = "a";
12155
$link{onclick} = "toggle_display_element('err', 'errlink');";
12156
$link{class} = "pointer";
12157
$link{id} = "errlink";
12158
$link{innerHTML} = "";
12159
12160
{ my %linkdiv;
12161
$linkdiv{tag} = "div";
12162
$linkdiv{class} = "navbutton_selected";
12163
$linkdiv{id} = "errdiv";
12164
$linkdiv{style} = "height: 100%; width: 100%;";
12165
$linkdiv{innerHTML} = "Errors";
12166
12167
$link{innerHTML} .= Html2::tag(\%linkdiv);
12168
}
12169
12170
$content .= Html2::tag(\%link);
12171
}
12172
$content .= "</td><td width=3></td><td>";
12173
{ my %link;
12174
$link{tag} = "a";
12175
$link{onclick} = "toggle_display_element('acc', 'acclink');";
12176
$link{class} = "pointer";
12177
$link{id} = "acclink";
12178
$link{innerHTML} = "";
12179
12180
{ my %linkdiv;
12181
$linkdiv{tag} = "div";
12182
$linkdiv{class} = "navbutton";
12183
$linkdiv{id} = "accdiv";
12184
$linkdiv{style} = "height: 100%; width: 100%;";
12185
$linkdiv{innerHTML} = "Access";
12186
12187
$link{innerHTML} .= Html2::tag(\%linkdiv);
12188
}
12189
12190
$content .= Html2::tag(\%link);
12191
}
12192
$content .= "</td><td width=3></td><td>";
12193
{ my %link;
12194
$link{tag} = "a";
12195
$link{onclick} = "toggle_display_element('oth', 'othlink');";
12196
$link{class} = "pointer";
12197
$link{id} = "othlink";
12198
$link{innerHTML} = "";
12199
12200
{ my %linkdiv;
12201
$linkdiv{tag} = "div";
12202
$linkdiv{class} = "navbutton";
12203
$linkdiv{id} = "othdiv";
12204
$linkdiv{style} = "height: 100%; width: 100%;";
12205
$linkdiv{innerHTML} = "Other(s)?";
12206
12207
$link{innerHTML} .= Html2::tag(\%linkdiv);
12208
}
12209
12210
$content .= Html2::tag(\%link);
12211
}
12212
$content .= "</td></tr></table>" . Html2::br();
12213
12214
$content .= "<table border=0 cellspacing=0 cellpadding=0 height=100%><tr><td align=center height=1 width=234 valign=top>";
12215
12216
{ my %errdiv;
12217
$errdiv{tag} = "div";
12218
$errdiv{id} = "err";
12219
$errdiv{class} = "scrolling_both-auto nowrap";
12220
$errdiv{style} = "height: 200px; max-width: 650px;";
12221
12222
my $log = `tail /var/log/apache2/error.log`;
12223
$log =~ s/\n/Html2::br()/eg;
12224
$errdiv{innerHTML} = $log;
12225
12226
$content .= Html2::tag(\%errdiv);
12227
}
12228
12229
{ my %accdiv;
12230
$accdiv{tag} = "div";
12231
$accdiv{id} = "acc";
12232
$accdiv{class} = "scrolling_both-auto nowrap";
12233
$accdiv{style} = "height: 200px; max-width: 650px; display: none;";
12234
12235
my $log = `tail /var/log/apache2/access.log`;
12236
$log =~ s/\n/Html2::br()/eg;
12237
$accdiv{innerHTML} = $log;
12238
12239
$content .= Html2::tag(\%accdiv);
12240
}
12241
12242
{ my %othdiv;
12243
$othdiv{tag} = "div";
12244
$othdiv{id} = "oth";
12245
$othdiv{style} = "display: none;";
12246
$othdiv{innerHTML} = "Other logs, maybe?";
12247
12248
$content .= Html2::tag(\%othdiv);
12249
}
12250
12251
$content .= "</td></tr></table>";
12252
12253
12254
} # end elsif ($page eq Bc_sql::get_constant("ADMIN_LOGS_PAGE") and User::isUserSuperAdmin($Bc_sql::LOGGEDIN))
12255
elsif ($page eq Bc_sql::get_constant("ADMIN_ACTIVITY_PAGE") and User::isUserSuperAdmin($Bc_sql::LOGGEDIN)) {
12256
12257
12258
my $divheight = "300px";
12259
$title .= "System Activity";
12260
$content .= "<table border=0 cellspacing=0 cellpadding=0 height=100%><tr><td align=center height=1 width=234>";
12261
{ my %font;
12262
$font{tag} = "font";
12263
$font{class} = "subnavbar subtitle";
12264
$font{innerHTML} = " Latest Ban Activity ";
12265
12266
$content .= Html2::tag(\%font);
12267
}
12268
$content .= "</td><td class=spacerx_large></td><td align=center height=1 width=234>";
12269
{ my %font;
12270
$font{tag} = "font";
12271
$font{class} = "subnavbar subtitle";
12272
$font{innerHTML} = " Latest System Changes ";
12273
12274
$content .= Html2::tag(\%font);
12275
}
12276
$content .= "</td><td class=spacerx_large></td><td align=center height=1 width=234>";
12277
{ my %font;
12278
$font{tag} = "font";
12279
$font{class} = "subnavbar subtitle";
12280
$font{innerHTML} = " User Edits ";
12281
12282
$content .= Html2::tag(\%font);
12283
}
12284
$content .= "</td></tr><tr><td class=spacery colspan=5>";
12285
$content .= "</td></tr><tr><td align=center valign=top>";
12286
12287
{ my %fs;
12288
$fs{tag} = "fieldset";
12289
$fs{style} = "height: 100%; width: 95%; text-align: left;";
12290
$fs{innerHTML} = "";
12291
12292
{ my %bansdiv;
12293
$bansdiv{tag} = "div";
12294
$bansdiv{class} = "scrolling_vertical-auto";
12295
$bansdiv{style} = "max-height: $divheight; min-height: $divheight; width: 100%;";
12296
$bansdiv{innerHTML} = "";
12297
12298
my $sql = "select * from bans";
12299
my $results = Bc_sql::sql_execute($sql, "display admin page");
12300
if ($results) {
12301
if (ref $results eq "HASH") {
12302
$bansdiv{innerHTML} .= "got one banned users" . Html2::br();
12303
$bansdiv{innerHTML} .= "$results->{ID}: $results->{BID} banned by $results->{ByID}. Reason $results->{why}" . Html2::br();
12304
} else {
12305
if (@$results) {
12306
$bansdiv{innerHTML} .= "found " . Html2::embolden(scalar @$results) . " banned users:" . Html2::br();
12307
foreach my $banned_ref (@$results) {
12308
$bansdiv{innerHTML} .= "$banned_ref->{ID}: $banned_ref->{BID} banned by $banned_ref->{ByID}. Reason $banned_ref->{why}" . Html2::br();
12309
}
12310
} else {
12311
$bansdiv{innerHTML} .= "<table border=0 cellpadding=0 cellspacing=0 style='height: $divheight' width=100%><tr><td align=center>";
12312
{ my %none;
12313
$none{tag} = "div";
12314
$none{class} = "yellow-panel";
12315
$none{innerHTML} = "No one has been banned!";
12316
12317
$bansdiv{innerHTML} .= Html2::tag(\%none);
12318
}
12319
$bansdiv{innerHTML} .= "</td></tr></table>";
12320
}
12321
}
12322
} else {
12323
{ my %none;
12324
$none{tag} = "div";
12325
$none{class} = "yellow-panel";
12326
$none{innerHTML} = "DB failure!";
12327
12328
$bansdiv{innerHTML} .= Html2::tag(\%none);
12329
}
12330
}
12331
12332
$fs{innerHTML} .= Html2::tag(\%bansdiv);
12333
} # end bans div
12334
12335
$content .= Html2::tag(\%fs);
12336
} # end fieldset
12337
12338
$content .= "</td><td class=spacerx_large></td><td align=center valign=top>";
12339
12340
{ my %fs;
12341
$fs{tag} = "fieldset";
12342
$fs{style} = "height: 100%; width: 95%; text-align: left;";
12343
$fs{innerHTML} = "";
12344
12345
{ my %innerdiv;
12346
$innerdiv{tag} = "div";
12347
$innerdiv{class} = "scrolling_vertical";
12348
$innerdiv{style} = "max-height: $divheight; min-height: $divheight; width: 100%;";
12349
$innerdiv{innerHTML} = "Who changed what " . Html2::italicize("system") . " setting(s), and when";
12350
12351
$fs{innerHTML} .= Html2::tag(\%innerdiv);
12352
}
12353
12354
$content .= Html2::tag(\%fs);
12355
}
12356
12357
$content .= "</td><td class=spacerx_large></td><td align=center valign=top>";
12358
12359
{ my %fs;
12360
$fs{tag} = "fieldset";
12361
$fs{style} = "height: 100%; width: 95%; text-align: left;";
12362
$fs{innerHTML} = "";
12363
12364
{ my %innerdiv;
12365
$innerdiv{tag} = "div";
12366
$innerdiv{class} = "scrolling_vertical";
12367
$innerdiv{innerHTML} = "Who edited what user data, and when?";
12368
$innerdiv{style} = "max-height: $divheight; min-height: $divheight; width: 100%;";
12369
12370
$fs{innerHTML} .= Html2::tag(\%innerdiv);
12371
}
12372
12373
$content .= Html2::tag(\%fs);
12374
}
12375
$content .= "</td></tr><tr><td class=spacery_large colspan=5>";
12376
$content .= "</td></tr><tr><td colspan=5 height=1>" . Html2::hr();
12377
$content .= "</td></tr><tr><td class=spacery_large colspan=5>";
12378
$content .= "</td></tr><tr><td align=center height=1 width=234>";
12379
{ my %font;
12380
$font{tag} = "font";
12381
$font{class} = "subnavbar subtitle";
12382
$font{innerHTML} = " Failed Payments ";
12383
12384
$content .= Html2::tag(\%font);
12385
}
12386
$content .= "</td><td class=spacerx_large></td><td align=center height=1 width=234>";
12387
{ my %font;
12388
$font{tag} = "font";
12389
$font{class} = "subnavbar subtitle";
12390
$font{innerHTML} = " Flagging Activity ";
12391
12392
$content .= Html2::tag(\%font);
12393
}
12394
$content .= "</td><td class=spacerx_large></td><td align=center height=1 width=234>";
12395
{ my %font;
12396
$font{tag} = "font";
12397
$font{class} = "subnavbar subtitle";
12398
$font{innerHTML} = " Page Visitors ";
12399
12400
$content .= Html2::tag(\%font);
12401
}
12402
12403
$content .= "</td></tr><tr><td class=spacery colspan=5>";
12404
$content .= "</td></tr><tr><td align=center>";
12405
12406
{ my %fs;
12407
$fs{tag} = "fieldset";
12408
$fs{style} = "height: 100%; width: 95%;";
12409
$fs{innerHTML} = "";
12410
12411
{ my %ppdiv; # PAYPAL
12412
$ppdiv{tag} = "div";
12413
$ppdiv{class} = "scrolling_vertical";
12414
$ppdiv{style} = "max-height: $divheight; min-height: $divheight; width: 100%;";
12415
$ppdiv{innerHTML} = "";
12416
12417
my $ptype = Bc_misc::get_param("ptype");
12418
if (!$ptype) {
12419
my $paypalsql = "select * from paypal";
12420
my $ppresults = Bc_sql::sql_execute($paypalsql, "", 1); # always returns an array
12421
my $count = 0;
12422
foreach my $result (@$ppresults) {
12423
if ($result->{ipn_data} =~ /payment_status=/) {
12424
my $status = $result->{ipn_data};
12425
$status =~ s/.*payment_status=//;
12426
$status =~ s/\&.*//;
12427
if ($status != "Completed") {
12428
$count++;
12429
}
12430
} else {
12431
$count++;
12432
}
12433
}
12434
12435
if ($count) {
12436
$ppdiv{innerHTML} .= "Found " . Html2::embolden($count) . Bc_misc::pluralize(" transaction", $count) . Html2::br();
12437
{ my %link;
12438
$link{tag} = "a";
12439
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}&ptype=all";
12440
$link{innerHTML} = "Show All";
12441
12442
$ppdiv{innerHTML} .= Html2::tag(\%link);
12443
}
12444
$ppdiv{innerHTML} .= Html2::hr();
12445
} else {
12446
$ppdiv{innerHTML} .= "<table border=0 cellpadding=0 cellspacing=0 style='height: $divheight' width=100%><tr><td align=center>";
12447
$ppdiv{innerHTML} .= Html2::embolden({class=>"yellow-panel", innerHTML=>"no failed transactions!"}) . Html2::br();
12448
{ my %link;
12449
$link{tag} = "a";
12450
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}&ptype=all";
12451
$link{innerHTML} = "Show All";
12452
12453
$ppdiv{innerHTML} .= Html2::tag(\%link);
12454
}
12455
$ppdiv{innerHTML} .= "</td></tr></table>";
12456
}
12457
12458
foreach my $result (@$ppresults) {
12459
if ($result->{ipn_data} =~ /payment_status=/) {
12460
my $status = $result->{ipn_data};
12461
$status =~ s/.*payment_status=//;
12462
$status =~ s/\&.*//;
12463
if ($status != "Completed") { $ppdiv{innerHTML} .= "$status" . Html2::br(); }
12464
} else {
12465
$ppdiv{innerHTML} .= Html2::embolden({title=>Date::expand_date($result->{doc}), innerHTML=>$result->{txn_id}}) . " has no payment status!" . Html2::br();
12466
}
12467
}
12468
} else {
12469
my $paypalsql = "select * from paypal";
12470
my $ppresults = Bc_sql::sql_execute($paypalsql, "", 1); # always returns an array
12471
if (@$ppresults) {
12472
$ppdiv{innerHTML} .= "showing " . (scalar @$ppresults) . " " . Bc_misc::pluralize("transaction", @$ppresults) . Html2::br();
12473
{ my %link;
12474
$link{tag} = "a";
12475
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}";
12476
$link{innerHTML} = "Show Failed";
12477
12478
$ppdiv{innerHTML} .= Html2::tag(\%link);
12479
}
12480
$ppdiv{innerHTML} .= Html2::hr();
12481
foreach my $result (@$ppresults) {
12482
$ppdiv{innerHTML} .= "$result->{txn_id}:$result->{ipn_data}:$result->{doc}:$result->{uid}";
12483
}
12484
} else {
12485
$ppdiv{innerHTML} .= "<table border=0 cellpadding=0 cellspacing=0 style='height: $divheight' width=100%><tr><td align=center>";
12486
$ppdiv{innerHTML} .= Html2::embolden({class=>"yellow-panel", innerHTML=>"No Transactions!"}) . Html2::br();
12487
{ my %link;
12488
$link{tag} = "a";
12489
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}";
12490
$link{innerHTML} = "Show Failed";
12491
12492
$ppdiv{innerHTML} .= Html2::tag(\%link);
12493
}
12494
$ppdiv{innerHTML} .= "</td></tr></table>";
12495
}
12496
}
12497
12498
$fs{innerHTML} .= Html2::tag(\%ppdiv);
12499
} # end PAYPAL div
12500
12501
$content .= Html2::tag(\%fs);
12502
} # end fieldset
12503
12504
$content .= "</td><td class=spacerx_large></td><td align=center valign=top>";
12505
12506
{ my %fs; # FLAGGED STUFF
12507
$fs{tag} = "fieldset";
12508
$fs{style} = "height: 100%; width: 95%; text-align: left;";
12509
$fs{innerHTML} = "";
12510
12511
{ my %flagdiv;
12512
$flagdiv{tag} = "div";
12513
$flagdiv{class} = "scrolling_vertical center";
12514
$flagdiv{style} = "max-height: $divheight; min-height: $divheight; width: 100%;";
12515
$flagdiv{innerHTML} = "";
12516
12517
my $sql = "select * from flagged where not status='trashed'";
12518
my $results = Bc_sql::sql_execute($sql, "display admin page", 1);
12519
if ($results) {
12520
if (ref $results eq "ARRAY") {
12521
if (@$results) {
12522
$flagdiv{innerHTML} .= Html2::tag({tag=>"div",
12523
innerHTML=>"Found " .
12524
Html2::embolden(scalar @$results) .
12525
" flagged " . Bc_misc::pluralize("item", @$results),
12526
class=>"yellow-panel sticky",
12527
style=>"margin-bottom: 5px;"
12528
}) . Html2::hr();
12529
12530
{ my %flaglist;
12531
$flaglist{tag} = "fieldset";
12532
$flaglist{class} = "bordered text-align-left red-panel";
12533
$flaglist{innerHTML} = "";
12534
12535
my $first = 1;
12536
foreach my $flagged_ref (@$results) {
12537
if ($first)
12538
{ $first = 0; } else
12539
{ $flaglist{innerHTML} .= Html2::hr(); }
12540
12541
my $flaggedNN = Html2::profile_link($flagged_ref->{UID});
12542
my $flaggerNN = Html2::profile_link($flagged_ref->{flagger_ID});
12543
12544
{ my %legend;
12545
$legend{tag} = "legend";
12546
$legend{class} = "yellow-panel nobgimg";
12547
$legend{innerHTML} = "Flag ID: " . Html2::embolden($flagged_ref->{ID});
12548
12549
$flaglist{innerHTML} .= Html2::tag(\%legend);
12550
}
12551
12552
if ($flagged_ref->{type} eq "i") { $flaglist{innerHTML} .= Html2::embolden("image"); }
12553
elsif ($flagged_ref->{type} eq "n") { $flaglist{innerHTML} .= Html2::embolden("nickname"); }
12554
elsif ($flagged_ref->{type} eq "d") { $flaglist{innerHTML} .= Html2::embolden("description"); }
12555
elsif ($flagged_ref->{type} eq "m") {
12556
my %link;
12557
$link{tag} = "a";
12558
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" .
12559
Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE") . "&" .
12560
Bc_sql::get_constant("QUERY_MSGID") . "=" . $flagged_ref->{content_ID};
12561
$link{innerHTML} = "message";
12562
12563
$flaglist{innerHTML} .= " " . Html2::tag(\%link) . " from " . $flaggedNN;
12564
}
12565
else { $flaglist{innerHTML} .= Html2::embolden("(unknown)"); }
12566
12567
$flaglist{innerHTML} .= " flagged by $flaggerNN";
12568
}
12569
12570
$flagdiv{innerHTML} .= Html2::tag(\%flaglist);
12571
}
12572
12573
} else {
12574
12575
$flagdiv{innerHTML} .= "<table border=0 cellpadding=0 cellspacing=0 style='height: $divheight' width=100%><tr><td align=center>";
12576
$flagdiv{innerHTML} .= Html2::embolden({class=>"yellow-panel", innerHTML=>"nothing has been flagged"}) . Html2::br();
12577
{ my %link;
12578
$link{tag} = "a";
12579
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}&ftype=all";
12580
$link{innerHTML} = "Show All";
12581
12582
$flagdiv{innerHTML} .= Html2::tag(\%link);
12583
}
12584
$flagdiv{innerHTML} .= "</td></tr></table>";
12585
}
12586
12587
}
12588
} else {
12589
$flagdiv{innerHTML} .= "nada outta da db??";
12590
}
12591
12592
$fs{innerHTML} .= Html2::tag(\%flagdiv);
12593
} # end flagged stuff div
12594
12595
$content .= Html2::tag(\%fs);
12596
} # end flagged stuff fieldset
12597
12598
$content .= "</td><td class=spacerx_large></td><td align=center valign=top style='height: 240px; min-height: 240px;'>";
12599
12600
{ my %fs; # page visits fieldset
12601
$fs{tag} = "fieldset";
12602
$fs{style} = "height: 100%; width: 95%; text-align: left;";
12603
$fs{innerHTML} = "";
12604
12605
{ my %pagevisits;
12606
$pagevisits{tag} = "div";
12607
$pagevisits{id} = "pagevisits";
12608
$pagevisits{class} = "scrolling_vertical center";
12609
$pagevisits{style} = "max-height: $divheight; min-height: $divheight; width: 100%;";
12610
$pagevisits{innerHTML} = "";
12611
12612
my %copyjs; {
12613
$copyjs{tag} = "script";
12614
$copyjs{innerHTML} = "\nfunction copy(eid) {\n" .
12615
" let e = document.getElementById(eid);\n" .
12616
"\n" .
12617
" if (e) {\n" .
12618
" if (e.setSelectionRange) e.setSelectionRange(0, 99999);\n" .
12619
" e.select();\n" .
12620
" document.execCommand('copy');\n" .
12621
" //console.log('copied: ' + e.value);\n" .
12622
" } else {\n" .
12623
" //console.log('no such eid: ' + eid);\n" .
12624
" }\n" .
12625
"}\n" .
12626
"\n" .
12627
"let lastVisitDiv = 'homepagevisitsdiv'; \n" .
12628
"function showVisitDiv(eid) {\n" .
12629
" let e = document.getElementById(eid);\n" .
12630
" let laste = document.getElementById(lastVisitDiv);\n" .
12631
"\n" .
12632
" if (e) {\n" .
12633
" if (e.style.display === 'none') {\n" .
12634
" if (lastVisitDiv) { laste.style.display = 'none'; }\n" .
12635
" e.style.display = 'inline';\n" .
12636
" lastVisitDiv = eid;\n" .
12637
" } else {\n" .
12638
" console.log(eid + ' is not hidden');\n" .
12639
" }\n" .
12640
" } else {\n" .
12641
" console.log('no such eid: ' + eid);\n" .
12642
" }\n" .
12643
"}\n" .
12644
"\n";
12645
$pagevisits{innerHTML} .= Html2::tag(\%copyjs);
12646
} # end javascript
12647
12648
# home page visit counts
12649
my $vtype = Bc_misc::get_param("vtype");
12650
my $vcSql = "select count(*) as count from visits";
12651
my $vcResult = Bc_sql::sql_execute($vcSql, "Html::display_admin_page::count unique visitors");
12652
my $vSql = "select * from visits where last_visit_date=" . $Bc_sql::DB->quote(Date::get_today("db"));
12653
if ($vtype eq "all") { $vSql = "select * from visits"; }
12654
my $vResults = Bc_sql::sql_execute($vSql, "Html::display_admin_page::list of visitors", 1);
12655
12656
# signup page visit counts
12657
my $svtype = Bc_misc::get_param("stype");
12658
my $svcSql = "select count(*) as count from create_visits";
12659
my $svcResult = Bc_sql::sql_execute($svcSql, "Html::display_admin_page::count unique signup visitors");
12660
my $svSql = "select * from create_visits where last_visit_date=" . $Bc_sql::DB->quote(Date::get_today("db"));
12661
if ($svtype eq "all") { $svSql = "select * from create_visits"; }
12662
my $svResults = Bc_sql::sql_execute($svSql, "Html::display_admin_page::list of signup visitors", 1);
12663
12664
# other page visit counts
12665
my $ovtype = Bc_misc::get_param("otype");
12666
my $ovcSql = "select count(*) as count from page_visits";
12667
my $ovcResult = Bc_sql::sql_execute($ovcSql, "Html::display_admin_page::count unique page visitors");
12668
my $ovSql = "select * from page_visits where last_visit_date=" . $Bc_sql::DB->quote(Date::get_today("db"));
12669
if ($ovtype eq "all") { $ovSql = "select * from page_visits"; }
12670
my $ovResults = Bc_sql::sql_execute($ovSql, "Html::display_admin_page::list of page visitors", 1);
12671
12672
{ my %nav;
12673
$nav{tag} = "div";
12674
$nav{class} = "center sticky nowrap";
12675
$nav{innerHTML} = "";
12676
12677
{ my %home;
12678
$home{tag} = "button";
12679
$home{type} = "button";
12680
$home{class} = "green nowrap";
12681
$home{onclick} = "showVisitDiv('homepagevisitsdiv');";
12682
$home{innerHTML} = "Home" . Html2::br();
12683
if (@$vResults)
12684
{ $home{innerHTML} .= Html2::italicize(scalar @$vResults); } else
12685
{ $home{innerHTML} .= "0"; }
12686
$home{innerHTML} .= " / ";
12687
if ($vcResult->{count})
12688
{ $home{innerHTML} .= Html2::italicize($vcResult->{count}); } else
12689
{ $home{innerHTML} .= "0"; }
12690
12691
$nav{innerHTML} .= Html2::tag(\%home);
12692
}
12693
12694
{ my %sign;
12695
$sign{tag} = "button";
12696
$sign{type} = "button";
12697
$sign{class} = "blue nowrap";
12698
$sign{onclick} = "showVisitDiv('signuppagevisitsdiv');";
12699
$sign{innerHTML} = "Sign Up" . Html2::br();
12700
if (@$svResults) { $sign{innerHTML} .= Html2::italicize(scalar @$svResults); } else { $sign{innerHTML} .= "0"; }
12701
$sign{innerHTML} .= " / ";
12702
if ($svcResult->{count})
12703
{ $sign{innerHTML} .= Html2::italicize($svcResult->{count}); } else
12704
{ $sign{innerHTML} .= "0"; }
12705
12706
$nav{innerHTML} .= Html2::tag(\%sign);
12707
}
12708
12709
{ my %other;
12710
$other{tag} = "button";
12711
$other{type} = "button";
12712
$other{class} = "yellow nowrap";
12713
$other{onclick} = "showVisitDiv('otherpagevisitsdiv');";
12714
$other{innerHTML} = "Other" . Html2::br();
12715
12716
my $ovc = 0;
12717
foreach my $visitor (@$ovResults)
12718
{ if ($visitor->{URL} =~ /\/create_account\.pl/) { $ovc++; } }
12719
12720
if ($ovc) { $other{innerHTML} .= Html2::italicize({class=>"green-panel embolden", innerHTML=>$ovc}); } else { $other{innerHTML} .= Html2::italicize({class=>"red-panel", innerHTML=>"x"}); }
12721
$other{innerHTML} .= " / ";
12722
if (@$ovResults) { $other{innerHTML} .= Html2::italicize(scalar @$ovResults); } else { $other{innerHTML} .= "0"; }
12723
$other{innerHTML} .= " / ";
12724
if ($ovcResult->{count})
12725
{ $other{innerHTML} .= Html2::italicize($ovcResult->{count}); } else
12726
{ $other{innerHTML} .= "0"; }
12727
12728
$nav{innerHTML} .= Html2::tag(\%other);
12729
}
12730
12731
$pagevisits{innerHTML} .= Html2::tag(\%nav) . Html2::hr();
12732
} # end nav
12733
12734
{ # home page visits
12735
if (ref $vResults eq "ARRAY") {
12736
if (@$vResults) {
12737
{ my %div;
12738
$div{tag} = "div";
12739
$div{style} = "display: block;";
12740
$div{class} = "center";
12741
$div{id} = "homepagevisitsdiv";
12742
$div{innerHTML} = "";
12743
12744
{ my %js;
12745
$js{tag} = "script";
12746
# when a user clicks the ? icon, a floating panel
12747
# ought to appear, containing the IP's geolocation
12748
# or an error msg if geolocation fails somehow
12749
$js{innerHTML} = "function imageclicked(ip) {\n" .
12750
" let url = \"/geo.pl?" . Bc_sql::get_constant("QUERY_IP") . "=\" + ip;\n" .
12751
" hrequest(url).then(function(data) {\n" .
12752
" alert(data);\n" .
12753
" });\n" .
12754
"}\n";
12755
$div{innerHTML} .= Html2::tag(\%js);
12756
}
12757
12758
{ my %hpdiv;
12759
$hpdiv{tag} = "div";
12760
$hpdiv{class} = "subnavbar_dark padded copyright";
12761
$hpdiv{style} = "margin-bottom: 8px;";
12762
$hpdiv{innerHTML} = "Home Page Visits" . Html2::hr() .
12763
"Found " . Html2::tag({tag=>"div", class=>"inline-block margins-left-right-small padded-left-right-small small yellow-panel", innerHTML=>Html2::embolden($vcResult->{count})}) .
12764
" unique " . Bc_misc::pluralize("visitor", $vcResult->{count}) . Html2::br() .
12765
"since " . Date::expand_date("2020-08-04");
12766
12767
$div{innerHTML} .= Html2::tag(\%hpdiv) . Html2::br();
12768
} # end homepage visits div
12769
if (!$vtype) {
12770
$div{innerHTML} .= "We have had " . Html2::embolden(scalar @$vResults) . " " . Html2::italicize("unique") . " " . Bc_misc::pluralize("visitor", @$vResults) . " today!" . Html2::br();
12771
{ my %link;
12772
$link{tag} = "a";
12773
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}&vtype=all";
12774
$link{innerHTML} = "Show All";
12775
12776
$div{innerHTML} .= Html2::tag(\%link);
12777
}
12778
} else {
12779
$div{innerHTML} .= "Showing all visitors" . Html2::br();
12780
{ my %link;
12781
$link{tag} = "a";
12782
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}";
12783
$link{innerHTML} = "Show Today's";
12784
12785
$div{innerHTML} .= Html2::tag(\%link);
12786
}
12787
}
12788
12789
$div{innerHTML} .= Html2::br() . Html2::br();
12790
12791
{ my %listdiv;
12792
$listdiv{tag} = "div";
12793
$listdiv{class} = "text-align-left";
12794
12795
foreach my $visitor (@$vResults) {
12796
my $randomID = Bc_misc::new_id();
12797
if ($vtype eq "all") {
12798
$listdiv{innerHTML} .= Html2::tag({tag=>"font", title=>$visitor->{last_visit_date}, innerHTML=>$visitor->{IP}}) .
12799
" (x$visitor->{count})";
12800
} else {
12801
$listdiv{innerHTML} .= "$visitor->{IP} (x$visitor->{count})";
12802
}
12803
12804
$listdiv{innerHTML} .= " ";
12805
12806
{ my %img; # Geolocation of IP
12807
$img{tag} = "img";
12808
$img{class} = "enlarge clickable";
12809
$img{src} = "/img.pl?i=site/help.png&s=s";
12810
$img{onclick} = "imageclicked(\"$visitor->{IP}\");";
12811
$img{title} = "Click to see where this IP hails from";
12812
12813
$listdiv{innerHTML} .= Html2::tag(\%img);
12814
}
12815
12816
$listdiv{innerHTML} .= " ";
12817
12818
{ my %img; # copy IP text
12819
$img{tag} = "img";
12820
$img{class} = "enlarge clickable";
12821
$img{src} = "/img.pl?i=site/admin/copy.png&s=s";
12822
$img{onclick} = "copy('IP_$randomID');";
12823
$img{title} = "Copy IP to Clipboard";
12824
12825
$listdiv{innerHTML} .= Html2::tag(\%img);
12826
}
12827
12828
{ my %input;
12829
$input{tag} = "input";
12830
$input{type} = "text";
12831
$input{style} = "width: 20px; position: relative; z-index: -500; background: transparent; color: transparent; border: none;";
12832
$input{value} = $visitor->{IP};
12833
$input{id} = "IP_" . $randomID;
12834
12835
$listdiv{innerHTML} .= Html2::tag(\%input) . Html2::br();
12836
}
12837
} # end foreach visit
12838
12839
$div{innerHTML} .= Html2::tag(\%listdiv);
12840
} # end list div
12841
12842
$pagevisits{innerHTML} .= Html2::tag(\%div);
12843
} # end div
12844
} # end if (@$vResults)
12845
else {
12846
$pagevisits{innerHTML} .= "<table id='homepagevisitsdiv' border=0 cellpadding=0 cellspacing=0 height=100% width=100%><tr><td align=center>";
12847
$pagevisits{innerHTML} .= Html2::embolden({class=>"notice", innerHTML=>"no visitors today!"}) . Html2::br();
12848
if (not $vtype) {
12849
my %link;
12850
$link{tag} = "a";
12851
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}&vtype=all";
12852
$link{innerHTML} = "Show All";
12853
12854
$pagevisits{innerHTML} .= Html2::tag(\%link);
12855
} # end if (not $vtype)
12856
else {
12857
my %link;
12858
$link{tag} = "a";
12859
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}";
12860
$link{innerHTML} = "Show Today's";
12861
12862
$pagevisits{innerHTML} .= Html2::tag(\%link);
12863
} # end else of if (not $vtype)
12864
$pagevisits{innerHTML} .= "</td></tr></table>";
12865
} # end if (@$vResults)
12866
} # end if (ref $vResults eq "ARRAY")
12867
else {
12868
$pagevisits{innerHTML} .= Html2::embolden({id=>"homepagevisitsdiv", innerHTML=>"not an array reference!?"});
12869
} # end else of if (ref $vResults eq "ARRAY")
12870
} # END home page visits
12871
12872
{ # signup page visits
12873
if (ref $svResults eq "ARRAY") {
12874
if (@$svResults) {
12875
{ my %div;
12876
$div{tag} = "div";
12877
$div{style} = "display: none;";
12878
$div{id} = "signuppagevisitsdiv";
12879
12880
{ my %count;
12881
$count{tag} = "div";
12882
$count{class} = "subnavbar_dark padded copyright";
12883
$count{innerHTML} = "Sign-Up Page Visits" . Html2::hr() .
12884
"Found " . Html2::tag({tag=>"div", class=>"inline-block margins-left-right-small padded-left-right-small small yellow-panel", innerHTML=>Html2::embolden($svcResult->{count})}) .
12885
" unique " . Bc_misc::pluralize("visitor", $svcResult->{count}) . Html2::br() .
12886
"since " . Date::expand_date("2020-08-04");
12887
12888
$div{innerHTML} .= Html2::tag(\%count) . Html2::hr();
12889
}
12890
12891
if (not $svtype) {
12892
$div{innerHTML} .= "We have had " . Html2::embolden(scalar @$svResults) . " " . Html2::italicize("unique") . " " . Bc_misc::pluralize("visitor", @$svResults) . " today!" . Html2::br();
12893
{ my %link;
12894
$link{tag} = "a";
12895
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}&stype=all";
12896
$link{innerHTML} = "Show All";
12897
12898
$div{innerHTML} .= Html2::tag(\%link);
12899
}
12900
} # end if (not $svtype)
12901
else {
12902
$div{innerHTML} .= "Showing all visitors" . Html2::br();
12903
{ my %link;
12904
$link{tag} = "a";
12905
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}";
12906
$link{innerHTML} = "Show Today's";
12907
12908
$div{innerHTML} .= Html2::tag(\%link);
12909
}
12910
} # end else of if (not $svtype)
12911
12912
$div{innerHTML} .= Html2::hr();
12913
12914
foreach my $visitor (@$svResults) {
12915
if ($svtype eq "all") {
12916
$div{innerHTML} .= Html2::tag({tag=>"font", title=>$visitor->{last_visit_date}, innerHTML=>"$visitor->{IP}"});
12917
} else {
12918
$div{innerHTML} .= $visitor->{IP};
12919
}
12920
$div{innerHTML} .= " (x$visitor->{count}) ";
12921
12922
{ my %img;
12923
$img{tag} = "img";
12924
$img{class} = "enlarge clickable";
12925
$img{src} = "/img.pl?i=site/help.png&s=s";
12926
$img{onclick} = "imageclicked('$visitor->{IP}');";
12927
$img{title} = "Click to see where this IP hails from";
12928
12929
$div{innerHTML} .= Html2::tag(\%img);
12930
}
12931
12932
$div{innerHTML} .= Html2::br();
12933
} # end foreach $visitor
12934
12935
$pagevisits{innerHTML} .= Html2::tag(\%div);
12936
} # end div
12937
} # end if (@$svResults)
12938
else {
12939
{ my %signupcontainer;
12940
$signupcontainer{tag} = "div";
12941
$signupcontainer{style} = "display: none; width: 200px;";
12942
$signupcontainer{id} = "signuppagevisitsdiv";
12943
$signupcontainer{class} = "center";
12944
$signupcontainer{innerHTML} = "";
12945
12946
{ my %signupcontent;
12947
$signupcontent{tag} = "div";
12948
$signupcontent{class} = "centered center";
12949
$signupcontent{innerHTML} = Html2::tag({tag=>"div", class=>"yellow-panel", innerHTML=>"no sign-up page visitors today!"});
12950
12951
{ my %linkdiv;
12952
$linkdiv{tag} = "div";
12953
12954
{ my %link;
12955
$link{tag} = "a";
12956
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}";
12957
if (not $svtype) {
12958
$link{href} .= "&stype=all";
12959
$link{innerHTML} = "Show All";
12960
} else {
12961
$link{innerHTML} = "Show Today's";
12962
}
12963
12964
$linkdiv{innerHTML} .= Html2::tag(\%link);
12965
} # end link
12966
12967
$signupcontent{innerHTML} .= Html2::tag(\%linkdiv);
12968
} # end link div
12969
12970
$signupcontainer{innerHTML} .= Html2::tag(\%signupcontent);
12971
} # end other content
12972
12973
$pagevisits{innerHTML} .= Html2::tag(\%signupcontainer);
12974
} # end other container
12975
} # end else of if (@$svResults)
12976
} # end if (ref $svResults eq "ARRAY")
12977
else {
12978
my %b;
12979
$b{tag} = "b";
12980
$b{style} = "display: none;";
12981
$b{id} = "signuppagevisitsdiv";
12982
$b{innerHTML} = "Not an Array Reference!?";
12983
12984
$pagevisits{innerHTML} .= Html2::tag(\%b);
12985
} # end else of if (ref $svResults eq "ARRAY")
12986
} # END signup page visits
12987
12988
{ # other page visits
12989
if (ref $ovResults eq "ARRAY") {
12990
if (@$ovResults) {
12991
{ my %div;
12992
$div{tag} = "div";
12993
$div{style} = "display: none;";
12994
$div{id} = "otherpagevisitsdiv";
12995
$div{innerHTML} = "";
12996
12997
{ my %visits;
12998
$visits{tag} = "div";
12999
$visits{class} = "subnavbar_dark padded copyright";
13000
$visits{innerHTML} = "Other Page Visits" . Html2::hr() .
13001
"Found " . Html2::tag({tag=>"div", class=>"inline-block margins-left-right-small padded-left-right-small small yellow-panel", innerHTML=>Html2::embolden($ovcResult->{count})}) .
13002
" unique " . Bc_misc::pluralize("visitor", $ovcResult->{count}) . Html2::br() .
13003
"since " . Date::expand_date("2020-08-04");
13004
$div{innerHTML} .= Html2::tag(\%visits);
13005
}
13006
13007
$div{innerHTML} .= Html2::br();
13008
13009
if (!$ovtype) {
13010
$div{innerHTML} .= "We have had " .
13011
Html2::embolden(scalar @$ovResults) . " " . Html2::italicize("unique") . " " .
13012
Bc_misc::pluralize("visitor", @$ovResults) .
13013
" today!" . Html2::br();
13014
{ my %link;
13015
$link{tag} = "a";
13016
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}&otype=all";
13017
$link{innerHTML} = "Show All";
13018
13019
$div{innerHTML} .= Html2::tag(\%link);
13020
}
13021
} # end if (!$ovtype)
13022
else {
13023
$div{innerHTML} .= "Showing all visitors" . Html2::br();
13024
{ my %link;
13025
$link{tag} = "a";
13026
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}";
13027
$link{innerHTML} = "Show Today's";
13028
13029
$div{innerHTML} .= Html2::tag(\%link);
13030
}
13031
} # end else of if (!$ovtype)
13032
13033
$div{innerHTML} .= Html2::hr();
13034
13035
foreach my $visitor (@$ovResults) {
13036
if ($ovtype eq "all") {
13037
$div{innerHTML} .= Html2::tag({
13038
tag=>"font",
13039
title=>$visitor->{last_visit_date},
13040
innerHTML=>$visitor->{IP} . "(x" . $visitor->{count} . ") @ "
13041
});
13042
13043
{ my %img;
13044
$img{tag} = "img";
13045
$img{class} = "enlarge clickable";
13046
$img{src} = "/img.pl?i=site/page_link.png&s=s";
13047
$img{onclick} = "document.location='$visitor->{URL}';";
13048
$img{title} = $visitor->{URL};
13049
13050
$div{innerHTML} .= Html2::tag(\%img);
13051
}
13052
} # end if ($ovtype eq "all")
13053
else {
13054
my %url; {
13055
$url{tag} = "a";
13056
$url{href} = $visitor->{URL};
13057
$url{innerHTML} = "url";
13058
$url{title} = $url{href};
13059
}
13060
13061
my %refurl; {
13062
$refurl{tag} = "a";
13063
$refurl{href} = $visitor->{ref_URL};
13064
$refurl{innerHTML} = "ref";
13065
$refurl{title} = $refurl{href};
13066
}
13067
13068
$div{innerHTML} .= Html2::small("$visitor->{IP} (x$visitor->{count})") . ": " . Html2::tag(\%url);
13069
if ($visitor->{ref_URL} ne "(none)") {
13070
$div{innerHTML} .= " | " . Html2::tag(\%refurl);
13071
}
13072
} # end else of if ($ovtype eq "all")
13073
13074
$div{innerHTML} .= " ";
13075
13076
{ my %img;
13077
$img{tag} = "img";
13078
$img{class} = "enlarge clickable";
13079
$img{src} = "/img.pl?i=site/help.png&s=s";
13080
$img{onclick} = "imageclicked('$visitor->{IP}');";
13081
$img{title} = "Click to see where this IP hails from";
13082
13083
$div{innerHTML} .= Html2::tag(\%img);
13084
}
13085
13086
$div{innerHTML} .= " ";
13087
13088
{ my %font;
13089
$font{tag} = "font";
13090
13091
if ($visitor->{URL} =~ /create_account\.pl/i) {
13092
$font{class} = "green";
13093
$font{innerHTML} = $checkmark;
13094
} else {
13095
$font{class} = "red";
13096
$font{innerHTML} = "x";
13097
}
13098
13099
$div{innerHTML} .= Html2::tag(\%font);
13100
}
13101
13102
$div{innerHTML} .= Html2::br();
13103
} # foreach my $visitor (@$ovResults)
13104
13105
$pagevisits{innerHTML} .= Html2::tag(\%div);
13106
} # end div
13107
} # end if (@$ovResults)
13108
else {
13109
{ my %othercontainer;
13110
$othercontainer{tag} = "div";
13111
$othercontainer{style} = "display: none; width: 200px;";
13112
$othercontainer{id} = "otherpagevisitsdiv";
13113
$othercontainer{class} = "center";
13114
$othercontainer{innerHTML} = "";
13115
13116
{ my %othercontent;
13117
$othercontent{tag} = "div";
13118
$othercontent{class} = "centered center";
13119
$othercontent{innerHTML} = Html2::tag({tag=>"div", class=>"yellow-panel", innerHTML=>"no other page visitors today!"});
13120
13121
{ my %linkdiv;
13122
$linkdiv{tag} = "div";
13123
13124
{ my %link;
13125
$link{tag} = "a";
13126
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{ADMIN_PAGE}&$Bc_sql::CONSTANTS{QUERY_ADMIN_PAGE}=$Bc_sql::CONSTANTS{ADMIN_ACTIVITY_PAGE}";
13127
if (!$ovtype) {
13128
$link{href} .= "&otype=all";
13129
$link{innerHTML} = "Show All";
13130
} else {
13131
$link{innerHTML} = "Show Today's";
13132
}
13133
13134
$linkdiv{innerHTML} .= Html2::tag(\%link);
13135
} # end link
13136
13137
$othercontent{innerHTML} .= Html2::tag(\%linkdiv);
13138
} # end link div
13139
13140
$othercontainer{innerHTML} .= Html2::tag(\%othercontent);
13141
} # end other content
13142
13143
$pagevisits{innerHTML} .= Html2::tag(\%othercontainer);
13144
} # end other container
13145
} # end else of if (@$ovResults)
13146
} # end if (ref $ovResults eq "ARRAY")
13147
else {
13148
my %b;
13149
$b{tag} = "b";
13150
$b{style} = "display: none;";
13151
$b{id} = "otherpagevisitsdiv";
13152
$b{innerHTML} = "Not an Array Reference??";
13153
13154
$pagevisits{innerHTML} .= Html2::tag(\%b);
13155
} # end else of if (ref $ovResults eq "ARRAY")
13156
} # END other page visits
13157
13158
$fs{innerHTML} .= Html2::tag(\%pagevisits);
13159
} # END scrolling div
13160
13161
$content .= Html2::tag(\%fs);
13162
} # end page visits fieldset
13163
$content .= "</td></tr></table>";
13164
$content .= "</td></tr></table>";
13165
13166
13167
} # end elsif ($page eq Bc_sql::get_constant("ADMIN_ACTIVITY_PAGE") and User::isUserSuperAdmin($Bc_sql::LOGGEDIN))
13168
elsif ($page eq Bc_sql::get_constant("ADMBc_sql::in_maint_PAGE") and User::isUserSuperAdmin($Bc_sql::LOGGEDIN)) {
13169
13170
13171
$title .= "Site Maintenance";
13172
$content .= "<table border=0 cellspacing=0 cellpadding=0 height=100%><tr><td align=center valign=top>";
13173
$content .= "For starters, list the items to be \"maintenanced\"" . Html2::br() . Html2::br();
13174
$content .= "</td></tr><tr><td class=spacery_large>";
13175
$content .= "</td></tr><tr><td valign=top>";
13176
$content .= "A link to do all of the below operations!" . Html2::br();
13177
$content .= "A link to wipe all references to invalid UID's from DB ";
13178
{ my %s;
13179
$s{tag} = "small";
13180
$s{innerHTML} = "(if the UID isn't in the ";
13181
$s{innerHTML} .= Html2::italicize("users");
13182
$s{innerHTML} .= " table, it's invalid)";
13183
13184
$content .= Html2::tag(\%s);
13185
}
13186
$content .= Html2::br();
13187
13188
{ my %link;
13189
$link{tag} = "a";
13190
$link{href} = "/remove_test_accounts.pl";
13191
$link{innerHTML} = "Delete TEST accounts";
13192
13193
$content .= Html2::tag(\%link);
13194
}
13195
$content .= Html2::br();
13196
$content .= "A link to wipe all expired password reset requests";
13197
$content .= "</td></tr><tr><td class=spacery_large>";
13198
$content .= "</td></tr><tr><td class=spacery_large>";
13199
$content .= "</td></tr><tr><td align=center valign=top>";
13200
$content .= "The following is a list of DB tables to examine" . Html2::br();
13201
$content .= "w/associated column name(s)";
13202
$content .= "</td></tr><tr><td class=spacery_large>";
13203
$content .= Html2::br();
13204
$content .= "bans ";
13205
my %img;
13206
$img{tag} = "img";
13207
$img{src} = "/images/grey/bullet_arrow_right.png";
13208
$img{height} = "18";
13209
13210
$content .= Html2::tag(\%img);
13211
$content .= " BID" . Html2::br();
13212
$content .= "beta_users ";
13213
$content .= Html2::tag(\%img);
13214
$content .= " UID" . Html2::br();
13215
$content .= "blocks ";
13216
$content .= Html2::tag(\%img);
13217
$content .= "UID and BID" . Html2::br();
13218
$content .= "ccinfo ";
13219
$content .= Html2::tag(\%img);
13220
$content .= "UID" . Html2::br();
13221
$content .= "coins ";
13222
$content .= Html2::tag(\%img);
13223
$content .= "ID" . Html2::br();
13224
$content .= "debugger_allowed ";
13225
$content .= Html2::tag(\%img);
13226
$content .= "UID" . Html2::br();
13227
$content .= "flagged ";
13228
$content .= Html2::tag(\%img);
13229
$content .= "UID" . Html2::br();
13230
$content .= "flagged_counts_per_user ";
13231
$content .= Html2::tag(\%img);
13232
$content .= "UID" . Html2::br();
13233
$content .= "friends ";
13234
$content .= Html2::tag(\%img);
13235
$content .= "UID and FID" . Html2::br();
13236
$content .= "fuck_alerts ";
13237
$content .= Html2::tag(\%img);
13238
$content .= "to_UID and from_UID" . Html2::br();
13239
$content .= "images ";
13240
$content .= Html2::tag(\%img);
13241
$content .= "UID" . Html2::br();
13242
$content .= "loggedin ";
13243
$content .= Html2::tag(\%img);
13244
$content .= "UID" . Html2::br();
13245
$content .= "mod_messages ";
13246
$content .= Html2::tag(\%img);
13247
$content .= "UID" . Html2::br();
13248
$content .= "profile_views ";
13249
$content .= Html2::tag(\%img);
13250
$content .= "UID" . Html2::br();
13251
$content .= "purchased_gifts ";
13252
$content .= Html2::tag(\%img);
13253
$content .= "UID" . Html2::br();
13254
$content .= "pw_reset ";
13255
$content .= Html2::tag(\%img);
13256
$content .= "UID and date" . Html2::br();
13257
$content .= "new_email ";
13258
$content .= Html2::tag(\%img);
13259
$content .= "UID" . Html2::br();
13260
$content .= "sessions ";
13261
$content .= Html2::tag(\%img);
13262
$content .= "UID" . Html2::br();
13263
$content .= "theme_purchases ";
13264
$content .= Html2::tag(\%img);
13265
$content .= "UID" . Html2::br();
13266
$content .= "user_images ";
13267
$content .= Html2::tag(\%img);
13268
$content .= "UID" . Html2::br();
13269
$content .= "user_points ";
13270
$content .= Html2::tag(\%img);
13271
$content .= "ID" . Html2::br();
13272
$content .= "users ";
13273
$content .= Html2::tag(\%img);
13274
$content .= "ID" . Html2::br();
13275
$content .= "warnings ";
13276
$content .= Html2::tag(\%img);
13277
$content .= "UID" . Html2::br();
13278
$content .= "</td></tr></table>";
13279
13280
13281
} # end elsif ($page eq Bc_sql::get_constant("ADMBc_sql::in_maint_PAGE") and User::isUserSuperAdmin($Bc_sql::LOGGEDIN))
13282
elsif ($page eq Bc_sql::get_constant("ADMIN_BETA_PAGE") and User::isUserAdmin($Bc_sql::LOGGEDIN)) {
13283
13284
13285
$title .= "Beta Messages";
13286
$content .= "<table border=0 cellspacing=0 cellpadding=0 height=100%><tr><td align=center height=1 valign=top>";
13287
13288
my $sorted_by = Bc_misc::get_param("sort_by");
13289
if (not $sorted_by) { $sorted_by = "dor"; }
13290
my $direction = Bc_misc::get_param("dir");
13291
if (not $direction) { $direction = "asc"; }
13292
my $sql = "select * from beta_msg order by $sorted_by collate nocase $direction";
13293
my $DEBUG_BETA_ADMIN = 0;
13294
if ($DEBUG_BETA_ADMIN) {
13295
$content .= "SQL: " . Html2::embolden($sql);
13296
} else {
13297
my $results = Bc_sql::sql_execute($sql, "display admin page");
13298
my $tc = "<table border=0 cellpadding=0 cellspacing=0><tr><td align=center colspan=13>";
13299
$tc .= $sql . Html2::hr() . Html2::br();
13300
$tc .= "</td></tr><tr><td>";
13301
$tc .= "Date ";
13302
13303
{ my %link;
13304
$link{tag} = "a";
13305
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . (Bc_sql::get_constant("ADMIN_PAGE")) . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_BETA_PAGE") . "&sort_by=dor&dir=";
13306
if ($direction eq "asc") { $link{href} .= "desc"} else { $link{href} .= "asc"; }
13307
if ($sorted_by eq "dor" and $direction eq "asc") { $link{innerHTML} = "9-0"; }
13308
elsif ($sorted_by eq "dor" and $direction eq "desc") { $link{innerHTML} .= "0-9"; }
13309
else { $link{innerHTML} .= "0-9"; }
13310
$tc .= Html2::tag(\%link);
13311
}
13312
13313
$tc .= "</td><td class=spacerx></td><td>";
13314
$tc .= "Nickname";
13315
$tc .= "</td><td class=spacerx></td><td>";
13316
$tc .= "URL ";
13317
13318
{ my %link;
13319
$link{tag} = "a";
13320
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . (Bc_sql::get_constant("ADMIN_PAGE")) . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_BETA_PAGE") . "&sort_by=URL&dir=";
13321
if ($direction eq "asc") { $link{href} .= "desc"} else { $link{href} .= "asc"; }
13322
if ($sorted_by eq "URL" and $direction eq "asc") { $link{innerHTML} .= "z-a"; }
13323
elsif ($sorted_by eq "URL" and $direction eq "desc") { $link{innerHTML} .= "a-z"; }
13324
else { $link{innerHTML} .= "a-z"; }
13325
13326
$tc .= Html2::tag(\%link);
13327
}
13328
13329
$tc .= "</td><td class=spacerx></td><td>";
13330
$tc .= "Type ";
13331
13332
{ my %link;
13333
$link{tag} = "a";
13334
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . (Bc_sql::get_constant("ADMIN_PAGE")) . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_BETA_PAGE") . "&sort_by=type&dir=";
13335
if ($direction eq "asc") { $link{href} .= "desc"} else { $link{href} .= "asc"; }
13336
if ($sorted_by eq "type" and $direction eq "asc") { $link{innerHTML} = "z-a"; }
13337
elsif ($sorted_by eq "type" and $direction eq "desc") { $link{innerHTML} = "a-z"; }
13338
else { $link{innerHTML} .= "a-z"; }
13339
13340
$tc .= Html2::tag(\%link);
13341
}
13342
13343
$tc .= "</td><td class=spacerx></td><td>";
13344
$tc .= "Notes";
13345
$tc .= "</td><td class=spacerx></td><td>";
13346
$tc .= "Status ";
13347
13348
{ my %link;
13349
$link{tag} = "a";
13350
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . (Bc_sql::get_constant("ADMIN_PAGE")) . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_BETA_PAGE") . "&sort_by=status&dir=";
13351
if ($direction eq "asc") { $link{href} .= "desc"} else { $link{href} .= "asc"; }
13352
if ($sorted_by eq "type" and $direction eq "asc") { $link{innerHTML} = "z-a"; }
13353
elsif ($sorted_by eq "type" and $direction eq "desc") { $link{innerHTML} = "a-z"; }
13354
else { $link{innerHTML} = "a-z"; }
13355
13356
$tc .= Html2::tag(\%link);
13357
}
13358
13359
$tc .= "</td></tr><tr><td colspan=13>" . Html2::hr() . "</td></tr><tr><td>";
13360
my $status_sql = "select * from beta_status";
13361
my $status_results = Bc_sql::sql_execute($status_sql, "display admin page");
13362
my @statuses = Bc_sql::get_config("beta_status");
13363
13364
if (ref $results eq "HASH") {
13365
my $ulink = Html2::profile_link($results->{UID});
13366
my $url = uri_unescape($results->{url});
13367
$tc .= "$ulink - ";
13368
{ my %link;
13369
$link{tag} = "a";
13370
$link{href} = $url;
13371
$link{innerHTML} = Bc_misc::shorten_str($url, 25);
13372
13373
$tc .= Html2::tag(\%link);
13374
}
13375
13376
$tc .= " - $results->{type} - " . Bc_misc::shorten_str($results->{notes}, 40) . " - $results->{status} - $results->{dor}" . Html2::br();
13377
} else {
13378
if (@$results) {
13379
foreach my $result (@$results) {
13380
my $status_dd = dropdown("", "", $result->{status}, "", "", "", "", "", \@statuses);
13381
my $ulink = Html2::profile_link($result->{UID});
13382
my $url = uri_unescape($result->{url});
13383
$tc .= $result->{dor};
13384
$tc .= "</td><td class=spacerx></td><td>";
13385
$tc .= $ulink;
13386
$tc .= "</td><td class=spacerx></td><td>";
13387
{ my %link;
13388
$link{tag} = "a";
13389
$link{href} = $url;
13390
$link{innerHTML} = Bc_misc::shorten_str($url, 25);
13391
13392
$tc .= Html2::tag(\%link);
13393
}
13394
$tc .= "</td><td class=spacerx></td><td>";
13395
$tc .= $result->{type};
13396
$tc .= "</td><td class=spacerx></td><td>";
13397
$tc .= Bc_misc::shorten_str($result->{notes}, 40);
13398
$tc .= "</td><td class=spacerx></td><td>";
13399
$tc .= $status_dd;
13400
$tc .= "</td><td class=spacerx></td><td>";
13401
{ my %button;
13402
$button{tag} = "button";
13403
$button{type} = "button";
13404
$button{class} = "green";
13405
$button{onclick} = "";
13406
$button{innerHTML} = "Update";
13407
13408
$tc .= Html2::tag(\%button);
13409
}
13410
$tc .= "</td></tr><tr><td>";
13411
}
13412
} # end if @results
13413
else {
13414
# nothing displayed??
13415
} # end else of if @results
13416
} # end else of if ref eq hash
13417
13418
$tc =~ s/<tr><td>$//;
13419
$tc .= "</table>";
13420
13421
$content .= table($tc, "", "subnavbar", 1, "", "");
13422
# end else of if debug beta
13423
}
13424
13425
$content .= "</td></tr></table>";
13426
} # end elsif ($page eq Bc_sql::get_constant("ADMIN_BETA_PAGE") and User::isUserAdmin($Bc_sql::LOGGEDIN))
13427
else {
13428
$content .= "Something ain't right!";
13429
} # end else of elsif ($page eq Bc_sql::get_constant("ADMIN_BETA_PAGE") and User::isUserAdmin($Bc_sql::LOGGEDIN))
13430
13431
###############################################################################################################
13432
# the following code constructs the remainder of the page (which contains the above "$content")
13433
# so, display the title of the page we're on
13434
# display the "navbar"
13435
# and insert $content
13436
# all neatly wrapped in a multi-celled table (fuckin archaic)
13437
if ($title) {
13438
if (User::isUserAdmin()) {
13439
my %font;
13440
$font{tag} = "font";
13441
$font{class} = "subtitle";
13442
$font{innerHTML} = $title;
13443
13444
$rv .= Html2::tag(\%font) . Html2::br();
13445
}
13446
if ($page eq Bc_sql::get_constant("ADMIN_HOME")) {
13447
$rv .= Html2::embolden("Home");
13448
} else {
13449
my %link;
13450
$link{tag} = "a";
13451
if (User::User::isUserAdmin()) {
13452
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_HOME");
13453
$link{innerHTML} = "Home";
13454
} else {
13455
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MOD_PAGE");
13456
$link{innerHTML} = "Home";
13457
}
13458
13459
$rv .= Html2::tag(\%link);
13460
}
13461
$rv .= " " . Html2::embolden("|") . " ";
13462
13463
if ($page eq Bc_sql::get_constant("ADMIN_USER_EDITOR_PAGE")) {
13464
$rv .= Html2::embolden("Users");
13465
} else {
13466
my %link;
13467
$link{tag} = "a";
13468
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_USER_EDITOR_PAGE");
13469
$link{innerHTML} = "Users";
13470
13471
$rv .= Html2::tag(\%link);
13472
}
13473
$rv .= " " . Html2::embolden("|") . " ";
13474
13475
if (User::isUserAdmin($Bc_sql::LOGGEDIN)) {
13476
if ($page eq Bc_sql::get_constant("ADMIN_THEME_EDITOR_PAGE")) {
13477
$rv .= Html2::embolden("Themes");
13478
} else {
13479
my %link;
13480
$link{tag} = "a";
13481
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_THEME_EDITOR_PAGE");
13482
$link{innerHTML} = "Themes";
13483
13484
$rv .= Html2::tag(\%link);
13485
}
13486
$rv .= " " . Html2::embolden("|") . " ";
13487
13488
if ($page eq Bc_sql::get_constant("ADMIN_BETA_PAGE")) {
13489
$rv .= Html2::embolden("Beta Msgs");
13490
} else {
13491
my %link;
13492
$link{tag} = "a";
13493
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_BETA_PAGE");
13494
$link{innerHTML} = "Beta Messages";
13495
13496
$rv .= Html2::tag(\%link);
13497
}
13498
$rv .= " " . Html2::embolden("|") . " ";
13499
13500
if (User::isUserSuperAdmin($Bc_sql::LOGGEDIN)) {
13501
if ($page eq Bc_sql::get_constant("ADMIN_SYSTEM_PAGE")) {
13502
$rv .= Html2::embolden("System");
13503
} else {
13504
my %link;
13505
$link{tag} = "a";
13506
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_SYSTEM_PAGE");
13507
$link{innerHTML} = "System";
13508
13509
$rv .= Html2::tag(\%link);
13510
}
13511
$rv .= " " . Html2::embolden("|") . " ";
13512
13513
if ($page eq Bc_sql::get_constant("ADMIN_CONTENT_EDITOR_PAGE")) {
13514
$rv .= Html2::embolden("Content");
13515
} else {
13516
my %link;
13517
$link{tag} = "a";
13518
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_CONTENT_EDITOR_PAGE");
13519
$link{innerHTML} = "Content";
13520
13521
$rv .= Html2::tag(\%link);
13522
}
13523
$rv .= " " . Html2::embolden("|") . " ";
13524
13525
if ($page eq Bc_sql::get_constant("ADMIN_ACTIVITY_PAGE")) {
13526
$rv .= Html2::embolden("Activity");
13527
} else {
13528
my %link;
13529
$link{tag} = "a";
13530
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_ACTIVITY_PAGE");
13531
$link{innerHTML} = "Activity";
13532
13533
$rv .= Html2::tag(\%link);
13534
}
13535
$rv .= " " . Html2::embolden("|") . " ";
13536
}
13537
13538
if ($page eq Bc_sql::get_constant("ADMBc_sql::in_maint_PAGE")) {
13539
$rv .= Html2::embolden("Maint");
13540
} else {
13541
my %link;
13542
$link{tag} = "a";
13543
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMBc_sql::in_maint_PAGE");
13544
$link{innerHTML} = "Maint";
13545
13546
$rv .= Html2::tag(\%link);
13547
}
13548
$rv .= " " . Html2::embolden("|") . " ";
13549
13550
if ($page eq Bc_sql::get_constant("ADMIN_LOGS_PAGE")) {
13551
$rv .= Html2::embolden("Logs");
13552
} else {
13553
my %link;
13554
$link{tag} = "a";
13555
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_LOGS_PAGE");
13556
$link{innerHTML} = "Logs";
13557
13558
$rv .= Html2::tag(\%link);
13559
}
13560
$rv .= " " . Html2::embolden("|") . " ";
13561
}
13562
13563
if ($page eq Bc_sql::get_constant("ADMIN_BANNED_USERS_PAGE")) {
13564
$rv .= Html2::embolden("Bans");
13565
} else {
13566
my %link;
13567
$link{tag} = "a";
13568
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_BANNED_USERS_PAGE");
13569
$link{innerHTML} = "Bans";
13570
13571
$rv .= Html2::tag(\%link);
13572
}
13573
$rv .= " " . Html2::embolden("|") . " ";
13574
13575
if ($page eq Bc_sql::get_constant("ADMIN_FEEDBACK_INBOX_PAGE")) {
13576
$rv .= Html2::embolden("Feedback");
13577
} else {
13578
my %link;
13579
$link{tag} = "a";
13580
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_FEEDBACK_INBOX_PAGE");
13581
$link{innerHTML} = "Feedback";
13582
13583
$rv .= Html2::tag(\%link);
13584
}
13585
13586
# this ends the "navbar"
13587
$rv .= "</td></tr><tr><td height=7>";
13588
$rv .= "</td></tr><tr><td align=center height=100% valign=top>";
13589
# and now insert the $content
13590
$rv .= $content;
13591
$rv .= "</td></tr></table>";
13592
} else {
13593
$rv .= "no such page: $page";
13594
}
13595
} else {
13596
$rv .= "no such page: $page";
13597
}
13598
13599
return $rv; # a scalar
13600
#usage: my $admin_page_html = display_admin_page(get_config("ADMIN_BANNED_USERS_PAGE"), "");
13601
}
13602
13603
########################
13604
sub display_mail(;$$$) {
13605
#*
13606
# loads the loggedin user's inbox (or related pages), and wraps it in HTML
13607
# will never load any other inbox but the loggedin user (unless admin flag is on)
13608
#*
13609
my ($subpage, $spacing, $admin) = @_; # a page (optional, default = MAIL_INBOX_PAGE) && spacing for pretty printing HTML output (optional) && toggle to show other user inbox (optional, pass a valid UID)
13610
if (!$spacing) { $spacing = ""; }
13611
if (not $subpage) { $subpage = Bc_sql::get_constant("MAIL_INBOX_PAGE"); }
13612
my $rv = "";
13613
13614
my $uid = $Bc_sql::LOGGEDIN;
13615
if ($admin) { $uid = $admin; } # so an admin can perform mailbox troubleshooting
13616
my $moderator = User::isUserModerator($Bc_sql::LOGGEDIN);
13617
my $administrator = User::isUserAdmin($Bc_sql::LOGGEDIN);
13618
13619
my @msgs = get_user_messages($uid);
13620
13621
if (Bc_sql::user_exists($uid)) {
13622
# setup the "title" of the page
13623
my $title = "(none)";
13624
if ($subpage eq Bc_sql::get_constant("MAIL_INBOX_PAGE")) { $title = "Inbox"; }
13625
if ($subpage eq Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE")) {
13626
my $mid = Bc_misc::get_param(Bc_sql::get_constant("QUERY_MSGID"));
13627
my $msgData = get_user_message($mid);
13628
13629
my %t;
13630
$t{tag} = "div";
13631
$t{class} = "subtitle";
13632
if (ref $msgData eq "HASH" and User::isUserModerator($Bc_sql::LOGGEDIN) and $mid) { $t{class} .= " padded"; }
13633
$t{innerHTML} = "View Message";
13634
$title = Html2::tag(\%t);
13635
13636
if (ref $msgData eq "HASH" and User::isUserModerator($Bc_sql::LOGGEDIN) and $mid) {
13637
my %info;
13638
$info{innerHTML} = "";
13639
13640
{ my %to;
13641
$to{tag} = "div";
13642
$to{innerHTML} = "";
13643
$to{class} = "small";
13644
$to{style} = "margin-bottom: 2px;";
13645
13646
# is the message to $Bc_sql::LOGGEDIN
13647
if ($msgData->{to_ID} eq $Bc_sql::LOGGEDIN) {
13648
$to{class} .= " cyan-panel";
13649
$to{innerHTML} .= "Moderating Your Own Message?";
13650
} else {
13651
$to{class} .= " yellow-panel";
13652
$to{innerHTML} .= "Moderating Message";
13653
}
13654
13655
$info{innerHTML} .= Html2::tag(\%to);
13656
}
13657
13658
$info{innerHTML} .= Html2::br();
13659
13660
$info{tag} = "div";
13661
$info{class} = "padded-small sunken small min-content centered";
13662
$info{innerHTML} .= "Sec. Level: " . Html2::embolden(get_config_asWord("sec_levels", $Bc_sql::USER_DATA->{security}, "friendly_name"));
13663
$info{innerHTML} .= Html2::br();
13664
$info{innerHTML} .= "Msg ID: " . Html2::embolden($mid);
13665
13666
$title .= Html2::tag(\%info) . Html2::tag({tag=>"div", class=>"spacery_large"});
13667
13668
} # end if (ref $msgData eq "HASH")
13669
# end if ($subpage eq Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE"))
13670
}
13671
if ($subpage eq Bc_sql::get_constant("MAIL_COMPOSE_PAGE")) { $title = "Send Message"; }
13672
if ($subpage eq Bc_sql::get_constant("MAIL_SENT_PAGE")) { $title = "Sent Messages"; }
13673
if ($subpage eq Bc_sql::get_constant("MAIL_DELMSG_PAGE")) { $title = "Delete Message"; }
13674
if ($subpage eq Bc_sql::get_constant("MAIL_EMPTY_PAGE")) { $title = "Delete All Messages"; }
13675
13676
###############################
13677
# and now the html
13678
# first, is to display the title
13679
{ my %title;
13680
$title{tag} = "div";
13681
$title{class} = "normal-panel min-content nowrap centered center subtitle";
13682
$title{style} = "grid-area: msgtitle;";
13683
$title{innerHTML} = $title;
13684
13685
$rv .= Html2::tag(\%title);
13686
}
13687
13688
{ my %nav;
13689
$nav{tag} = "div";
13690
if (User::isUserModerator($Bc_sql::LOGGEDIN))
13691
{ $nav{class} = "blue-panel margins-top-bottom-large"; } else
13692
{ $nav{class} = "normal-panel"; }
13693
$nav{class} .= " padded min-content nowrap center centered";
13694
$nav{style} = "grid-area: msgnav; padding-top: 8px !important;";
13695
$nav{innerHTML} = "";
13696
13697
if ($subpage eq Bc_sql::get_constant("MAIL_COMPOSE_PAGE")) {
13698
13699
my %button;
13700
$button{tag} = "button";
13701
$button{type} = "button";
13702
$button{class} = "red";
13703
$button{onclick} = "previous_page();";
13704
$button{innerHTML} = "Cancel";
13705
13706
$nav{innerHTML} .= Html2::tag(\%button);
13707
13708
} # end elsif ($subpage eq Bc_sql::get_constant("MAIL_COMPOSE_PAGE"))
13709
elsif ($subpage eq Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE")) {
13710
13711
my $msgid = Bc_misc::get_param("msgid");
13712
my $msgRef = get_user_message($msgid);
13713
13714
if (ref $msgRef eq "HASH") {
13715
if (User::isUserModerator($Bc_sql::LOGGEDIN) and $Bc_sql::LOGGEDIN ne $msgRef->{to_ID}) {
13716
{ my %button;
13717
$button{tag} = "button";
13718
$button{type} = "button";
13719
$button{class} = "yellow";
13720
$button{onclick} = "previous_page();";
13721
$button{innerHTML} = "Go Back";
13722
$button{title} = "Return to Referring Page";
13723
13724
$nav{innerHTML} .= Html2::tag(\%button);
13725
}
13726
13727
{ my %button;
13728
$button{tag} = "button";
13729
$button{type} = "button";
13730
$button{class} = "red";
13731
$button{onclick} = "/";
13732
$button{innerHTML} = "Trash";
13733
$button{title} = "Obliterate the Message";
13734
13735
$nav{innerHTML} .= Html2::tag(\%button);
13736
}
13737
13738
$nav{innerHTML} .= Html2::br();
13739
}
13740
13741
my $fid = is_flagged($msgRef->{from_ID}, $msgRef->{ID}, "m");
13742
if (ref $fid eq "HASH") {
13743
if ($moderator or $administrator) {
13744
# flagged
13745
$nav{innerHTML} .= Html2::italicize({class=>"red-panel", innerHTML=>"FLAGGED"});
13746
13747
if ($fid->{status} eq "pending") {
13748
# send warning msg
13749
$nav{innerHTML} .= Html2::embolden(" - ");
13750
13751
my %button;
13752
$button{tag} = "button";
13753
$button{type} = "button";
13754
$button{class} = "red";
13755
$button{onclick} = "document.location=\"/flag.pl?id=$msgid&" . Bc_sql::get_constant("FLAG_TYPE") . "=m&$Bc_sql::QUERY_UID=$msgRef->{from_ID}&" . Bc_sql::get_constant("FLAG_ID") . "=$fid->{ID}&del=1\";";
13756
$button{innerHTML} = "Delete";
13757
$button{title} = "Set Flag Status to Deleted\nSend warning msg\nDelete Message from Recipient and Sender";
13758
$button{title} .= "\n" . $button{onclick};
13759
13760
$nav{innerHTML} .= Html2::tag(\%button);
13761
} else {
13762
# other status
13763
$nav{innerHTML} .= $fid->{status};
13764
}
13765
13766
$nav{innerHTML} .= Html2::embolden("- ");
13767
13768
# unflag
13769
{ my %button;
13770
$button{tag} = "button";
13771
$button{type} = "button";
13772
$button{class} = "yellow";
13773
$button{onclick} = "document.location=\"/flag.pl?id=$msgid&" . Bc_sql::get_constant("FLAG_TYPE") . "=m&$Bc_sql::QUERY_UID=$msgRef->{from_ID}&ignore=1&" . Bc_sql::get_constant("FLAG_ID") . "=$fid->{ID}\";";
13774
$button{innerHTML} = "Unflag";
13775
$button{title} = "Cancels this Flag";
13776
$button{title} .= "\n" . $button{onclick};
13777
13778
$nav{innerHTML} .= Html2::tag(\%button);
13779
}
13780
13781
} else {
13782
# flagged
13783
$nav{innerHTML} .= Html2::embolden("| ");
13784
$nav{innerHTML} .= Html2::italicize({class=>"red", innerHTML=>"FLAGGED"});
13785
}
13786
13787
# end if (ref $fid eq "HASH")
13788
} else {
13789
# msg is not flagged
13790
13791
if ($Bc_sql::LOGGEDIN eq $msgRef->{to_ID}) {
13792
# reply
13793
{ my %button;
13794
$button{tag} = "button";
13795
$button{type} = "button";
13796
$button{class} = "green";
13797
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_COMPOSE_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_TO") . "=$msgRef->{from_ID}&" . Bc_sql::get_constant("QUERY_MAIL_SUBJECT") . "=$msgRef->{subject}\";";
13798
$button{innerHTML} = "Reply";
13799
$button{title} = "Click this button to reply";
13800
13801
$nav{innerHTML} .= Html2::tag(\%button);
13802
}
13803
13804
# delete
13805
{ my %button;
13806
$button{tag} = "button";
13807
$button{type} = "button";
13808
$button{class} = "red";
13809
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_DELMSG_PAGE") . "&" . Bc_sql::get_constant("QUERY_MSGID") . "=$msgid\";";
13810
$button{innerHTML} = "Delete";
13811
$button{title} = "Click this button to delete the message";
13812
13813
$nav{innerHTML} .= Html2::tag(\%button);
13814
}
13815
}
13816
13817
$nav{innerHTML} .= Html2::embolden(" | ");
13818
13819
# flag
13820
{ my %button;
13821
$button{tag} = "button";
13822
$button{type} = "button";
13823
$button{class} = "red";
13824
$button{onclick} = "document.location=\"/flag.pl?id=$msgid&" . Bc_sql::get_constant("FLAG_TYPE") . "=m&$Bc_sql::QUERY_UID=$msgRef->{from_ID}\";";
13825
$button{innerHTML} = "Flag";
13826
$button{title} = "Click this button to flag the message - " . $button{onclick};
13827
13828
$nav{innerHTML} .= Html2::tag(\%button);
13829
}
13830
}
13831
# end if (ref $msgRef eq "HASH")
13832
} else {
13833
$nav{innerHTML} .= "msgid ($msgid) not found";
13834
# end else of if (ref $msgRef eq "HASH")
13835
}
13836
13837
} # end elsif ($subpage eq Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE"))
13838
elsif ($subpage ne Bc_sql::get_constant("MAIL_SENT_PAGE") and $subpage ne Bc_sql::get_constant("MAIL_DELMSG_PAGE") and $subpage ne Bc_sql::get_constant("MAIL_EMPTY_PAGE")) {
13839
13840
$nav{innerHTML} .= Html2::reloadbutton("Reload Inbox") . Html2::embolden("| ");
13841
13842
if (@msgs) {
13843
my %button;
13844
$button{tag} = "button";
13845
$button{type} = "button";
13846
$button{class} = "red";
13847
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_EMPTY_PAGE") . "&" . $Bc_sql::QUERY_UID . "=$uid\";";
13848
$button{title} = "Clear Inbox";
13849
$button{innerHTML} = img("i=" . Bc_sql::get_constant("IMAGE_ERASER_ICON") . "&s=i", "", "", "", "", 1);
13850
13851
$nav{innerHTML} .= Html2::tag(\%button) . Html2::embolden("| ");
13852
}
13853
13854
{ my %button;
13855
$button{tag} = "button";
13856
$button{type} = "button";
13857
$button{class} = "green";
13858
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_COMPOSE_PAGE") . "\";";
13859
$button{title} = "Compose";
13860
$button{innerHTML} = img("i=" . Bc_sql::get_constant("IMAGE_COMPOSE_ICON") . "&s=i", "", "", "", "", 1);
13861
13862
$nav{innerHTML} .= Html2::tag(\%button);
13863
}
13864
13865
} # end elsif ($subpage ne Bc_sql::get_constant("MAIL_SENT_PAGE") and $subpage ne Bc_sql::get_constant("MAIL_DELMSG_PAGE") and $subpage ne Bc_sql::get_constant("MAIL_EMPTY_PAGE"))
13866
else {
13867
13868
$nav{innerHTML} .= "mm.mmmm...ailbox bro-" . Html2::br() . Html2::br();
13869
$nav{innerHTML} .= "daaah...I think it's dead, Jim!";
13870
13871
} # end if/else/elsif structure
13872
13873
# this puts a button back to inbox, if $msgRef->{to_ID} == $Bc_sql::LOGGEDIN
13874
if ($subpage ne Bc_sql::get_constant("MAIL_INBOX_PAGE")) {
13875
13876
if ($subpage eq Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE")) {
13877
my $msgid = Bc_misc::get_param(Bc_sql::get_constant("QUERY_MSGID"));
13878
my $msgRef = get_user_message($msgid);
13879
if (ref $msgRef eq "HASH") {
13880
# is $Bc_sql::LOGGEDIN the recipient of $msgid?
13881
if ($Bc_sql::LOGGEDIN eq $msgRef->{to_ID}) {
13882
if ($moderator) {
13883
{ my %button;
13884
$button{tag} = "button";
13885
$button{type} = "button";
13886
$button{class} = "purple";
13887
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MOD_PAGE") . "\";";
13888
$button{innerHTML} = "Moderator Home";
13889
$button{title} = "Return to the Moderator Home Page";
13890
13891
$nav{innerHTML} .= Html2::hr() . Html2::tag(\%button);
13892
}
13893
}
13894
13895
$nav{innerHTML} .= Html2::embolden("- ");
13896
13897
my %button;
13898
$button{tag} = "button";
13899
$button{type} = "button";
13900
$button{class} = "green";
13901
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "\";";
13902
$button{innerHTML} = "Back to Inbox";
13903
13904
$nav{innerHTML} .= Html2::tag(\%button);
13905
}
13906
}
13907
# end if ($subpage eq Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE"))
13908
} elsif ($subpage eq Bc_sql::get_constant("MAIL_SENT_PAGE")) {
13909
my %button;
13910
$button{tag} = "button";
13911
$button{type} = "button";
13912
$button{class} = "green";
13913
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "\";";
13914
$button{innerHTML} = "Back to Inbox";
13915
13916
$nav{innerHTML} .= Html2::tag(\%button);
13917
} else {
13918
my %button;
13919
$button{tag} = "button";
13920
$button{type} = "button";
13921
$button{class} = "green";
13922
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "\";";
13923
$button{innerHTML} = "Back to Inbox";
13924
13925
$nav{innerHTML} .= Html2::tag(\%button);
13926
}
13927
13928
} # end if ($subpage ne Bc_sql::get_constant("MAIL_INBOX_PAGE"))
13929
13930
$rv .= Html2::tag(\%nav);
13931
} # end message nav div
13932
13933
my $themeRef = Bc_sql::get_theme_data(User::get_user_stat($uid, "TID"));
13934
my %theme = %$themeRef;
13935
13936
###############################
13937
# now display the actual page
13938
# being called for
13939
if ($subpage eq Bc_sql::get_constant("MAIL_INBOX_PAGE")) {
13940
if (@msgs) {
13941
$rv .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0 class=email><tr><td align=center class=subtitle>";
13942
$rv .= "Status";
13943
$rv .= "</td><td width=10></td><td align=center class=subtitle>";
13944
$rv .= "Sender";
13945
$rv .= "</td><td width=10></td><td align=center class=subtitle width=250>";
13946
$rv .= "Subject";
13947
$rv .= "</td><td width=10></td><td align=center class=subtitle>";
13948
$rv .= "Date Sent";
13949
$rv .= "</td><td width=10></td><td align=center class=subtitle>";
13950
$rv .= "Actions";
13951
13952
$rv .= "</td></tr><tr><td colspan=222>";
13953
$rv .= Html2::hr();
13954
$rv .= "</td></tr>";
13955
13956
my $clr1 = $theme{gradient_light};
13957
my $clr2 = $theme{gradient_dark};
13958
my $c = $clr1;
13959
foreach my $msgid (@msgs) {
13960
my $msgRef = get_user_message($msgid);
13961
my %msgdata;
13962
if (ref $msgRef eq "HASH") { %msgdata = %$msgRef; }
13963
my $uname = User::get_user_stat($msgdata{from_ID}, "nickname", "");
13964
my $upic = get_user_pic($msgdata{from_ID}, "i");
13965
$rv .= "<tr style='background-color: #$c;'><td class=msg style='padding: 2px 2px 2px 5px; text-align: center;'>";
13966
if ($msgdata{seen} eq 1) {
13967
$rv .= img("i=site/mail.png&s=i", "", "", "title='Message has not been read'", "", 1);
13968
} else {
13969
$rv .= img("i=site/mail_open.png&s=i", "", "", "title='Message has been read'", "", 1);
13970
}
13971
13972
$rv .= "</td><td align=center class=msg>";
13973
$rv .= Html2::embolden("|");
13974
$rv .= "</td><td class=msg nowrap>";
13975
$rv .= "$upic " . Html2::profile_link($msgdata{from_ID}) . Html2::br();
13976
$rv .= "</td><td align=center class=msg>";
13977
$rv .= Html2::embolden("|");
13978
$rv .= "</td><td class=msg>";
13979
13980
{ my %link;
13981
$link{tag} = "a";
13982
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE") . "&" . Bc_sql::get_constant("QUERY_MSGID") . "=$msgdata{ID}";
13983
$link{title} = "View Message";
13984
$link{innerHTML} = Html2::italicize(shorten_str(uri_unescape($msgdata{subject}), 28));
13985
13986
$rv .= Html2::tag(\%link);
13987
}
13988
$rv .= "</td><td align=center class=msg>";
13989
$rv .= Html2::embolden("|");
13990
$rv .= "</td><td align=center class=msg nowrap>";
13991
$rv .= Date::expand_date($msgdata{sent}) . Html2::br();
13992
$rv .= "</td><td align=center class=msg>";
13993
$rv .= Html2::embolden("|");
13994
$rv .= "</td><td class=msg nowrap>";
13995
# this here is an open msg button
13996
{ my %link;
13997
$link{tag} = "a";
13998
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE") . "&" . Bc_sql::get_constant("QUERY_MSGID") . "=$msgdata{ID}";
13999
$link{title} = "Open";
14000
$link{innerHTML} = img("i=" . Bc_sql::get_constant("IMAGE_VIEWMSG_ICON") . "&s=i", "", "", "", "", 1);
14001
14002
$rv .= Html2::tag(\%link);
14003
}
14004
# if msg is not flagged
14005
if (not is_flagged($msgdata{from_ID}, $msgdata{ID}, "m")) {
14006
# this here is a reply to msg button
14007
{ my %link;
14008
$link{tag} = "a";
14009
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_COMPOSE_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_TO") . "=$msgdata{from_ID}&" . Bc_sql::get_constant("QUERY_MAIL_SUBJECT") . "=$msgdata{subject}";
14010
$link{title} = "Reply";
14011
$link{innerHTML} = img("i=" . Bc_sql::get_constant("IMAGE_REPLY_ICON") . "&s=i", "", "", "", "", 1);
14012
14013
$rv .= Html2::tag(\%link);
14014
}
14015
# this here is a delete msg button
14016
$rv .= Html2::embolden("-");
14017
# this here is a view profile button
14018
$rv .= Html2::profile_link({UID=>$msgdata{from_ID}, innerHTML=>img("i=" . Bc_sql::get_constant("IMAGE_PROFILE_ICON") . "&s=i", "", "", "", "", 1), title=>"Go to User's Profile"});
14019
$rv .= Html2::embolden("-");
14020
{ my %link;
14021
$link{tag} = "a";
14022
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_DELMSG_PAGE") . "&" . Bc_sql::get_constant("QUERY_MSGID") . "=$msgdata{ID}";
14023
$link{title} = "Delete";
14024
$link{innerHTML} = img("i=" . Bc_sql::get_constant("IMAGE_ERASER_ICON") . "&s=i", "", "", "", "", 1);
14025
14026
$rv .= Html2::tag(\%link);
14027
}
14028
} else {
14029
$rv .= " " . Html2::embolden("-") . " ";
14030
$rv .= Html2::italicize({class=>"error", innerHTML=>"FLAGGED"}) . " ";
14031
}
14032
$rv .= Html2::embolden("-");
14033
# this here is a block user button
14034
{ my %link;
14035
$link{tag} = "a";
14036
$link{href} = "/block.pl?" . $Bc_sql::QUERY_UID . "=$msgdata{from_ID}";
14037
$link{title} = "Block Sender";
14038
$link{innerHTML} = img("i=" . Bc_sql::get_constant("IMAGE_ADD_BLOCK_ICON") . "&s=i", "", "", "", "", 1);
14039
14040
$rv .= Html2::tag(\%link);
14041
}
14042
$rv .= "</td></tr><tr><td colspan=9 height=5></td></tr>";
14043
if ($c eq $clr1) { $c = $clr2; } else { $c = $clr1; }
14044
}
14045
$rv .= "</table>";
14046
} else {
14047
$rv .= "Your inbox is currently empty!";
14048
}
14049
14050
} elsif ($subpage eq Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE")) {
14051
14052
my $msgid = Bc_misc::get_param("msgid");
14053
my $msgdata = get_user_message($msgid);
14054
if (ref $msgdata eq "HASH") {
14055
my %hash = %$msgdata;
14056
if ($hash{seen} eq 1) {
14057
$hash{seen} = 2;
14058
# gotta update db here
14059
my $sql = "update messages set seen=2 where ID = " . $Bc_sql::DB->quote($hash{ID}); # ya. so? better safe than sorry
14060
Bc_sql::sql_execute($sql, "display mail"); # i won't bother with any error checking here. this SHOULD work, since we have already validated the input
14061
}
14062
14063
{ my %style;
14064
$style{tag} = "style";
14065
$style{innerHTML} = "\n" .
14066
".msgdivgrid {\n" .
14067
" display: grid;\n" .
14068
" grid-template-areas: 'from date' 'to to' 'subject subject' 'msg msg';\n" .
14069
" grid-template-columns: 1fr min-content;\n" .
14070
" grid-template-rows: min-content min-content min-content 1fr;\n" .
14071
" height: 350px;\n" .
14072
" min-width: 321px;\n" .
14073
" max-width: 900px;\n" .
14074
" width: 100%;\n" .
14075
" grid-gap: 5px;\n" .
14076
"\n" .
14077
"}\n";
14078
14079
$rv .= Html2::tag(\%style);
14080
}
14081
14082
{ my %msgdiv;
14083
$msgdiv{tag} = "div";
14084
$msgdiv{class} = "msgdivgrid";
14085
$msgdiv{style} = "grid-area: msgdiv;";
14086
14087
{ my %from;
14088
$from{tag} = "div";
14089
$from{class} = "normal-panel";
14090
$from{style} = "grid-area: from;";
14091
$from{innerHTML} = "From: " . Html2::profile_link($hash{from_ID});
14092
14093
$msgdiv{innerHTML} .= Html2::tag(\%from);
14094
}
14095
14096
{ my %date;
14097
$date{tag} = "div";
14098
$date{class} = "padded-left-right sunken nowrap";
14099
$date{style} = "grid-area: date;";
14100
$date{innerHTML} = "Sent: " . Html2::embolden(Date::expand_date($hash{sent}));
14101
14102
$msgdiv{innerHTML} .= Html2::tag(\%date);
14103
}
14104
14105
{ my %to;
14106
$to{tag} = "div";
14107
$to{class} = "normal-panel";
14108
$to{style} = "grid-area: to;";
14109
$to{innerHTML} = "To: ";
14110
if ($Bc_sql::LOGGEDIN eq $hash{to_ID}) {
14111
$to{innerHTML} .= "You";
14112
} else {
14113
$to{innerHTML} .= Html2::profile_link($hash{to_ID});
14114
}
14115
14116
$msgdiv{innerHTML} .= Html2::tag(\%to);
14117
}
14118
14119
{ my %subject;
14120
$subject{tag} = "div";
14121
$subject{class} = "normal-panel";
14122
$subject{style} = "grid-area: subject;";
14123
$subject{innerHTML} = "Subject: " . Html2::embolden(shorten_str(uri_unescape($hash{subject}), 111));
14124
14125
$msgdiv{innerHTML} .= Html2::tag(\%subject);
14126
}
14127
14128
{ my %msg;
14129
$msg{tag} = "div";
14130
$msg{class} = "padded-small sunken scrolling_vertical-auto";
14131
$msg{style} = "grid-area: msg; margin-top: 10px;max-width: 940px;";
14132
$msg{innerHTML} = uri_unescape($hash{msg});
14133
14134
$msgdiv{innerHTML} .= Html2::tag(\%msg);
14135
}
14136
14137
$rv .= Html2::tag(\%msgdiv);
14138
}
14139
} else {
14140
$rv .= "msg id ($msgid) not found!" . Html2::br();
14141
}
14142
14143
} elsif ($subpage eq Bc_sql::get_constant("MAIL_COMPOSE_PAGE")) {
14144
14145
$rv .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td valign=center>";
14146
{ my %form;
14147
$form{tag} = "form";
14148
$form{action} = "/index.pl";
14149
$form{method} = "post";
14150
$form{innerHTML} = "";
14151
14152
# a dropdown is better suited for the "to" field than just
14153
# allowing the user to type anything they want.
14154
# and what if the user has clicked the "msg user" icon? this will be allowed
14155
# so let's get the list of fuck buddies
14156
my $to = Bc_misc::get_param(Bc_sql::get_constant("QUERY_MAIL_TO"));
14157
my $ms = Bc_misc::get_param(Bc_sql::get_constant("QUERY_MAIL_SUBJECT"));
14158
if ($ms) { $ms = "re: $ms"; } else { $ms = ""; }
14159
my @friends = get_user_friends($uid);
14160
# here, we're gonna see if the logged in user clicked "msg user" via a profile page
14161
if ($to) {
14162
my $nn = User::get_user_stat($to, "nickname");
14163
$form{innerHTML} .= Html2::profile_link($to);
14164
{ my %input;
14165
$input{tag} = "input";
14166
$input{type} = "hidden";
14167
$input{name} = "to";
14168
$input{value} = $to;
14169
14170
$form{innerHTML} .= Html2::tag(\%input) . Html2::br();
14171
}
14172
$form{innerHTML} .= "</td></tr><tr><td align=left valign=center>";
14173
$form{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
14174
$form{innerHTML} .= "Subject: ";
14175
$form{innerHTML} .= "</td><td>";
14176
{ my %input;
14177
$input{tag} = "input";
14178
$input{class} = "mailsubject";
14179
$input{name} = "subject";
14180
$input{placeholder} = "message description";
14181
$input{value} = $ms;
14182
$input{style} = "width: 345px;";
14183
14184
$form{innerHTML} .= Html2::tag(\%input);
14185
}
14186
$form{innerHTML} .= "</td></tr></table>";
14187
$form{innerHTML} .= "</td></tr><tr><td align=center>";
14188
$form{innerHTML} .= Html2::hr();
14189
$form{innerHTML} .= "</td></tr><tr><td align=center>";
14190
{ my %ta;
14191
$ta{tag} = "textarea";
14192
$ta{placeholder} = "your message here";
14193
$ta{rows} = "15";
14194
$ta{name} = "body";
14195
$ta{class} = "mailbody";
14196
14197
$form{innerHTML} .= Html2::tag(\%ta);
14198
}
14199
$form{innerHTML} .= "</td></tr><tr><td align=center>";
14200
$form{innerHTML} .= Html2::hr();
14201
$form{innerHTML} .= "</td></tr><tr><td align=center>";
14202
# insert the appropriate hidden form data
14203
{ my %input;
14204
$input{tag} = "input";
14205
$input{type} = "hidden";
14206
$input{name} = $Bc_sql::QUERY_PAGE;
14207
$input{value} = Bc_sql::get_constant("MAIL_PAGE");
14208
14209
$form{innerHTML} .= Html2::tag(\%input);
14210
}
14211
14212
{ my %input;
14213
$input{tag} = "input";
14214
$input{type} = "hidden";
14215
$input{name} = Bc_sql::get_constant("QUERY_MAIL_PAGE");
14216
$input{value} = Bc_sql::get_constant("MAIL_SENT_PAGE");
14217
14218
$form{innerHTML} .= Html2::tag(\%input);
14219
}
14220
14221
{ my %button;
14222
$button{tag} = "button";
14223
$button{type} = "submit";
14224
$button{class} = "green giant-font-size";
14225
$button{innerHTML} = "Send";
14226
14227
$form{innerHTML} .= Html2::tag(\%button);
14228
}
14229
} elsif (@friends) {
14230
$form{innerHTML} .= "<table border=$TABLE_BORDER cellspacing=0 cellpadding=0 width=100%><tr><td>";
14231
$form{innerHTML} .= "To:";
14232
$form{innerHTML} .= "</td></tr><tr><td align=center>";
14233
{ my %select;
14234
$select{tag} = "select";
14235
$select{class} = "mailto";
14236
$select{name} = "to";
14237
$select{innerHTML} = "";
14238
14239
foreach my $fid (@friends) {
14240
my %option;
14241
$option{tag} = "option";
14242
$option{value} = $fid;
14243
$option{innerHTML} = User::get_user_stat($fid, "nickname");
14244
14245
$select{innerHTML} .= Html2::tag(\%option);
14246
}
14247
$form{innerHTML} .= Html2::tag(\%select);
14248
}
14249
$form{innerHTML} .= "</td></tr></table>";
14250
14251
$form{innerHTML} .= "</td></tr><tr><td>";
14252
$form{innerHTML} .= "Subject:";
14253
$form{innerHTML} .= "</td></tr><tr><td align=center>";
14254
$form{innerHTML} .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
14255
{ my %input;
14256
$input{tag} = "input";
14257
$input{class} = "mailsubject";
14258
$input{name} = "subject";
14259
$input{size} = "75";
14260
14261
$form{innerHTML} .= Html2::tag(\%input);
14262
}
14263
$form{innerHTML} .= "</td></tr></table>";
14264
$form{innerHTML} .= "</td></tr><tr><td align=center>";
14265
$form{innerHTML} .= Html2::hr();
14266
$form{innerHTML} .= "</td></tr><tr><td align=center>";
14267
{ my %ta;
14268
$ta{tag} = "textarea";
14269
$ta{placeholder} = "you message here";
14270
$ta{rows} = "15";
14271
$ta{class} = "mailbody";
14272
$ta{name} = "body";
14273
14274
$form{innerHTML} .= Html2::tag(\%ta);
14275
}
14276
$form{innerHTML} .= "</td></tr><tr><td align=center>";
14277
$form{innerHTML} .= Html2::hr();
14278
$form{innerHTML} .= "</td></tr><tr><td align=center>";
14279
# insert the appropriate hidden form data
14280
{ my %input;
14281
$input{tag} = "input";
14282
$input{type} = "hidden";
14283
$input{name} = $Bc_sql::QUERY_PAGE;
14284
$input{value} = Bc_sql::get_constant("MAIL_PAGE");
14285
14286
$form{innerHTML} .= Html2::tag(\%input);
14287
}
14288
14289
{ my %input;
14290
$input{tag} = "input";
14291
$input{type} = "hidden";
14292
$input{name} = Bc_sql::get_constant("QUERY_MAIL_PAGE");
14293
$input{value} = Bc_sql::get_constant("MAIL_SENT_PAGE");
14294
14295
$form{innerHTML} .= Html2::tag(\%input);
14296
}
14297
14298
{ my %button;
14299
$button{tag} = "button";
14300
$button{type} = "submit";
14301
$button{class} = "big_green_button";
14302
$button{innerHTML} = "Send";
14303
14304
$form{innerHTML} .= Html2::tag(\%button);
14305
}
14306
} else {
14307
$form{innerHTML} .= "There are no users on your fuck buddies list!" . Html2::br();
14308
{ my %link;
14309
$link{tag} = "a";
14310
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("SEARCH_PAGE");
14311
$link{innerHTML} = "Find";
14312
14313
$form{innerHTML} .= Html2::tag(\%link);
14314
}
14315
$form{innerHTML} .= " a fuck buddy to message..." . Html2::br();
14316
}
14317
14318
$rv .= Html2::tag(\%form);
14319
} # end form
14320
$rv .= "</td></tr></table>";
14321
14322
} elsif ($subpage eq Bc_sql::get_constant("MAIL_DELMSG_PAGE")) {
14323
14324
# first, grab the url parameters
14325
my $mid = Bc_misc::get_param(Bc_sql::get_constant("QUERY_MSGID"));
14326
my $mdata = Bc_sql::sql_execute("select * from messages where ID=" . $Bc_sql::DB->quote($mid), "display mail");
14327
my $uid = 0;
14328
if (ref $mdata eq "HASH") { $uid = $mdata->{UID}; }
14329
# next, ensure the msg ID exists
14330
if (Bc_sql::user_exists($uid) and msg_exists($mid) and not is_flagged($uid, $mid, "m")) {
14331
# then let's make certain the msg we are deleting really belongs to uid
14332
my $check = "select to_ID from messages where ID = " . $Bc_sql::DB->quote($mid);
14333
my $check_results = Bc_sql::sql_execute($check, "Html.pm - display mail, 1");
14334
if (ref $check_results eq "HASH") {
14335
if ($check_results->{to_ID} eq $uid) {
14336
# once all is confirmed, delete the fucker
14337
my $sql = "delete from messages where ID = " . $Bc_sql::DB->quote($mid);
14338
my $results = Bc_sql::sql_execute($sql, "Html.pm - display mail, 2");
14339
if ($results) {
14340
$rv .= "msg deleted...";
14341
} else {
14342
$rv .= "msg not deleted!" . Html2::br();
14343
}
14344
} else {
14345
$rv .= "msg not deleted (not yours)!" . Html2::br();
14346
}
14347
} else {
14348
$rv .= "msg not found!" . Html2::br();
14349
}
14350
} else {
14351
$rv .= "message is flagged, not deleted" . Html2::br();
14352
}
14353
} elsif ($subpage eq Bc_sql::get_constant("MAIL_SENT_PAGE")) {
14354
14355
# first, grab the url params
14356
my $to = Bc_misc::get_param("to");
14357
my $subject = Bc_misc::get_param("subject");
14358
my $msg = Bc_misc::get_param("body");
14359
14360
# next, make certain the uid provided in $to is valid!
14361
if (Bc_sql::user_exists($to) and not blockedUser($to)) {
14362
# now, make sure the msg contains something...
14363
if ($msg) {
14364
# okay...good enough for now
14365
my $toname = User::get_user_stat($to, "nickname");
14366
$toname = Html2::profile_link($to);
14367
my %msgdata;
14368
$msgdata{ID} = new_msgid();
14369
$msgdata{recipient} = $to;
14370
$msgdata{sender} = $Bc_sql::LOGGEDIN;
14371
$msgdata{subject} = $subject;
14372
$msgdata{body} = $msg;
14373
$msgdata{sent} = Date::get_today("db");
14374
$msgdata{sent_time} = get_time(0, 1);
14375
14376
my $sql = "insert into messages values(";
14377
$sql .= $Bc_sql::DB->quote($msgdata{ID});
14378
$sql .= ", " . $Bc_sql::DB->quote($msgdata{sender});
14379
$sql .= ", " . $Bc_sql::DB->quote($msgdata{recipient});
14380
$sql .= ", " . $Bc_sql::DB->quote($msgdata{sent});
14381
$sql .= ", " . $Bc_sql::DB->quote($msgdata{subject});
14382
$sql .= ", " . $Bc_sql::DB->quote($msgdata{body});
14383
$sql .= ", '1', '1'";
14384
#$sql .= ", " . $Bc_sql::DB->quote($msgdata{sent_time});
14385
$sql .= ")";
14386
my $results = Bc_sql::sql_execute($sql, "Html.pm - display mail, 3");
14387
if ($results > 0) {
14388
$rv .= "Your message has been delivered." . Html2::br();
14389
} else {
14390
$rv .= "Strange...it seems your message has been rendered undeliverable ($results)!" . Html2::br();
14391
}
14392
} # end if msg contains any thing
14393
else {
14394
$rv .= "no msg body";
14395
}
14396
} # end if user exists
14397
else {
14398
$rv .= "no such user ($to)";
14399
}
14400
14401
# end of elsif ($subpage eq Bc_sql::get_constant("MAIL_SENT_PAGE"))
14402
} elsif ($subpage eq Bc_sql::get_constant("MAIL_EMPTY_PAGE")) {
14403
# immediately empties the user's inbox of all unflagged messages
14404
# this will not be undoable, purposefully
14405
14406
# get a list of this user's msgs (read and unread)
14407
# then remove from the list those that are "flagged"
14408
# and finally, delete those that remain
14409
my @msgs = get_user_messages($Bc_sql::LOGGEDIN);
14410
if (@msgs) {
14411
foreach my $msg (@msgs) {
14412
# is this msg flagged?
14413
my $msgData = get_user_message($msg);
14414
if (not is_flagged($msgData->{ID}, $msg, "m")) {
14415
my $delmsgsql = "delete from messages where ID=" . $Bc_sql::DB->quote($msgData->{ID});
14416
if (Bc_sql::sql_execute($delmsgsql, "display mail")) {
14417
$rv .= "$msg deleted" . Html2::br();
14418
} else {
14419
$rv .= "$msg not deleted" . Html2::br();
14420
}
14421
} else {
14422
$rv .= "$msg is flagged and thus was not deleted" . Html2::br();
14423
}
14424
}
14425
} else {
14426
$rv .= "no messages to delete!" . Html2::br();
14427
}
14428
# end of elsif ($subpage eq Bc_sql::get_constant("MAIL_EMPTY_PAGE"))
14429
} else {
14430
$rv .= "mmm...ailbbox conn" . Html2::br();
14431
$rv .= "unable to process inquiry, please restate!" . Html2::br();
14432
# end else of elsif ($subpage eq Bc_sql::get_constant("MAIL_EMPTY_PAGE"))
14433
}
14434
} else {
14435
$rv .= "mmm...ailbbox conn" . Html2::br();
14436
$rv .= "unable to process inquiry, please restate!" . Html2::br();
14437
}
14438
14439
# now, take $rv's contents, and stuff it all inside a container! :)
14440
# this container will be a grid and wrap $rv!
14441
# which means we also need to prepend some css to $rv
14442
14443
{ my %container;
14444
$container{tag} = "div";
14445
$container{class} = "msgcontainer";
14446
$container{innerHTML} = $rv;
14447
14448
$rv = Html2::tag(\%container);
14449
}
14450
14451
{ my %style;
14452
$style{tag} = "style";
14453
$style{innerHTML} = "\n" .
14454
".msgcontainer {\n" .
14455
" display: grid;\n" .
14456
" grid-template-areas: 'msgtitle' 'msgnav' 'msgdiv';\n" .
14457
" grid-template-columns: 1fr;\n" .
14458
" grid-template-rows: min-content min-content 1fr;\n" .
14459
" grid-gap: 8px;\n" .
14460
" padding-top: 15px;\n" .
14461
"}\n" .
14462
"\n" .
14463
"\n";
14464
14465
$rv = Html2::tag(\%style) . $rv;
14466
}
14467
14468
return $rv; # a scalar
14469
#usage: print display_mail("inbox", "");
14470
}
14471
14472
########################
14473
sub display_mod_page(;$$) {
14474
#*
14475
# shows an interface for moderators
14476
# this ought to be a moderator account's
14477
# "homepage", instead of the norm.
14478
#*
14479
my ($page, $spacing) = @_; # a sub-page (optional) && spacing for pretty printing HTML output (optional)
14480
if (!$spacing) { $spacing = ""; }
14481
my $TITLE = "Moderator Home";
14482
my $uid = Bc_misc::get_param($Bc_sql::QUERY_UID);
14483
14484
my $MOD_PAGE = Bc_sql::get_constant("MOD_PAGE");
14485
my $QUERY_MOD_PAGE = Bc_sql::get_constant("QUERY_MOD_PAGE");
14486
14487
if ($page eq "msg") { $TITLE = "Message " . Html2::italicize(User::get_user_stat($uid, "nickname")); }
14488
if ($page eq "ban") { $TITLE = "Ban Profile for " . Html2::italicize(User::get_user_stat($uid, "nickname")); }
14489
if ($page eq "fm") {
14490
if (not Bc_sql::user_exists($uid)) {
14491
# then maybe we were given a nickname in $uid?
14492
$uid = get_uid_byNickname($uid);
14493
if (not Bc_sql::user_exists($uid)) {
14494
print pre_html_header();
14495
print "no such uid: $uid";
14496
exit 1;
14497
}
14498
}
14499
$TITLE = "All Flags for " . Html2::italicize(User::get_user_stat($uid, "nickname"));
14500
}
14501
if ($page eq "flagged") {
14502
if (Bc_sql::user_exists($uid)) {
14503
$TITLE = Html2::embolden(Bc_misc::word_as_possessive(User::get_user_stat($uid, "nickname"))) . " flagged content";
14504
} else {
14505
$TITLE = "uid " . Html2::embolden($uid) . " doesn't exist";
14506
}
14507
}
14508
14509
my $rv = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td class=spacery_large>";
14510
$rv .= "</tr><tr><td align=center>";
14511
$rv .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td class='subnavbar subtitle'> $TITLE </td></tr></table>";
14512
$rv .= "</tr><tr><td class=spacery_largest>";
14513
$rv .= "</tr><tr><td align=center>";
14514
14515
if ($page) {
14516
# msg, ban, feedback, reset pw
14517
14518
if ($page eq "msg") {
14519
my $modmsgs = Bc_sql::sql_execute("select * from mod_msgs", "display mod page");
14520
if (ref $modmsgs eq "ARRAY") {
14521
my @msgRefs = @$modmsgs;
14522
$rv .= "messages sent from here will be sent to the user's email and site inbox" . Html2::br() . Html2::br();
14523
14524
$rv .= "<table border=$TABLE_BORDER cellpadding=5 cellspacing=0><tr class=subnavbar><td nowrap>";
14525
{ my %input;
14526
$input{tag} = "input";
14527
$input{type} = "hidden";
14528
$input{name} = $Bc_sql::QUERY_PAGE;
14529
$input{value} = $MOD_PAGE;
14530
14531
$rv .= Html2::tag(\%input);
14532
}
14533
$rv .= "Subject ";
14534
14535
{ my %select;
14536
$select{tag} = "select";
14537
$select{name} = "msgid";
14538
$select{innerHTML} = "";
14539
14540
foreach my $msg (@msgRefs) {
14541
my %option;
14542
$option{tag} = "option";
14543
$option{value} = $msg->{ID};
14544
$option{innerHTML} = $msg->{subject};
14545
14546
$select{innerHTML} .= Html2::tag(\%option);
14547
}
14548
14549
$rv .= Html2::tag(\%select);
14550
}
14551
$rv .= "</td><td> </td><td nowrap>";
14552
$rv .= "Reason ";
14553
{ my %select;
14554
$select{tag} = "select";
14555
$select{name} = "reason";
14556
$select{innerHTML} = "";
14557
14558
{ my %option;
14559
$option{tag} = "option";
14560
$option{value} = "0";
14561
$option{innerHTML} = "Harassment";
14562
14563
$select{innerHTML} .= Html2::tag(\%option);
14564
}
14565
14566
{ my %option;
14567
$option{tag} = "option";
14568
$option{value} = "1";
14569
$option{innerHTML} = "Reached Max Violations";
14570
14571
$select{innerHTML} .= Html2::tag(\%option);
14572
}
14573
14574
{ my %option;
14575
$option{tag} = "option";
14576
$option{value} = "2";
14577
$option{innerHTML} = "Repeated Violations of Terms";
14578
14579
$select{innerHTML} .= Html2::tag(\%option);
14580
}
14581
14582
{ my %option;
14583
$option{tag} = "option";
14584
$option{value} = "3";
14585
$option{innerHTML} = "Court Ordered";
14586
14587
$select{innerHTML} .= Html2::tag(\%option);
14588
}
14589
14590
$rv .= Html2::tag(\%select);
14591
}
14592
$rv .= "</td></tr><tr><td colspan=3 height=10>";
14593
$rv .= "</td></tr><tr><td align=center colspan=3>";
14594
{ my %button;
14595
$button{tag} = "button";
14596
$button{type} = "button";
14597
$button{class} = "green";
14598
$button{innerHTML} = "Send";
14599
14600
$rv .= Html2::tag(\%button);
14601
}
14602
$rv .= "</td></tr></table>";
14603
} else {
14604
$rv .= "no msgs" . Html2::br();
14605
}
14606
14607
} elsif ($page eq "ban") {
14608
14609
if (User::isUserModerator($uid)) {
14610
$rv .= "This user cannot be banned" . Html2::br();
14611
} else {
14612
my $banned = banned($uid);
14613
if ($banned) {
14614
$rv .= Html2::small("Your User ID: " . Html2::embolden($Bc_sql::LOGGEDIN)) . Html2::br() . Html2::br();
14615
$rv .= "This member was banned for ";
14616
{ my %bold;
14617
$bold{tag} = "b";
14618
14619
my $sql = "select why from bans where BID=" . $Bc_sql::DB->quote($uid);
14620
my $r = Bc_sql::sql_execute($sql, "display mod page");
14621
14622
if (ref $r eq "HASH") {
14623
my $words = get_reason_asWord($r->{why});
14624
$bold{innerHTML} = "$words";
14625
} else {
14626
$bold{innerHTML} = "(unknown)";
14627
}
14628
$rv .= Html2::tag(\%bold) . Html2::br();
14629
}
14630
14631
$rv .= "Banned by: " . Html2::embolden(User::get_user_stat($banned->{ByID}, "nickname")) . Html2::br() . Html2::br() . Html2::br();
14632
14633
{ my %form;
14634
$form{tag} = "form";
14635
$form{method} = "post";
14636
$form{action} = "/ban.pl";
14637
$form{innerHTML} = "";
14638
14639
{ my %input;
14640
$input{tag} = "input";
14641
$input{type} = "hidden";
14642
$input{name} = $Bc_sql::QUERY_UID;
14643
$input{value} = $uid;
14644
14645
$form{innerHTML} .= Html2::tag(\%input);
14646
}
14647
14648
{ my %input;
14649
$input{tag} = "input";
14650
$input{type} = "hidden";
14651
$input{name} = "u";
14652
$input{value} = "1";
14653
14654
$form{innerHTML} .= Html2::tag(\%input);
14655
}
14656
14657
{ my %button;
14658
$button{tag} = "button";
14659
$button{type} = "reset";
14660
$button{class} = "yellow";
14661
$button{innerHTML} = " Unban User ";
14662
14663
$form{innerHTML} .= Html2::tag(\%button);
14664
}
14665
14666
$rv .= Html2::tag(\%form) . Html2::br();
14667
}
14668
} else {
14669
$rv .= "Your User ID: " . Html2::embolden($Bc_sql::LOGGEDIN) . Html2::br() . Html2::br();
14670
$rv .= "Select the Reason for Banning this user" . Html2::br();
14671
14672
{ my %form;
14673
$form{tag} = "form";
14674
$form{method} = "post";
14675
$form{action} = "/ban.pl";
14676
$form{innerHTML} = "";
14677
14678
{ my %input;
14679
$input{tag} = "input";
14680
$input{type} = "hidden";
14681
$input{name} = $Bc_sql::QUERY_UID;
14682
$input{value} = $uid;
14683
14684
$form{innerHTML} .= Html2::tag(\%input);
14685
}
14686
14687
my @reasons = get_reasons(); # a list of hash references, each hash ref is a reason code and text
14688
$form{innerHTML} .= dropdown("reason", "", 0, "", "", "", "style='margin: 0 0 8px 0;'", Html2::br(), \@reasons, 0);
14689
14690
{ my %button;
14691
$button{tag} = "button";
14692
$button{type} = "button";
14693
$button{class} = "red";
14694
$button{innerHTML} = "Cancel";
14695
14696
$form{innerHTML} .= Html2::tag(\%button) . Html2::br();
14697
}
14698
14699
$rv .= Html2::tag(\%form) . Html2::br();
14700
}
14701
}
14702
}
14703
14704
} elsif ($page eq "flagged") {
14705
14706
$rv =~ s/align=center>$/>/;
14707
$rv .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0 height=150 width=350><tr><td valign=top>";
14708
14709
if (Bc_sql::user_exists($uid)) {
14710
my $sql = "select * from flagged where status='pending' and UID=" . $Bc_sql::DB->quote($uid);
14711
my $results = Bc_sql::sql_execute($sql, "display mod page");
14712
if (ref $results eq "HASH") {
14713
if ($results->{flagger_reason} =~ /^nickname /i) {
14714
$results->{flagger_reason} =~ s/^nickname /<a href='\/?$Bc_sql::QUERY_PAGE=$Bc_sql::PROFILE_PAGE&$Bc_sql::QUERY_UID=$results->{UID}'>nickname<\/a> /i;
14715
14716
$rv .= Html2::embolden($results->{status}) . ":" . Html2::italicize($results->{flagger_reason}) . Html2::br();
14717
} elsif ($results->{flagger_reason} =~ /^message /i) {
14718
my %link;
14719
$link{tag} = "a";
14720
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE") . "&" . Bc_sql::get_constant("QUERY_MSGID") . "=$results->{content_ID}";
14721
$link{innerHTML} = "message";
14722
14723
my $r = Html2::tag(\%link);
14724
$results->{flagger_reason} =~ s/^message /$r /i;
14725
14726
$rv .= Html2::embolden($results->{status}) . ":" . Html2::italicize($results->{flagger_reason}) . Html2::br();
14727
} elsif ($results->{flagger_reason} =~ /^description /i) {
14728
my $r = Html2::profile_link({UID=>$results->{UID}, innerHTML=>"description"});
14729
$results->{flagger_reason} =~ s/^description /$r /i;
14730
14731
$rv .= Html2::embolden($results->{status}) . ":" . Html2::italicize($results->{flagger_reason}) . Html2::br();
14732
} elsif ($results->{flagger_reason} =~ /^image /i) {
14733
my $r = Html2::profile_link({UID=>$results->{UID}, innerHTML=>"image"});
14734
$results->{flagger_reason} =~ s/^image /$r /i;
14735
14736
$rv .= Html2::embolden($results->{status}) . ":" . Html2::italicize($results->{flagger_reason}) . Html2::br();
14737
} else {
14738
$rv .= Html2::embolden($results->{status}) . ":" . Html2::italicize($results->{flagger_reason}) . Html2::br();
14739
}
14740
} else {
14741
if (@$results) {
14742
my %div;
14743
$div{tag} = "div";
14744
$div{class} = "scrolling_vertical";
14745
$div{innerHTML} = "";
14746
14747
foreach my $flag (@$results) {
14748
if ($flag->{flagger_reason} =~ /^nickname/i) {
14749
$flag->{flagger_reason} =~ s/^nickname/Html2::profile_link($flag->{UID})/ie;
14750
14751
$div{innerHTML} .= Html2::embolden($flag->{status}) . ":" . Html2::italicize($flag->{flagger_reason}) . Html2::br();
14752
} elsif ($flag->{flagger_reason} =~ /^message /i) {
14753
my %link;
14754
$link{tag} = "a";
14755
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("MAIL_PAGE") . "&" . Bc_sql::get_constant("QUERY_MAIL_PAGE") . "=" . Bc_sql::get_constant("MAIL_VIEW_MSG_PAGE") . "&" . Bc_sql::get_constant("QUERY_MSGID") . "=$flag->{content_ID}";
14756
$link{innerHTML} = "message";
14757
my $r = Html2::tag(\%link);
14758
$flag->{flagger_reason} =~ s/^message /$r /i;
14759
14760
$div{innerHTML} .= Html2::embolden($flag->{status}) . ":" . Html2::italicize($flag->{flagger_reason}) . Html2::br();
14761
} elsif ($flag->{flagger_reason} =~ /^description /i) {
14762
my $r = Html2::profile_link({UID=>$flag->{UID}, innerHTML=>"description"});
14763
$flag->{flagger_reason} =~ s/^description /$r /i;
14764
14765
$div{innerHTML} .= Html2::embolden($flag->{status}) . ":" . Html2::italicize($flag->{flagger_reason}) . Html2::br();
14766
} elsif ($flag->{flagger_reason} =~ /^image /i) {
14767
my %link;
14768
$link{tag} = "a";
14769
$link{href} = "/getimage.pl?id=$flag->{content_ID}&m=$Bc_sql::LOGGEDIN&" . Bc_sql::get_constant("FLAG_ID") . "=$flag->{ID}";
14770
$link{innerHTML} = "image";
14771
14772
my $r = Html2::tag(\%link);
14773
$flag->{flagger_reason} =~ s/^image /$r /i;
14774
14775
$div{innerHTML} .= Html2::embolden($flag->{status}) . ":" . Html2::italicize($flag->{flagger_reason}) . Html2::br();
14776
} else {
14777
$div{innerHTML} .= Html2::embolden($flag->{status}) . ":" . Html2::italicize($flag->{flagger_reason}) . Html2::br();
14778
}
14779
}
14780
14781
$rv .= Html2::tag(\%div);
14782
} else {
14783
my %div;
14784
$div{tag} = "div";
14785
$div{class} = "yellow";
14786
$div{innerHTML} = "No Flagged Content was Found";
14787
14788
$rv .= Html2::br() . Html2::tag(\%div);
14789
}
14790
}
14791
}
14792
14793
$rv .= "</td></tr></table>";
14794
14795
} elsif ($page eq "fm") {
14796
# flags manager
14797
my %frame;
14798
$frame{tag} = "iframe";
14799
$frame{class} = "rounded";
14800
$frame{src} = "/edit_uflags.pl?$Bc_sql::QUERY_UID=$uid";
14801
$frame{height} = "375";
14802
$frame{width} = "430";
14803
14804
$rv .= Html2::tag(\%frame);
14805
14806
} else {
14807
$rv .= "no such page: $page";
14808
}
14809
14810
$rv .= "</td></tr><tr><td class=spacery_large>";
14811
$rv .= "</td></tr><tr><td align=center>";
14812
{ my %button;
14813
$button{tag} = "button";
14814
$button{type} = "button";
14815
$button{class} = "yellow padded-large";
14816
$button{onclick} = "document.location=\"/?$Bc_sql::QUERY_PAGE=$MOD_PAGE\";";
14817
if ($page eq "flagged" and not Bc_sql::user_exists($uid))
14818
{ $button{title} = "Alrighty then!"; } else
14819
{ $button{title} = "Cancel"; }
14820
14821
$rv .= Html2::tag(\%button);
14822
}
14823
14824
} # end if $page
14825
else {
14826
# meaning if (not $page) ...
14827
# show the moderator home page
14828
14829
{ my %flexbox;
14830
$flexbox{tag} = "div";
14831
$flexbox{class} = "modcontrolgrid";
14832
$flexbox{innerHTML} = "";
14833
14834
{ my %css;
14835
$css{tag} = "style";
14836
$css{innerHTML} = "\n" .
14837
".modcontrolgrid {\n" .
14838
" display: grid;\n" .
14839
" grid-template-areas: 'usercontrolgrid flaggedcontentgrid'" .
14840
" 'badnamesgrid badnamesgrid';" .
14841
" grid-template-columns: min-content 1fr;\n" .
14842
" grid-template-rows: min-content min-content;\n" .
14843
" gap: 15px;\n" .
14844
"}\n" .
14845
"\n" .
14846
".usercontrolgrid {\n" .
14847
" display: grid;\n" .
14848
" grid-area: usercontrolgrid;\n" .
14849
" grid-template-areas: '. usercontroltitle .'" .
14850
" 'nickname nickname profilebutton'\n" .
14851
" 'hr hr hr'\n" .
14852
" 'bannedusersbutton usermanbutton userfeedbutton';\n" .
14853
" grid-template-columns: min-content min-content min-content;\n" .
14854
" grid-template-rows: min-content min-content min-content min-content;\n" .
14855
"}\n" .
14856
"\n" .
14857
".badnamesgrid {\n" .
14858
" display: grid;\n" .
14859
" grid-area: badnamesgrid;\n" .
14860
" grid-template-areas: 'badnamestitle badnamestitle'" .
14861
" 'badnamesadd badnamesdesc'\n" .
14862
" 'badnameslist badnamesdesc';\n" .
14863
" grid-template-columns: min-content min-content;\n" .
14864
" grid-template-rows: min-content min-content min-content;\n" .
14865
" gap: 15px;\n" .
14866
"}\n" .
14867
"\n" .
14868
"\@media (max-width: 1125px) {\n" .
14869
" .modcontrolgrid {\n" .
14870
" grid-template-areas: 'usercontrolgrid'" .
14871
" 'flaggedcontentgrid'\n" .
14872
" 'badnamesgrid';\n" .
14873
" grid-template-columns: min-content;\n" .
14874
" grid-template-rows: min-content min-content min-content;\n" .
14875
" }\n" .
14876
"\n" .
14877
"\@media (max-width: 1000px) {\n" .
14878
" .badnamesgrid {\n" .
14879
" grid-template-areas: 'badnamestitle'" .
14880
" 'badnamesdesc'\n" .
14881
" 'badnamesadd'\n" .
14882
" 'badnameslist';\n" .
14883
" grid-template-columns: min-content;\n" .
14884
" grid-template-rows: min-content min-content min-content min-content;\n" .
14885
" }\n" .
14886
"}\n" .
14887
"\n" .
14888
".flaggedcontentgrid {\n" .
14889
" display: grid;\n" .
14890
" grid-area: flaggedcontentgrid;\n" .
14891
" grid-template-areas: 'flaggedtitle' 'flaggedlist';" .
14892
" grid-template-columns: 1fr;\n" .
14893
" grid-template-rows: min-content 1fr;\n" .
14894
" gap: 15px;\n" .
14895
"}\n" .
14896
"\n" .
14897
"\n";
14898
14899
$flexbox{innerHTML} .= Html2::tag(\%css);
14900
} # end css
14901
14902
{ my %usercontrol;
14903
$usercontrol{tag} = "form";
14904
$usercontrol{method} = "post";
14905
$usercontrol{action} = "/";
14906
$usercontrol{class} = "usercontrolgrid normal-panel padded";
14907
$usercontrol{innerHTML} = "";
14908
14909
{ my %title;
14910
$title{tag} = "div";
14911
$title{class} = "subnavbar_dark nowrap min-content";
14912
$title{style} = "grid-area: usercontroltitle; margin-bottom: 15px;";
14913
$title{innerHTML} = "User Control";
14914
14915
$usercontrol{innerHTML} .= Html2::tag(\%title);
14916
} # end title
14917
14918
{ my %nickname;
14919
$nickname{tag} = "input";
14920
$nickname{style} = "grid-area: nickname; width: 100%;";
14921
$nickname{placeholder} = "UID or Nickname";
14922
$nickname{title} = "Type in a Member's Name or UID";
14923
$nickname{name} = "nn";
14924
$nickname{required} = 1;
14925
14926
$usercontrol{innerHTML} .= Html2::tag(\%nickname);
14927
} # end nickname
14928
14929
{ my %profilebutton;
14930
$profilebutton{tag} = "button";
14931
$profilebutton{type} = "submit";
14932
$profilebutton{class} = "green nowrap";
14933
$profilebutton{style} = "grid-area: profilebutton; margin-left: 8px;";
14934
$profilebutton{innerHTML} = "Profile";
14935
$profilebutton{name} = $Bc_sql::QUERY_PAGE;
14936
$profilebutton{value} = Bc_sql::get_constant("PROFILE_PAGE");
14937
14938
$usercontrol{innerHTML} .= Html2::tag(\%profilebutton);
14939
} # end profile button
14940
14941
{ my %hr;
14942
$hr{tag} = "hr";
14943
$hr{style} = "grid-area: hr;";
14944
14945
$usercontrol{innerHTML} .= Html2::tag(\%hr);
14946
} # end hr
14947
14948
{ my %usermanbutton;
14949
$usermanbutton{tag} = "button";
14950
$usermanbutton{type} = "button";
14951
$usermanbutton{class} = "purple";
14952
$usermanbutton{style} = "grid-area: usermanbutton;";
14953
$usermanbutton{innerHTML} = "User Manager";
14954
$usermanbutton{onclick} = "document.location='/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_USER_EDITOR_PAGE") . "';";
14955
14956
$usercontrol{innerHTML} .= Html2::tag(\%usermanbutton);
14957
} # end browse button
14958
14959
{ my %bannedusersbutton;
14960
$bannedusersbutton{tag} = "button";
14961
$bannedusersbutton{type} = "button";
14962
$bannedusersbutton{class} = "red";
14963
$bannedusersbutton{style} = "grid-area: bannedusersbutton;";
14964
$bannedusersbutton{innerHTML} = "Banned Users";
14965
$bannedusersbutton{onclick} = "document.location='/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_BANNED_USERS_PAGE") . "';";
14966
$bannedusersbutton{title} = $bannedusersbutton{onclick};
14967
14968
$usercontrol{innerHTML} .= Html2::tag(\%bannedusersbutton);
14969
} # end banned users button
14970
14971
{ my %userfeedbutton;
14972
$userfeedbutton{tag} = "button";
14973
$userfeedbutton{type} = "button";
14974
$userfeedbutton{class} = "blue";
14975
$userfeedbutton{style} = "grid-area: userfeedbutton;";
14976
$userfeedbutton{innerHTML} = "User Feedback";
14977
$userfeedbutton{onclick} = "document.location='/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("ADMIN_PAGE") . "&" . Bc_sql::get_constant("QUERY_ADMIN_PAGE") . "=" . Bc_sql::get_constant("ADMIN_FEEDBACK_INBOX_PAGE") . "';";
14978
14979
$usercontrol{innerHTML} .= Html2::tag(\%userfeedbutton);
14980
} # end banned users button
14981
14982
$flexbox{innerHTML} .= Html2::tag(\%usercontrol);
14983
} # end user control
14984
14985
{ my %badnamesgrid;
14986
$badnamesgrid{tag} = "div";
14987
$badnamesgrid{class} = "badnamesgrid normal-panel padded-large min-content";
14988
$badnamesgrid{innerHTML} = "";
14989
14990
{ my %title;
14991
$title{tag} = "div";
14992
$title{class} = "subnavbar_dark min-content nowrap centered";
14993
$title{style} = "grid-area: badnamestitle;";
14994
$title{innerHTML} = "Blacklisted Words";
14995
14996
$badnamesgrid{innerHTML} .= Html2::tag(\%title);
14997
} # end title
14998
14999
{ my %badnamesadd;
15000
$badnamesadd{tag} = "form";
15001
$badnamesadd{method} = "post";
15002
$badnamesadd{action} = "/addbadname.pl";
15003
$badnamesadd{class} = "nowrap normal-panel padded";
15004
$badnamesadd{style} = "grid-area: badnamesadd;";
15005
$badnamesadd{innerHTML} = "";
15006
15007
{ my %title;
15008
$title{tag} = "div";
15009
$title{class} = "subnavbar_dark block min-content";
15010
$title{style} = "margin-bottom: 5px;";
15011
$title{innerHTML} = "Add Word";
15012
15013
$badnamesadd{innerHTML} .= Html2::tag(\%title);
15014
} # end title
15015
15016
{ my %hiddeninput;
15017
$hiddeninput{tag} = "input";
15018
$hiddeninput{type} = "hidden";
15019
$hiddeninput{name} = "rt";
15020
$hiddeninput{value} = "mod";
15021
15022
$badnamesadd{innerHTML} .= Html2::tag(\%hiddeninput);
15023
} # end hidden input for redirection to here
15024
15025
{ my %input;
15026
$input{tag} = "input";
15027
$input{type} = "text";
15028
$input{style} = "width: 123px;";
15029
$input{placeholder} = "bad word here";
15030
$input{title} = "Type a word into this textbox";
15031
$input{required} = 1;
15032
15033
$badnamesadd{innerHTML} .= Html2::tag(\%input);
15034
} # end text input
15035
15036
{ my %button;
15037
$button{tag} = "button";
15038
$button{class} = "green";
15039
$button{innerHTML} = $checkmark;
15040
$button{title} = "Add Word to Blacklist";
15041
15042
$badnamesadd{innerHTML} .= Html2::tag(\%button);
15043
} # end add button
15044
15045
$badnamesgrid{innerHTML} .= Html2::tag(\%badnamesadd);
15046
} # end add bad word
15047
15048
{ my %badnameslist;
15049
$badnameslist{tag} = "div";
15050
$badnameslist{style} = "grid-area: badnameslist;";
15051
$badnameslist{innerHTML} = "";
15052
15053
{ my %scrollingcontainer;
15054
$scrollingcontainer{tag} = "div";
15055
$scrollingcontainer{class} = "sunken scrolling_vertical padded";
15056
$scrollingcontainer{style} = "width: 100%; height: 100px;";
15057
15058
my $sql = "select * from badnames order by name asc";
15059
my $badnames = Bc_sql::sql_execute($sql, "Html::display_mod_page()", 1);
15060
foreach my $word (@$badnames) {
15061
{ my %form;
15062
$form{tag} = "form";
15063
$form{class} = "nowrap";
15064
$form{method} = "post";
15065
$form{action} = "/addbadname.pl";
15066
$form{innerHTML} = "";
15067
15068
{ my %hiddeninput;
15069
$hiddeninput{tag} = "input";
15070
$hiddeninput{type} = "hidden";
15071
$hiddeninput{name} = "ID";
15072
$hiddeninput{value} = $word->{ID};
15073
15074
$form{innerHTML} .= Html2::tag(\%hiddeninput);
15075
} # end hidden input for $word->{ID}
15076
15077
{ my %hiddeninput;
15078
$hiddeninput{tag} = "input";
15079
$hiddeninput{type} = "hidden";
15080
$hiddeninput{name} = "rt";
15081
$hiddeninput{value} = "mod";
15082
15083
$form{innerHTML} .= Html2::tag(\%hiddeninput);
15084
} # end hidden input for redirection to here
15085
15086
{ my %input;
15087
$input{tag} = "input";
15088
$input{type} = "text";
15089
$input{style} = "width: 123px;";
15090
$input{placeholder} = "bad word here";
15091
$input{title} = "Type a word into this textbox";
15092
$input{required} = 1;
15093
$input{name} = "name";
15094
$input{value} = $word->{name};
15095
15096
$form{innerHTML} .= Html2::tag(\%input);
15097
} # end text input
15098
15099
{ my %submit;
15100
$submit{tag} = "button";
15101
$submit{type} = "submit";
15102
$submit{class} = "green";
15103
$submit{innerHTML} = $checkmark;
15104
15105
$form{innerHTML} .= Html2::tag(\%submit);
15106
} # end submit button
15107
15108
{ my %delete;
15109
$delete{tag} = "button";
15110
$delete{type} = "submit";
15111
$delete{class} = "red";
15112
$delete{innerHTML} = "x";
15113
$delete{name} = "d";
15114
$delete{value} = 1;
15115
15116
$form{innerHTML} .= Html2::tag(\%delete);
15117
} # end delete button
15118
15119
$scrollingcontainer{innerHTML} .= Html2::tag(\%form);
15120
} # end form
15121
} # end foreach $word in @$badnames
15122
15123
$badnameslist{innerHTML} .= Html2::tag(\%scrollingcontainer);
15124
} # end scrolling container
15125
15126
$badnamesgrid{innerHTML} .= Html2::tag(\%badnameslist);
15127
} # end bad names list
15128
15129
{ my %badnamesdesc;
15130
$badnamesdesc{tag} = "div";
15131
$badnamesdesc{class} = "red-panel nowrap min-content center padded";
15132
$badnamesdesc{style} = "grid-area: badnamesdesc; height: 100%; display: flex; align-items: center;";
15133
$badnamesdesc{innerHTML} = "";
15134
15135
{ my %note;
15136
$note{tag} = "div";
15137
$note{style} = "display: flex; gap: 15px;";
15138
$note{innerHTML} = "";
15139
15140
{ my %notetitle;
15141
$notetitle{tag} = "div";
15142
$notetitle{class} = "centered padding-none";
15143
$notetitle{innerHTML} = Html2::tag({tag=>"img", src=>"/images/site/denied1.png", width=>"64", height=>"70"});
15144
15145
$note{innerHTML} .= Html2::tag(\%notetitle);
15146
}
15147
15148
{ my %notetext;
15149
$notetext{tag} = "div";
15150
$notetext{innerHTML} = Html2::embolden("This is a words blacklist," . Html2::br() .
15151
"not a banned user list!") . Html2::br() . Html2::br();
15152
$notetext{innerHTML} .= "Words listed here will not be" . Html2::br() .
15153
"allowed in nicknames, descriptions," . Html2::br() .
15154
"and/or messages!";
15155
15156
$note{innerHTML} .= Html2::tag(\%notetext);
15157
}
15158
15159
$badnamesdesc{innerHTML} .= Html2::tag(\%note);
15160
}
15161
15162
$badnamesgrid{innerHTML} .= Html2::tag(\%badnamesdesc);
15163
} # end bad names desc
15164
15165
$flexbox{innerHTML} .= Html2::tag(\%badnamesgrid);
15166
} # end bad names grid
15167
15168
{ my %flaggedcontentgrid;
15169
$flaggedcontentgrid{tag} = "div";
15170
$flaggedcontentgrid{class} = "flaggedcontentgrid normal-panel padded";
15171
$flaggedcontentgrid{innerHTML} = "";
15172
15173
{ my %title;
15174
$title{tag} = "div";
15175
$title{style} = "grid-area: flaggedtitle; margin-bottom: 15px;";
15176
$title{class} = "subnavbar_dark nowrap";
15177
$title{innerHTML} = "Flagged Content";
15178
15179
$flaggedcontentgrid{innerHTML} .= Html2::tag(\%title);
15180
} # end flagged content title div
15181
15182
{ my %list;
15183
$list{tag} = "div";
15184
$list{class} = "scrolling_vertical sunken text-align-left";
15185
$list{style} = "grid-area: flaggedlist;" .
15186
"height: 72px;" .
15187
"width: 100%;";
15188
15189
my $list = Bc_sql::get_flagged();
15190
if ($list) {
15191
if (@$list) {
15192
foreach my $item (@$list) {
15193
# $item is a hash reference
15194
{ my %flaggeditemdiv;
15195
$flaggeditemdiv{tag} = "div";
15196
$flaggeditemdiv{class} = "hoverborder rounded nowrap text-align-left padded-left-right min-content";
15197
15198
my $flagged_nn = User::get_user_stat($item->{UID}, "nickname");
15199
15200
$flaggeditemdiv{innerHTML} .= Html2::profile_link($item->{UID});
15201
$flaggeditemdiv{innerHTML} .= " ";
15202
15203
if ($item->{type} eq "i") {
15204
my %imglink;
15205
$imglink{tag} = "a";
15206
$imglink{href} = $item->{link};
15207
$imglink{innerHTML} = "image";
15208
15209
$flaggeditemdiv{innerHTML} .= Html2::tag(\%imglink);
15210
} elsif ($item->{type} eq "m") {
15211
my %imglink;
15212
$imglink{tag} = "a";
15213
$imglink{href} = $item->{link};
15214
$imglink{innerHTML} = "message";
15215
$imglink{title} = "View Message";
15216
15217
$flaggeditemdiv{innerHTML} .= Html2::tag(\%imglink);
15218
} elsif ($item->{type} eq "n") {
15219
$flaggeditemdiv{innerHTML} .= "nickname";
15220
} elsif ($item->{type} eq "d") {
15221
$flaggeditemdiv{innerHTML} .= "description";
15222
} else {
15223
$flaggeditemdiv{innerHTML} .= Html2::embolden("unknown");
15224
}
15225
15226
{ my %tooltip;
15227
$tooltip{tag} = "img";
15228
$tooltip{src} = "img.pl?i=site/help.png&s=s";
15229
$tooltip{title} = "\nFlagged by: " . User::get_user_stat($item->{flagger_ID}, "nickname") . "\n" .
15230
"Status: " . $item->{status};
15231
15232
$flaggeditemdiv{innerHTML} .= " " . Html2::tag(\%tooltip);
15233
}
15234
15235
$list{innerHTML} .= Html2::tag(\%flaggeditemdiv);
15236
} # end flaggeditemdiv
15237
} # end foreach item
15238
} # end if @$list
15239
else {
15240
$list{innerHTML} .= Html2::embolden("You should never see this!");
15241
} # end else of if @$list
15242
} # end if $list
15243
else {
15244
$list{innerHTML} .= Html2::embolden("no flagged content!");
15245
} # end else of if $list
15246
15247
$flaggedcontentgrid{innerHTML} .= Html2::tag(\%list);
15248
} # end flagged content list div
15249
15250
$flexbox{innerHTML} .= Html2::tag(\%flaggedcontentgrid);
15251
} # end flagged content grid
15252
15253
$rv .= Html2::tag(\%flexbox);
15254
} # end mod flexbox
15255
} # end else of if $page
15256
15257
$rv .= "</td></tr></table>";
15258
15259
return $rv; # a scalar
15260
#usage: print display_mod_page();
15261
}
15262
15263
########################
15264
sub display_signup_page(;$$) {
15265
#*
15266
# display the account creation page
15267
#*
15268
my ($spacing, $show_details) = @_; # spacing for pretty printing HTML output (optional) && a debugging toggle (optional)
15269
if (!$spacing) { $spacing = ""; }
15270
15271
my @yesno = Bc_sql::get_config("yesno");
15272
my @orientations = Bc_sql::get_config("orientations");
15273
my @races = Bc_sql::get_config("races");
15274
my @eyes = Bc_sql::get_config("eyes");
15275
my @hair = Bc_sql::get_config("hair");
15276
my @genders = Bc_sql::get_config("genders");
15277
my @yrs = get_years_forDropdowns();
15278
my @mons = get_months_forDropdowns();
15279
my @days = get_days_forDropdowns();
15280
my @heights = Bc_sql::get_config("heights");
15281
my @weights = Bc_sql::get_config("weights");
15282
my @bodies = Bc_sql::get_config("bodies");
15283
my @erections = Bc_sql::get_config("erections");
15284
my @busts = Bc_sql::get_config("busts");
15285
my @seeking = Bc_sql::get_config("styles");
15286
15287
my $nn_waiting = img("s=s&i=yellow/bullet_yellow.png", "", "", "id=nn_indicator_waiting title=\"Verifying...\" style=\"display: none;\"", "", 1);
15288
my $nn_available = img("s=u&i=green/bullet_green.png", "", "", "id=nn_indicator_available title=\"Available\" style=\"display: none;\"", "", 1);
15289
my $nn_invalid = img("s=u&i=red/bullet_red.png", "", "", "id=nn_indicator_invalid title=\"Invalid\" style=\"display: inline;\" width=16 height=16", "", 1);
15290
my $nn_unavailable = img("s=u&i=red/bullet_red.png", "", "", "id=nn_indicator_unavailable title=\"Unavailable\" style=\"display: none;\"", "", 1);
15291
15292
my $e_waiting = img("s=s&i=yellow/bullet_yellow.png", "", "", "id=e_indicator_waiting title=\"Verifying...\" style=\"display: none;\"", "", 1);
15293
my $e_available = img("s=u&i=green/bullet_green.png", "", "", "id=e_indicator_available title=\"Available\" style=\"display: none;\"", "", 1);
15294
my $e_invalid = img("s=u&i=red/bullet_red.png", "", "", "id=e_indicator_invalid title=\"Invalid\" style=\"display: inline;\" width=16 height=16", "", 1);
15295
my $e_unavailable = img("s=u&i=red/bullet_red.png", "", "", "id=e_indicator_unavailable title=\"Unavailable\" style=\"display: none;\"", "", 1);
15296
15297
# if the user forgets or sets information incorrectly, then
15298
# the "create_account.pl" script should come back to this page,
15299
# and the fields below ought to be populated with what the
15300
# user originally entered
15301
my %account_data = Bc_misc::get_params_asHash();
15302
my $BORDER = 0;
15303
15304
my $rv = "";
15305
{ my %form;
15306
$form{tag} = "form";
15307
$form{id} = "signupform";
15308
$form{action} = "/create_account.pl";
15309
$form{method} = "post";
15310
$form{style} = "z-index: 1000;";
15311
$form{innerHTML} = "";
15312
15313
#$form{innerHTML} .= "<script src=\"https://www.google.com/recaptcha/api.js\" async defer></script>";
15314
$form{innerHTML} .= "<table align=center border=$BORDER cellpadding=0 cellspacing=0><tr><td class='bordered rounded padded highlight italic'>" . Html2::br();
15315
$form{innerHTML} .= "We will not use your email address for sending unsolicted crap, nor will we let others have it." . Html2::br();
15316
$form{innerHTML} .= "We won't even verify if you gave us your actual email address - that's your lookout." . Html2::br() . Html2::br();
15317
$form{innerHTML} .= "</td></tr><tr><td class=spacery_largest>";
15318
$form{innerHTML} .= "</td></tr><tr><td align=center class='signup-container'>";
15319
15320
### START BETA PANEL
15321
if (1 == 2) { ### <--- placeholder, replace with something like "is beta-test phase open"
15322
{ my %beta;
15323
$beta{tag} = "div";
15324
$beta{class} = "signup-beta";
15325
$beta{innerHTML} = "";
15326
15327
{ my %fs;
15328
$fs{tag} = "fieldset";
15329
$fs{class} = "red-panel";
15330
$fs{innerHTML} = "<table border=$BORDER cellpadding=0 cellspacing=0><tr><td align=center>";
15331
$fs{innerHTML} .= "<table cellpadding=0 cellspacing=0 class='title subnavbar'><tr><td>";
15332
$fs{innerHTML} .= " ";
15333
{ my %img;
15334
$img{tag} = "img";
15335
$img{src} = "/img.pl?i=site/admin/debug.png";
15336
$img{height} = "32";
15337
15338
$fs{innerHTML} .= Html2::tag(\%img);
15339
}
15340
$fs{innerHTML} .= "</td><td> Beta Testing </td></tr></table>";
15341
$fs{innerHTML} .= "</td></tr><tr><td class=spacery_large>";
15342
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
15343
my $spotsAvailable = 500 - Bc_sql::get_beta_users(1);
15344
$fs{innerHTML} .= "<table border=0 cellpadding=0 cellspacing=0><tr><td class=spacery>";
15345
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
15346
{ my %font;
15347
$font{tag} = "font";
15348
$font{class} = "green_button";
15349
$font{innerHTML} = Html2::big($spotsAvailable) . " of 500";
15350
15351
$fs{innerHTML} .= Html2::tag(\%font) . Html2::br();
15352
}
15353
$fs{innerHTML} .= "</td></tr><tr><td class=spacery>";
15354
$fs{innerHTML} .= "</td></tr><tr><td>";
15355
$fs{innerHTML} .= Html2::italicize("spots available!") . Html2::br();
15356
$fs{innerHTML} .= "</td></tr></table>";
15357
$fs{innerHTML} .= "</td></tr><tr><td class=spacery_large>";
15358
$fs{innerHTML} .= "</td></tr><tr><td align=left>";
15359
15360
{ my %script;
15361
$script{tag} = "script";
15362
$script{innerHTML} .= "\n";
15363
$script{innerHTML} .= "function toggleModCB() {\n";
15364
$script{innerHTML} .= " var mod_e = document.getElementById('bmod');\n";
15365
$script{innerHTML} .= " var beta_e = document.getElementById('beta');\n";
15366
$script{innerHTML} .= "\n";
15367
$script{innerHTML} .= " if (beta_e.checked) {\n";
15368
$script{innerHTML} .= " mod_e.disabled = false;\n";
15369
$script{innerHTML} .= " } else {\n";
15370
$script{innerHTML} .= " mod_e.disabled = true;\n";
15371
$script{innerHTML} .= " }\n";
15372
$script{innerHTML} .= "}\n";
15373
15374
$fs{innerHTML} .= Html2::tag(\%script);
15375
}
15376
15377
{ my %input;
15378
$input{tag} = "input";
15379
$input{name} = "beta";
15380
$input{id} = "beta";
15381
$input{type} = "checkbox";
15382
$input{onchange} = "toggleModCB();";
15383
if ($account_data{beta}) { $input{checked} = 1; }
15384
15385
$fs{innerHTML} .= Html2::tag(\%input);
15386
}
15387
15388
{ my %label;
15389
$label{tag} = "label";
15390
$label{class} = "as_body_textcolor";
15391
$label{for} = "beta";
15392
$label{innerHTML} = "Opt-in as Beta tester" . Html2::br();
15393
15394
{ my %ul;
15395
$ul{tag} = "ul";
15396
$ul{innerHTML} = "";
15397
15398
{ my %li;
15399
$li{tag} = "li";
15400
$li{innerHTML} = "";
15401
15402
{ my %innerfs;
15403
$innerfs{tag} = "fieldset";
15404
$innerfs{class} = "nowrap";
15405
$innerfs{innerHTML} = "Find bugs, help improve the site" . Html2::br();
15406
$innerfs{innerHTML} .= "+50,000 ";
15407
15408
{ my %img;
15409
$img{tag} = "img";
15410
$img{src} = "/img.pl?i=site/coin.png";
15411
$img{height} = "16";
15412
15413
$innerfs{innerHTML} .= Html2::tag(\%img) . Html2::br();
15414
}
15415
15416
$li{innerHTML} .= Html2::tag(\%innerfs);
15417
}
15418
15419
$ul{innerHTML} .= Html2::tag(\%li);
15420
}
15421
15422
$fs{innerHTML} .= Html2::tag(\%ul);
15423
}
15424
15425
$fs{innerHTML} .= Html2::tag(\%label) . Html2::br();
15426
}
15427
15428
{ my %input;
15429
$input{tag} = "input";
15430
$input{name} = "bmod";
15431
$input{id} = "bmod";
15432
$input{type} = "checkbox";
15433
if (not $account_data{beta}) { $input{disabled} = 1; }
15434
15435
$fs{innerHTML} .= Html2::tag(\%input);
15436
}
15437
15438
{ my %label;
15439
$label{tag} = "label";
15440
$label{class} = "as_body_textcolor";
15441
$label{for} = "bmod";
15442
$label{innerHTML} = "Opt-in as Moderator" . Html2::br();
15443
15444
{ my %ul;
15445
$ul{tag} = "ul";
15446
$ul{innerHTML} = "";
15447
15448
{ my %li;
15449
$li{tag} = "li";
15450
$li{innerHTML} = "";
15451
15452
{ my %innerfs;
15453
$innerfs{tag} = "fieldset";
15454
$innerfs{innerHTML} = "+1 month free access" . Html2::br();
15455
$innerfs{innerHTML} .= "+25,000 ";
15456
15457
{ my %img;
15458
$img{tag} = "img";
15459
$img{src} = "/img.pl?i=site/coin.png";
15460
$img{height} = "16";
15461
15462
$innerfs{innerHTML} .= Html2::tag(\%img);
15463
}
15464
15465
$li{innerHTML} .= Html2::tag(\%innerfs);
15466
}
15467
15468
$ul{innerHTML} .= Html2::tag(\%li);
15469
}
15470
15471
$label{innerHTML} .= Html2::tag(\%ul);
15472
}
15473
15474
$fs{innerHTML} .= Html2::tag(\%label);
15475
}
15476
15477
$fs{innerHTML} .= "</td></tr></table>";
15478
15479
$beta{innerHTML} .= Html2::tag(\%fs);
15480
} # end fieldset
15481
15482
$form{innerHTML} .= Html2::tag(\%beta);
15483
} # end beta
15484
} # end if (time within beta start/end dates)
15485
### END BETA PANEL
15486
15487
{ my %accountdiv;
15488
$accountdiv{tag} = "div";
15489
$accountdiv{class} = "signup-account";
15490
15491
{ my %fs;
15492
$fs{tag} = "fieldset";
15493
$fs{class} = "subnavbar";
15494
$fs{innerHTML} = "";
15495
15496
{ my %legend;
15497
$legend{tag} = "legend";
15498
$legend{innerHTML} = "Your New Account Info";
15499
15500
$fs{innerHTML} .= Html2::tag(\%legend);
15501
}
15502
15503
$fs{innerHTML} .= "<table border=$BORDER cellpadding=0 cellspacing=0><tr><td align=center>";
15504
$fs{innerHTML} .= "<table border=$BORDER cellpadding=0 cellspacing=0><tr><td>";
15505
15506
my $inputWidth = "140px";
15507
$fs{innerHTML} .= "Nickname *:";
15508
$fs{innerHTML} .= "</td><td rowspan=2 width=3></td><td>";
15509
{ my %input;
15510
$input{tag} = "input";
15511
$input{type} = "text";
15512
$input{id} = "nn";
15513
$input{name} = Bc_sql::get_constant("QUERY_NICKNAME");
15514
$input{placeholder} = "Billy-Joe-Bob";
15515
$input{required} = 1;
15516
$input{onkeyup} = "check_nn_valid('nn', 'nn_indicator');";
15517
$input{value} = $account_data{nickname};
15518
$input{autocomplete} = "username";
15519
$input{style} = "width: $inputWidth;";
15520
15521
$fs{innerHTML} .= Html2::tag(\%input);
15522
}
15523
15524
$fs{innerHTML} .= "</td><td rowspan=2 width=3></td><td>";
15525
$fs{innerHTML} .= $nn_waiting;
15526
$fs{innerHTML} .= $nn_invalid;
15527
$fs{innerHTML} .= $nn_available;
15528
$fs{innerHTML} .= $nn_unavailable;
15529
$fs{innerHTML} .= "</td></tr><tr><td>";
15530
15531
$fs{innerHTML} .= "Email:";
15532
$fs{innerHTML} .= "</td><td>";
15533
{ my %input;
15534
$input{tag} = "input";
15535
$input{type} = "email";
15536
$input{id} = "ee";
15537
$input{name} = "email";
15538
$input{placeholder} = "email\@site.com";
15539
$input{required} = 1;
15540
$input{onkeyup} = "check_e_valid('ee', 'e_indicator');";
15541
$input{value} = $account_data{email};
15542
$input{autocomplete} = "email";
15543
$input{style} = "width: $inputWidth;";
15544
15545
$fs{innerHTML} .= Html2::tag(\%input);
15546
}
15547
15548
$fs{innerHTML} .= "</td><td>";
15549
$fs{innerHTML} .= $e_waiting;
15550
$fs{innerHTML} .= $e_invalid;
15551
$fs{innerHTML} .= $e_available;
15552
$fs{innerHTML} .= $e_unavailable;
15553
$fs{innerHTML} .= "</td></tr></table>";
15554
15555
{ my %small;
15556
$small{tag} = "small";
15557
$small{innerHTML} = "email is only used for ";
15558
15559
{ my %link;
15560
$link{tag} = "a";
15561
$link{href} = "/?ip=forgot";
15562
$link{innerHTML} = "password resets";
15563
15564
$small{innerHTML} .= Html2::tag(\%link);
15565
}
15566
15567
$fs{innerHTML} .= Html2::tag(\%small) . Html2::br();
15568
}
15569
15570
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
15571
$fs{innerHTML} .= Html2::hr();
15572
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
15573
15574
{ my %script;
15575
$script{tag} = "script";
15576
$script{innerHTML} = "\n";
15577
$script{innerHTML} .= "function gender_toggle() {\n";
15578
$script{innerHTML} .= " var g = document.getElementById('gender');\n";
15579
$script{innerHTML} .= " if (g.value == 1) {\n";
15580
$script{innerHTML} .= " // guy\n";
15581
$script{innerHTML} .= " document.getElementById('erectiondiv').style.display = 'inline';\n";
15582
$script{innerHTML} .= " document.getElementById('bustdiv').style.display = 'none';\n";
15583
$script{innerHTML} .= " document.getElementById('bust').selectedIndex = 0;\n";
15584
$script{innerHTML} .= " document.getElementById('erection').selectedIndex = 0;\n";
15585
$script{innerHTML} .= " } else if (g.value == 2) {\n";
15586
$script{innerHTML} .= " // gal\n";
15587
$script{innerHTML} .= " document.getElementById('bustdiv').style.display = 'inline';\n";
15588
$script{innerHTML} .= " document.getElementById('erectiondiv').style.display = 'none';\n";
15589
$script{innerHTML} .= " document.getElementById('erection').selectedIndex = 0;\n";
15590
$script{innerHTML} .= " document.getElementById('bust').selectedIndex = 0;\n";
15591
$script{innerHTML} .= " } else {\n";
15592
$script{innerHTML} .= " document.getElementById('bustdiv').style.display = 'none';\n";
15593
$script{innerHTML} .= " document.getElementById('erectiondiv').style.display = 'none';\n";
15594
$script{innerHTML} .= " document.getElementById('bust').selectedIndex = 0;\n";
15595
$script{innerHTML} .= " document.getElementById('erection').selectedIndex = 0;\n";
15596
$script{innerHTML} .= " }\n";
15597
$script{innerHTML} .= "}\n";
15598
15599
$fs{innerHTML} .= Html2::tag(\%script);
15600
}
15601
15602
# ($selected, $id, $title, $onchange, $spacing, $separator, $add999, $extras)
15603
if ($account_data{country})
15604
{ $fs{innerHTML} .= display_country_names_asDropdown($account_data{country}, "country", "Location:", "populate_with_cities('country', 'city', 0);", "", ",", "", "style='width: 80px;'"); } else
15605
{ $fs{innerHTML} .= display_country_names_asDropdown(-1, "country", "Location:", "populate_with_cities('country', 'city', 0);", "", ",", "", "style='width: 80px;'"); }
15606
15607
if ($account_data{country} and $account_data{city})
15608
{ $fs{innerHTML} .= display_city_names_asDropdown($account_data{country}, $account_data{city}, "city", "", "", "", "", 0, "style='width: 80px;'"); } else
15609
{ $fs{innerHTML} .= display_city_names_asDropdown(-1, -1, "city", "", "", "", "", 0, "style='width: 80px;'"); }
15610
$fs{innerHTML} .= Html2::br();
15611
15612
if ($account_data{DOBM})
15613
{ $fs{innerHTML} .= dropdown("DOBM", "DOB *:", $account_data{DOBM}, "", "", "", "style='width: 100px;' required", "", \@mons); } else
15614
{ $fs{innerHTML} .= dropdown("DOBM", "DOB *:", -1, "", "", "", "style='width: 100px;' required", "", \@mons); }
15615
15616
if ($account_data{DOBD})
15617
{ $fs{innerHTML} .= dropdown("DOBD", "", $account_data{DOBD}, "", "", "", "style='width: 55px;' required", "", \@days); } else
15618
{ $fs{innerHTML} .= dropdown("DOBD", "", -1, "", "", "", "style='width: 55px;' required", "", \@days); }
15619
15620
if ($account_data{DOBY})
15621
{ $fs{innerHTML} .= dropdown("DOBY", ", ", $account_data{DOBY}, "", "", "", "style='width: 60px;' required", "", \@yrs); } else
15622
{ $fs{innerHTML} .= dropdown("DOBY", ", ", -1, "", "", "", "style='width: 60px;' required", "", \@yrs); }
15623
$fs{innerHTML} .= Html2::br();
15624
15625
{ my %cbox;
15626
$cbox{tag} = "div";
15627
$cbox{class} = "text-align-right";
15628
$cbox{innerHTML} = "";
15629
15630
{ my %input;
15631
$input{tag} = "input";
15632
$input{type} = "checkbox";
15633
$input{id} = "show_bday";
15634
$input{name} = "show_bday";
15635
$input{checked} = 1;
15636
15637
$cbox{innerHTML} .= Html2::tag(\%input);
15638
}
15639
15640
{ my %label;
15641
$label{tag} = "label";
15642
$label{for} = "show_bday";
15643
$label{class} = "small";
15644
$label{innerHTML} .= " Make Birthday Public";
15645
15646
$cbox{innerHTML} .= Html2::tag(\%label);
15647
}
15648
15649
$fs{innerHTML} .= Html2::tag(\%cbox) . Html2::br();
15650
}
15651
15652
if ($account_data{gender})
15653
{ $fs{innerHTML} .= dropdown("gender", "Gender *: ", $account_data{gender}, "", "gender_toggle();", "", "style='width: 52px;' required", " ", \@genders); } else
15654
{ $fs{innerHTML} .= dropdown("gender", "Gender *: ", -1, "", "gender_toggle();", "", "style='width: 52px;' required", " ", \@genders); }
15655
15656
if ($account_data{race})
15657
{ $fs{innerHTML} .= dropdown("race", "Ethnicity *: ", $account_data{race}, "", "", "", "style='width: 75px;' required", "", \@races, 2); } else
15658
{ $fs{innerHTML} .= dropdown("race", "Ethnicity *: ", 888, "", "", "", "style='width: 75px;' required", "", \@races, 2); }
15659
$fs{innerHTML} .= Html2::br();
15660
15661
if ($account_data{orientation})
15662
{ $fs{innerHTML} .= dropdown("orientation", "Orientation: ", $account_data{orientation}, "", "", "", "required", "", \@orientations, 2); } else
15663
{ $fs{innerHTML} .= dropdown("orientation", "Orientation: ", 888, "", "", "", "required", "", \@orientations, 2); }
15664
$fs{innerHTML} .= Html2::br();
15665
15666
if ($account_data{seeking_gender})
15667
{ $fs{innerHTML} .= dropdown("seeking_gender", "Seeking a ", $account_data{seeking_gender}, "", "", "", "required", "", \@genders, 2); } else
15668
{ $fs{innerHTML} .= dropdown("seeking_gender", "Seeking a ", 888, "", "", "", "required", "", \@genders, 2); }
15669
15670
if ($account_data{seeking})
15671
{ $fs{innerHTML} .= dropdown("seeking", "for", $account_data{seeking}, "", "", "", "style='width: 75px;' required", "", \@seeking, 2); } else
15672
{ $fs{innerHTML} .= dropdown("seeking", "for", 888, "", "", "", "style='width: 75px;' required", "", \@seeking, 2); }
15673
$fs{innerHTML} .= Html2::br();
15674
15675
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
15676
$fs{innerHTML} .= Html2::hr();
15677
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
15678
15679
my %morefs; {
15680
$morefs{tag} = "fieldset";
15681
$morefs{id} = "morefs";
15682
$morefs{class} = "subnavbar_dark transparent padded";
15683
$morefs{style} = "margin-bottom: 0;";
15684
15685
my %legend; {
15686
$legend{tag} = "legend";
15687
$legend{class} = "text-align-left transparent padding-none";
15688
$legend{style} = "margin-bottom: 0;";
15689
15690
my %button; {
15691
$button{tag} = "button";
15692
$button{type} = "button";
15693
$button{id} = "morebutton";
15694
$button{class} = "blue";
15695
$button{style} = "margin-right: 0; margin-bottom: 0;";
15696
15697
my %script; {
15698
$script{tag} = "script";
15699
$script{innerHTML} = "function clickmore() {\n" .
15700
" let e = document.getElementById('morebutton');\n" .
15701
"\n" .
15702
" if (e) {\n" .
15703
" //console.log('good');\n" .
15704
" // now, see if div is hidden or not\n" .
15705
" let d = document.getElementById('morediv');\n" .
15706
" let f = document.getElementById('morefs');\n" .
15707
" if (d) {\n" .
15708
" //console.log('good');\n" .
15709
" if (d.style.display === 'none') {\n" .
15710
" //console.log('show');\n" .
15711
" d.style.display = 'block';\n" .
15712
" f.classList.remove('transparent');\n" .
15713
" } else {\n" .
15714
" //console.log('hide');\n" .
15715
" d.style.display = 'none';\n" .
15716
" f.classList.add('transparent');\n" .
15717
" }\n" .
15718
" } else {\n" .
15719
" //console.log('bad');\n" .
15720
" }\n" .
15721
" } else {\n" .
15722
" //console.log('bad');\n" .
15723
" }\n" .
15724
"}\n" .
15725
"\n";
15726
}
15727
15728
$button{onclick} = "clickmore(); blur();";
15729
$button{innerHTML} = Html2::tag(\%script) . "More Details...";
15730
}
15731
15732
$legend{innerHTML} = Html2::tag(\%button);
15733
}
15734
15735
$morefs{innerHTML} = Html2::tag(\%legend);
15736
15737
my %morediv; {
15738
$morediv{tag} = "div";
15739
$morediv{id} = "morediv";
15740
#$morediv{class} = "bordered";
15741
$morediv{style} = "display: none;";
15742
15743
if ($account_data{eye_clr})
15744
{ $morediv{innerHTML} .= dropdown("eye_clr", "Eye Colour *: ", $account_data{eye_clr}, "", "", "", "style='width: 75px;' required", "", \@eyes, 2); } else
15745
{ $morediv{innerHTML} .= dropdown("eye_clr", "Eye Colour *: ", 888, "", "", "", "style='width: 75px;' required", "", \@eyes, 2); }
15746
15747
if ($account_data{hair_clr})
15748
{ $morediv{innerHTML} .= dropdown("hair_clr", "Hair Colour *: ", $account_data{hair_clr}, "", "", "", "style='width: 75px;' required", "", \@hair, 2); } else
15749
{ $morediv{innerHTML} .= dropdown("hair_clr", "Hair Colour *: ", 888, "", "", "", "style='width: 75px;' required", "", \@hair, 2); }
15750
15751
$morediv{innerHTML} .= Html2::br();
15752
15753
if ($account_data{weight})
15754
{ $morediv{innerHTML} .= dropdown("weight", "Weight: ", $account_data{weight}, "", "", "", "style='width: 75px;' required", "", \@weights, 2); } else
15755
{ $morediv{innerHTML} .= dropdown("weight", "Weight: ", 888, "", "", "", "style='width: 75px;' required", "", \@weights, 2); }
15756
15757
if ($account_data{height})
15758
{ $morediv{innerHTML} .= dropdown("height", "Height: ", $account_data{height}, "", "", "", "style='width: 75px;' required", "", \@heights, 2); } else
15759
{ $morediv{innerHTML} .= dropdown("height", "Height: ", 888, "", "", "", "style='width: 75px;' required", "", \@heights, 2); }
15760
15761
$morediv{innerHTML} .= Html2::br();
15762
15763
{ my %stat;
15764
$stat{tag} = "div";
15765
$stat{id} = "erectiondiv";
15766
$stat{style} = "display: none;";
15767
$stat{innerHTML} = "";
15768
15769
if ($account_data{erection})
15770
{ $stat{innerHTML} .= dropdown("erection", "Erection: ", $account_data{erection}, "", "", "", "", "", \@erections, 2); } else
15771
{ $stat{innerHTML} .= dropdown("erection", "Erection: ", 888, "", "", "", "", "", \@erections, 2); }
15772
15773
$morediv{innerHTML} .= Html2::tag(\%stat);
15774
}
15775
15776
{ my %stat;
15777
$stat{tag} = "div";
15778
$stat{id} = "bustdiv";
15779
$stat{style} = "display: none;";
15780
$stat{innerHTML} = "";
15781
15782
if ($account_data{bust})
15783
{ $stat{innerHTML} .= dropdown("bust", "Bust: ", $account_data{bust}, "", "", "", "", "", \@busts, 2); } else
15784
{ $stat{innerHTML} .= dropdown("bust", "Bust: ", 888, "", "", "", "", "", \@busts, 2); }
15785
15786
$morediv{innerHTML} .= Html2::tag(\%stat);
15787
}
15788
15789
if ($account_data{body})
15790
{ $morediv{innerHTML} .= dropdown("body", "Curves: ", $account_data{body}, "", "", "", "style='width: 75px;' required", "", \@bodies, 2); } else
15791
{ $morediv{innerHTML} .= dropdown("body", "Curves: ", 888, "", "", "", "style='width: 75px;' required", "", \@bodies, 2); }
15792
15793
$morediv{innerHTML} .= Html2::br();
15794
15795
if ($account_data{wheels})
15796
{ $morediv{innerHTML} .= dropdown("wheels", "Vehical: ", $account_data{wheels}, "", "", "", "style='width: 75px;' required", "", \@yesno, 2); } else
15797
{ $morediv{innerHTML} .= dropdown("wheels", "Vehical: ", 888, "", "", "", "style='width: 75px;' required", "", \@yesno, 2); }
15798
15799
if ($account_data{can_host})
15800
{ $morediv{innerHTML} .= dropdown("can_host", "Can Host: ", $account_data{can_host}, "", "", "", "style='width: 75px;' required", "", \@yesno, 2); } else
15801
{ $morediv{innerHTML} .= dropdown("can_host", "Can Host: ", 888, "", "", "", "style='width: 75px;' required", "", \@yesno, 2); }
15802
15803
$morediv{innerHTML} .= Html2::br();
15804
15805
if ($account_data{can_host})
15806
{ $morediv{innerHTML} .= dropdown("smoker", "Smoking Ok: ", $account_data{can_host}, "", "", "", "style='width: 75px;' required", "", \@yesno, 2); } else
15807
{ $morediv{innerHTML} .= dropdown("smoker", "Smoking Ok: ", 888, "", "", "", "style='width: 75px;' required", "", \@yesno, 2); }
15808
15809
if ($account_data{can_host})
15810
{ $morediv{innerHTML} .= dropdown("drinker", "Alcohol Ok: ", $account_data{can_host}, "", "", "", "style='width: 75px;' required", "", \@yesno, 2); } else
15811
{ $morediv{innerHTML} .= dropdown("drinker", "Alcohol Ok: ", 888, "", "", "", "style='width: 75px;' required", "", \@yesno, 2); }
15812
15813
$morediv{innerHTML} .= Html2::br();
15814
15815
if ($account_data{drugs})
15816
{ $morediv{innerHTML} .= dropdown("drugs", "Drugs Ok: ", $account_data{drugs}, "", "", "", "style='width: 75px;' required", "", \@yesno, 2); } else
15817
{ $morediv{innerHTML} .= dropdown("drugs", "Drugs Ok: ", 888, "", "", "", "style='width: 75px;' required", "", \@yesno, 2); }
15818
15819
$morefs{innerHTML} .= Html2::tag(\%morediv);
15820
}
15821
15822
$fs{innerHTML} .= Html2::tag(\%morefs);
15823
}
15824
15825
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
15826
$fs{innerHTML} .= Html2::hr();
15827
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
15828
{ my %input;
15829
$input{tag} = "input";
15830
$input{type} = "hidden";
15831
$input{name} = $Bc_sql::QUERY_PAGE;
15832
$input{value} = Bc_sql::get_constant("SIGNUP_PAGE");
15833
15834
$fs{innerHTML} .= Html2::tag(\%input);
15835
}
15836
15837
{ my %input;
15838
$input{tag} = "input";
15839
$input{type} = "hidden";
15840
$input{name} = "c";
15841
$input{value} = "1";
15842
15843
$fs{innerHTML} .= Html2::tag(\%input);
15844
}
15845
$fs{innerHTML} .= "Password" . Html2::br();
15846
15847
{ my %input;
15848
$input{tag} = "input";
15849
$input{type} = "password";
15850
$input{name} = "password";
15851
$input{placeholder} = "password";
15852
$input{required} = 1;
15853
$input{value} = $account_data{password};
15854
$input{autocomplete} = "password";
15855
15856
$fs{innerHTML} .= Html2::tag(\%input) . Html2::br();
15857
}
15858
15859
{ my %input;
15860
$input{tag} = "input";
15861
$input{type} = "password";
15862
$input{name} = "passwordagain";
15863
$input{placeholder} = "password again";
15864
$input{required} = 1;
15865
$input{value} = $account_data{passwordagain};
15866
$input{autocomplete} = "password";
15867
15868
$fs{innerHTML} .= Html2::tag(\%input) . Html2::br();
15869
}
15870
15871
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
15872
$fs{innerHTML} .= Html2::br();
15873
15874
{ my %notice;
15875
$notice{tag} = "div";
15876
$notice{class} = "subnavbar_dark";
15877
$notice{innerHTML} = Html2::embolden("fields with * next to them cannot be changed later," . Html2::br() . "unless \"Ask Me\" is selected.");
15878
15879
$fs{innerHTML} .= Html2::tag(\%notice);
15880
}
15881
$fs{innerHTML} .= "</td></tr><tr><td class=spacery_large>";
15882
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
15883
15884
{ my %recap;
15885
$recap{tag} = "div";
15886
$recap{class} = "g-recaptcha";
15887
$recap{"data-sitekey"} = Bc_sql::get_constant("GOOGLE_SITE_KEY");
15888
$recap{"date-size"} = "compact";
15889
15890
#$fs{innerHTML} .= Html2::tag(\%recap); # LWP::Protocol::https fails to install!
15891
} # end recaptcha
15892
15893
$fs{innerHTML} .= "</td></tr><tr><td class=spacery_large>";
15894
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
15895
{ my %input;
15896
$input{tag} = "input";
15897
$input{type} = "checkbox";
15898
$input{name} = "terms";
15899
$input{id} = "terms";
15900
$input{required} = 1;
15901
15902
$fs{innerHTML} .= Html2::tag(\%input);
15903
}
15904
15905
{ my %label;
15906
$label{tag} = "label";
15907
$label{for} = "terms";
15908
$label{innerHTML} = " " . Html2::italicize("I agree to the");
15909
15910
$fs{innerHTML} .= Html2::tag(\%label);
15911
}
15912
15913
{ my %link;
15914
$link{tag} = "a";
15915
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("TERMS_PAGE");
15916
$link{innerHTML} = "terms";
15917
15918
$fs{innerHTML} .= Html2::tag(\%link);
15919
}
15920
15921
$fs{innerHTML} .= "</td></tr><tr><td class=spacery_large>";
15922
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
15923
15924
{ my %button;
15925
$button{tag} = "button";
15926
$button{type} = "submit";
15927
$button{class} = "green";
15928
$button{innerHTML} = "Create";
15929
15930
$fs{innerHTML} .= Html2::tag(\%button);
15931
}
15932
15933
{ my %button;
15934
$button{tag} = "button";
15935
$button{type} = "button";
15936
$button{class} = "red";
15937
$button{onclick} = "document.location=\"/\";";
15938
$button{innerHTML} = "Cancel";
15939
15940
$fs{innerHTML} .= Html2::tag(\%button);
15941
}
15942
$fs{innerHTML} .= "</td></tr></table>";
15943
15944
$accountdiv{innerHTML} .= Html2::tag(\%fs);
15945
} # end fieldset
15946
15947
$form{innerHTML} .= Html2::tag(\%accountdiv);
15948
} # end account div
15949
$form{innerHTML} .= "</td></tr></table>";
15950
15951
$rv .= Html2::tag(\%form);
15952
} # end form!
15953
15954
{ my %script;
15955
$script{tag} = "script";
15956
$script{defer} = 1;
15957
$script{innerHTML} = "check_nn_valid('nn', 'nn_indicator'); check_e_valid('ee', 'e_indicator');";
15958
15959
#$rv .= Html2::tag(\%script); # why the fuck not!?
15960
}
15961
15962
return $rv; # sign up page
15963
15964
#usage: my $output .= display_signup_page("");
15965
}
15966
15967
########################
15968
sub display_faq_page(;$) {
15969
#*
15970
# display the frequently asked questions page
15971
#*
15972
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
15973
if (!$spacing) { $spacing = ""; }
15974
15975
my $output = "<table align=left border=0 cellpadding=0 cellspacing=0 width=100%><tr><td height=1>";
15976
{ my %script;
15977
$script{tag} = "script";
15978
$script{innerHTML} = "lastDivSeen = \"\";";
15979
15980
$output .= Html2::tag(\%script);
15981
}
15982
$output .= "</td></tr><tr><td class=spacery></td></tr><tr><td>";
15983
{ my %fs;
15984
$fs{tag} = "fieldset";
15985
$fs{innerHTML} = "";
15986
15987
{ my %legend;
15988
$legend{tag} = "legend";
15989
$legend{style} = "margin: 0 0 0 10px;";
15990
$legend{innerHTML} = Html2::tag({tag=>"h2", class=>"margins-none", id=>"what_is_it", innerHTML=>"What is a one-night stand?"});
15991
15992
$fs{innerHTML} .= Html2::tag(\%legend);
15993
}
15994
15995
{ my %div;
15996
$div{tag} = "div";
15997
$div{id} = "what_is_it_div";
15998
$div{style} = "display: block;";
15999
$div{innerHTML} = "";
16000
16001
{ my %ul;
16002
$ul{tag} = "ul";
16003
$ul{innerHTML} = "A one-night stand is where two people hook up, have sex, and part ways shortly afterward, usually never to meet again and especially no strings attached." . Html2::br();
16004
$ul{innerHTML} .= "Synonyms: Hook-up, Intimate Encounter, Fuck Buddy, Friend with Benefits, and ";
16005
16006
{ my %link;
16007
$link{tag} = "a";
16008
$link{href} = "https://www.powerthesaurus.org/one-night_stand/synonyms";
16009
$link{target} = "_blank";
16010
$link{innerHTML} = "more";
16011
16012
$ul{innerHTML} .= Html2::tag(\%link) . "!" . Html2::br() . Html2::br();
16013
}
16014
16015
$ul{innerHTML} .= "Discover more:";
16016
{ my %linklist;
16017
$linklist{tag} = "ul";
16018
$linklist{innerHTML} = "";
16019
16020
{ my %link;
16021
$link{tag} = "a";
16022
$link{href} = "https://en.wikipedia.org/wiki/One-night_stand";
16023
$link{target} = "_blank";
16024
$link{innerHTML} = "Wikipedia's Entry on One-Night Stands";
16025
$link{title} = $link{innerHTML};
16026
16027
$linklist{innerHTML} .= Html2::tag(\%link) . Html2::br();
16028
}
16029
{ my %link;
16030
$link{tag} = "a";
16031
$link{href} = "https://www.mensfitness.com/women/sex-tips/the-dos-and-don%E2%80%99ts-of-a-one-night-stand";
16032
$link{target} = "_blank";
16033
$link{innerHTML} = "The Dos and Don'ts of a One-Night Stand";
16034
$link{title} = $link{innerHTML};
16035
16036
$linklist{innerHTML} .= Html2::tag(\%link) . Html2::br();
16037
}
16038
{ my %link;
16039
$link{tag} = "a";
16040
$link{href} = "http://www.cosmopolitan.com/sex-love/positions/g12020019/hook-up-sex-positions/";
16041
$link{target} = "_blank";
16042
$link{innerHTML} = "5 Raw, Real Sex Positions for a One-night Stand";
16043
$link{title} = $link{innerHTML};
16044
16045
$linklist{innerHTML} .= Html2::tag(\%link) . Html2::br();
16046
}
16047
{ my %link;
16048
$link{tag} = "a";
16049
$link{href} = "https://globalnews.ca/news/3192597/who-regrets-the-one-night-stand-more-men-or-women/";
16050
$link{target} = "_blank";
16051
$link{innerHTML} = "Who regrets the one night stand more - men or women?";
16052
$link{title} = $link{innerHTML};
16053
16054
$linklist{innerHTML} .= Html2::tag(\%link) . Html2::br();
16055
}
16056
{ my %link;
16057
$link{tag} = "a";
16058
$link{href} = "http://www.huffingtonpost.ca/2017/06/05/june-one-night-stand_n_16957250.html";
16059
$link{target} = "_blank";
16060
$link{innerHTML} = "June Is The Most Popular Month For One-Night Stands";
16061
$link{title} = $link{innerHTML};
16062
16063
$linklist{innerHTML} .= Html2::tag(\%link) . Html2::br();
16064
}
16065
16066
$ul{innerHTML} .= Html2::tag(\%linklist);
16067
}
16068
16069
$div{innerHTML} .= Html2::tag(\%ul);
16070
}
16071
16072
$fs{innerHTML} .= Html2::tag(\%div);
16073
}
16074
16075
$output .= Html2::tag(\%fs) . Html2::br() . Html2::br();
16076
}
16077
16078
{ my %fs;
16079
$fs{tag} = "fieldset";
16080
$fs{innerHTML} = "";
16081
16082
{ my %legend;
16083
$legend{tag} = "legend";
16084
$legend{style} = "margin: 0 0 0 10px;";
16085
$legend{innerHTML} = Html2::tag({tag=>"h2", style=>"margin: 0 0 0 0px;", id=>"harassment", innerHTML=>"Who is this site for?"});
16086
16087
$fs{innerHTML} .= Html2::tag(\%legend);
16088
}
16089
16090
{ my %div;
16091
$div{tag} = "div";
16092
$div{id} = "harassment_div";
16093
$div{style} = "display: block;";
16094
$div{innerHTML} = "";
16095
16096
{ my %ul;
16097
$ul{tag} = "ul";
16098
$ul{innerHTML} = "Anyone. Well, anyone of legal age to consent to sexual relations with another of legal consenting age. The site is open to";
16099
$ul{innerHTML} .= " the whole world as well; from Afghanistan to Zimbabwe! I am sorry if your city or town is not listed. It is difficult to find";
16100
$ul{innerHTML} .= " a list of all the cities in the world (and surrounding suburban cities). I did find one, but it's got so much data in it, it's";
16101
$ul{innerHTML} .= " really quite difficult to sort through.";
16102
16103
$div{innerHTML} .= Html2::tag(\%ul);
16104
}
16105
16106
$fs{innerHTML} .= Html2::tag(\%div);
16107
}
16108
16109
$output .= Html2::tag(\%fs) . Html2::br() . Html2::br();
16110
}
16111
16112
{ my %fs;
16113
$fs{tag} = "fieldset";
16114
$fs{innerHTML} = "";
16115
16116
{ my %legend;
16117
$legend{tag} = "legend";
16118
$legend{style} = "margin: 0 0 0 10px;";
16119
$legend{innerHTML} = Html2::tag({tag=>"h2", style=>"margin: 0 0 0 0px;", id=>"harassment", innerHTML=>"Where is the site hosted?"});
16120
16121
$fs{innerHTML} .= Html2::tag(\%legend);
16122
}
16123
16124
{ my %div;
16125
$div{tag} = "div";
16126
$div{id} = "harassment_div";
16127
$div{style} = "display: block;";
16128
$div{innerHTML} = "";
16129
16130
{ my %ul;
16131
$ul{tag} = "ul";
16132
$ul{innerHTML} = "The site is hosted in my home, on a double firewalled, secured Linux server. Your data is NOT stored in the 'cloud' and is not shared or sold.";
16133
$ul{innerHTML} .= "My internet service provider is Shaw Cable and we are located in Surrey, BC, Canada.";
16134
16135
$div{innerHTML} .= Html2::tag(\%ul);
16136
}
16137
16138
$fs{innerHTML} .= Html2::tag(\%div);
16139
}
16140
16141
$output .= Html2::tag(\%fs) . Html2::br() . Html2::br();
16142
}
16143
16144
{ my %fs;
16145
$fs{tag} = "fieldset";
16146
$fs{innerHTML} = "";
16147
16148
{ my %legend;
16149
$legend{tag} = "legend";
16150
$legend{style} = "margin: 0 0 0 10px;";
16151
$legend{innerHTML} = Html2::tag({tag=>"h2", style=>"margin: 0 0 0 0px;", id=>"harassment", innerHTML=>"Someone is harassing me or I see content violating the T&C, what can I do about it?"});
16152
16153
$fs{innerHTML} .= Html2::tag(\%legend);
16154
}
16155
16156
{ my %div;
16157
$div{tag} = "div";
16158
$div{id} = "harassment_div";
16159
$div{style} = "display: block;";
16160
$div{innerHTML} = "";
16161
16162
{ my %ul;
16163
$ul{tag} = "ul";
16164
16165
$ul{innerHTML} = "You can easily block any member who is harassing you by visiting their profile and clicking the Block User (";
16166
{ my %img;
16167
$img{tag} = "img";
16168
$img{src} = "/img.pl?i=$Bc_sql::CONSTANTS{IMAGE_ADD_BLOCK_ICON}";
16169
$img{height} = "16";
16170
16171
$ul{innerHTML} .= Html2::tag(\%img);
16172
}
16173
$ul{innerHTML} .= ") icon." . Html2::br();
16174
$ul{innerHTML} .= "If you see content violating the ";
16175
{ my %link;
16176
$link{tag} = "a";
16177
$link{href} = "";
16178
$link{innerHTML} = "Terms";
16179
$link{title} = $link{innerHTML};
16180
16181
$ul{innerHTML} .= Html2::tag(\%link);
16182
}
16183
$ul{innerHTML} .= ", you can \"flag\" the content for review by a moderator or an administrator.";
16184
16185
$div{innerHTML} .= Html2::tag(\%ul);
16186
}
16187
16188
$fs{innerHTML} .= Html2::tag(\%div);
16189
}
16190
16191
$output .= Html2::tag(\%fs) . Html2::br() . Html2::br();
16192
}
16193
16194
{ my %fs;
16195
$fs{tag} = "fieldset";
16196
$fs{innerHTML} = "";
16197
16198
{ my %legend;
16199
$legend{tag} = "legend";
16200
$legend{style} = "margin: 0 0 0 10px;";
16201
$legend{innerHTML} = Html2::tag({tag=>"h2", style=>"margin: 0 0 0 0px;", id=>"flagged", innerHTML=>"What does flag or flagged mean?"});
16202
16203
$fs{innerHTML} .= Html2::tag(\%legend);
16204
}
16205
16206
{ my %div;
16207
$div{tag} = "div";
16208
$div{id} = "flagged_div";
16209
$div{style} = "display: block;";
16210
$div{innerHTML} = "";
16211
16212
{ my %ul;
16213
$ul{tag} = "ul";
16214
$ul{innerHTML} = "If an image, nickname, message, or description violates the ";
16215
{ my %link;
16216
$link{tag} = "a";
16217
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{TERMS_PAGE}";
16218
$link{innerHTML} = "Terms";
16219
$link{title} = $link{innerHTML};
16220
16221
$ul{innerHTML} .= Html2::tag(\%link) . ", it can be ";
16222
}
16223
$ul{innerHTML} .= Html2::italicize("flagged") . " for review by a moderator or an administrator. ";
16224
$ul{innerHTML} .= "A flagged image will become temporarily invisible until reviewed.";
16225
16226
$div{innerHTML} .= Html2::tag(\%ul);
16227
}
16228
16229
$fs{innerHTML} .= Html2::tag(\%div);
16230
}
16231
16232
$output .= Html2::tag(\%fs) . Html2::br() . Html2::br();
16233
}
16234
16235
{ my %fs;
16236
$fs{tag} = "fieldset";
16237
$fs{innerHTML} = "";
16238
16239
{ my %legend;
16240
$legend{tag} = "legend";
16241
$legend{style} = "margin: 0 0 0 10px;";
16242
$legend{innerHTML} = "";
16243
16244
{ my %h2;
16245
$h2{tag} = "h2";
16246
$h2{style} = "margin: 0 0 0 0px;";
16247
$h2{id} = "sharedinfo";
16248
$h2{innerHTML} = "Does " . Html2::italicize($Bc_sql::CONSTANTS{SITE_NAME});
16249
$h2{innerHTML} .= Html2::tag({tag=>"sup", innerHTML=>"™"});
16250
$h2{innerHTML} .= " share account information with other entities?";
16251
16252
$legend{innerHTML} .= Html2::tag(\%h2);
16253
}
16254
16255
$fs{innerHTML} .= Html2::tag(\%legend);
16256
}
16257
16258
{ my %div;
16259
$div{tag} = "div";
16260
$div{id} = "sharedinfo_div";
16261
$div{style} = "display: block;";
16262
$div{innerHTML} = "";
16263
16264
{ my %ul;
16265
$ul{tag} = "ul";
16266
$ul{innerHTML} = "The only thing we share is our url, address and phone number!" . Html2::br() . Html2::br();
16267
$ul{innerHTML} .= "If you're looking for a no strings attached affair but don't want the bar scene, or don't want to pay bloated amounts of dollars to gain full";
16268
$ul{innerHTML} .= " access to those...other sites, Night Stand is your ticket to " . Html2::italicize("ride") . "! Night Stand also believes in your privacy. Nothing you provide is";
16269
$ul{innerHTML} .= " shared by Night Stand. Nothing. The only stuff we get is what you actually give us when you click things or type stuff. Night Stand doesn't";
16270
$ul{innerHTML} .= " care to track your movements that intensely. If it doesn't have anything to do with Night Stand directly, then we don't want it nor will we it";
16271
$ul{innerHTML} .= " keep it or create it. See our ";
16272
{ my %link;
16273
$link{tag} = "a";
16274
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{DATA_POLICY_PAGE}";
16275
$link{innerHTML} = "Data Policy";
16276
$link{title} = $link{innerHTML};
16277
16278
$ul{innerHTML} .= Html2::tag(\%link);
16279
}
16280
$ul{innerHTML} .= " for more info.";
16281
16282
$fs{innerHTML} .= Html2::tag(\%ul);
16283
}
16284
16285
$fs{innerHTML} .= Html2::tag(\%div);
16286
}
16287
16288
$output .= Html2::tag(\%fs) . Html2::br() . Html2::br();
16289
}
16290
16291
{ my %fs;
16292
$fs{tag} = "fieldset";
16293
$fs{innerHTML} = "";
16294
16295
{ my %legend;
16296
$legend{tag} = "legend";
16297
$legend{style} = "margin: 0 0 0 10px;";
16298
$legend{innerHTML} = Html2::tag({tag=>"h2", style=>"margin: 0 0 0 0px;", id=>"howhookup", innerHTML=>"How do I find someone to hook up with?"});
16299
16300
$fs{innerHTML} .= Html2::tag(\%legend);
16301
}
16302
16303
{ my %div;
16304
$div{tag} = "div";
16305
$div{id} = "howhookup_div";
16306
$div{style} = "display: block;";
16307
$div{innerHTML} = "";
16308
16309
{ my %ul;
16310
$ul{tag} = "ul";
16311
$ul{innerHTML} = "After logging in, you can use the search bar at the top of any ";
16312
{ my %link;
16313
$link{tag} = "a";
16314
$link{href} = "/";
16315
$link{innerHTML} = $Bc_sql::CONSTANTS{SITE_NAME};
16316
$link{title} = $link{innerHTML};
16317
16318
$ul{innerHTML} .= Html2::tag(\%link);;
16319
}
16320
16321
$ul{innerHTML} .= "™ page, or you can ";
16322
{ my %link;
16323
$link{tag} = "a";
16324
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{BROWSE_PAGE}";
16325
$link{innerHTML} = "browse";
16326
$link{title} = $link{innerHTML};
16327
16328
$ul{innerHTML} .= Html2::tag(\%link);
16329
}
16330
16331
$ul{innerHTML} .= " for members by country, age, gender, or even hair colour! To engage in discourse with each other, both accounts must be ";
16332
16333
{ my %link;
16334
$link{tag} = "a";
16335
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{PAY_PAGE}";
16336
$link{innerHTML} = "Premium Accounts";
16337
$link{title} = $link{innerHTML};
16338
16339
$ul{innerHTML} .= Html2::tag(\%link);
16340
}
16341
16342
$div{innerHTML} .= Html2::tag(\%ul);
16343
}
16344
16345
$fs{innerHTML} .= Html2::tag(\%div);;
16346
}
16347
16348
$output .= Html2::tag(\%fs) . Html2::br() . Html2::br();
16349
}
16350
16351
{ my %fs;
16352
$fs{tag} = "fieldset";
16353
$fs{innerHTML} = "";
16354
16355
{ my %legend;
16356
$legend{tag} = "legend";
16357
$legend{style} = "margin: 0 0 0 10px;";
16358
$legend{innerHTML} = Html2::tag({tag=>"h2", style=>"margin: 0 0 0 0px;", id=>"coins", innerHTML=>"What are these coins I'm getting?"});
16359
16360
$fs{innerHTML} .= Html2::tag(\%legend);
16361
}
16362
16363
{ my %div;
16364
$div{tag} = "div";
16365
$div{id} = "coins_div";
16366
$div{style} = "display: block;";
16367
$div{innerHTML} = "";
16368
16369
{ my %ul;
16370
$ul{tag} = "ul";
16371
$ul{innerHTML} = "Coins can be earned by visiting a profile you've never been to before, or someone visits your profile for the first time.";
16372
$ul{innerHTML} .= "Either way, both parties will earn coins. When you have enough coins, you can spend them in the ";
16373
16374
{ my %link;
16375
$link{tag} = "a";
16376
$link{href} = "/?$Bc_sql::CONSTANTS{QUERY_PAGE}=$Bc_sql::CONSTANTS{STORE_PAGE}";
16377
$link{innerHTML} = "Theme Store";
16378
$link{title} = $link{innerHTML};
16379
16380
$ul{innerHTML} .= Html2::tag(\%link);
16381
}
16382
16383
$div{innerHTML} .= Html2::tag(\%ul);
16384
}
16385
16386
$fs{innerHTML} .= Html2::tag(\%div);
16387
}
16388
16389
$output .= Html2::tag(\%fs) . Html2::br() . Html2::br();
16390
}
16391
16392
{ my %fs;
16393
$fs{tag} = "fieldset";
16394
$fs{innerHTML} = "";
16395
16396
{ my %legend;
16397
$legend{tag} = "legend";
16398
$legend{style} = "margin: 0 0 0 10px;";
16399
$legend{innerHTML} = Html2::tag({tag=>"h2", style=>"margin: 0 0 0 0px;", id=>"siteissues", innerHTML=>"A page is failing to load, or something didn't work right, what do I do?"});
16400
16401
$fs{innerHTML} .= Html2::tag(\%legend);
16402
}
16403
16404
{ my %div;
16405
$div{tag} = "div";
16406
$div{id} = "siteissues_div";
16407
$div{style} = "display: block;";
16408
$div{innerHTML} = "";
16409
16410
{ my %ul;
16411
$ul{tag} = "ul";
16412
$ul{innerHTML} = "At the bottom of any Night-Stand page, you will find a " . Html2::embolden("Bug Report") . " box. So long as the page hasn't failed to load (500, or 404), then click the green button and";
16413
$ul{innerHTML} .= "follow the prompts. Submit the report, and we will receive it and do our best to fix the issue. Often it's an easy fix (Usually we've simply typo'd something).";
16414
$ul{innerHTML} .= "Night-Stand, afterall, has only one employee for everything - from hosting, to coding, to advertising.";
16415
16416
$div{innerHTML} .= Html2::tag(\%ul);
16417
}
16418
16419
$fs{innerHTML} .= Html2::tag(\%div);
16420
}
16421
16422
$output .= Html2::tag(\%fs) . Html2::br() . Html2::br();
16423
}
16424
16425
$output .= "</td></tr></table>";
16426
16427
return $output; # a scalar
16428
#usage: my $output .= display_faq_page("");
16429
}
16430
16431
########################
16432
sub display_forgot_page(;$) {
16433
#*
16434
# display the reset password page
16435
#*
16436
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
16437
if (!$spacing) { $spacing = ""; }
16438
my $output = Html2::br() . "<table border=$TABLE_BORDER align=center cellpadding=0 cellspading=0><tr><td align=center>";
16439
{ my %style;
16440
$style{tag} = "style";
16441
$style{innerHTML} = "\n" .
16442
".somelayout {\n" .
16443
" display: grid;\n" .
16444
" grid-template-areas: 'safesex blurb' 'junk junk';\n" .
16445
" grid-template-columns: min-content 1fr;\n" .
16446
" grid-template-rows: min-content min-content;\n" .
16447
" grid-gap: 5px;\n" .
16448
" justify-content: center;\n" .
16449
" align-items: center;\n" .
16450
" max-width: 600px;\n" .
16451
"}\n" .
16452
"\n" .
16453
"\@media screen and (max-width: 500px) {\n" .
16454
" .somelayout {\n" .
16455
" grid-template-areas: 'safesex' 'blurb' 'junk';\n" .
16456
" grid-template-columns: 1fr;\n" .
16457
" grid-template-rows: min-content min-content min-content;\n" .
16458
" min-width: 320px;\n" .
16459
" }\n" .
16460
"}\n" .
16461
"\n" .
16462
"\n";
16463
16464
$output .= Html2::tag(\%style);
16465
}
16466
16467
{ my %container;
16468
$container{tag} = "div";
16469
$container{class} = "somelayout translucent padded-top-bottom";
16470
$container{innerHTML} = "";
16471
16472
{ my %div;
16473
$div{tag} = "div";
16474
$div{style} = "grid-area: safesex;";
16475
$div{innerHTML} = "";
16476
16477
{ my %img;
16478
$img{tag} = "img";
16479
$img{src} = "/images/misc/safesex.gif";
16480
16481
$div{innerHTML} .= Html2::tag(\%img);
16482
}
16483
16484
$container{innerHTML} .= Html2::tag(\%div);
16485
}
16486
16487
{ my %blurb;
16488
$blurb{tag} = "div";
16489
$blurb{class} = "padded-top-bottom-large sunken margins-large";
16490
$blurb{style} = "grid-area: blurb;";
16491
$blurb{innerHTML} = "So you've done forgot your password. No worries - this page should save you! ";
16492
$blurb{innerHTML} .= "For security purposes, your password is encoded in such a way that it cannot be decoded. ";
16493
$blurb{innerHTML} .= "Upon submitting this request, Night Stand will send an email which has a link to perform ";
16494
$blurb{innerHTML} .= "the actual reset process. Click the link in the email, type your new password and hit ";
16495
$blurb{innerHTML} .= "the button and then try logging in again.";
16496
16497
$container{innerHTML} .= Html2::tag(\%blurb);
16498
}
16499
16500
{ my %junk;
16501
$junk{tag} = "div";
16502
$junk{class} = "description nowrap min-content centered";
16503
$junk{style} = "grid-area: junk;";
16504
$junk{innerHTML} = "And, as always, check your email's junk folder!";
16505
16506
$container{innerHTML} .= Html2::tag(\%junk);
16507
}
16508
16509
$output .= Html2::tag(\%container);
16510
} # end blurb container
16511
$output .= "</td></tr><tr><td class=spacery_largest>";
16512
$output .= "</td></tr><tr><td align=center height=1>";
16513
$output .= "<table border=0 cellpadding=0 cellspacing=0 class='padded red-panel' style='max-width: 520px;'><tr><td colspan=3 class='center subtitle padded'>";
16514
$output .= "Delete Cookies First!";
16515
$output .= "</td></tr><tr><td class=spacery colspan=3>";
16516
$output .= "</td></tr><tr><td>";
16517
$output .= "<table cellpadding=0 cellspacing=0><tr><td>";
16518
$output .= "In " . Html2::italicize("some") . " cases, cookies can become corrupted because ... browsers.";
16519
$output .= "Before resetting your password, try ";
16520
{ my %button;
16521
$button{tag} = "button";
16522
$button{type} = "button";
16523
$button{class} = "save margins-none padded-left-right-small";
16524
$button{onclick} = "document.location=\"/wipe_cookies.pl\";";
16525
$button{title} = "This will clear Night-Stand's cookies ONLY!";
16526
$button{innerHTML} = "clearing";
16527
16528
$output .= Html2::tag(\%button);
16529
}
16530
$output .= " your cookies.";
16531
$output .= "</td></tr></table>";
16532
$output .= "</td><td class=spacerx_large></td><td>";
16533
{ my %img;
16534
$img{tag} = "img";
16535
$img{src} = "/img.pl?i=site/cookie.png";
16536
$img{height} = "64";
16537
16538
$output .= Html2::tag(\%img);
16539
}
16540
$output .= "</td></tr></table>";
16541
$output .= "</td></tr><tr><td align=center class=spacery_largest>";
16542
$output .= "</td></tr><tr><td align=center height=1>";
16543
16544
{ my %form;
16545
$form{tag} = "form";
16546
$form{action} = "/resetpw.pl";
16547
$form{method} = "post";
16548
$form{innerHTML} = "<table cellpadding=0 cellspacing=0 class='padded subnavbar_dark' style='max-width: 320px;'><tr><td>";
16549
$form{innerHTML} .= "Failing the above, type the nickname" . Html2::br();
16550
$form{innerHTML} .= "associated with the account" . Html2::br();
16551
$form{innerHTML} .= "</td></tr><tr><td align=center class=spacery>";
16552
$form{innerHTML} .= "</td></tr><tr><td align=center height=1>";
16553
{ my %input;
16554
$input{tag} = "input";
16555
$input{type} = "text";
16556
$input{name} = Bc_sql::get_constant("QUERY_NICKNAME");
16557
$input{placeholder} = "Billy-Joe-Bob";
16558
$input{required} = 1;
16559
16560
$form{innerHTML} .= Html2::tag(\%input);
16561
}
16562
$form{innerHTML} .= "</td></tr><tr><td class=spacery>";
16563
$form{innerHTML} .= "</td></tr><tr><td align=center height=1>";
16564
{ my %button;
16565
$button{tag} = "button";
16566
$button{type} = "submit";
16567
$button{class} = "green";
16568
$button{innerHTML} = "Send Password Reset Link";
16569
16570
$form{innerHTML} .= Html2::tag(\%button) . Html2::br();
16571
}
16572
16573
{ my %div;
16574
$div{tag} = "div";
16575
$div{class} = "copyright";
16576
$div{innerHTML} = "*you are able to send many, but please, only do one.";
16577
$div{innerHTML} .= "If the nickname you entered is not on file, no email";
16578
$div{innerHTML} .= "message will be sent, and nor will you know it.";
16579
16580
$form{innerHTML} .= Html2::tag(\%div);
16581
}
16582
$form{innerHTML} .= "</td></tr></table>";
16583
16584
$output .= Html2::tag(\%form);
16585
}
16586
$output .= "</td></tr></table>";
16587
16588
return $output; # a scalar
16589
#usage: my $output .= display_forgot_page("");
16590
}
16591
16592
########################
16593
sub get_config_forDropdowns($;$) {
16594
#*
16595
# gets a list of data stored in specified table
16596
#*
16597
my ($cfg, $asRef) = @_; # the table to query && rVal as array reference
16598
my @cfg = Bc_sql::get_config($cfg);
16599
16600
if ($asRef) {
16601
return \@cfg; # an array reference fit to use in dropdown(...)
16602
} else {
16603
return @cfg; # an array
16604
}
16605
#usage: my @dd_data = get_config_forDropdowns("races");
16606
}
16607
16608
########################
16609
sub get_years_forDropdowns(;$) {
16610
#*
16611
# a list filled with (this yr - 123) to this yr (eg: 1=1894)
16612
# well, actually, it'll be reversed.
16613
#*
16614
my ($asRef) = @_; # rVal as reference (optional, default = 0)
16615
my $thisYear = Date::get_today("y", 0);
16616
my $startYear = $thisYear - 123;
16617
my @rv = ();
16618
16619
for (my $i = 1; $i <= 105; $i++) {
16620
$rv[$i-1] = "$i=" . ($startYear+$i); # "1=1894"
16621
}
16622
16623
@rv = reverse @rv;
16624
if (not $asRef) {
16625
return @rv; # an array
16626
} else {
16627
return \@rv; # an array reference
16628
}
16629
#usage: print dropdown(....., get_years_forDropdowns(1));
16630
}
16631
16632
########################
16633
sub get_months_forDropdowns(;$) {
16634
#*
16635
# a list filled with the names of the months
16636
#*
16637
my ($asRef) = @_; # rVal as reference (optional, default = 0)
16638
my @rv = ();
16639
16640
for (my $i = 1; $i <= 12; $i++) {
16641
$rv[$i-1] = "$i=" . Date::get_month($i);
16642
}
16643
16644
if (not $asRef) {
16645
return @rv; # an array
16646
} else {
16647
return \@rv; # an array reference
16648
}
16649
#usage: print dropdown(....., get_months_forDropdowns(1));
16650
}
16651
16652
########################
16653
sub get_days_forDropdowns(;$) {
16654
#*
16655
# a list filled with the names of the months
16656
#*
16657
my ($asRef) = @_; # rVal as reference (optional, default = 0)
16658
my @rv = ();
16659
16660
for (my $i = 1; $i <= 31; $i++) {
16661
$rv[$i-1] = "$i=" . Bc_misc::add_numeric_suffix($i);
16662
}
16663
16664
if (not $asRef) {
16665
return @rv; # an array
16666
} else {
16667
return \@rv; # an array reference
16668
}
16669
#usage: print dropdown(....., get_days_forDropdowns(1));
16670
}
16671
16672
########################
16673
sub Bc_sql::get_security_forDropdowns(;$) {
16674
#*
16675
# a list (array) filled with name=value pairs of security levels
16676
#*
16677
my ($asRef) = @_; # rVal as reference (optional, default = 0)
16678
my @rv = ();
16679
16680
my $sql = "select * from sec_levels";
16681
my $results = Bc_sql::sql_execute($sql, "get security for dropdowns");
16682
if (ref $results eq "ARRAY") {
16683
# if there's only one sec level, then this will never occur.
16684
# there should never be only one sec level!
16685
foreach my $levelRef (@$results) {
16686
push @rv, $levelRef->{ID} . "=" . $levelRef->{friendly_name};
16687
}
16688
}
16689
16690
if (not $asRef) {
16691
return @rv; # an array
16692
} else {
16693
return \@rv; # an array reference
16694
}
16695
#usage: print dropdown(....., Bc_sql::get_security_forDropdowns(1));
16696
}
16697
16698
########################
16699
sub get_themes_forDropdowns(;$$$) {
16700
#*
16701
# retrieves an array (or array referrence) of valid theme IDs.
16702
# excluding theme names beginning with <i>{EDITOR}</i> (can be overridden)
16703
# excludes unpurchased themes (can be overridden)
16704
#*
16705
my ($asRef, $all, $DEBUG_THEMES) = @_; # rVal as array reference (optional, default = 0) && include all themes, or user specific (optional, default = 0) && debug mode (optional, default = 0)
16706
my @themeids = get_themes(); # a list of all theme IDs
16707
my @purchases = get_theme_purchases(); # a list of the loggedin user's purchased themes, if any
16708
my $admin = User::isUserAdmin();
16709
16710
my @themes = ();
16711
TID: foreach my $tid (@themeids) {
16712
# first, check if the $tid is available for the user.
16713
# two lists: the entire themes list, and the user's
16714
# 'purchased' themes list, if they have any purchases
16715
my %theme = Bc_sql::get_theme_data($tid);
16716
16717
if ($theme{name} !~ /EDITOR/) {
16718
my $dd = $tid . "=" . Bc_misc::shorten_str($theme{name}, 21);
16719
my $purchased = 0;
16720
PURCHASE: foreach my $purchase (@purchases) {
16721
if ($purchase eq $tid) { $purchased = 1; last PURCHASE; }
16722
}
16723
16724
# check if listing all or not
16725
if ($all) {
16726
push(@themes, $dd); # add the id to the themes list
16727
} else {
16728
# remove if premium, unless purchased!
16729
if ($theme{premium} eq 1
16730
or $purchased) {
16731
push(@themes, $dd); # add the id to the themes list
16732
}
16733
}
16734
}
16735
}
16736
16737
@themes = sort {$a <=> $b} @themes; # an array of theme IDs
16738
if ($DEBUG_THEMES) {
16739
my $tc = @themeids; # theme count
16740
push @themes, "themeids array size: " . $tc;
16741
$tc = @purchases;
16742
push @themes, "purchased array size: " . $tc;
16743
if ($asRef) { push @themes, "ret" . "urn as array referrence"; } else { push @themes, "ret" . "urn as array"; }
16744
}
16745
16746
if (not $asRef) {
16747
return @themes; # an array
16748
} else {
16749
return \@themes; # or a reference to an array
16750
}
16751
#usage: my @themes = get_themes();
16752
}
16753
16754
##########################
16755
sub get_zodiac_icon($$) {
16756
#*
16757
# creates an IMG tag of a specified zodiac, with a specified size
16758
# valid size values: <i>i</i>, <i>t</>, or <i>f</i> (icon, thumb, full)
16759
# $z should be a number between 0 and 11 (inclusively). values < 0 equal 0. > 11 is 11.
16760
#*
16761
my ($d, $size) = @_; # the date && a size to display it in (see 'img.pl' for more info)
16762
16763
return Date::determine_zodiac($d, "i"); # a scalar
16764
#usage: my $zodiacIcon = get_zodiac_icon($uid, 'i');
16765
}
16766
16767
########################
16768
sub display_error_page($$;$) {
16769
#*
16770
# displays a specified error page (eg: $e = 500)
16771
#*
16772
my ($url, $e, $spacing) = @_; # the page URL that got us here && an error code (like 500) && spacing for pretty printing HTML output
16773
if (!$spacing) { $spacing = ""; }
16774
16775
my $ERROR_BORDER = 0;
16776
my $msg = "";
16777
my $extmsg = "";
16778
if ($Bc_sql::LOGGEDIN) {
16779
$msg = "Premium Account Required";
16780
my %link;
16781
$link{tag} = "a";
16782
$link{href} = "/?$Bc_sql::QUERY_PAGE=$Bc_sql::CONSTANTS{PAY_PAGE}";
16783
$link{innerHTML} = "Premium Membership";
16784
16785
$extmsg = Html2::tag(\%link) . " is required to access this feature";
16786
}
16787
else {
16788
$msg = "Account Required";
16789
my %link;
16790
$link{tag} = "a";
16791
$link{href} = "/?$Bc_sql::QUERY_PAGE=$Bc_sql::CONSTANTS{SIGNUP_PAGE}";
16792
$link{innerHTML} = "Create an Account";
16793
16794
$extmsg = Html2::br() . Html2::tag(\%link) . " to gain access to this feature" . Html2::br();
16795
}
16796
16797
my $w = "325px";
16798
16799
my $output = "";
16800
16801
{ my %div;
16802
$div{tag} = "div";
16803
$div{class} = "server_error_msg";
16804
$div{innerHTML} = "";
16805
16806
{ my %logo;
16807
$logo{tag} = "div";
16808
$logo{class} = "logo margins-right-largest";
16809
$logo{innerHTML} = "";
16810
16811
{ my %img;
16812
$img{tag} = "img";
16813
$img{src} = "/img.pl?i=site/books.png";
16814
16815
$logo{innerHTML} .= Html2::tag(\%img);
16816
}
16817
16818
$div{innerHTML} .= Html2::tag(\%logo);
16819
}
16820
16821
{ my %msg;
16822
$msg{tag} = "div";
16823
$msg{class} = "msg";
16824
$msg{innerHTML} = "";
16825
16826
{ my %fs;
16827
$fs{tag} = "fieldset";
16828
$fs{style} = "max-width: 250px; min-width: 250px; padding: 8px 12px 8px 10px;";
16829
16830
{ my %legend;
16831
$legend{tag} = "legend";
16832
$legend{class} = "subtitle nowrap";
16833
$legend{innerHTML} = "";
16834
16835
if ($e eq 403) {
16836
$legend{innerHTML} .= img("i=" . Bc_sql::get_constant("IMAGE_403"), "", "", "", "", 1);
16837
$legend{innerHTML} .= "Access Denied";
16838
16839
{ my %font;
16840
$font{tag} = "div";
16841
$font{class} = "error";
16842
$font{innerHTML} = "Server actively denied access to" . Html2::br() . Html2::italicize($url);
16843
16844
$extmsg .= Html2::tag(\%font);
16845
}
16846
} elsif ($e eq 404) {
16847
$legend{innerHTML} .= img("i=" . Bc_sql::get_constant("IMAGE_404"), "", "", "", "", 1);
16848
$legend{innerHTML} .= "File not found";
16849
16850
{ my %font;
16851
$font{tag} = "div";
16852
$font{class} = "error";
16853
$font{innerHTML} = Html2::italicize($url) . Html2::br() . " does not exist on this server! ";
16854
16855
$extmsg = Html2::tag(\%font);
16856
}
16857
} elsif ($e eq 500) {
16858
$legend{innerHTML} .= img("i=" . Bc_sql::get_constant("IMAGE_500"), "", "", "", "", 1);
16859
$legend{innerHTML} .= "Server Error";
16860
16861
{ my %font;
16862
$font{tag} = "div";
16863
$font{class} = "error";
16864
$font{style} = "white-space: normal";
16865
$font{innerHTML} = "The server was unable to process the request because of an error in the code at" . Html2::br() . Html2::italicize($url);
16866
16867
$extmsg = Html2::tag(\%font);
16868
}
16869
} elsif ($e eq 4004) {
16870
$legend{innerHTML} .= $msg;
16871
{ my %font;
16872
$font{tag} = "div";
16873
$font{class} = "notice";
16874
$font{innerHTML} = " $extmsg ";
16875
16876
$extmsg = Html2::tag(\%font);
16877
}
16878
} else {
16879
$legend{innerHTML} .= "Error $e - $msg";
16880
{ my %font;
16881
$font{tag} = "div";
16882
$font{class} = "error";
16883
$font{innerHTML} = " $extmsg ";
16884
16885
$extmsg = Html2::tag(\%font);
16886
}
16887
}
16888
16889
$fs{innerHTML} .= Html2::tag(\%legend);
16890
}
16891
16892
$fs{innerHTML} .= "<table align=center border=$ERROR_BORDER cellpadding=0 cellspacing=0><tr><td>";
16893
$fs{innerHTML} .= $extmsg;
16894
if ($e ne 4004) {
16895
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
16896
my $refr = Bc_misc::referrer();
16897
if ($refr) {
16898
$fs{innerHTML} .=Html2::hr({style=>"margin-top: 15px;"});
16899
$fs{innerHTML} .= "Return to the" . Html2::br();
16900
{ my %link;
16901
$link{tag} = "a";
16902
$link{href} = $refr;
16903
$link{innerHTML} = "referring page";
16904
16905
$fs{innerHTML} .= Html2::tag(\%link);
16906
}
16907
$fs{innerHTML} .= "</td></tr><tr><td class=spacery>";
16908
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
16909
$fs{innerHTML} .= Html2::embolden("or") . Html2::br();
16910
$fs{innerHTML} .= "</td></tr><tr><td class=spacery>";
16911
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
16912
}
16913
$fs{innerHTML} .= "Go to the ";
16914
{ my %link;
16915
$link{tag} = "a";
16916
$link{href} = "/";
16917
$link{innerHTML} = "Home Page";
16918
16919
$fs{innerHTML} .= Html2::tag(\%link);
16920
}
16921
$fs{innerHTML} .= "</td></tr></table>";
16922
} else {
16923
if ($msg =~ /create an account/i) {
16924
$fs{innerHTML} .= "<table border=$ERROR_BORDER cellpading=0 cellspacing=0><tr><td align=center class=subtitle>";
16925
$fs{innerHTML} .= "Features";
16926
$fs{innerHTML} .= "</td></tr><tr><td class=spacery>";
16927
$fs{innerHTML} .= "</td></tr><tr><td align=center>";
16928
$fs{innerHTML} .= "messaging" . Html2::br();
16929
$fs{innerHTML} .= "alerts" . Html2::br();
16930
$fs{innerHTML} .= "themes" . Html2::br();
16931
$fs{innerHTML} .= "and more!";
16932
$fs{innerHTML} .= "</td></tr></table>";
16933
}
16934
}
16935
16936
if ($e ne 4004) {
16937
my %div;
16938
$div{tag} = "div";
16939
$div{class} = "small";
16940
$div{innerHTML} = "copyright " .
16941
Html2::tag({tag=>"sup", innerHTML=>Html2::embolden("©")}) . " 2015; " .
16942
Html2::embolden({class=>"nowrap", innerHTML=>Bc_sql::get_site_name()}) .
16943
Html2::tag({tag=>"sup", innerHTML=>Html2::embolden("™")});
16944
16945
$fs{innerHTML} .= Html2::tag(\%div);
16946
}
16947
16948
$msg{innerHTML} .= Html2::tag(\%fs);
16949
}
16950
16951
$div{innerHTML} .= Html2::tag(\%msg);
16952
}
16953
16954
$output .= Html2::tag(\%div);
16955
}
16956
16957
return $output; # a scalar
16958
#usage: print display_error_page($ENV{REQUEST_URI}, 500, "");
16959
}
16960
16961
########################
16962
sub display_about_page(;$) {
16963
#*
16964
# by now you should know what this does
16965
#*
16966
my ($spacing) = @_; # spacing for pretty printing HTML output (optional)
16967
if (!$spacing) { $spacing = ""; }
16968
16969
my $sql = "select * from misc where name='about'";
16970
my $result = Bc_sql::sql_execute($sql, "Html.pm - display about page");
16971
my $rv;
16972
16973
if (ref $result eq "HASH") {
16974
$rv = "$result->{value}";
16975
} else {
16976
$rv = "about page data is corrupt, or there was an error retrieving the about page data";
16977
}
16978
16979
return $rv; # a scalar
16980
#usage: print display_about_page("");
16981
}
16982
16983
########################
16984
sub display_store_page(;$) {
16985
#*
16986
# to display the store!
16987
# full of gifts, and themes
16988
#*
16989
my ($spacing) = @_; # spacing for pretty printing HTML output
16990
if (!$spacing) { $spacing = ""; }
16991
my $DEBUG = 1;
16992
16993
my $PP_server = "www.paypal.com";
16994
if ($DEBUG) { $PP_server = "www.sandbox.paypal.com"; }
16995
16996
my $themeDescHeight = "250px";
16997
my $themeWidth = "375"; # px is concatenated after next line
16998
my $previewButtonTDWidth = ($themeWidth - 30) . "px";
16999
$themeWidth .= "px";
17000
my $themeHeight = "300px";
17001
my $themeListHeight = "300px";
17002
my $themeListWidth = "175px";
17003
17004
my $sql = "select ID from themes where premium = '2'";
17005
my $ref = Bc_sql::sql_execute($sql, "display store page");
17006
# we now have a reference to a list of hash references
17007
# each hash reference contains a theme ID!
17008
my @themes = ();
17009
foreach my $theme (@$ref) {
17010
my $td = Bc_sql::get_theme_data($theme->{ID});
17011
push @themes, "$td->{ID}=" . Bc_misc::shorten_str($td->{name}, 18);
17012
}
17013
17014
my $rv = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
17015
{ my %script;
17016
$script{tag} = "script";
17017
$script{innerHTML} = "\n";
17018
$script{innerHTML} .= "function updateFrame() {\n";
17019
$script{innerHTML} .= " var c = document.getElementById('user_coins');\n";
17020
$script{innerHTML} .= " var f = document.getElementById('f');\n";
17021
$script{innerHTML} .= " var s = document.getElementById('user_theme');\n";
17022
$script{innerHTML} .= "\n";
17023
$script{innerHTML} .= " f.src = '/previewtheme.pl?tid=' + s.value;\n";
17024
$script{innerHTML} .= "}\n";
17025
$script{innerHTML} .= "\n";
17026
$script{innerHTML} .= "var previewing = 0;\n";
17027
$script{innerHTML} .= "function preview() {\n";
17028
$script{innerHTML} .= " var b = document.getElementById('preview_button');\n";
17029
$script{innerHTML} .= " var view = \"<img src='images/mix/eye.png' height=20> Preview selected theme\";\n";
17030
$script{innerHTML} .= " var unview = \"<img src='images/brown/eye_close.png' height=20> Unpreview\";\n";
17031
$script{innerHTML} .= " if (previewing == 1) {\n";
17032
$script{innerHTML} .= " //console.log('restore theme');\n";
17033
$script{innerHTML} .= " restore_theme();\n";
17034
$script{innerHTML} .= " previewing = 0;\n";
17035
$script{innerHTML} .= " b.innerHTML = view;\n";
17036
$script{innerHTML} .= " } else {\n";
17037
$script{innerHTML} .= " //console.log('preview theme');\n";
17038
$script{innerHTML} .= " preview_theme();\n";
17039
$script{innerHTML} .= " previewing = 1;\n";
17040
$script{innerHTML} .= " b.innerHTML = unview;\n";
17041
$script{innerHTML} .= " }\n";
17042
$script{innerHTML} .= "}\n";
17043
$script{innerHTML} .= "\n";
17044
17045
my @array;
17046
for (my $i = 0; $i < 123; $i++) { $array[$i] = $i; }
17047
my %hash;
17048
$hash{test1} = "test 1";
17049
$hash{test2} = "test 2";
17050
$hash{test3} = "test 3";
17051
$hash{test4} = "test 4";
17052
foreach my $key (%hash) { $script{innerHTML} .= "//$key => $hash{$key}" . Html2::br(); }
17053
17054
$rv .= Html2::tag(\%script);
17055
}
17056
17057
$rv .= dropdown("user_theme", "", 0, "", "updateFrame();", "", " size=2 style='max-height: $themeListHeight; max-width: $themeListWidth; min-height: $themeListHeight; min-width: $themeListWidth;'", Html2::br(), \@themes, 0);
17058
my $t = $themes[0];
17059
$t =~ s/\=(.)*//;
17060
$rv .= "</td><td width=15></td><td>";
17061
17062
{ my %iframe;
17063
$iframe{tag} = "iframe";
17064
$iframe{id} = "f";
17065
$iframe{src} = "/previewtheme.pl?tid=$t";
17066
$iframe{style} = "max-height: $themeDescHeight; max-width: $themeWidth; min-height: $themeHeight; min-width: $themeWidth;";
17067
17068
$rv .= Html2::tag(\%iframe);
17069
}
17070
17071
{ my %script;
17072
$script{tag} = "script";
17073
$script{async} = 1;
17074
$script{innerHTML} = "updateFrame(); store_update_coins();";
17075
17076
$rv .= Html2::tag(\%script);
17077
}
17078
$rv .= "</td></tr><tr><td align=right colspan=3>";
17079
{ my %button;
17080
$button{tag} = "button";
17081
$button{type} = "button";
17082
$button{class} = "green";
17083
$button{id} = "preview_button";
17084
$button{onclick} = "preview();";
17085
$button{innerHTML} = "";
17086
17087
{ my %img;
17088
$img{tag} = "img";
17089
$img{src} = "/images/mix/eye.png";
17090
$img{height} = "20";
17091
17092
$button{innerHTML} .= Html2::tag(\%img);
17093
}
17094
17095
$button{innerHTML} .= " Preview selected theme";
17096
17097
$rv .= Html2::tag(\%button);
17098
}
17099
$rv .= "</td></tr></table>";
17100
17101
$rv .= Html2::br();
17102
$rv .= "<table border=0 cellpadding=0 cellspacing=0><tr><td align=center>";
17103
{ my %div;
17104
$div{tag} = "div";
17105
$div{class} = "subnavbar";
17106
$div{innerHTML} = "You have " . Html2::embolden({id=>"user_coins", innerHTML=>get_user_points($Bc_sql::LOGGEDIN)});
17107
{ my %img;
17108
$img{tag} = "img";
17109
$img{src} = "/img.pl?i=orange/coin_single_gold.png";
17110
$img{height} = "16";
17111
17112
$div{innerHTML} .= Html2::tag(\%img);
17113
}
17114
$div{innerHTML} .= Html2::br() . Html2::small("All prices are Canadian (CAD)") . Html2::br();
17115
$div{innerHTML} .= "Today is " . Html2::embolden(Date::expand_date(Date::get_today("db", 1))) . Html2::br();
17116
17117
$rv .= Html2::tag(\%div);
17118
}
17119
$rv .= "</td></tr></table>";
17120
17121
return $rv; # a scalar
17122
#usage: print display_store_page();
17123
}
17124
17125
########################
17126
sub display_theme_names_asDropdown($$$$$$) {
17127
#*
17128
# creates a dropdown of all themes available to the loggedin user
17129
#*
17130
my ($id, $selected, $title, $extras, $spacing, $separator) = @_; # an id for the dropdown && value of the selected item && a title before the dropdown && extra html attributes && spacing for pretty printing HTML output && an ending for after the dropdown
17131
if (!$spacing) { $spacing = ""; }
17132
17133
if ($spacing eq 0) { $spacing = ""; }
17134
if ($separator eq "\n") { $separator = ""; }
17135
17136
my $output = "";
17137
if ($title) { $output .= Html2::italicize(Html2::embolden($title)); }
17138
{ my %select;
17139
$select{tag} = "select";
17140
if ($id) { $select{id} = $id; }
17141
$select{innerHTML} = "";
17142
17143
my @themes = Bc_sql::get_themes();
17144
my @purchases = Bc_sql::get_theme_purchases();
17145
17146
# this should always get a list of
17147
# basic and purchased themes
17148
17149
foreach my $theme (@themes) {
17150
my ($TID, $tname) = split("=", $theme);
17151
my $purchased = User::isUserAdmin($Bc_sql::LOGGEDIN);
17152
foreach my $purchase (@purchases) {
17153
if ($purchase eq $TID) { $purchased = 1; last; }
17154
}
17155
17156
my $ref = Bc_sql::theme_exists($TID);
17157
if (ref $ref eq "HASH") {
17158
if ($ref->{premium} eq 1 or $purchased) {
17159
my %option;
17160
$option{tag} = "option";
17161
$option{value} = $TID;
17162
if ($selected eq $TID) { $option{selected} = 1; }
17163
$option{innerHTML} .= $tname;
17164
17165
$select{innerHTML} .= Html2::tag(\%option);
17166
}
17167
}
17168
}
17169
17170
$output .= Html2::tag(\%select);
17171
}
17172
#if ($separator ne "") { $output .= $separator; }
17173
if ($extras) { $output =~ s/>/ $extras/; }
17174
17175
return $output; # a scalar
17176
#usage: my $bobsThemes = display_theme_names_asDropdown("bob_themes", "Themes", "", "");
17177
}
17178
17179
########################
17180
sub display_theme_names($$$$$) {
17181
#*
17182
# just a list of all theme names
17183
#*
17184
my ($title, $class, $spacing, $separator) = @_; # a title for the list && a class && spacing for pretty printing HTML output && an ending
17185
if (!$spacing) { $spacing = ""; }
17186
17187
if ($spacing eq 0) { $spacing = ""; }
17188
if ($separator eq 0) { $separator = ""; }
17189
17190
my $output = "";
17191
17192
{ my %div;
17193
$div{tag} = "div";
17194
if ($class) { $div{class} = $class; }
17195
$div{innerHTML} = "";
17196
17197
if ($title) {
17198
my %title;
17199
$title{tag} = "div";
17200
$title{class} = "subtitle";
17201
$title{innerHTML} = $title;
17202
17203
$div{innerHTML} .= Html2::tag(\%title);
17204
}
17205
17206
{ my %ul;
17207
$ul{tag} = "ul";
17208
$ul{innerHTML} = "";
17209
17210
my @themes = get_themes();
17211
foreach my $themenum (@themes) {
17212
my %themedata = Bc_sql::get_theme_data($themenum);
17213
my %li;
17214
$li{tag} = "li";
17215
$li{innerHTML} = $themenum . " - " . $themedata{name};
17216
17217
$ul{innerHTML} .= Html2::tag(\%li);
17218
}
17219
17220
$div{innerHTML} .= Html2::tag(\%ul);
17221
}
17222
17223
$output .= Html2::tag(\%div);
17224
}
17225
17226
return $output; # a scalar
17227
#usage: my $themesList = display_theme_names("Themes", "css_themes_list", "", "");
17228
}
17229
17230
########################
17231
sub display_user_list($$$$$$) {
17232
#*
17233
# html'izes a list of all users
17234
#*
17235
my ($title, $class, $spacing, $admins, $separator) = @_; # a title && a css class && spacing for pretty printing HTML output && include admins or not && a separator for after the list
17236
if (!$spacing) { $spacing = ""; }
17237
17238
if ($spacing eq 0) { $spacing = ""; }
17239
if ($separator eq 0) { $separator = ""; }
17240
17241
my $output = "<table border=$TABLE_BORDER";
17242
if ($class) { $output .= " class=\"$class\""; }
17243
$output .= "><tr><td>";
17244
17245
{ my %fs;
17246
$fs{tag} = "fieldset";
17247
$fs{innerHTML} = "";
17248
17249
if ($title) {
17250
my %legend;
17251
$legend{tag} = "legend";
17252
$legend{class} = "subtitle";
17253
$legend{innerHTML} = $title;
17254
17255
$fs{innerHTML} .= Html2::tag(\%legend);
17256
}
17257
17258
if ($admins) {
17259
foreach my $user (Bc_sql::get_users(0)) { $fs{innerHTML} .= $user . Html2::br(); }
17260
} else {
17261
foreach my $user (Bc_sql::get_users(1)) { $fs{innerHTML} .= $user . Html2::br(); }
17262
}
17263
17264
$output .= Html2::tag(\%fs);
17265
}
17266
$output .= "</td></tr></table>";
17267
17268
return $output; # a scalar
17269
#usage: my $ulist = display_user_list("Users", "css_users_list", "", 1, "");
17270
}
17271
17272
########################
17273
sub display_welcome_page($) {
17274
#*
17275
# shows a welcome page
17276
# for AFTER a user becomes a subscriber!
17277
#*
17278
# @_; # (no params)
17279
my ($spacing) = @_; # spacing for pretty printing HTML output
17280
if (!$spacing) { $spacing = ""; }
17281
17282
my $output = "Hey, " . Html2::embolden($Bc_sql::USER_DATA->{nickname}) . ", thanks for becoming a Premium member at " . Html2::embolden(Bc_sql::get_constant("SITE_NAME")) . Html2::br() . Html2::br();
17283
17284
$output .= "You now have " . Html2::italicize("Premium") . " access to " . Bc_misc::word_as_possessive(Bc_sql::get_constant("SITE_NAME")) . Html2::tag({tag=>"a", href=>"/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("STORE_PAGE"), innerHTML=>"store"}) . ", themes, chat and more!" . Html2::br();
17285
{ my %link;
17286
$link{tag} = "a";
17287
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("BROWSE_PAGE");
17288
$link{innerHTML} = "Browse";
17289
17290
$output .= Html2::tag(\%link) . " our list of users, ";
17291
}
17292
$output .= "add some fuck buddies, send them gifts or alerts, and enjoy your time with " . Bc_sql::get_constant("SITE_NAME") . "!" . Html2::br();
17293
17294
# table($content, $spacing, $class, $centered, $extras, $separator)
17295
$output = table(table($output, $spacing, "", 1, "", ""), "$spacing", "", 1, "style='height: 100%; width: 100%;'", "");
17296
17297
return $output; # a scalar
17298
#usage: my $ulist = display_welcome_page("");
17299
}
17300
17301
########################
17302
sub form() {
17303
#*
17304
# html'izes a list of all users
17305
#*
17306
my ($title, $action, $method, $content, $class, $spacing, $admins, $separator) = @_; # a title && action && method && a css class && spacing for pretty printing HTML output && include admins or not && a separator for after the list
17307
if (!$spacing) { $spacing = ""; }
17308
if (not $method) { $method = "post"; }
17309
17310
my %form;
17311
$form{tag} = "form";
17312
$form{innerHTML} = "";
17313
17314
if ($action) { $form{action} = $action; }
17315
if ($method) { $form{method} = $method; }
17316
if ($title) { $form{innerHTML} .= $title };
17317
$form{innerHTML} .= $content;
17318
17319
return Html2::tag(\%form); # a scalar
17320
#usage: my $ulist = display_welcome_page("");
17321
}
17322
17323
########################
17324
sub centered($) {
17325
#*
17326
# "centers" some "content" horizontally and vertically.
17327
# crossbrowser compatible, and will never fail!
17328
#*
17329
my ($contents) = @_; # hash reference
17330
my $rv = "";
17331
if (ref $contents eq "HASH") {
17332
$rv = $contents->{spacing} . "<table border=0 cellspacing=0 class=fullsize><tr><td></td><td";
17333
if ($contents->{topcenter}) {
17334
$rv .=" valign=top style='white-space: nowrap;'>$contents->{topcenter}";
17335
} else {
17336
$rv .= ">";
17337
}
17338
$rv .= "</td><td></td></tr><tr><td></td><td width=1 height=1";
17339
if (not $contents->{disable_nowrap}) { $rv .= " style='white-space: nowrap;'"; }
17340
if ($contents->{main_align}) { $rv .= " align=" . $contents->{main_align}; }
17341
if ($contents->{class}) { $rv .= " class=" . $contents->{class}; }
17342
if ($contents->{main_valign}) { $rv .= " valign=" . $contents->{main_valign}; }
17343
$rv .= ">";
17344
$rv .= $contents->{spacing} . $contents->{main} . "";
17345
$rv .= $contents->{spacing} . "</td><td></td></tr><tr><td></td><td";
17346
if ($contents->{bottomcenter}) {
17347
$rv .= " valign=bottom style='white-space: nowrap;'>$contents->{bottomcenter}";
17348
} else {
17349
$rv .= ">";
17350
}
17351
$rv .= "</td><td></td></tr></table>";
17352
}
17353
17354
return $rv; # a scalar
17355
#usage: my $centralized = centered("Hello, Worldly Folk");
17356
}
17357
17358
########################
17359
sub display_modal($$$$$$;$$) {
17360
#*
17361
# puts a hidden modal into your document
17362
#
17363
# it's up to you to include the bits to
17364
# show the modal! it is??
17365
#
17366
# where $toggler format is: type,label[,src]
17367
# where type can be: button, link, or almost
17368
# any other HTML element (including images)
17369
#
17370
# $id must be unique
17371
#*
17372
my ($id, $toggler, $class, $title, $content, $footer, $spacing, $togglerclass) = @_; # an ID for the modal && that which opens the modal && css class && title && contents && footer contents && spacing for pretty printing HTML output && a class for the toggler (just in case)
17373
if (!$spacing) { $spacing = ""; }
17374
my $debug = 0;
17375
if ($spacing eq "debug") { $debug = 1; $spacing = ""; }
17376
17377
if (not $toggler) { $toggler = "button,show modal $id"; }
17378
if (not $title) { $title = "(no title)"; }
17379
if (not $footer) { $footer = "(no description)"; }
17380
17381
my ($toggleType, $toggleLabel, $toggleSrc, $toggleImgSize, $toggleImgBorders) = split(",", $toggler);
17382
$toggleType = lc($toggleType);
17383
17384
$content =~ s/\"/\\\"/g;
17385
17386
my $output = "";
17387
17388
if ($debug) {
17389
$output .= "debug info" . Html2::br();
17390
$output .= "id: " . $id . Html2::br();
17391
$output .= "toggler: " . $toggler . Html2::br();
17392
$output .= "class: " . $class . Html2::br();
17393
$output .= "title: " . $title . Html2::br();
17394
$output .= "content: " . Html2::italicize("not shown here!") . Html2::br();
17395
$output .= "footer: " . $footer . Html2::br();
17396
$output .= "toggler Class: " . $togglerclass . Html2::br();
17397
$output .= "toggle Type: " . $toggleType . Html2::br();
17398
}
17399
17400
my %script; {
17401
$script{tag} = "script";
17402
$script{innerHTML} = "var $id" . "_modal;\n";
17403
$script{innerHTML} .= "var $id" . "_modal_toggler;\n";
17404
$script{innerHTML} .= "var $id" . "_closer;\n";
17405
$script{innerHTML} .= "\n";
17406
$script{innerHTML} .= "const $id" . "_modalClose = _ => { $id" . "_modal.classList.remove('is-open'); $id" . "_modal.removeEventListener('animationend', $id" . "_modalClose); }\n";
17407
$script{innerHTML} .= "\n";
17408
$script{innerHTML} .= "function initModal$id(m) {\n";
17409
$script{innerHTML} .= " $id" . "_modal = document.getElementById(m + '_modal');\n";
17410
$script{innerHTML} .= " $id" . "_modal_toggler = document.getElementById(m + '_modal_toggler');\n";
17411
$script{innerHTML} .= " $id" . "_closer = document.getElementById(m + '_closer');\n";
17412
$script{innerHTML} .= " $id" . "_modal_toggler.addEventListener('click', e => {\n";
17413
$script{innerHTML} .= " //console.log('open modal ' + m);\n";
17414
$script{innerHTML} .= " e.preventDefault()\n";
17415
$script{innerHTML} .= " showModal$id(m);\n";
17416
$script{innerHTML} .= " document.getElementsByTagName('html')[0].style.overflowY = 'hidden';\n";
17417
$script{innerHTML} .= " });\n";
17418
$script{innerHTML} .= "\n";
17419
$script{innerHTML} .= " $id" . "_closer.addEventListener('keydown', e => {\n";
17420
$script{innerHTML} .= " if (e.keyCode == 27 && $id" . "_modal.classList.contains('is-open')) {\n";
17421
$script{innerHTML} .= " //console.log('esc pressed');\n";
17422
$script{innerHTML} .= " $id" . "_modal.style.animation = 'modalFadeOut 500ms forwards';\n";
17423
$script{innerHTML} .= " $id" . "_modal.addEventListener('animationend', $id" . "_modalClose);\n";
17424
$script{innerHTML} .= " $id" . "_modal.focus();\n";
17425
$script{innerHTML} .= " document.getElementsByTagName('html')[0].style.overflowY = 'scroll';\n";
17426
$script{innerHTML} .= " }\n";
17427
$script{innerHTML} .= " });\n";
17428
17429
$script{innerHTML} .= " $id" . "_closer.addEventListener('click', e => {\n";
17430
$script{innerHTML} .= " //console.log('close modal ' + m);\n";
17431
$script{innerHTML} .= " e.preventDefault()\n";
17432
$script{innerHTML} .= " showModal$id(m);\n";
17433
$script{innerHTML} .= " document.getElementsByTagName('html')[0].style.overflowY = 'scroll';\n";
17434
$script{innerHTML} .= " });\n";
17435
$script{innerHTML} .= "}\n";
17436
$script{innerHTML} .= "\n";
17437
$script{innerHTML} .= "function showModal$id(m) {\n";
17438
$script{innerHTML} .= " $id" . "_modal_toggler = document.getElementById(m + '_modal_toggler');\n";
17439
$script{innerHTML} .= " $id" . "_modal_content = document.getElementById(m + '_modal_content');\n";
17440
$script{innerHTML} .= " $id" . "_modal = document.getElementById(m + '_modal');\n";
17441
$script{innerHTML} .= " $id" . "_closer = document.getElementById(m + '_closer');\n";
17442
$script{innerHTML} .= "\n";
17443
$script{innerHTML} .= " if ($id" . "_modal.classList.contains('is-open')) {\n";
17444
$script{innerHTML} .= " $id" . "_modal.style.animation = 'modalFadeOut 500ms forwards';\n";
17445
$script{innerHTML} .= " $id" . "_modal.addEventListener('animationend', $id" . "_modalClose);\n";
17446
$script{innerHTML} .= " } else { \n";
17447
$script{innerHTML} .= " $id" . "_modal.classList.add('is-open');\n";
17448
$script{innerHTML} .= " $id" . "_modal.style.animation = 'modalFadeIn 500ms forwards';\n";
17449
$script{innerHTML} .= " $id" . "_modal_content.innerHTML = \"$content\";\n";
17450
$script{innerHTML} .= " }\n";
17451
$script{innerHTML} .= "}\n";
17452
17453
$output .= Html2::tag(\%script);
17454
}
17455
17456
17457
my %toggler; {
17458
$toggler{id} = $id . "_modal_toggler";
17459
$toggler{innerHTML} = $toggleLabel;
17460
if ($togglerclass) { $toggler{class} = $togglerclass; }
17461
17462
if ($toggleType eq "link") {
17463
$toggler{tag} = "a";
17464
} elsif ($toggleType eq "button") {
17465
$toggler{tag} = "button";
17466
$toggler{type} = "button";
17467
} elsif ($toggleType eq "img") {
17468
$toggler{tag} = "img";
17469
$toggler{alt} = $toggleLabel;
17470
$toggler{title} = $toggleLabel;
17471
$toggler{src} = $toggleSrc;
17472
if ($toggleSrc !~ /getimage\.pl/ and $toggleSrc !~ /img.\pl/ and $toggleImgSize ne "0") {
17473
$toggler{height} = $toggleImgSize;
17474
}
17475
$toggler{class} .= " enlarge clickable";
17476
delete $toggler{innerHTML};
17477
} else {
17478
$toggler{tag} = $toggleType;
17479
$toggler{class} .= " enlarge clickable";
17480
}
17481
17482
$output .= Html2::tag(\%toggler);
17483
}
17484
17485
{ my %modal;
17486
$modal{tag} = "div";
17487
$modal{id} = $id . "_modal";
17488
$modal{class} = "modal";
17489
if ($class) { $modal{class} .= " $class"; }
17490
$modal{innerHTML} = "";
17491
17492
{ my %closebutton;
17493
$closebutton{tag} = "button";
17494
$closebutton{type} = "button";
17495
$closebutton{innerHTML} = "x";
17496
$closebutton{id} = $id . "_closer";
17497
$closebutton{class} = "modal-close";
17498
17499
$modal{innerHTML} .= Html2::tag(\%closebutton);
17500
}
17501
17502
{ my %modalcontainer;
17503
$modalcontainer{tag} = "div";
17504
$modalcontainer{class} = "modal-container";
17505
$modalcontainer{innerHTML} = "";
17506
17507
{ my %modalheader;
17508
$modalheader{tag} = "div";
17509
$modalheader{class} = "modal-header";
17510
$modalheader{innerHTML} = "";
17511
17512
{ my %title;
17513
$title{tag} = "div";
17514
$title{class} = "subnavbar";
17515
$title{innerHTML} = $title;
17516
17517
$modalheader{innerHTML} .= Html2::tag(\%title);
17518
} # end title
17519
17520
$modalcontainer{innerHTML} .= Html2::tag(\%modalheader);
17521
} # end modal header
17522
17523
{ my %modalcontent;
17524
$modalcontent{tag} = "div";
17525
$modalcontent{id} = $id . "_modal_content";
17526
$modalcontent{class} = "modal-content";
17527
if ($toggleImgBorders) { $modalcontent{class} .= " bordered"; }
17528
17529
$modalcontainer{innerHTML} .= Html2::tag(\%modalcontent);
17530
}
17531
17532
{ my %modalfooter;
17533
$modalfooter{tag} = "div";
17534
$modalfooter{class} = "modal-footer";
17535
$modalfooter{innerHTML} = $footer;
17536
17537
$modalcontainer{innerHTML} .= Html2::tag(\%modalfooter);
17538
}
17539
17540
$modal{innerHTML} .= Html2::tag(\%modalcontainer);
17541
} # end modal inner container
17542
17543
{ my %initjs;
17544
$initjs{tag} = "script";
17545
$initjs{innerHTML} = "initModal$id(\"$id\");";
17546
17547
$modal{innerHTML} .= Html2::tag(\%initjs);
17548
}
17549
17550
$output .= Html2::tag(\%modal);
17551
} # end modal container (dunno why 2, but hey, here we are)
17552
17553
return $output; # a scalar
17554
#usage: my $modal = display_modal("", "subnavbar");
17555
}
17556
17557
########################
17558
sub display_source(;$$) {
17559
#*
17560
# displays the raw contents of a given file
17561
# if not $fn, then display list of files.
17562
#*
17563
my ($fn, $spacing) = @_; # a filename (include full path or it's relative to webroot) && spacing for pretty printing HTML output (optional)
17564
if (!$spacing) { $spacing = ""; }
17565
my $text = "";
17566
17567
if (not $fn) {
17568
{ my %container;
17569
$container{tag} = "div";
17570
$container{class} = "center";
17571
$container{style} = "width: 100%; padding-bottom: 5px;";
17572
17573
{ my %div;
17574
$div{tag} = "div";
17575
$div{class} = "padded-large error";
17576
$div{innerHTML} = "";
17577
17578
{ my %img;
17579
$img{tag} = "img";
17580
$img{src} = "/img.pl?i=site/bullet_delete.png&s=u";
17581
$img{width} = "32";
17582
17583
$div{innerHTML} .= Html2::tag(\%img);
17584
}
17585
17586
$div{innerHTML} .= " Copying Source is forbidden";
17587
17588
$container{innerHTML} .= Html2::tag(\%div);
17589
}
17590
17591
$text .= Html2::tag(\%container);
17592
}
17593
17594
my @list = Bc_dir::files("./", "pl");
17595
17596
my @pms = Bc_dir::files("./Pm", "pm");
17597
foreach my $file (@pms) { $file = "Pm/" . $file; }
17598
push(@list, @pms);
17599
17600
my @css = Bc_dir::files("./css", "sass");
17601
foreach my $file (@css) { $file = "css/" . $file; }
17602
push(@list, @css);
17603
17604
foreach my $file (sort @list) {
17605
my %div;
17606
$div{tag} = "div";
17607
$div{class} = "file";
17608
$div{innerHTML} = "";
17609
17610
{ my %link;
17611
$link{tag} = "a";
17612
$link{href} = "/?$Bc_sql::QUERY_PAGE=" . Bc_sql::get_constant("SOURCE_PAGE") . "&sc=$file";
17613
$link{innerHTML} = $file;
17614
17615
$div{innerHTML} .= Html2::tag(\%link);
17616
}
17617
17618
$text .= Html2::tag(\%div);
17619
}
17620
} else {
17621
if ($fn =~ /debug.pl/ or $fn =~ /\.txt|\.db$/i) {
17622
my %div;
17623
$div{tag} = "div";
17624
$div{class} = "error";
17625
$div{innerHTML} = "Oh, not this one, sorry folks. i'm not HIDING anything," . Html2::br() . "I just need to refactor a few things," . Html2::br();
17626
$div{innerHTML} .= "and move sensitive data out of the code." . Html2::br() . "once i do that, this code will be visible. Either that, or you're" . Html2::br();
17627
$div{innerHTML} .= "trying to access the site's database - which, no matter how open we are, we can't let you see into the database.";
17628
17629
$text .= Html2::tag(\%div);
17630
} else {
17631
$fn =~ s/\%2F/\//ig;
17632
my $ftext = Bc_dir::read_text($fn);
17633
17634
if ($ftext !~ /^No such file or directory/i) {
17635
my $nr_of_lines = $ftext =~ tr/\n//;
17636
$nr_of_lines++;
17637
$ftext =~ s/\</\</g;
17638
$ftext =~ s/\>/\>/g;
17639
$ftext =~ s/ /\ /g;
17640
17641
my @temp = split("\n", $ftext);
17642
$ftext = "";
17643
my $count = 1;
17644
my $w = 15 * (length $#temp);
17645
foreach my $line (@temp) {
17646
{ my %container;
17647
$container{tag} = "div";
17648
$container{class} = "hilite";
17649
$container{innerHTML} = "";
17650
17651
{ my %countdiv;
17652
$countdiv{tag} = "div";
17653
$countdiv{class} = "inline-block blue-panel center";
17654
$countdiv{style} = "margin-right: 5px; min-width: " . $w . "px; margin-right: 5px;";
17655
$countdiv{innerHTML} = $count;
17656
17657
$container{innerHTML} .= Html2::tag(\%countdiv);
17658
}
17659
17660
{ my %spacer;
17661
$spacer{tag} = "div";
17662
$spacer{class} = "spacerx inline-block";
17663
17664
$container{innerHTML} .= Html2::tag(\%spacer);
17665
}
17666
17667
{ my %codeline;
17668
$codeline{tag} = "div";
17669
$codeline{class} = "inline";
17670
$codeline{innerHTML} = $line;
17671
17672
$container{innerHTML} .= Html2::tag(\%codeline);
17673
}
17674
17675
$line = Html2::tag(\%container);
17676
}
17677
17678
$count++;
17679
}
17680
$ftext = join("\n", @temp);
17681
17682
my %title; {
17683
$title{tag} = "div";
17684
$title{class} = "title";
17685
$title{innerHTML} = $fn;
17686
}
17687
my %copy; {
17688
$copy{tag} = "div";
17689
$copy{class} = "copyright error";
17690
$copy{innerHTML} = "Copying Source is Forbidden";
17691
}
17692
my %lines; {
17693
$lines{tag} = "div";
17694
$lines{class} = "count";
17695
$lines{innerHTML} = $nr_of_lines . " lines of code";
17696
}
17697
my %code; {
17698
$code{tag} = "div";
17699
$code{class} = "code";
17700
$code{innerHTML} = $ftext;
17701
}
17702
17703
$text .= Html2::tag(\%title);
17704
$text .= Html2::tag(\%copy);
17705
$text .= Html2::tag(\%lines);
17706
$text .= Html2::tag(\%code);
17707
} else {
17708
# yes, "$text =" and not "$text .="!!!
17709
my %div;
17710
$div{tag} = "div";
17711
$div{class} = "error";
17712
$div{innerHTML} = "Oh, for security purposes, not this one, sorry folks.";
17713
17714
$text = Html2::tag(\%div);
17715
}
17716
}
17717
}
17718
17719
my $div_class = "source";
17720
if (not $fn) { $div_class .= "-list"; }
17721
17722
return Html2::tag({tag=>"div", class=>$div_class, innerHTML=>$text}); # a scalar
17723
#usage: my $code = display_source("Pm/Date.pm");
17724
}
17725
17726
17727
################################################################################################
17728
# single param duplicates (<--- shrug)
17729
# the param will always need to be a hash ref
17730
# this parameter-passing method allows us to expand our parameters without worrying about
17731
# compiler errors, and it really does simplify subroutine params!
17732
################################################################################################
17733
17734
########################
17735
sub label2($) {
17736
#*
17737
# returns an HTML label tag, complete with
17738
# (possibly, if included), an input
17739
# param is a hash reference.
17740
# eg: $hashref->{for} = "myCheckbox";<br>
17741
17742
# now, i've only programmed the following HTML attributes:
17743
# class, for, id, name, onclick, style, title, and value<br>
17744
17745
# there are other 'attributes' you can include in your
17746
# hash reference. They are:
17747
# ender, innerHTML, separator<br>
17748
17749
# where {innerHTML} can be any HTML you like
17750
# and {separator} is meant for pretty printing HTML output
17751
# and ender is the very last thing added to the button before returning the button
17752
17753
# !note: all hash keys must be cased as shown!
17754
#*
17755
my ($hashref) = @_; # a hash reference
17756
my %label;
17757
$label{tag} = "label";
17758
17759
if ($hashref->{class}) { $label{class} = $hashref->{class}; }
17760
if ($hashref->{for}) { $label{for} = $hashref->{for}; }
17761
if ($hashref->{id}) { $label{id} = $hashref->{id}; }
17762
if ($hashref->{name}) { $label{name} = $hashref->{name}; }
17763
if ($hashref->{onclick}) { $label{onclick} = $hashref->{onclick}; }
17764
if ($hashref->{title}) { $label{title} .= $hashref->{title}; }
17765
if ($hashref->{style}) { $label{style} .= $hashref->{style}; }
17766
if ($hashref->{value}) { $label{value} .= $hashref->{value}; }
17767
17768
if ($hashref->{innerHTML}) { $label{innerHTML} = $hashref->{innerHTML}; }
17769
17770
return Html2::tag(\%label); # a scalar (empty when $hashref isn't a hash reference)
17771
#usage: my $label = label2(\%myLabel_input);
17772
}
17773
17774
########################
17775
sub input2($) {
17776
#*
17777
# returns an HTML input tag
17778
# param is a hash reference.
17779
# eg: $hashref->{id} = "myInputID";<br>
17780
17781
# now, i've only programmed the following HTML attributes:
17782
# class, cols, id, name, onclick, placeholder,
17783
# rows, style, title, value<br>
17784
17785
# there are other 'attributes' you can include in your
17786
# hash reference. They are:
17787
# ender, label, separator<br>
17788
17789
# where {label} is for after the input.
17790
# this {label} will be wrapped in a non-wrapping, min-content width div
17791
# and {separator} is meant for pretty printing HTML output
17792
# and ender is the very last thing added to the button before returning the button
17793
17794
# !note: all hash keys must be cased as shown!
17795
#*
17796
my ($hashref) = @_; # a hash reference
17797
my $rv = "";
17798
17799
if (ref $hashref eq "HASH") {
17800
if ($hashref->{spacing} and $hashref->{separator}) { $rv .= $hashref->{spacing}; }
17801
17802
if ($hashref->{type} eq "textbox" or $hashref->{type} eq "textarea") {
17803
my %ta;
17804
$ta{tag} = "textarea";
17805
if ($hashref->{class}) { $ta{class} .= $hashref->{class}; }
17806
if ($hashref->{cols}) { $ta{cols} .= $hashref->{cols}; }
17807
if ($hashref->{id}) { $ta{id} .= $hashref->{id}; }
17808
if ($hashref->{name}) { $ta{name} .= $hashref->{name}; }
17809
if ($hashref->{onclick}) { $ta{onclick} .= $hashref->{onclick}; }
17810
if ($hashref->{placeholder}) { $ta{placeholder} .= $hashref->{placeholder}; }
17811
if ($hashref->{rows}) { $ta{rows} .= $hashref->{rows}; }
17812
if ($hashref->{style}) { $ta{style} .= $hashref->{style}; }
17813
if ($hashref->{title}) { $ta{title} .= $hashref->{title}; }
17814
if ($hashref->{value}) { $ta{value} .= $hashref->{value}; }
17815
17816
$rv .= Html2::tag(\%ta);
17817
} else {
17818
my %div;
17819
$div{tag} = "div";
17820
if ($hashref->{label}) { $div{class} = "mincontentwidth nowrap"; }
17821
17822
my %input;
17823
$input{tag} = "input";
17824
17825
if ($hashref->{type} eq "checkbox") {
17826
$input{type} = "checkbox";
17827
} else {
17828
if ($hashref->{type} eq "text" or $hashref->{type} eq "search")
17829
{ $input{type} = "search"; } else
17830
{ $input{type} = $hashref->{type}; }
17831
}
17832
17833
if ($hashref->{class}) { $input{class} = $hashref->{class}; }
17834
if ($hashref->{id}) { $input{id} = $hashref->{id}; }
17835
if ($hashref->{name}) { $input{name} = $hashref->{name}; }
17836
if ($hashref->{onclick}) { $input{onclick} = $hashref->{onclick}; }
17837
if ($hashref->{placeholder}) { $input{placeholder} = $hashref->{placeholder}; }
17838
if ($hashref->{size}) { $input{size} = $hashref->{size}; }
17839
if ($hashref->{style}) { $input{style} = $hashref->{style}; }
17840
if ($hashref->{title}) { $input{title} = $hashref->{title}; }
17841
if ($hashref->{value}) { $input{value} = $hashref->{value}; }
17842
17843
if ($hashref->{label}) { $input{innerHTML} = " " . $hashref->{label}; }
17844
17845
$div{innerHTML} .= Html2::tag(\%input);
17846
$rv .= Html2::tag(\%div);
17847
}
17848
}
17849
17850
return $rv; # a scalar (empty when $hashref isn't a hash reference)
17851
#usage: my $input = input2(\%myInput);
17852
}
17853
17854
########################
17855
sub button2($) {
17856
#*
17857
# returns an HTML button, complete with innerHTML
17858
# and closing div tag
17859
# param is a hash reference.
17860
# eg: $hashref->{class} = "purple";<br>
17861
# now, i've only programmed the following HTML attributes:
17862
# class, id, name, onclick, style, title, type, value<br>
17863
17864
# there are other 'attributes' you can include in your
17865
# hash reference. They are:
17866
# ender, innerHTML, separator<br>
17867
17868
# where 'innerHTML' is for the button label.
17869
# this label will be wrapped in a non-wrapping, min-content width div
17870
# and as such, your innerHTML spacing should be +four of button's spacing
17871
# because the wrapping div is indented by two
17872
# note: leading spaces in first line of innerHTML will be removed, and replaced
17873
# and {separator} is meant for pretty printing HTML output
17874
# and ender is the very last thing added to the button before returning the button
17875
17876
# !note: all hash keys must be cased as shown!
17877
#*
17878
my ($hashref) = @_; # a hash reference
17879
my $rv = "";
17880
17881
if (ref $hashref eq "HASH") {
17882
my %button;
17883
$button{tag} = "button";
17884
$button{innerHTML} = "";
17885
17886
if ($hashref->{class}) { $button{class} = $hashref->{class}; }
17887
if ($hashref->{id}) { $button{id} = $hashref->{id}; }
17888
if ($hashref->{name}) { $button{name} = $hashref->{name}; }
17889
if ($hashref->{onclick}) { $button{onclick} = $hashref->{onclick}; }
17890
if ($hashref->{style}) { $button{style} = $hashref->{style}; }
17891
if ($hashref->{title}) { $button{title} = $hashref->{title}; }
17892
if ($hashref->{type}) { $button{type} = $hashref->{type}; }
17893
if ($hashref->{value}) { $button{value} = $hashref->{value}; }
17894
17895
if ($hashref->{innerHTML}) {
17896
# so, let's disable auto-wrap and set width to min-content
17897
my %div;
17898
$div{tag} = "div";
17899
$div{class} = "nowrap";
17900
$div{style} = "width: min-content;";
17901
17902
$hashref->{innerHTML} =~ s/^( )*//; # remove any leading spaces
17903
$div{innerHTML} = $hashref->{innerHTML};
17904
17905
$button{innerHTML} .= Html2::tag(\%div);
17906
}
17907
17908
$rv .= Html2::tag(\%button);
17909
}
17910
17911
return $rv; # a scalar
17912
#usage: my $button = button2(\%myButton);
17913
}
17914
17915
########################
17916
sub form2($) {
17917
#*
17918
# returns an HTML form, complete with inputs, innerHTML
17919
# cancel, reset, and submit buttons, and closing form tag
17920
# param is a hash reference.
17921
# eg: $hashref->{class} = "glass-dark mincontent";<br>
17922
17923
# now, i've only programmed the following HTML attributes:
17924
# action, class, id, method, name, style<br>
17925
17926
# there are other 'attributes' you can include in your
17927
# hash reference. They are:
17928
# cancel, ender, innerHTML, reset, separator, submit<br>
17929
17930
# where {innerHTML} is the HTML for the form itself, of course!
17931
# and {separator} is meant for pretty printing HTML output
17932
# and ender is the very last thing added to the button before returning the button
17933
# assign to $hashref->{cancel}, {reset} and {submit} a button2(\%)
17934
# and they will be included. if {submit} is not included, a default
17935
# submit button will be included.
17936
17937
# !note: all hash keys must be cased as shown!
17938
17939
# for a very simple form, you can build up your inputs, using input2(\%),
17940
# and concatenate each into this $hashref->{innerHTML} key.
17941
17942
# !Leading spaces in 'innerHTML' will be removed, and replaced with this<br>sub's $hashref->{spacing} plus four spaces
17943
17944
# defaults are:
17945
# action="./" if missing
17946
# method="post" if missing
17947
# submit=button2(\%default_submit_button) if missing
17948
#*
17949
my ($hashref) = @_; # a hash reference
17950
17951
my %default_submit_button;
17952
$default_submit_button{class} = "green";
17953
$default_submit_button{innerHTML} = "Submit";
17954
$default_submit_button{type} = "submit";
17955
$default_submit_button{title} = "Submit Form";
17956
17957
my $rv = "";
17958
17959
if (ref $hashref eq "HASH") {
17960
my %form;
17961
$form{tag} = "form";
17962
17963
if ($hashref->{action}) { $form{action} = $hashref->{action}; }
17964
if ($hashref->{class}) { $form{class} .= $hashref->{class}; }
17965
if ($hashref->{id}) { $form{id} = $hashref->{id}; }
17966
if ($hashref->{method}) { $form{method} = $hashref->{method}; }
17967
if ($hashref->{name}) { $form{name} = $hashref->{name}; }
17968
if ($hashref->{style}) { $form{style} = $hashref->{style}; }
17969
17970
if ($hashref->{innerHTML}) {
17971
$hashref->{innerHTML} =~ s/^( )*//; # remove any leading spaces
17972
$form{innerHTML} .= $hashref->{innerHTML};
17973
}
17974
if ($hashref->{cancel}) { $form{innerHTML} .= $hashref->{cancel}; }
17975
if ($hashref->{reset}) { $form{innerHTML} .= $hashref->{reset}; }
17976
17977
if ($hashref->{submit})
17978
{ $form{innerHTML} .= $hashref->{submit}; } else
17979
{ $form{innerHTML} .= button2(\%default_submit_button); }
17980
17981
$rv .= Html2::tag(\%form);
17982
}
17983
17984
return $rv; # a scalar (empty when $hashref isn't a hash reference)
17985
#usage: my $form = form2(\%myForm);
17986
}
17987
17988
########################
17989
sub div2($) {
17990
#*
17991
# returns an HTML div, complete with innerHTML
17992
# and closing div tag
17993
# param is a hash reference.
17994
# eg: $hashref->{class} = "glass-dark mincontent";<br>
17995
17996
# now, i've only programmed the following HTML attributes:
17997
# class, id, name, onclick, style<br>
17998
# the above paragraph will no longer apply, as this
17999
# subroutine is being upgraded to use the "tag" function
18000
18001
# there are other 'attributes' you can include in your
18002
# hash reference. They are:
18003
# ender, innerHTML, separator<br>
18004
18005
# where {innerHTML} is the div's inner HTML, of course!
18006
# and {separator} is meant for pretty printing HTML output
18007
# and ender is the very last thing added to the button before returning the button
18008
18009
# !note: all hash keys must be cased as shown!
18010
#*
18011
my ($hashref) = @_; # a hash reference
18012
my $rv = "";
18013
18014
if (ref $hashref eq "HASH") {
18015
my %div;
18016
$div{tag} = "div";
18017
$div{innerHTML} = "";
18018
18019
if ($hashref->{class}) { $div{class} = $hashref->{class}; }
18020
if ($hashref->{id}) { $div{id} = $hashref->{id}; }
18021
if ($hashref->{name}) { $div{name} = $hashref->{name}; }
18022
if ($hashref->{onclick}) { $div{onclick} = $hashref->{onclick}; }
18023
if ($hashref->{style}) { $div{style} = $hashref->{style}; }
18024
18025
if ($hashref->{innerHTML}) {
18026
$hashref->{innerHTML} =~ s/^( )*//; # remove any leading spaces
18027
$div{innerHTML} .= $hashref->{innerHTML};
18028
}
18029
18030
$rv .= Html2::tag(\%div);
18031
}
18032
18033
return $rv; # a scalar (empty when $hashref isn't a hash reference)
18034
#usage: my $div = div2(\%myDiv);
18035
}
18036
18037
########################
18038
sub display_debug_header($) {
18039
#*
18040
# this will take a scalar and output its value
18041
# it will not be dereferenced!
18042
#*
18043
my ($declaration) = @_; # a subroutine's declaration
18044
my $rv = Html2::br() .Html2::hr({class=>"tiny"});
18045
my $subLink = $declaration;
18046
my $params = $declaration;
18047
$subLink =~ s/\((.)*//;
18048
$params =~ s/$subLink//;
18049
18050
{ my %link;
18051
$link{tag} = "a";
18052
$link{href} = "#" . $subLink;
18053
$link{innerHTML} = $subLink;
18054
18055
$rv .= Html2::tag(\%link);
18056
}
18057
$rv .= Html2::embolden($params) . Html2::br();
18058
18059
return $rv; # a scalar
18060
#usage: print display_debug_one("This is a test of ???", functionBeingTested($param1, $param2, $etc));
18061
#test=display_debug_header("fake_test_subroutine('a scalar', 1, %)");
18062
}
18063
18064
########################
18065
sub display_debug_one($$) {
18066
#*
18067
# this will take a scalar and output its value
18068
# it will not be dereferenced!
18069
#*
18070
my ($declaration, $val) = @_; # subroutine's declaration && subroutine's output
18071
18072
my $rv = "";
18073
my $subLink = $declaration;
18074
my $params = $declaration;
18075
$subLink =~ s/\((.)*//;
18076
$params =~ s/$subLink//;
18077
18078
{ my %link;
18079
$link{tag} = "a";
18080
$link{href} = "#" . $subLink;
18081
$link{class} = "nowrap";
18082
$link{innerHTML} = $subLink;
18083
18084
$rv .= Html2::tag(\%link);
18085
}
18086
$rv .= Html2::embolden({html=>$params,class=>"nowrap"}) . Html2::br();
18087
18088
{ my %ul;
18089
$ul{tag} = "ul";
18090
$ul{innerHTML} = "";
18091
18092
{ my %li;
18093
$li{tag} = "li";
18094
if ($val) {
18095
$li{innerHTML} = $val;
18096
} else {
18097
if ($val eq 0) {
18098
$li{innerHTML} = "0";
18099
} else {
18100
$li{innerHTML} = "$declaration is undef, perhaps?";
18101
}
18102
}
18103
18104
$li{innerHTML} .= Html2::br();
18105
18106
$ul{innerHTML} .= Html2::tag(\%li);
18107
}
18108
18109
$rv .= Html2::tag(\%ul);
18110
}
18111
18112
return $rv; # a scalar
18113
#usage: print display_debug_one("This is a test of ???", functionBeingTested($param1, $param2, $etc));
18114
}
18115
18116
########################
18117
sub display_debug_many($$;$$) {
18118
#*
18119
# data within reference is shown by default
18120
#*
18121
my ($declaration, $ref, $separator, $brief) = @_; # function declaration && an array/hash reference && list separator && show data or not
18122
18123
my $rv = "";
18124
my $subLink = $declaration;
18125
my $params = $declaration;
18126
$subLink =~ s/\((.)*//;
18127
$params =~ s/$subLink//;
18128
{ my %link;
18129
$link{tag} = "a";
18130
$link{href} = "#" . $subLink;
18131
$link{innerHTML} = $subLink;
18132
$rv .= Html2::tag(\%link);
18133
}
18134
$rv .= Html2::embolden($params) . Html2::br();
18135
18136
{ my %size;
18137
$size{tag} = "div";
18138
$size{class} = "inline";
18139
$size{innerHTML} = "";
18140
18141
if (ref $ref eq "ARRAY") {
18142
$size{innerHTML} .= Html2::embolden(scalar @$ref);
18143
$size{innerHTML} .= " array element(s)";
18144
} elsif (ref $ref eq "HASH") {
18145
$size{innerHTML} .= Html2::embolden(scalar(keys %$ref));
18146
$size{innerHTML} .= " hash key(s)";
18147
} else {
18148
$size{innerHTML} .= Html2::italicize(ref $ref);
18149
}
18150
18151
$rv .= Html2::tag(\%size);
18152
}
18153
18154
if ($brief) {
18155
my %font;
18156
$font{tag} = "font";
18157
$font{class} = "notice";
18158
$font{innerHTML} = "Data Hidden";
18159
18160
$rv .= " - " . Html2::tag(\%font) . Html2::br();
18161
}
18162
elsif (ref $ref eq "ARRAY") {
18163
$rv .= ":" . Html2::br();
18164
18165
{ my %ul;
18166
$ul{tag} = "ul";
18167
$ul{innerHTML} = "";
18168
18169
{ my %li;
18170
$li{tag} = "li";
18171
$li{innerHTML} = "";
18172
18173
if (@$ref) {
18174
my $i = 0;
18175
foreach my $element (@$ref) {
18176
if (ref $element eq "HASH") {
18177
if ($element->{value}) {
18178
$li{innerHTML} = "$element->{value}$separator";
18179
} else {
18180
$li{innerHTML} = display_debug_hash("{$declaration}->[$i]", $element);
18181
}
18182
} else {
18183
$element =~ s/=$//;
18184
$li{innerHTML} = $element . $separator;
18185
}
18186
18187
$ul{innerHTML} .= Html2::tag(\%li);
18188
$i++;
18189
}
18190
} else {
18191
$li{innerHTML} = Html2::italicize("The array is empty!");
18192
$ul{innerHTML} .= Html2::tag(\%li);
18193
}
18194
}
18195
18196
$rv .= Html2::tag(\%ul);
18197
}
18198
}
18199
else {
18200
# it's a hash or a plain scalar
18201
$rv .= ":" . Html2::br();
18202
{ my %ul;
18203
$ul{tag} = "ul";
18204
$ul{innerHTML} = "";
18205
18206
{ my %li;
18207
$li{tag} = "li";
18208
$li{innerHTML} = "";
18209
18210
if (ref $ref eq "HASH") {
18211
foreach my $key (sort keys %$ref) {
18212
if (ref $ref->{$key} eq "ARRAY") {
18213
$li{innerHTML} = display_debug_array("$ref\->{$key}", $ref->{$key});
18214
} else {
18215
$li{innerHTML} = $key . " => " . $ref->{$key};
18216
}
18217
18218
$ul{innerHTML} .= Html2::tag(\%li);
18219
}
18220
} else {
18221
$li{innerHTML} .= $ref . Html2::br();
18222
$ul{innerHTML} .= Html2::tag(\%li);
18223
}
18224
}
18225
18226
$rv .= Html2::tag(\%ul);
18227
}
18228
}
18229
18230
return $rv; # a scalar
18231
#usage: print display_debug_many("This is a test of ???", \@list);
18232
}
18233
18234
########################
18235
sub display_debug_code($$;$) {
18236
#*
18237
# converts output of a function
18238
# changes spacing to a dot, lines ending in \n
18239
# will end with a special P notation.
18240
# html tags will be bolded.
18241
#*
18242
my ($declaration, $html, $big) = @_; # sub's declaration && HTML && toggle large display
18243
18244
my $dot = "\·\;";
18245
my $tag_font_start = "<font style='color: FFFF00;'>";
18246
my $special_font_start = "<font style='color: 00FFFF;'>";
18247
my $font_end = "<\/font>";
18248
18249
my $h = 200;
18250
my $w = 700;
18251
my $font = "";
18252
if ($big) {
18253
$h = 450;
18254
$w = 1100;
18255
#$font = " font-size: 12pt;";
18256
}
18257
18258
# replace all spaces not in HTML tags with ·
18259
my @html = split("\n", $html);
18260
# as a "just-in-case" thing, let's save the last two chars of $html
18261
my $tail = substr($html, -2); # in some cases, $tail might = \n\n or \n, and i think they vanish in this process
18262
my $addTail = 0;
18263
if ($tail eq "\n\n") {
18264
$addTail = 1;
18265
} else {
18266
# just to be as pedantic as i can ...
18267
$tail = substr($html, -1);
18268
if ($tail eq "\n") { $addTail = 1; }
18269
}
18270
my $count = 1;
18271
foreach my $line (@html) {
18272
my $head = $html[0]; # baha!
18273
my $addHead = 0;
18274
# now, remove all of the html from $head, except the first tag
18275
# but only if the first char is <
18276
if ($head =~ /^(.)*\</) {
18277
my $i = index($head, ">");
18278
if ($i) {
18279
$addHead = 1;
18280
$head = substr($line, 0, $i+1);
18281
}
18282
}
18283
18284
# copy $line into $temp
18285
my $temp = $line;
18286
# replace the HTML in temp with \n
18287
$temp =~ s/<((.)+?)>/\n/g;
18288
# now, split $line at the \n
18289
my @bits = split("\n", $temp);
18290
# now, convert each bit, and update $line as we go
18291
foreach my $bit (@bits) {
18292
# first, convert the spaces to this nifty dot thing
18293
my $origbit = $bit;
18294
$bit =~ s/ /$dot/g;
18295
# and now, update $line
18296
$line =~ s/\Q$origbit\E/$bit/;
18297
}
18298
18299
if ($count eq 1) {
18300
if ($addHead) {
18301
if ($line ne $head) { $line = $head . $line; }
18302
}
18303
}
18304
# enhance html tags in $line
18305
$line =~ s/<((.)+?)>/$tag_font_start<$1>$font_end/g;
18306
# enhance special tags in $line
18307
$line =~ s/\[((.)+?)]/$special_font_start\[$1]$font_end/g;
18308
# finally, enhance the $dot
18309
my $enhancedDot = Html2::tag({tag=>"font", style=>"color: #666666;", innerHTML=>$dot});
18310
$line =~ s/$dot/$enhancedDot/g;
18311
$count++;
18312
if ($count > (@html)) {
18313
if ($addTail) {
18314
# and here's where our $tail piece comes in (oh neat! see what i did there? lol)
18315
# verify if $tail is at the end of $html. if not, tack it on
18316
# add the tail, but ONLY if $line and $tail don't match
18317
if ($line ne $tail) { $line .= $tail; }
18318
}
18319
}
18320
18321
# what happened to the first html tag in $line???
18322
# now it's duplicated...
18323
}
18324
$html = join("\n", @html);
18325
18326
my $para = Html2::tag({tag=>"font", style=>"color: #666666;", innerHTML=>"\¶\;"});
18327
$html =~ s/\n/$para<br>/g;
18328
18329
my $rv .= Html2::br() .Html2::hr({class=>"tiny"});
18330
my $subLink = $declaration;
18331
my $params = $declaration;
18332
$subLink =~ s/\((.)*//;
18333
$params =~ s/$subLink//;
18334
{ my %link;
18335
$link{tag} = "a";
18336
$link{href} = "#" . $subLink;
18337
$link{innerHTML} = $subLink;
18338
18339
$rv .= Html2::tag(\%link);
18340
}
18341
$rv .= $params . Html2::br();
18342
{ my %ul;
18343
$ul{tag} = "ul";
18344
$ul{innerHTML} = "";
18345
18346
{ my %li;
18347
$li{tag} = "li";
18348
$li{innerHTML} = "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0 height=$h><tr><td nowrap>";
18349
18350
{ my %div;
18351
$div{tag} = "div";
18352
$div{class} = "scrolling_both subnavbar";
18353
$div{style} = "background-color: #000000; text-align: left; width: " . $w . "px; height: " . $h . "px;";
18354
18355
{ my %code;
18356
$code{tag} = "code";
18357
$code{style} = "color: #00AAAA;";
18358
$code{innerHTML} = $html;
18359
18360
$div{innerHTML} .= Html2::tag(\%code);
18361
}
18362
18363
$li{innerHTML} .= Html2::tag(\%div);
18364
}
18365
$li{innerHTML} .= "</td></tr></table>";
18366
18367
$ul{innerHTML} .= Html2::tag(\%li);
18368
}
18369
18370
$rv .= Html2::tag(\%ul);
18371
}
18372
18373
$rv .= Html2::br();
18374
18375
return $rv; # a scalar
18376
#usage: print display_debug_code("This is a test of ???", name_of_func($p1, $p2, $etc));
18377
}
18378
18379
########################
18380
sub display_debug_large($$;$) {
18381
#*
18382
# to display something much larger and indepth than
18383
# all of the other display_debug_* functions
18384
#*
18385
my ($declaration, $ref, $brief) = @_; # function declaration && an array/hash reference && show data or not
18386
18387
my $rv = Html2::br() . Html2::hr({class=>"tiny"});
18388
my $subLink = $declaration;
18389
my $params = $declaration;
18390
$subLink =~ s/\((.)*//;
18391
$params =~ s/$subLink//;
18392
{ my %link;
18393
$link{tag} = "a";
18394
$link{href} = "#" . $subLink;
18395
$link{innerHTML} = $subLink;
18396
18397
$rv .= Html2::tag(\%link);
18398
}
18399
$rv .= Html2::embolden($params) . Html2::br();
18400
if (ref $ref eq "ARRAY") {
18401
$rv .= "array reference encapsulates " . Html2::embolden(scalar @$ref) . Bc_misc::pluralize(" element", @$ref);
18402
18403
# check if the elements reference hashes?
18404
my $multitype = 0; # assume all of the elements reference a hash
18405
foreach my $r (@$ref) {
18406
if (ref $r ne "HASH") { $multitype++; } # oh, wait, this one isn't a hash reference
18407
}
18408
18409
if (not $multitype) {
18410
if ($brief) {
18411
$rv .= " - " . Html2::tag({tag=>"font", class=>"notice", innerHTML=>"data hidden"});
18412
# end if ($brief)
18413
} else {
18414
if (@$ref) {
18415
$rv .= Html2::small(Html2::br()) . "<table border=0 cellpadding=0 cellspacing=0><tr><td class='subnavbar subtitle'>";
18416
# names for each column
18417
my %h = $$ref[0];
18418
foreach my $key (sort keys %h) {
18419
if ($key ne "ID" and $key ne "TID" and $key ne "CCID") { $key = ucfirst($key); }
18420
if ($key eq "Desc") { $key = "Description"; }
18421
$rv .= Html2::small(" ") . $key . " </td><td> </td><td align=center class='subnavbar subtitle'>";
18422
}
18423
$rv =~ s/<td>\ \;(.)*$/\<\/td>/;
18424
$rv .= "</td></tr><tr><td align=right colspan=" . ((keys %h) + ((keys %h) - 1)) . " height=5>";
18425
$rv .= "</td></tr><tr><td></td><td>";
18426
# values for each column (hash data)
18427
foreach my $elementRef (@$ref) {
18428
my $c = 0;
18429
foreach my $key (sort keys %$elementRef) {
18430
if ($key =~ /description|desc/i) { $elementRef->{$key} = Bc_misc::shorten_str($elementRef->{$key}, 35); }
18431
$rv .= Html2::italicize(Html2::embolden($key)) . " = " . Html2::italicize(Html2::embolden($elementRef->{$key}));
18432
$c++;
18433
if ($c < keys %$elementRef) {
18434
$rv .= "</td></tr><tr><td></td><td>";
18435
}
18436
}
18437
$rv =~ s/\<td>\ \;\<\/td>\<td>$/\<\/tr>\<tr>\<td align=right>/;
18438
}
18439
$rv =~ s/\<\/td\>\<\/tr\>\<tr\>\<td align=right\>$//;
18440
$rv .= "</td></tr></table>";
18441
# end if (@$ref)
18442
} else {
18443
{ my %font;
18444
$font{tag} = "font";
18445
$font{class} = "red-button";
18446
$font{innerHTML} = "\$ref points to an empty array";
18447
18448
$rv .= Html2::tag(\%font);
18449
}
18450
# end else of if (@$ref)
18451
}
18452
# end else of if ($brief)
18453
}
18454
# end if (not $multitype)
18455
} else {
18456
$rv .= Html2::br();
18457
$rv .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td class=red-button>";
18458
$rv .= "\$ref points to an array where some elements are not hash references!" . Html2::br();
18459
$rv .= "$multitype elements do not reference a hash!" . Html2::br();
18460
18461
if (@$ref eq $multitype) {
18462
$rv .= "array size (" . (scalar @$ref) . ") equals number of elements not referencing a hash" . Html2::br();
18463
# are they all the same type?
18464
my $aRefCount = 0;
18465
my $hRefCount = 0;
18466
my $sCount = 0;
18467
foreach my $element (@$ref) {
18468
if (ref $element eq "ARRAY")
18469
{ $aRefCount++; }
18470
elsif (ref $element eq "HASH")
18471
{ $hRefCount++; }
18472
else
18473
{ $sCount++; }
18474
}
18475
18476
if ($aRefCount eq @$ref) {
18477
$rv .= "all elements reference more arrays!" . Html2::br();
18478
$rv .= "from this point, the data in the arrays will be treated as scalars, regardless of content" . Html2::br();
18479
$rv .= "</td></tr></table>";
18480
foreach my $aElement (@$ref) {
18481
my %ul;
18482
$ul{tag} = "ul";
18483
$ul{innerHTML} = "";
18484
18485
{ my %li;
18486
$li{tag} = "li";
18487
$li{innerHTML} = display_debug_many($aElement . "=>", $aElement);
18488
18489
$ul{innerHTML} .= Html2::tag(\%li);
18490
}
18491
18492
$rv .= Html2::tag(\%ul);
18493
}
18494
# end if ($aRefCount eq @$ref)
18495
} elsif ($hRefCount eq @$ref) {
18496
$rv .= "all elements reference hashes!" . Html2::br();
18497
$rv .= "</td></tr></table>";
18498
foreach my $aElement (@$ref) {
18499
my %ul;
18500
$ul{tag} = "ul";
18501
$ul{innerHTML} = "";
18502
18503
{ my %li;
18504
$li{tag} = "li";
18505
$li{innerHTML} = display_debug_one($aElement . "=>", $aElement); # was display_debug_large. maybe it should be display_debug_many? large is not right...this is the 'large' function!
18506
18507
$ul{innerHTML} .= Html2::tag(\%li);
18508
}
18509
18510
$rv .= Html2::tag(\%ul);
18511
}
18512
# end elsif ($hRefCount eq @$ref) of if ($aRefCount eq @$ref)
18513
} elsif ($sCount eq @$ref) {
18514
$rv .= "all elements are scalars (be it references, or not)!" . Html2::br();
18515
$rv .= "</td></tr></table>";
18516
18517
my %ul;
18518
$ul{tag} = "ul";
18519
$ul{innerHTML} = "";
18520
18521
{ my %li;
18522
$li{tag} = "li";
18523
$li{innerHTML} = display_debug_many(scalar @$ref, $ref, ", ", 0);
18524
#$li{innerHTML} = "PIGGY" . display_debug_many(scalar @$ref, $ref, ", ", 0);
18525
#$li{innerHTML} =~ s/PIGGY\<br\>\<hr class\=\\"tiny\\"\>//;
18526
18527
$ul{innerHTML} .= Html2::tag(\%li);
18528
}
18529
18530
$rv .= Html2::tag(\%ul);
18531
# end elsif ($sCount eq @$ref) of elsif ($hRefCount eq @$ref)
18532
} else {
18533
$rv .= "all elements are " . Html2::embolden("not") . " of the same type" . Html2::br();
18534
$rv .= "</td></tr></table>";
18535
# end else of if ($hRefCount eq @$ref)
18536
}
18537
} else {
18538
$rv .= "boo";
18539
$rv .= "</td></tr></table>";
18540
}
18541
# end else of if (not $multitype)
18542
}
18543
# end if (ref $ref eq "ARRAY")
18544
} else {
18545
$rv .= "<table border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td class=red-button>";
18546
$rv .= "\$ref is not an array reference" . Html2::br();
18547
$rv .= "best if \$ref references an array of hash references" . Html2::br();
18548
$rv .= "</td></tr></table>";
18549
# end else of if (ref $ref eq "ARRAY")
18550
}
18551
18552
$rv .= Html2::br();
18553
return $rv; # a scalar
18554
#usage: print display_debug_large("This is a test of ???", testFunc($p1, $p2, $etc));
18555
}
18556
18557
########################
18558
sub display_debug_script($) {
18559
#*
18560
# to test a Perl script
18561
# only give the name, eg: cities
18562
# don't include folders, /'s, .'s or file extensions
18563
# this function calls <a href='#display_debug_code'>display_debug_code</a>
18564
# !VERY simple setup, certainly NOT secure!
18565
#*
18566
my ($script) = @_; # name of Perl script
18567
my $rv = 0;
18568
18569
if ($script) {
18570
my $params = Bc_misc::get_param("p");
18571
if (not $params) {
18572
if ($script eq "edit_ustats") { $params = "$Bc_sql::QUERY_UID=A6DE0E8077"; }
18573
elsif ($script eq "cities") { $params = "c=7"; }
18574
elsif ($script eq "verifyemail") { $params = 'e=billy.joe.bob@fuckya.com'; }
18575
elsif ($script eq "verifynickname") { $params = "nn=franky"; }
18576
elsif ($script eq "getimage") { $params = "id=1"; }
18577
elsif ($script eq "pp_ipn") { $params = "mc_gross=19.95&protection_eligibility=Eligible&address_status=confirmed&payer_id=LPLWNMTBWMFAY&tax=0.00&address_street=1+Main+St&payment_date=20%3A12%3A59+Jan+13%2C+2009+PST&payment_status=Completed&charset=windows-1252&address_zip=95131&first_name=Test&mc_fee=0.88&address_country_code=US&address_name=Test+User¬ify_version=2.6&custom=&payer_status=verified&address_country=United+States&address_city=San+Jose&quantity=1&verify_sign=AtkOfCXbDm2hu0ZELryHFjY-Vb7PAUvS6nMXgysbElEn9v-1XcmSoGtf&payer_email=gpmac_1231902590_per%40paypal.com&txn_id=61E67681CH3238416&payment_type=instant&last_name=User&address_state=CA&receiver_email=gpmac_1231902686_biz%40paypal.com&payment_fee=0.88&receiver_id=S8XGHLYDW9T3S&txn_type=express_checkout&item_name=&mc_currency=USD&item_number=&residence_country=US&test_ipn=1&handling_amount=0.00&transaction_subject=&payment_gross=19.95&shipping=0.00"; }
18578
elsif ($script eq "js") { $params = "let=TEST_SCRIPT_OUTPUT"; }
18579
elsif ($script eq "css") { $params = "t=TEST_SCRIPT_OUTPUT"; }
18580
elsif ($script eq "error") { $params = "e=123&m=this is a test"; }
18581
elsif ($script eq "fma") { $params = "$Bc_sql::QUERY_UID=$Bc_sql::LOGGEDIN&r=1"; }
18582
elsif ($script eq "img") { $params = "i=site/logo.png"; }
18583
}
18584
18585
my $content = "";
18586
my $temp = uri_unescape($params);
18587
$temp =~ s/\&/ /g;
18588
$content = `/usr/bin/perl $script.pl $temp`;
18589
die("Could not execute script $script (no content was returned): $!") if !defined($content);
18590
my @files = qw(ajax=ajax.pl
18591
check_pp_debug=check_pp_debug.pl
18592
checkserver=checkserver.pl
18593
cities=cities.pl
18594
css=css.pl
18595
edit_ustats=edit_ustats.pl
18596
google=google.pl
18597
error=error.pl
18598
fma=fma.pl
18599
getthemes=getthemes.pl
18600
getusers=getusers.pl
18601
img=img.pl
18602
js=js.pl
18603
theme_editor=theme_editor.pl
18604
verifyemail=verifyemail.pl
18605
verifynickname=verifynickname.pl
18606
);
18607
my $dd = dropdown("scripts_dd", "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td class=subnavbar>", "$script", "", "document.location='?" . Bc_sql::get_constant("QUERY_DEBUG_PAGE") . "=script&s=' + document.getElementById('scripts_dd').value;", "", "", " | " . Html2::tag({tag=>"a", href=>"/$script.pl?$params", target=>"_blank", innerHTML=>"Live"}) . "</td></tr><tr><td class=subnavbar>Params: " . Html2::tag({tag=>"input", id=>"p", value=>$params, size=>"15", innerHTML=>" " . Html2::tag({tag=>"button", class=>"save", type=>"button", onclick=>"document.location=\"?" . Bc_sql::get_constant("QUERY_DEBUG_PAGE") . "=script&s=$script&p=\" + encodeURIComponent(document.getElementById(\"p\").value);", innerHTML=>"update"}) . "</td></tr></table>"}), \@files, 0);
18608
Bc_sql::sql_disconnect();
18609
$rv = display_debug_code($dd, $content, 1);
18610
#$rv =~ s/\<hr(.)*?\>/<br><br>/;
18611
$rv .= $temp . Html2::br();
18612
$rv .= "<table align=center border=$TABLE_BORDER cellpadding=0 cellspacing=0><tr><td>";
18613
$rv .= Html2::reloadbutton("Reload");
18614
$rv .= "</td></tr></table>";
18615
}
18616
18617
return $rv; # a scalar
18618
#usage: print display_debug_script("cities");
18619
}
18620
18621
########################
18622
sub display_debug_hash($$;$$) {
18623
#*
18624
# gimme a hash reference, and i'll do my
18625
# best to output something coherent from it
18626
#*
18627
my ($declaration, $hashRef, $subtitle, $notitles) = @_; # a title (generally, just enter the hash variable's name; remember to escape \$ with a \\) && a hash reference && a caption? && toggles titles on/off
18628
my $rv = Html2::embolden("Displaying Hash Data for") . " " . Html2::italicize($declaration);
18629
my $refType = ref $hashRef;
18630
18631
if ($refType eq "HASH") {
18632
if (keys %$hashRef) {
18633
$rv .= "<ul class=\"\">";
18634
foreach my $key (sort keys %$hashRef) {
18635
my $element = $hashRef->{$key};
18636
18637
if ($key ne "source") {
18638
18639
$rv .= "<li>";
18640
18641
my $dec = "{$key} = ";
18642
if (ref $element eq "HASH") {
18643
$rv .= display_debug_hash($dec, $element);
18644
} elsif (ref $element eq "ARRAY") {
18645
$rv .= display_debug_array($dec, $element);
18646
} else {
18647
$rv .= display_debug_scalar($dec, $element);
18648
}
18649
18650
if ($notitles) { $dec = ""; }
18651
}
18652
else {
18653
$rv .= "<li>{$key} = skipped";
18654
}
18655
}
18656
$rv .= "</ul>";
18657
}
18658
else {
18659
$rv .= "<ul><li>" . Html2::embolden($declaration) . " is a hash reference, but has no keys!</ul>" . Html2::br();
18660
}
18661
}
18662
else {
18663
$rv .= "<ul>";
18664
$rv .= "<li>$declaration is not a hash!<br>";
18665
$rv .= "<li>" . $declaration . "'s value is: $hashRef<br>";
18666
$rv .= "</ul>";
18667
}
18668
18669
return $rv; # a scalar
18670
#usage: print display_debug_hash("hash", \%hash);
18671
}
18672
18673
########################
18674
sub display_debug_array($$;$$) {
18675
#*
18676
# gimme an array, any array, and i'll do my
18677
# best to output something coherent from it
18678
#*
18679
my ($declaration, $scalar, $subtitle, $notitles) = @_; # an indescript scalar && a reference && a caption? && toggles titles on/off
18680
my $rv = Html2::embolden("Displaying Array Data for") . " " . Html2::italicize($declaration);
18681
my $numElements = @$scalar;
18682
$rv .= Html2::italicize($scalar) . " has " . Html2::embolden($numElements) . " " . Bc_misc::pluralize("element", @$scalar) . Html2::br();
18683
my $refType = ref $scalar;
18684
18685
if (ref $scalar eq "ARRAY") {
18686
if (@$scalar) {
18687
my %ol;
18688
$ol{tag} = "ol";
18689
$ol{class} = "rj";
18690
$ol{html} = "";
18691
18692
my $i = 0;
18693
foreach my $element (@$scalar) {
18694
my %li;
18695
$li{tag} = "li";
18696
$li{style} = "margin-left: 30px;";
18697
18698
if (ref $element eq "HASH") { $li{html} = display_debug_hash($scalar."->[$i]", $element); }
18699
elsif (ref $element eq "ARRAY") { $li{html} = display_debug_array($scalar."->[$i]", $element); }
18700
else {
18701
$element =~ s/ / /g;
18702
$element =~ s/</</g;
18703
$li{html} = display_debug_scalar("", $element);
18704
}
18705
18706
$ol{html} .= Html2::tag(\%li);
18707
$i++;
18708
}
18709
18710
$rv .= Html2::tag(\%ol);
18711
}
18712
else {
18713
$rv = $declaration . " is an array reference, but the array is empty!<br>";
18714
}
18715
}
18716
else {
18717
$rv = $declaration . " is not an array reference!<br>";
18718
$rv .= $declaration . "'s value is: " . Html2::embolden($scalar);
18719
}
18720
18721
return $rv; # a scalar
18722
#usage: print display_debug_array("array", \@arr);
18723
}
18724
18725
########################
18726
sub display_debug_scalar($$;$$) {
18727
#*
18728
# gimme a scalar, any scalar, and i'll do my
18729
# best to output something coherent from it
18730
#*
18731
my ($declaration, $scalar, $subtitle, $notitles) = @_; # a title to show && an indescript scalar && a caption? && toggles titles on/off
18732
my $refType = ref $scalar;
18733
my $rv = "";
18734
my $title = "$declaration: ";
18735
18736
if ($refType eq "SCALAR") { $title .= "is a scalar referrence"; }
18737
elsif ($refType eq "HASH") { $title .= "is a hash referrence (" . Html2::small($scalar."") . ")"; }
18738
elsif ($refType eq "ARRAY") { $title .= "is an array referrence (" . Html2::small($scalar."") . ")"; }
18739
elsif ($refType eq "CODE") { $title .= "is a code referrence"; }
18740
elsif ($refType eq "REF") { $title .= "is a referrence referrence"; }
18741
18742
if ($refType eq "ARRAY") {
18743
$rv .= $title;
18744
$rv .= "<ul><li>" . display_debug_array($scalar."", $scalar) . "</ul>";
18745
} elsif ($refType eq "HASH") {
18746
$rv .= $title;
18747
$rv .= "<br>" . display_debug_hash($scalar."", $scalar);
18748
}
18749
elsif ($refType eq "CODE") {
18750
$rv .= $title;
18751
$rv .= "<ul><li>it's a code reference" . Html2::br();
18752
$rv .= "i'm not sure wtf to do with this, yet..." . Html2::br();
18753
$rv .= "given value for \$scalar is: $scalar</ul>" . Html2::br();
18754
}
18755
elsif ($refType eq "REF") {
18756
$rv .= $title;
18757
$rv .= "it's a what now?? a reference to a reference???" . Html2::br();
18758
$rv .= "given value for \$scalar is: $scalar" . Html2::br();
18759
}
18760
else {
18761
if ($declaration eq "") { $declaration = " "; }
18762
$declaration =~ s/ / /g;
18763
$rv = $declaration . Html2::embolden($scalar . " ");
18764
}
18765
18766
return $rv; # a scalar!
18767
#usage: my $test_output = display_debug_scalar("a string of text, or a hash ref");
18768
#test=display_debug_scalar("scalar", $scalar);
18769
}
18770
18771
########################
18772
sub debug_banner(;$$$) {
18773
#*
18774
# prints a debugging banner
18775
#*
18776
my ($label, $content, $nospace, $fuqp) = @_; # a label && some content && force update query parameter
18777
if (not $fuqp) { $fuqp = "forceupdate"; }
18778
if (not $label) {
18779
$label = $0;
18780
$label =~ s/.*\///;
18781
}
18782
my $r = Bc_misc::referrer() . Html2::br();
18783
my %link;
18784
$link{tag} = "a";
18785
$link{href} = $r;
18786
$link{innerHTML} = $r;
18787
$r = Html2::tag(\%link);
18788
18789
my %div; {
18790
$div{tag} = "fieldset";
18791
$div{class} = "text-align-left padded min-content nowrap";
18792
$div{style} = "margin-bottom: 10px;";
18793
$div{innerHTML} = "";
18794
18795
{ my %css;
18796
$css{tag} = "style";
18797
$css{innerHTML} = <<END;
18798
.shrinkable {
18799
overflow-x: hidden;
18800
overflow-y: hidden;
18801
white-space: nowrap;
18802
transition: height 2s, width 2s;
18803
}
18804
END
18805
$div{innerHTML} .= Html2::tag(\%css);
18806
}
18807
18808
# oh! let's add a "toggle" to show/hide the params list! ya!!!, if there are params, that is!
18809
my %params = Bc_misc::get_params_asHash();
18810
if (keys %params) {
18811
{ my %legend;
18812
$legend{tag} = "legend";
18813
$legend{innerHTML} = "";
18814
18815
{ my %button;
18816
$button{tag} = "button";
18817
$button{type} = "button";
18818
$button{class} = "green";
18819
$button{id} = "shrink_button";
18820
$button{onclick} = "shrink('debug_paramslist');";
18821
$button{innerHTML} = "Show Params";
18822
18823
{ my %js;
18824
$js{tag} = "script";
18825
$js{innerHTML} = <<END;
18826
let shrink_start = true;
18827
let shrink_shrunk = false;
18828
let shrink_oheight = 0;
18829
let shrink_owidth = 0;
18830
let shrink_minheight = 0;
18831
18832
function shrink(eid, bid) {
18833
if (!eid) { return; }
18834
if (!bid) { bid = "shrink_button"; }
18835
18836
let e = document.getElementById(eid);
18837
18838
if (e) {
18839
if (e.style.display === "none") { e.style.display = "block"; }
18840
let b = document.getElementById(bid);
18841
18842
let cs = window.getComputedStyle(e);
18843
let h = cs.getPropertyValue("height");
18844
let w = cs.getPropertyValue("width");
18845
18846
if (shrink_start) {
18847
// first time; shrink
18848
shrink_oheight = h;
18849
shrink_owidth = w;
18850
e.style.height = shrink_minheight;
18851
e.style.width = 0;
18852
console.log("first click of button; shrinking");
18853
shrink_start = false;
18854
b.innerHTML = "Show Params";
18855
} else {
18856
if (shrink_shrunk) {
18857
// shrink
18858
e.style.height = shrink_minheight;
18859
e.style.width = 0;
18860
console.log("shrinking");
18861
shrink_shrunk = false;
18862
b.innerHTML = "Show Params";
18863
} else {
18864
// grow
18865
e.style.height = shrink_oheight;
18866
e.style.width = shrink_owidth;
18867
console.log("growing");
18868
shrink_shrunk = true;
18869
b.innerHTML = "Hide Params";
18870
}
18871
}
18872
} else {
18873
console.log("no such eid: " + eid);
18874
}
18875
}
18876
18877
function fixthisshit() {
18878
shrink("debug_paramslist");
18879
}
18880
18881
setTimeout(fixthisshit, 1234);
18882
END
18883
$button{innerHTML} .= Html2::tag(\%js);
18884
}
18885
18886
$legend{innerHTML} .= Html2::tag(\%button);
18887
}
18888
18889
$div{innerHTML} .= Html2::tag(\%legend);
18890
}
18891
18892
{ my %list;
18893
$list{tag} = "div";
18894
$list{class} = "shrinkable";
18895
$list{id} = "debug_paramslist";
18896
$list{style} = "display: none;";
18897
$list{innerHTML} = "";
18898
18899
foreach my $param (keys %params) {
18900
$list{innerHTML} .= "$param = " . Html2::italicize($params{$param}) . Html2::br();
18901
}
18902
18903
$div{innerHTML} .= Html2::tag(\%list);
18904
}
18905
}
18906
else {
18907
# no params given
18908
$div{class} .= " red-panel";
18909
$div{innerHTML} .= "No Params Given";
18910
}
18911
}
18912
18913
my $rv = "";
18914
18915
{ my %fs;
18916
$fs{tag} = "fieldset";
18917
$fs{class} = "translucent text-align-left";
18918
$fs{innerHTML} = "";
18919
18920
{ my %legend;
18921
$legend{tag} = "legend";
18922
$legend{innerHTML} = "DEBUGGING " . Html2::italicize($label) . " - no updates will occur";
18923
18924
$fs{innerHTML} .= Html2::tag(\%legend);
18925
}
18926
18927
$fs{innerHTML} .= "Referrer: " . Html2::embolden($r);
18928
$fs{innerHTML} .= Html2::tag(\%div) . Html2::hr();
18929
$fs{innerHTML} .= $content . Html2::hr();
18930
18931
{ my %buttons;
18932
$buttons{tag} = "div";
18933
$buttons{class} = "centered min-content nowrap";
18934
$buttons{innerHTML} .= Html2::reloadbutton();
18935
18936
{ my %forceupdate;
18937
$forceupdate{tag} = "button";
18938
$forceupdate{type} = "button";
18939
$forceupdate{class} = "red padded-small";
18940
$forceupdate{style} = "margin-left: 10px;";
18941
$forceupdate{innerHTML} = "Force Update";
18942
my $ref = "./?" . $ENV{QUERY_STRING};
18943
$ref = Bc_misc::add_param($fuqp, "1", $ref);
18944
18945
$forceupdate{title} = "Reloads page, forces update (ignores debug mode)";
18946
$forceupdate{title} .= "\n\nreloads as $ref";
18947
$forceupdate{onclick} = "document.location=\"" . $ref . "\";";
18948
18949
$buttons{innerHTML} .= Html2::tag(\%forceupdate);
18950
}
18951
18952
$fs{innerHTML} .= Html2::tag(\%buttons);
18953
}
18954
18955
$rv .= Html2::tag(\%fs);
18956
}
18957
18958
if (not $nospace) { $rv = Html2::br() . Html2::br() . Html2::br() . Html2::br() . Html2::br() . $rv; }
18959
18960
return $rv; # a scalar
18961
#usage: print debug_banner("myFunction()", "some debug info here");
18962
}
18963
18964
########################
18965
########################
18966
########################
18967
########################
18968
########################
18969
########################
18970
########################
18971
########################
18972
########################
18973
########################
18974
########################
18975
########################
18976
########################
18977
########################
18978
########################
18979
########################
18980
########################
18981
########################
18982
########################
18983
########################
18984
18985
########################
18986
sub _tests(;$) {
18987
#*
18988
# to test <i>Pm::Html</i> subroutines
18989
#*
18990
my ($extended) = @_; # to display extended info
18991
my $output = "no tests performed, yet...";
18992
18993
my $test = 0;
18994
my $test2 = 1;
18995
my $test3 = 0;
18996
my @test = ();
18997
my @test2 = ();
18998
$output = "";
18999
19000
$test = 0;
19001
$test2 = 0;
19002
$test3 = dropdown_for_users('users', '', 2, '', "alert('hey! that tickles');", ' ', '', '', $test, 0, 0, $test2, 1);
19003
$output .= display_debug_one("dropdown_for_users('users', '', 2, '', \"alert('hey! that tickles');\", ' ', '', '', $test, 0, 0, $test2, 1);", $test3);
19004
$test3 = dropdown_for_users('users2', '', -1, '', '', ' ', '', '', $test, 0, 0, $test2, 0);
19005
$output .= display_debug_one("dropdown_for_users('users2', '', -1, '', '', ' ', '', '', $test, 0, 0, $test2, 0);", $test3);
19006
19007
$output .= display_debug_code("pre_html_header({type=>'text/plain'})", pre_html_header({type=>"text/plain"}));
19008
$output .= Html2::br() . "Display Modal" . Html2::br();
19009
$output .= display_modal('testmodalone', 'link,show modal 1', '', 'title 1', 'content 1', 'footer 1', '');
19010
$output .= Html2::br();
19011
$output .= display_modal('testmodaltwo', 'button,show modal 2', '', 'title 2', 'content 2', 'footer 2', '', 'green');
19012
19013
$output .= Html2::br() . Html2::hr() . Html2::br();
19014
my %f = {
19015
src=>"test"
19016
};
19017
$test = "i=site/add.png&s=ss";
19018
$output .= display_debug_one("img(\"$test\", 0, 0, \\\%f)", "" . img($test, 0, 0, \%f));
19019
19020
return $output; # a scalar
19021
#usage: print _tests();
19022
}
19023
19024
1;