#!/usr/bin/perl # $Id: BackupFix $ # $HeadURL: YABB $ # $Revision$ # $Source: /BackupFix.pl $ ############################################################################### # BackUpFix.pl # # $Date: 06.01.17 $ # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 2.7.00 # # Packaged: June 1, 2017 # # Distributed by: http://www.yabbforum.com # # =========================================================================== # # Copyright (c) 2000-2017 YaBB (www.yabbforum.com) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # ############################################################################### use strict; use warnings; use CGI::Carp qw(fatalsToBrowser); use CGI qw(:standard); use Time::Local; use File::stat; our $VERSION = '2.7.00'; our ( $boardurl, $vardir, $memberdir, $yyhtml_root, ); our $script_root = $ENV{'SCRIPT_FILENAME'}; if ( !$script_root ) { $script_root = $ENV{'PATH_TRANSLATED'}; } $script_root =~ s/\/BackupFix[.](pl|cgi)//igxsm; push @INC, $script_root; require Paths; my $yyext = 'pl'; if ( -e ('YaBB.cgi') ) { $yyext = 'cgi'; } else { $yyext = 'pl'; } my $back_url = "$boardurl/YaBB.$yyext"; if ( !-e "$vardir/backup.lock" ) { print "Location: $back_url\n\n" or croak 'cannot find location'; exit; } open my $ALIST, '<', "$vardir/adminlst.db" or croak 'cannot find adminlist'; my @alist = <$ALIST>; close $ALIST or croak 'cannot close adminlist'; chomp @alist; my $q = CGI->new; my $job = $q->param('job'); my $iamadmin = $q->param('iamadmin'); my $id = $q->param('username'); my $passwrd = $q->param('passwrd'); my $username = 'Guest'; my $password = q{}; if ( $job && $job == 1 && $iamadmin && $iamadmin == 1 ) { unlink "$vardir/backup.lock"; print "Location: $back_url\n\n" or croak 'cannot find location'; exit; } our ( $mbname, $cookieusername, $cookiepassword, ); require Variables::Settings; my $check = 0; if ( !$job ) { ( $username, $password ) = bakcookie( $cookieusername, $cookiepassword ); foreach my $i (@alist) { if ( $username eq $i ) { my ( $myid, $pssword ) = get_user($username); if ( $pssword eq $password ) { $username = qq{Hello $myid}; $check = 1; } last; } } } elsif ( $job == 2 ) { foreach my $j (@alist) { if ( $id eq $j ) { my $cryptpass = encode_password($passwrd); my ( $myid, $pssword ) = get_user($id); if ( $pssword eq $cryptpass ) { $username = qq{Hello $myid}; $check = 1; } } } } my $delbackuplock = q{}; my $ver_age = ( stat("$vardir/backup.lock")->mtime ); my $time = time; my $timelog = q{}; my $timelogp = q{}; my %map = (); my $login = q{}; print "Content-type: text/html\n\n" or croak 'cannot print line1'; if ( $check == 1 ) { $timelog = $time - $ver_age; my $myhrstxt = q{}; my $mymintxt = q{}; my $mysectxt = q{}; my $myhrs = 0; my $mymin = 0; my $mysec = 0; $myhrs = int( $timelog / 3600 ); $myhrstxt = qq~$myhrs hours, ~; $mymin = $timelog - ( $myhrs * 3600 ); $mymin = int( $mymin / 60 ); $mymintxt = qq~$mymin minutes, ~; $mysec = $timelog - ( $myhrs * 3600 ) - ( $mymin * 60 ); $mysectxt = qq~$mysec seconds.~; $timelogp = qq~
This backup has been running for $myhrstxt$mymintxt$mysectxt ($timelog seconds).
~; $delbackuplock = qq~~; $login = q{}; } else { $username = q~Hello, Guest. This forum is undergoing regular maintenance. Please check back later.~; $login = qq~ ~; } my $page = qq~$username
$timelogp $delbackuplock $login