| ############################################################################### |
| ############################################################################### |
| # ErrorLog.pl # |
| # ErrorLog.pm # |
| |
| # $Date: 01.05.16 $ # |
| ############################################################################### |
| ############################################################################### |
| # YaBB: Yet another Bulletin Board # |
| # YaBB: Yet another Bulletin Board # |
| # Open-Source Community Software for Webmasters # |
| # Open-Source Community Software for Webmasters # |
| # Version: YaBB 2.5.2 # |
| # Version: YaBB 2.6.12 # |
| # Packaged: October 21, 2012 # |
| # Packaged: January 5, 2016 # |
| # Distributed by: http://www.yabbforum.com # |
| # Distributed by: http://www.yabbforum.com # |
| # =========================================================================== # |
| # =========================================================================== # |
| # Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Copyright (c) 2000-2016 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Software by: The YaBB Development Team # |
| # Software by: The YaBB Development Team # |
| # with assistance from the YaBB community. # |
| # with assistance from the YaBB community. # |
| ############################################################################### |
| ############################################################################### |
| |
| use CGI::Carp qw(fatalsToBrowser); |
| |
| our $VERSION = '2.6.12'; |
| |
| |
| $errorlogplver = 'YaBB 2.5.2 $Revision: 1.0 $'; |
| $errorlogpmver = 'YaBB 2.6.12 $Revision: 1710 $'; |
| if ($action eq 'detailedversion') { return 1; } |
| if ( $action eq 'detailedversion' ) { return 1; } |
| |
| |
| sub ErrorLog { |
| sub ErrorLog { |
| &is_admin_or_gmod; |
| is_admin_or_gmod(); |
| $yytitle = "$errorlog{'1'}"; |
| $yytitle = "$errorlog{'1'}"; |
| $errorcount = 0; |
| $errorcount = 0; |
| fopen(ERRORFILE, "$vardir/errorlog.txt"); |
| fopen( ERRORFILE, "$vardir/errorlog.txt" ); |
| @errors = <ERRORFILE>; |
| @errors = <ERRORFILE>; |
| fclose(ERRORFILE); |
| fclose(ERRORFILE); |
| $errorcount = @errors; |
| $errorcount = @errors; |
| $date2 = $date; |
| $date2 = $date; |
| for ($i = 0; $i < $errorcount; $i++) { |
| $mytest = 0; |
| my @tmpArray = split(/\|/, $errors[$i]); |
| for my $i ( 0 .. $#errors ) { |
| $date1 = $tmpArray[1]; |
| my @tmpArray = split /\|/xsm, $errors[$i]; |
| &calcdifference; |
| if ( $tmpArray[0] eq q{} || $tmpArray[0] =~ /\D/igsm || $tmpArray[1] eq q{} || $tmpArray[1] =~ /\D/igsm ) { next; } |
| $date_ref = $result; |
| else { |
| $tmplist[$i] = qq~$date_ref\|$errors[$i]~; |
| $date1 = $tmpArray[1]; |
| } |
| calcdifference(); |
| |
| $date_ref = $result; |
| $sortmode = $INFO{'sort'}; |
| $tmplist[$mytest] = qq~$date_ref|$errors[$i]~; |
| $sortorder = $INFO{'order'}; |
| $mytest++; |
| if ($sortmode eq "") { |
| } |
| $sortmode = "time"; |
| } |
| } |
| |
| if ($sortorder eq "") { |
| $sortmode = $INFO{'sort'}; |
| $sortorder = "reverse"; |
| $sortorder = $INFO{'order'}; |
| } |
| if ( $sortmode eq q{} ) { |
| my @sortlist = (); |
| $sortmode = 'time'; |
| my $field = '0'; # 0-based field defaults to the datecmp value |
| } |
| my $type = '0'; # 0=numeric; 1=text |
| if ( $sortorder eq q{} ) { |
| my $case = '1'; # 0=case sensitive; 1=ignore case |
| $sortorder = 'reverse'; |
| my $dir = '0'; # 0=increasing; 1=decreasing |
| } |
| |
| my @sortlist = (); |
| if ($sortmode eq "time") { |
| my $field = '0'; # 0-based field defaults to the datecmp value |
| $field = '1'; |
| my $type = '0'; # 0=numeric; 1=text |
| $type = '0'; |
| my $case = '1'; # 0=case sensitive; 1=ignore case |
| $case = '1'; |
| my $dir = '0'; # 0=increasing; 1=decreasing |
| $dir = '0'; |
| |
| } elsif ($sortmode eq "users") { |
| if ( $sortmode eq 'time' ) { |
| $field = '8'; |
| $field = '1'; |
| $type = '1'; |
| $type = '0'; |
| $case = '1'; |
| $case = '1'; |
| $dir = '0'; |
| $dir = '0'; |
| } elsif ($sortmode eq "ip") { |
| } |
| $field = '3'; |
| elsif ( $sortmode eq 'users' ) { |
| $type = '0'; |
| $field = '8'; |
| $case = '0'; |
| $type = '1'; |
| $dir = '0'; |
| $case = '1'; |
| } |
| $dir = '0'; |
| @sortlist = map { $_->[0] } sort { YaBBsort($field, $type, $case, $dir) } map { [$_, split /\|/] } @tmplist; |
| } |
| |
| elsif ( $sortmode eq 'ip' ) { |
| if ($INFO{'order'} eq "reverse") { |
| $field = '3'; |
| @sortlist = reverse @sortlist; |
| $type = '0'; |
| } else { |
| $case = '0'; |
| if ($sortmode eq "time") { |
| $dir = '0'; |
| $order_time = ";order=reverse"; |
| } |
| } elsif ($sortmode eq "users") { |
| @sortlist = |
| $order_users = ";order=reverse"; |
| map { $_->[0] } |
| } elsif ($sortmode eq "ip") { |
| sort { YaBBsort( $field, $type, $case, $dir ) } |
| $order_ip = ";order=reverse"; |
| map { [ $_, split /\|/xsm ] } @tmplist; |
| } |
| |
| } |
| if ( $INFO{'order'} eq 'reverse' ) { |
| |
| @sortlist = reverse @sortlist; |
| if ($sortmode ne "") { |
| } |
| $sortmode = ";sort=" . $INFO{'sort'}; |
| else { |
| } |
| if ( $sortmode eq 'time' ) { |
| if ($sortorder ne "") { |
| $order_time = ';order=reverse'; |
| $sortorder = ";order=" . $INFO{'order'}; |
| } |
| } |
| elsif ( $sortmode eq 'users' ) { |
| $yymain .= qq~\ |
| $order_users = ';order=reverse'; |
| <script language="JavaScript1.2" src="$yyhtml_root/ubbc.js" type="text/javascript"></script> |
| } |
| <script language="JavaScript1.2" type="text/javascript"> |
| elsif ( $sortmode eq 'ip' ) { |
| <!-- Begin |
| $order_ip = ';order=reverse'; |
| |
| } |
| |
| } |
| |
| |
| |
| if ( $sortmode ne q{} ) { |
| |
| $sortmode = ';sort=' . $INFO{'sort'}; |
| |
| } |
| |
| if ( $sortorder ne q{} ) { |
| |
| $sortorder = ';order=' . $INFO{'order'}; |
| |
| } |
| |
| |
| |
| $errorlog_error = q{}; |
| |
| if ( $#errors > $#tmplist ) { |
| |
| $err = $#errors - $#tmplist; |
| |
| $errorlog_error = qq~<br /><span class="important"><b>$errorlog{'27a'} $err $errorlog{'27b'}</b></span>~; |
| |
| if ( $err == 1 ) { |
| |
| $errorlog_error = qq~<br /><span class="important"><b>$errorlog{'27c'} $err $errorlog{'27d'}</b></span>~; |
| |
| } |
| |
| } |
| |
| $yymain .= qq~\ |
| |
| <script src="$yyhtml_root/ubbc.js" type="text/javascript"></script> |
| |
| <script type="text/javascript"> |
| function changeBox(cbox) { |
| function changeBox(cbox) { |
| box = eval(cbox); |
| box = eval(cbox); |
| box.checked = !box.checked; |
| box.checked = !box.checked; |
| } |
| } |
| function checkAll() { |
| function checkAll() { |
| for (var i = 0; i < document.errorlog_form.elements.length; i++) { |
| for (var i = 0; i < document.errorlog_form.elements.length; i++) { |
| if(document.errorlog_form.elements[i].name != "subfield" && document.errorlog_form.elements[i].name != "msgfield") { |
| if(document.errorlog_form.elements[i].name != "subfield" && document.errorlog_form.elements[i].name != "msgfield") { |
| document.errorlog_form.elements[i].checked = true; |
| document.errorlog_form.elements[i].checked = true; |
| } |
| } |
| } |
| } |
| } |
| } |
| function uncheckAll() { |
| function uncheckAll() { |
| for (var i = 0; i < document.errorlog_form.elements.length; i++) { |
| for (var i = 0; i < document.errorlog_form.elements.length; i++) { |
| if(document.errorlog_form.elements[i].name != "subfield" && document.errorlog_form.elements[i].name != "msgfield") { |
| if(document.errorlog_form.elements[i].name != "subfield" && document.errorlog_form.elements[i].name != "msgfield") { |
| document.errorlog_form.elements[i].checked = false; |
| document.errorlog_form.elements[i].checked = false; |
| } |
| } |
| } |
| } |
| } |
| } |
| //--> |
| |
| </script> |
| </script> |
| <form name="errorlog_form" action="$adminurl?action=deleteerror;$sortmode$sortorder" method="post" onsubmit="return submitproc()"> |
| <form name="errorlog_form" action="$adminurl?action=deleteerror;$sortmode$sortorder" method="post" onsubmit="return submitproc()"> |
| <input type="hidden" name="button" value="4" /> |
| <input type="hidden" name="button" value="4" /> |
| |
| <div class="bordercolor rightboxdiv"> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| <table class="border-space pad-cell" style="margin-bottom:.5em"> |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| <colgroup> |
| <tr valign="middle"> |
| <col style="width:5%" /> |
| <td align="left" class="titlebg" colspan="5"> |
| <col style="width:10%" /> |
| <img src="$imagesdir/xx.gif" alt="" border="0" /><b>$yytitle</b> |
| <col style="width:15%" /> |
| </td> |
| <col style="width:65%" /> |
| </tr> |
| <col style="width:5%" /> |
| <tr valign="middle"> |
| </colgroup> |
| <td align="left" class="windowbg2" colspan="5"><br /> |
| <tr> |
| $errorlog{'18'}<br /><br /> |
| <td class="titlebg" colspan="5">$admin_img{'xx'} <b>$yytitle</b></td> |
| </td> |
| </tr><tr> |
| </tr> |
| <td class="windowbg2" colspan="5"><div class="pad-more">$errorlog{'18'} $errorlog_error</div></td> |
| <tr valign="middle"> |
| </tr><tr> |
| <td align="center" valign="middle" class="catbg"> |
| <td class="catbg center"><b>$errorlog{'21'}</b></td> |
| <b>$errorlog{'21'}</b> |
| <td class="catbg center"> |
| </td> |
| <a href="$adminurl?action=errorlog$startmode;sort=time$order_time"><b>$errorlog{'5'}</b></a> |
| <td align="center" valign="middle" class="catbg"> |
| </td> |
| <a href="$adminurl?action=errorlog$startmode;sort=time$order_time"><b>$errorlog{'5'}</b></a> |
| <td class="catbg center"> |
| </td> |
| <a href="$adminurl?action=errorlog$startmode;sort=users$order_users"><b>$errorlog{'11'}</b></a> ( <a href="$adminurl?action=errorlog$startmode;sort=ip$order_ip"><b>$errorlog{'6'}</b></a> ) |
| <td align="center" valign="middle" class="catbg"> |
| </td> |
| <a href="$adminurl?action=errorlog$startmode;sort=users$order_users"><b>$errorlog{'11'}</b></a> ( <a href="$adminurl?action=errorlog$startmode;sort=ip$order_ip"><b>$errorlog{'6'}</b></a> ) |
| <td class="catbg center"><b>$errorlog{'7'} / $errorlog{'8'}</b></td> |
| </td> |
| <td class="catbg center"><b>$errorlog{'13'}</b></td> |
| <td align="center" valign="middle" class="catbg"> |
| </tr>~; |
| <b>$errorlog{'7'} / $errorlog{'8'}</b> |
| $numshown = 0; |
| </td> |
| $actualnum = 0; |
| <td align="center" valign="middle" class="catbg"> |
| $bb = 0; |
| <b>$errorlog{'13'}</b> |
| while ( $numshown <= $errorcount ) { |
| </td> |
| my ( $tmp_user, $username, $numb, $ids, $all ) = q{}; |
| </tr> |
| $numshown++; |
| ~; |
| $sortlist[$bb] =~ s/<br \/>/\[br \/\]/gsm; |
| $numshown = 0; |
| $sortlist[$bb] =~ s/<b>/\[b\]/gxsm; |
| $actualnum = 0; |
| $sortlist[$bb] =~ s/<\/b>/\[\/b\]/gxsm; |
| while ($numshown <= $errorcount) { |
| $sortlist[$bb] =~ s/</</gxsm; |
| my ($tmp_user, $username, $numb, $ids, $all) = ''; |
| $sortlist[$bb] =~ s/>/>/gxsm; |
| $numshown++; |
| $sortlist[$bb] =~ s/\[b\]/<b>/gxsm; |
| my ($tmp_datecmp, $tmp_id, $tmp_date, $tmp_userip, $tmp_error, $tmp_action, $tmp_topic_number, $tmp_board, $tmp_username, $tmp_password) = split(/\|/, $sortlist[$b]); |
| $sortlist[$bb] =~ s/\[\/b\]/<\/b>/gxsm; |
| if (!$tmp_id) { next; } |
| $sortlist[$bb] =~ s/\[br \/\]/<br \/>/gsm; |
| &FormatUserName($tmp_username); |
| $sortlist[$bb] =~ s/\$/$/gsm; |
| if (!$tmp_username) { |
| $sortlist[$bb] =~ s/\@/@/gsm; |
| $tmp_user = "Guest"; |
| $sortlist[$bb] =~ s/\%/%/gsm; |
| } else { |
| my ( |
| $tmp_user = $tmp_username; |
| $tmp_datecmp, $tmp_id, $tmp_date, |
| } |
| $tmp_userip, $tmp_error, $tmp_action, |
| $userlist{$tmp_user} = $userlist{$tmp_user} + 1; |
| $tmp_topic_number, $tmp_board, $tmp_username, |
| $tmp_date = &timeformat($tmp_date); |
| $tmp_password |
| &LoadUser($tmp_user); |
| ) = split /\|/xsm, $sortlist[$bb]; |
| if ($tmp_user eq "$useraccount{$tmp_user}") { |
| if ( !$tmp_id ) { next; } |
| if ($userprofile{$tmp_user}->[1]) { |
| FormatUserName($tmp_username); |
| $username = qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$tmp_user}" target ="_blank">$userprofile{$tmp_user}->[1]</a>~; |
| if ( !$tmp_username ) { |
| } else { |
| $tmp_user = 'Guest'; |
| $username .= qq~$useraccount{$tmp_user}~; |
| } |
| } |
| else { |
| $username .= qq~<br />($tmp_userip)~; |
| $tmp_user = $tmp_username; |
| } else { |
| } |
| $username = qq~$tmp_user<br />($tmp_userip)~; |
| $userlist{$tmp_user} = $userlist{$tmp_user} + 1; |
| } |
| $tmp_date = timeformat($tmp_date); |
| if ($tmp_topic_number eq '') { |
| LoadUser($tmp_user); |
| $numb = "&action=$tmp_action"; |
| my $ipBlock = q{}; |
| } else { |
| my $lookupIP = qq{$tmp_userip}; |
| $numb = "&action=$tmp_action&num=$tmp_topic_number"; |
| my $ipBan = q{}; |
| } |
| if ( $tmp_userip ne '127.0.0.1' ) { |
| if ($tmp_board eq '') { |
| $ipBlock = ( $use_guardian && $use_htaccess ) ? qq~<br /><a href="$adminurl?action=guardian_block;ip=$tmp_userip;return=errorlog" onclick="return confirm('$admin_txt{'ipblock_confirm'}$tmp_userip');">$admin_txt{'ipblock'}</a>~ : qq~<br /><a href="$adminurl?action=blockip;ip=$tmp_userip;return=errorlog" onclick="return confirm('$admin_txt{'ipblock_confirm'}$tmp_userip');">$admin_txt{'ipblock2'}</a>~; |
| $ids = "?board="; |
| |
| } else { |
| $lookupIP = |
| $ids = "?board=$tmp_board"; |
| ($ipLookup) |
| } |
| ? qq~<a href="$scripturl?action=iplookup;ip=$tmp_userip">$tmp_userip</a>~ |
| if ($tmp_action eq '' && $tmp_board eq '') { |
| : qq~$tmp_userip~; |
| $all = "$boardurl/$yyexec.$yyext"; |
| $ipBan = qq~ - <a href="$adminurl?action=ipban_err;ban=$tmp_userip;lev=p;return=errorlog" onclick="return confirm('$admin_txt{'ipban_confirm'}$tmp_userip');">$admin_txt{'725f'}</a>~; |
| } else { |
| } |
| $all = "$boardurl/$yyexec.$yyext$ids$numb"; |
| if ( $tmp_user eq "$useraccount{$tmp_user}" ) { |
| } |
| if ( $userprofile{$tmp_user}->[1] ) { |
| if ($tmp_error eq $admin_txt{'39'} || $tmp_error eq $admin_txt{'40'}) { |
| $username = |
| $tmp_error = $tmp_error . " - (<span style=\"color: #FF0000;\">$tmp_password</span>)"; |
| qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$tmp_user}" target="_blank">$userprofile{$tmp_user}->[1]</a>~; |
| } |
| } |
| |
| else { |
| $b++; |
| $username .= qq~$useraccount{$tmp_user}~; |
| $addel = qq~<td class="windowbg" align="center"><input type="checkbox" name="error$tmp_id" value="$tmp_id" class="windowbg" style="border: 0px;" /></td>~; |
| } |
| $actualnum++; |
| $username .= |
| $print_errorlog .= qq~ |
| qq~<br />$lookupIP$ipBan$ipBlock~; |
| <tr> |
| } |
| <td class="windowbg" align="center">$actualnum</td> |
| else { |
| <td class="windowbg">$tmp_date</td> |
| $username = qq~$tmp_user<br />$lookupIP$ipBan$ipBlock~; |
| <td class="windowbg2" align="center">$username</td> |
| } |
| <td class="windowbg" align="center"> |
| if ( $tmp_topic_number eq q{} ) { |
| <span class="small">$tmp_error<br /><br /><a href="$all">$all</a></span> |
| $numb = "&action=$tmp_action"; |
| </td> |
| } |
| $addel |
| else { |
| </tr>~; |
| $numb = "&action=$tmp_action&num=$tmp_topic_number"; |
| } |
| } |
| if (!($actualnum)) { |
| if ( $tmp_board eq q{} ) { |
| $print_errorlog = qq~ |
| $ids = '?board='; |
| <tr> |
| } |
| <td class="windowbg2" align="center" colspan="5"> |
| else { |
| $errorlog{'19'} |
| $ids = "?board=$tmp_board"; |
| </td> |
| } |
| </tr>~; |
| if ( $tmp_action eq q{} && $tmp_board eq q{} ) { |
| } |
| $all = "$boardurl/$yyexec.$yyext"; |
| $yymain .= qq~ |
| } |
| |
| else { |
| |
| $all = "$boardurl/$yyexec.$yyext$ids$numb"; |
| |
| } |
| |
| if ( $tmp_error eq $admin_txt{'39'} || $tmp_error eq $admin_txt{'40'} ) |
| |
| { |
| |
| $tmp_error = |
| |
| $tmp_error . qq~ - (<span class="important">$tmp_password</span>)~; |
| |
| } |
| |
| |
| |
| $bb++; |
| |
| $addel = |
| |
| qq~ <td class="windowbg center"><input type="checkbox" name="error$tmp_id" value="$tmp_id" class="windowbg" style="border: 0;" /></td>~; |
| |
| $actualnum++; |
| |
| $print_errorlog .= qq~<tr> |
| |
| <td class="windowbg center">$actualnum</td> |
| |
| <td class="windowbg">$tmp_date</td> |
| |
| <td class="windowbg2 center">$username</td> |
| |
| <td class="windowbg center"> |
| |
| <div class="small" style="height:5em; overflow:auto">$tmp_error<br /><a href="$all">$all</a></div> |
| |
| </td> |
| |
| $addel |
| |
| </tr>~; |
| |
| } |
| |
| if ( !($actualnum) ) { |
| |
| $print_errorlog = qq~<tr> |
| |
| <td class="windowbg2 center" colspan="5">$errorlog{'19'}</td> |
| |
| </tr>~; |
| |
| } |
| |
| $yymain .= qq~ |
| $print_errorlog |
| $print_errorlog |
| ~; |
| ~; |
| |
| |
| @userlist = sort { $userlist{$b} <=> $userlist{$a} } keys %userlist; |
| @userlist = reverse sort { $userlist{$a} <=> $userlist{$b} } keys %userlist; |
| foreach $member (@userlist) { |
| foreach my $member (@userlist) { |
| $errmember .= qq~$member ($userlist{$member}), ~; |
| $errmember .= qq~$member ($userlist{$member}), ~; |
| } |
| } |
| $errmember =~ s/, \Z//; |
| $errmember =~ s/, \Z//sm; |
| |
| |
| $yymain .= qq~ |
| $yymain .= qq~ <tr> |
| <tr valign="middle"> |
| <td class="windowbg2" colspan="5"><div class="pad-more"><b>$errorlog{'26'}</b> $errmember</div></td> |
| <td align="left" class="windowbg2" colspan="5"><br /> |
| </tr><tr> |
| <strong>$errorlog{'26'}</strong> $errmember<br /><br /> |
| <td class="windowbg right" colspan="4"> ~; |
| </td> |
| if ( $errorcount > 0 ) { |
| </tr> |
| $yymain .= |
| <tr valign="middle"> |
| qq~<label for="checkall"><b>$admin_txt{'737'}</b></label> ~; |
| <td align="right" class="windowbg" colspan="4"> ~; |
| } |
| if ($errorcount > 0) { $yymain .= qq~<label for="checkall"><b>$admin_txt{'737'}</label> </b>~; } |
| $yymain .= q~ |
| $yymain .= qq~ |
| </td> |
| </td> |
| <td class="windowbg center"> ~; |
| <td class="windowbg" align="center"> ~; |
| if ( $errorcount > 0 ) { |
| if ($errorcount > 0) { $yymain .= qq~<input type="checkbox" name="checkall" id="checkall" class="windowbg" style="border: 0px;" onclick="if (this.checked) checkAll(); else uncheckAll();" />~; } |
| $yymain .= |
| $yymain .= qq~ |
| q~<input type="checkbox" name="checkall" id="checkall" class="windowbg" style="border: 0;" onclick="if (this.checked) checkAll(); else uncheckAll();" />~; |
| </td> |
| } |
| </tr> |
| $yymain .= q~ |
| </table> |
| </td> |
| </div> |
| </tr> |
| |
| </table> |
| <br /> |
| </div>~; |
| ~; |
| |
| |
| if ( $errorcount > 0 ) { |
| if ($errorcount > 0) { |
| |
| |
| $yymain .= qq~ |
| $yymain .= qq~ |
| <div class="bordercolor rightboxdiv"> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| <table class="border-space pad-cell"> |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| <tr> |
| <tr valign="middle"> |
| <th class="titlebg">$admin_img{'prefimg'} $errorlog{'14'}</th> |
| <td align="center" class="catbg"> |
| </tr><tr> |
| <input type="submit" value="$errorlog{'14'}" onclick="return confirm('$errorlog{'15'}')" class="button" /> |
| <td class="catbg center"> |
| </td> |
| <input type="submit" value="$errorlog{'14'}" onclick="return confirm('$errorlog{'15'}')" class="button" /> |
| </tr> |
| <br /><a href="$boardurl/AdminIndex.$yyaext?action=cleanerrorlog" onclick="return confirm('$errorlog{'15a'}')">$errorlog{'14a'}</a> |
| </table> |
| </td> |
| </div> |
| </tr> |
| ~; |
| </table> |
| } |
| </div>~; |
| |
| } |
| |
| |
| $yymain .= qq~ |
| $yymain .= q~ |
| </form> |
| </form> |
| ~; |
| ~; |
| $action_area = "errorlog"; |
| $action_area = 'errorlog'; |
| &AdminTemplate; |
| AdminTemplate(); |
| |
| return; |
| } |
| } |
| |
| |
| sub CleanErrorLog { |
| sub CleanErrorLog { |
| &is_admin_or_gmod; |
| is_admin_or_gmod(); |
| if (-e ("$vardir/errorlog.txt")) { unlink("$vardir/errorlog.txt") || die "$!" } |
| if ( -e ("$vardir/errorlog.txt") ) { |
| $yySetLocation = qq~$adminurl?action=errorlog~; |
| unlink "$vardir/errorlog.txt" or croak qq~$!~; |
| &redirectexit; |
| } |
| |
| $yySetLocation = qq~$adminurl?action=errorlog~; |
| |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| sub DeleteError { |
| sub DeleteError { |
| &is_admin_or_gmod; |
| is_admin_or_gmod(); |
| my ($count, $memnum, $currentmem, @deademails, $start, $sortmode, $sortorder); |
| my ( $sortmode, $sortorder ); |
| chomp $FORM{"button"}; |
| chomp $FORM{'button'}; |
| if ($FORM{"button"} ne "4") { &admin_fatal_error("no_access"); } |
| if ( $FORM{'button'} ne '4' ) { fatal_error('no_access'); } |
| fopen(FILE, "$vardir/errorlog.txt"); |
| fopen( FILE, "$vardir/errorlog.txt" ); |
| @errors = <FILE>; |
| @errors = <FILE>; |
| fclose(FILE); |
| fclose(FILE); |
| unlink("$vardir/errorlog.txt"); |
| unlink "$vardir/errorlog.txt"; |
| fopen(FILE, ">>$vardir/errorlog.txt"); |
| fopen( FILE, ">>$vardir/errorlog.txt" ); |
| |
| |
| foreach my $line (@errors) { |
| foreach my $line (@errors) { |
| chomp $line; |
| chomp $line; |
| my ($tmp_id, $tmp_date, $tmp_username, $tmp_error, $tmp_board, $tmp_action) = split(/\|/, $line); |
| my ( |
| unless (exists $FORM{"error$tmp_id"}) { |
| $tmp_id, $tmp_date, $tmp_username, |
| print FILE $line . "\n"; |
| $tmp_error, $tmp_board, $tmp_action |
| } |
| ) = split /\|/xsm, $line; |
| } |
| if ( !exists $FORM{"error$tmp_id"} ) { |
| fclose(FILE); |
| print {FILE} $line . "\n" or croak "$croak{'print'} FILE"; |
| $yySetLocation = qq~$adminurl?action=errorlog~; |
| } |
| &redirectexit; |
| } |
| |
| fclose(FILE); |
| |
| $yySetLocation = qq~$adminurl?action=errorlog~; |
| |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| # Moved here from Subs.pl since it was only used here |
| # Moved here from Subs.pm since it was only used here |
| sub YaBBsort { |
| sub YaBBsort { |
| my $field = (shift || 0) + 1; # 0-based field |
| my $field = ( shift || 0 ) + 1; # 0-based field |
| my $type = shift || 0; # 0=numeric; 1=text |
| my $type = shift || 0; # 0=numeric; 1=text |
| my $case = shift || 0; # 0=case sensitive; 1=ignore case |
| my $case = shift || 0; # 0=case sensitive; 1=ignore case |
| my $dir = shift || 0; # 0=increasing; 1=decreasing |
| my $dir = shift || 0; # 0=increasing; 1=decreasing |
| |
| |
| if ($type == 0) { |
| if ( $type == 0 ) { |
| if ($dir == 0) { |
| if ( $dir == 0 ) { |
| $a->[$field] <=> $b->[$field]; |
| $a->[$field] <=> $b->[$field]; |
| } else { |
| } |
| $b->[$field] <=> $a->[$field]; |
| else { |
| } |
| $b->[$field] <=> $a->[$field]; |
| } else { |
| } |
| if ($case == 0) { |
| } |
| if ($dir == 0) { |
| else { |
| $a->[$field] cmp $b->[$field]; |
| if ( $case == 0 ) { |
| } else { |
| if ( $dir == 0 ) { |
| $b->[$field] cmp $a->[$field]; |
| $a->[$field] cmp $b->[$field]; |
| } |
| } |
| } else { |
| else { |
| if ($dir == 0) { |
| $b->[$field] cmp $a->[$field]; |
| uc $a->[$field] cmp uc $b->[$field]; |
| } |
| } else { |
| } |
| uc $b->[$field] cmp uc $a->[$field]; |
| else { |
| } |
| if ( $dir == 0 ) { |
| } |
| uc $a->[$field] cmp uc $b->[$field]; |
| } |
| } |
| |
| else { |
| |
| uc $b->[$field] cmp uc $a->[$field]; |
| |
| } |
| |
| } |
| |
| } |
| |
| return 1; |
| |
| } |
| |
| |
| |
| sub update_htaccess { |
| |
| my ( $action, @values ) = @_; |
| |
| my ( $htheader, $htfooter, @denies, @htout ); |
| |
| if ( !$action ) { return 0; } |
| |
| fopen( HTA, '.htaccess' ); |
| |
| @htlines = <HTA>; |
| |
| fclose(HTA); |
| |
| |
| |
| # header to determine only who has access to the main script, not the admin script |
| |
| $htheader = q~<Files YaBB*>~; |
| |
| $htfooter = q~</Files>~; |
| |
| $start = 0; |
| |
| foreach (@htlines) { |
| |
| chomp $_; |
| |
| if ( $_ eq $htheader ) { $start = 1; } |
| |
| if ( $start == 0 && $_ !~ m{#}sm && $_ ne q{} ) { push @htout, "$_\n"; } |
| |
| if ( $_ eq $htfooter ) { $start = 0; } |
| |
| if ( $start == 1 && $_ =~ s/Deny from //gsm ) { |
| |
| push @denies, $_; |
| |
| } |
| |
| } |
| |
| if ( $action eq 'load' ) { |
| |
| return @denies; |
| |
| } |
| |
| elsif ( $action eq 'save' ) { |
| |
| fopen( HTA, '>.htaccess' ); |
| |
| print {HTA} '# Last modified by YaBB: ' |
| |
| . timeformat( $date, 1 ) |
| |
| . " #\n\n" |
| |
| or croak "$croak{'print'} HTA"; |
| |
| print {HTA} @htout or croak "$croak{'print'} HTA"; |
| |
| if (@values) { |
| |
| print {HTA} "\n$htheader\n" or croak "$croak{'print'} HTA"; |
| |
| foreach (@values) { |
| |
| chomp $_; |
| |
| if ( $_ ne q{} ) { |
| |
| print {HTA} "Deny from $_\n" or croak "$croak{'print'} HTA"; |
| |
| } |
| |
| } |
| |
| print {HTA} "$htfooter\n" or croak "$croak{'print'} HTA"; |
| |
| } |
| |
| fclose(HTA); |
| |
| } |
| |
| elsif ( $action eq 'add' ) { |
| |
| push @denies, @values; |
| |
| update_htaccess( 'save', @denies ); |
| |
| } |
| |
| return; |
| |
| } |
| |
| |
| |
| sub blockip { |
| |
| is_admin_or_gmod(); |
| |
| my $blockIP = $INFO{'ip'}; |
| |
| update_htaccess( 'add', $blockIP ); |
| |
| $yySetLocation = qq~$adminurl?action=errorlog~; |
| |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| 1; |
| 1; |
| |
| |