############################################################################### # HoneyPot.pm # # $Date: 01 Sep 2026 $ # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBBForum 3.2 # # Packaged: 01 Sep 2026 # # Distributed by: https://yabbforum.nz # # =========================================================================== # # Copyright (c) 2000-2026 YaBB (yabbforum.nz) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # ############################################################################### use CGI::Carp qw(fatalsToBrowser); our $VERSION = '3.2'; $honeypotpmver = 'YaBBForum 3.2'; if ( $action eq 'detailedversion' ) { return 1; } my $honey_language = $FORM{'honey_language'} || $INFO{'honey_language'} || $lang; sub honeypot { is_admin_or_gmod(); opendir LNGDIR, $langdir; my @lfilesanddirs = readdir LNGDIR; closedir LNGDIR; foreach my $fld (sort {lc($a) cmp lc $b} @lfilesanddirs) { if (-e "$langdir/$fld/Main.lng") { my $displang = $fld; $displang =~ s/(.+?)\_(.+?)$/$1 ($2)/gism; if ($honey_language eq $fld) { $drawnldirs .= qq~~; } else { $drawnldirs .= qq~~; } } } if (-e "$langdir/$honey_language/honey.txt") { fopen(HONEYPOT, "<$langdir/$honey_language/honey.txt") || fatal_error('cannot_open',"$langdir/$honey_language/honey.txt", 1); @honey_label = ; fclose(HONEYPOT); } $total_labels = @honey_label || 0; if ($total_labels) { $show_hon_labels = qq~ $honeypot{'label'} $honeypot{'edits'} $honeypot{'deletes'} ~; foreach my $hon_labels ( sort { $a <=> $b } @honey_label ) { chomp $hon_labels; $show_hon_labels .= qq~ $hon_labels
~; } } else { $show_hon_labels = qq~ $honeypot{'no_label'} ~; } $yymain = qq~
$show_hon_labels
$admin_img{'prefimg'} $honeypot{'labels'} ($total_labels)
$admin_img{'prefimg'} $honeypot{'add_new_label'}
$admin_img{'prefimg'} $admin_txt{'10'}
~; $yytitle = $honeypot{'labels'}; $action_area = 'honeypot'; AdminTemplate(); exit; } sub honeypot_add { is_admin_or_gmod(); $h_label = $FORM{'honey_add'}; if ( $h_label eq q{} ) { fatal_error( 'invalid_value', "$honeypot{'label'}" ); } fopen( HONEYPOT, ">>$langdir/$honey_language/honey.txt" ) || fatal_error( 'cannot_open', "$langdir/$honey_language/honey.txt", 1 ); print {HONEYPOT} "$h_label\n" or croak "$croak{'print'} HONEYPOT"; fclose(HONEYPOT); if ( $action eq 'honeypot_add' ) { $yySetLocation = qq~$adminurl?action=honeypot;honey_language=$FORM{'honey_language'}~; redirectexit(); } return; } sub honeypot_edit { is_admin_or_gmod(); $h_label = $FORM{'hon_label'}; fopen( HONEYPOT, "<$langdir/$honey_language/honey.txt" ) || fatal_error( 'cannot_open', "$langdir/$honey_language/honey.txt", 1 ); @h_labels = ; fclose(HONEYPOT); my $aa = 0; foreach my $id (@h_labels) { chomp $id; if ( $id eq $h_label ) { last; } $aa++; } $yymain = qq~
$admin_img{'prefimg'} $honeypot{'edits'}
$admin_img{'prefimg'} $admin_txt{'10'}
 
~; $yytitle = $honeypot{'labels'}; AdminTemplate(); exit; } sub honeypot_edit2 { is_admin_or_gmod(); $h_label = $FORM{'hon_label2'}; $line = $FORM{'hon_line'}; if ( $h_label eq q{} ) { fatal_error( 'invalid_value', "$honeypot{'label'}" ); } fopen( HONEYPOT, "<$langdir/$honey_language/honey.txt" ) || fatal_error( 'cannot_open', "$langdir/$honey_language/honey.txt", 1 ); @h_labels = ; fclose(HONEYPOT); fopen( HONEYPOT, ">$langdir/$honey_language/honey.txt" ) || fatal_error( 'cannot_open', "$langdir/$honey_language/honey.txt", 1 ); $aa = 0; foreach my $i ( @h_labels) { chomp $i; if($aa == $line) { print {HONEYPOT} "$h_label\n" or croak "$croak{'print'} HONEYPOT"; } else { print {HONEYPOT} "$i\n" or croak "$croak{'print'} HONEYPOT"; } $aa++; } fclose(HONEYPOT); $yySetLocation = qq~$adminurl?action=honeypot;honey_language=$FORM{'honey_language'}~; redirectexit(); return; } sub honeypot_delete { is_admin_or_gmod(); $h_label = $FORM{'hon_label'}; fopen( HONEYPOT, "<$langdir/$honey_language/honey.txt" ) || fatal_error( 'cannot_open', "$langdir/$honey_language/honey.txt", 1 ); @h_labels = ; fclose(HONEYPOT); fopen( HONEYPOT, ">$langdir/$honey_language/honey.txt" ) || fatal_error( 'cannot_open', "$langdir/$honey_language/honey.txt", 1 ); foreach my $i ( @h_labels) { chomp $i; if( $h_label eq $i) { print {HONEYPOT} q{} or croak "$croak{'print'} HONEYPOT"; } else { print {HONEYPOT} "$i\n" or croak "$croak{'print'} HONEYPOT"; } } fclose(HONEYPOT); $yySetLocation = qq~$adminurl?action=honeypot;honey_language=$FORM{'honey_language'}~; redirectexit(); return; } 1;