| ############################################################################### |
| ############################################################################### |
| # Backup.pl # |
| # Backup.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. # |
| ############################################################################### |
| ############################################################################### |
| |
| # Many thanks to AK108 (http://fkp.jkcsi.com/) # |
| |
| # for his contribution to the YaBB community # |
| |
| ############################################################################### |
| |
| # use strict; |
| |
| # use warnings; |
| |
| # no warnings qw(uninitialized once redefine); |
| |
| use CGI::Carp qw(fatalsToBrowser); |
| |
| use English '-no_match_vars'; |
| |
| our $VERSION = '2.6.12'; |
| |
| |
| # Many thanks to AK108 (http://fkp.jkcsi.com/) for his contibution to the YaBB community |
| $backuppmver = 'YaBB 2.6.12 $Revision: 1710 $'; |
| |
| if ( $action eq 'detailedversion' ) { return 1; } |
| $backupplver = 'YaBB 2.5.2 $Revision: 1.0 $'; |
| |
| if ($action eq 'detailedversion') { return 1; } |
| |
| |
| |
| # Add in support for Archive::Tar in the Modules directory and binaries in different places |
| # Add in support for Archive::Tar in the Modules directory and binaries in different places |
| @ENVpaths = split(/\:/, $ENV{'PATH'}); |
| @ENVpaths = split /\:/xsm, $ENV{'PATH'}; |
| |
| |
| &LoadLanguage('Backup'); |
| LoadLanguage('Backup'); |
| $yytitle = $backup_txt{1}; |
| $yytitle = $backup_txt{1}; |
| $action_area = 'backupsettings'; |
| $action_area = 'backupsettings'; |
| |
| |
| my $curtime = CORE::time; # None of that Time::HiRes stuff |
| my $curtime = CORE::time; # None of that Time::HiRes stuff |
| |
| |
| my %dirs = ( |
| my %dirs = ( |
| 'src' => "Admin/ $backup_txt{'and'} Sources/", |
| 'src' => "Admin/ $backup_txt{'and'} Sources/", |
| 'bo' => "Boards/", |
| 'bo' => 'Boards/', |
| 'lan' => "Languages/ $backup_txt{'and'} Help/", |
| 'lan' => "Languages/ $backup_txt{'and'} Help/", |
| 'mem' => "Members/", |
| 'mem' => 'Members/', |
| 'mes' => "Messages/", |
| 'mes' => 'Messages/', |
| 'temp' => "Templates/ $backup_txt{10}", |
| 'temp' => "Templates/ $backup_txt{10}", |
| 'var' => "Variables/", |
| 'var' => 'Variables/', |
| 'html' => "yabbfiles", |
| 'html' => 'yabbfiles', |
| 'upld' => "yabbfiles/Attachments $backup_txt{'and'} yabbfiles/avatars/UserAvatars", |
| 'upld' => "yabbfiles/Attachments, yabbfiles/PMAttachments, $backup_txt{'and'} yabbfiles/avatars", |
| ); |
| ); |
| |
| |
| &is_admin_or_gmod; |
| is_admin_or_gmod(); |
| |
| |
| sub backupsettings { |
| sub backupsettings { |
| my ($module, $command, $tarcompress1, $tarcompress2, $allchecked, $item, %pathchecklist, %methodchecklist, $presetjavascriptcode, $file, @backups, $newcommand, $style, $disabledtext, $input); |
| my ( |
| |
| $module, $command, $tarcompress1, |
| $yymain .= qq~<b>$backup_txt{33} $INFO{'backupspendtime'} $backup_txt{34}</b><br /><br />~ if $INFO{'backupspendtime'}; |
| $tarcompress2, $allchecked, $item, |
| $yymain .= qq~<font color="green"><b>$backup_txt{'mailsuccess'}</b></font><br /><br />~ if $INFO{'mailinfo'} == 1; |
| %pathchecklist, %methodchecklist, $presetjavascriptcode, |
| $yymain .= qq~<font color="red"><b>$backup_txt{'mailfail'}</b></font><br /><br />~ if $INFO{'mailinfo'} == -1; |
| $file, @backups, $newcommand, |
| |
| $style, $disabledtext, $input |
| if (@backup_paths == 8) { $allchecked = 'checked="checked" '; } |
| ); |
| |
| |
| # Yes, my checklists are really hashes. Oh well. |
| if ( $INFO{'backupspendtime'} ) { |
| foreach $item (@backup_paths) { $pathchecklist{$item} = 'checked="checked" '; } |
| $yymain .= |
| $methodchecklist{$backupmethod} = 'checked="checked" '; |
| qq~<b>$backup_txt{33} $INFO{'backupspendtime'} $backup_txt{34}</b><br /><br />~; |
| $methodchecklist{$compressmethod} = 'checked="checked" '; |
| } |
| |
| if ( $INFO{'mailinfo'} == 1 ) { |
| # domodulecheck if we have a checked value |
| $yymain .= |
| $presetjavascriptcode = qq~ domodulecheck("$backupmethod", 'init');~; |
| qq~<span class="good"><b>$backup_txt{'mailsuccess'}</b></span><br /><br />~; |
| |
| } |
| # Javascript to make the behavior of the form buttons work better |
| if ( $INFO{'mailinfo'} == -1 ) { |
| $yymain .= qq~ |
| $yymain .= |
| <script type="text/javascript"> |
| qq~<span class="important"><b>$backup_txt{'mailfail'}</b></span><br /><br />~; |
| <!-- |
| } |
| function checkYaBB () { |
| |
| // See if the check all box should be checked or unchecked. |
| # Yes, my checklists are really hashes. Oh well. |
| // It should be checked only if all the other boxes are checked. |
| foreach my $item (@backup_paths) { |
| if (document.backupsettings.YaBB_bo.checked && document.backupsettings.YaBB_mes.checked && document.backupsettings.YaBB_mem.checked && document.backupsettings.YaBB_temp.checked && document.backupsettings.YaBB_lan.checked && document.backupsettings.YaBB_var.checked && document.backupsettings.YaBB_src.checked && document.backupsettings.YaBB_html.checked && document.backupsettings.YaBB_upld.checked) { |
| $pathchecklist{$item} = 'checked="checked" '; |
| document.backupsettings.YaBB_ALL.checked = 1; |
| } |
| } else { |
| if ( @backup_paths == 9 ) { $allchecked = 'checked="checked" '; } |
| document.backupsettings.YaBB_ALL.checked = 0; |
| |
| } |
| $methodchecklist{$backupmethod} = 'checked="checked" '; |
| } |
| $methodchecklist{$compressmethod} = 'checked="checked" '; |
| |
| |
| function masscheckYaBB (toggleboxstate) { |
| # domodulecheck if we have a checked value |
| if(!toggleboxstate) { // Uncheck all |
| $presetjavascriptcode = qq~ domodulecheck("$backupmethod", 'init');~; |
| checkstate = 0; |
| |
| } else if(toggleboxstate) { // Check all |
| # Javascript to make the behavior of the form buttons work better |
| checkstate = 1; |
| $yymain .= qq~ |
| } |
| <script type="text/javascript"> |
| document.backupsettings.YaBB_bo.checked = checkstate; |
| function checkYaBB () { |
| document.backupsettings.YaBB_mes.checked = checkstate; |
| // See if the check all box should be checked or unchecked. |
| document.backupsettings.YaBB_mem.checked = checkstate; |
| // It should be checked only if all the other boxes are checked. |
| document.backupsettings.YaBB_temp.checked = checkstate; |
| if (document.backupsettings.YaBB_bo.checked && document.backupsettings.YaBB_mes.checked && document.backupsettings.YaBB_mem.checked && document.backupsettings.YaBB_temp.checked && document.backupsettings.YaBB_lan.checked && document.backupsettings.YaBB_var.checked && document.backupsettings.YaBB_src.checked && document.backupsettings.YaBB_html.checked && document.backupsettings.YaBB_upld.checked) { |
| document.backupsettings.YaBB_lan.checked = checkstate; |
| document.backupsettings.YaBB_ALL.checked = 1; |
| document.backupsettings.YaBB_var.checked = checkstate; |
| } else { |
| document.backupsettings.YaBB_src.checked = checkstate; |
| document.backupsettings.YaBB_ALL.checked = 0; |
| document.backupsettings.YaBB_html.checked = checkstate; |
| } |
| document.backupsettings.YaBB_upld.checked = checkstate; |
| } |
| } |
| |
| |
| function masscheckYaBB (toggleboxstate) { |
| function domodulecheck (module, initstate) { |
| if(!toggleboxstate) { // Uncheck all |
| if(module == "Archive::Tar") { |
| checkstate = 0; |
| for(i = 0; document.getElementsByName("tarmodulecompress")[i]; i++) { |
| } else if(toggleboxstate) { // Check all |
| document.getElementsByName("tarmodulecompress")[i].disabled = false; |
| checkstate = 1; |
| } |
| } |
| if(!initstate) { |
| document.backupsettings.YaBB_bo.checked = checkstate; |
| document.getElementsByName("tarmodulecompress")[0].checked = true; |
| document.backupsettings.YaBB_mes.checked = checkstate; |
| } |
| document.backupsettings.YaBB_mem.checked = checkstate; |
| } else { |
| document.backupsettings.YaBB_temp.checked = checkstate; |
| for(i = 0; document.getElementsByName("tarmodulecompress")[i]; i++) { |
| document.backupsettings.YaBB_lan.checked = checkstate; |
| document.getElementsByName("tarmodulecompress")[i].disabled = true; |
| document.backupsettings.YaBB_var.checked = checkstate; |
| } |
| document.backupsettings.YaBB_src.checked = checkstate; |
| } |
| document.backupsettings.YaBB_html.checked = checkstate; |
| |
| document.backupsettings.YaBB_upld.checked = checkstate; |
| if(module == "/tar") { |
| } |
| for(i = 0; document.getElementsByName("bintarcompress")[i]; i++) { |
| |
| document.getElementsByName("bintarcompress")[i].disabled = false; |
| function domodulecheck (module, initstate) { |
| } |
| if(module == "Archive::Tar") { |
| if(!initstate) { |
| for(i = 0; document.getElementsByName("tarmodulecompress")[i]; i++) { |
| document.getElementsByName("bintarcompress")[0].checked = true; |
| document.getElementsByName("tarmodulecompress")[i].disabled = false; |
| } |
| } |
| } else { |
| if(!initstate) { |
| for(i = 0; document.getElementsByName("bintarcompress")[i]; i++) { |
| document.getElementsByName("tarmodulecompress")[0].checked = true; |
| document.getElementsByName("bintarcompress")[i].disabled = true; |
| } |
| } |
| } else { |
| } |
| for(i = 0; document.getElementsByName("tarmodulecompress")[i]; i++) { |
| } |
| document.getElementsByName("tarmodulecompress")[i].disabled = true; |
| --> |
| } |
| </script> |
| } |
| <form action="$adminurl?action=backupsettings2" method="post" name="backupsettings"> |
| |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| if(module == "$backupprogusr/tar") { |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| for(i = 0; document.getElementsByName("bintarcompress")[i]; i++) { |
| <tr valign="middle"> |
| document.getElementsByName("bintarcompress")[i].disabled = false; |
| <td align="left" class="titlebg"> |
| } |
| <img src="$imagesdir/preferences.gif" alt="" border="0" /><b>$backup_txt{1}</b> |
| if(!initstate) { |
| </td> |
| document.getElementsByName("bintarcompress")[0].checked = true; |
| </tr>~; |
| } |
| |
| } else { |
| if(!$backupsettingsloaded) { |
| for(i = 0; document.getElementsByName("bintarcompress")[i]; i++) { |
| $yymain .= qq~ |
| document.getElementsByName("bintarcompress")[i].disabled = true; |
| <tr valign="middle"> |
| } |
| <td align="left" class="catbg"> |
| } |
| <b>$backup_txt{2}</b> |
| } |
| </td> |
| </script> |
| </tr> |
| <form action="$adminurl?action=backupsettings2" method="post" name="backupsettings" onsubmit="savealert()" accept-charset="$yymycharset"> |
| <tr valign="middle"> |
| <div class="bordercolor rightboxdiv"> |
| <td align="left"> |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| <!-- Empty td for a spacer --> |
| <tr> |
| </td> |
| <td class="titlebg">$admin_img{'prefimg'} <b>$backup_txt{1}</b></td> |
| </tr>~; |
| </tr>~; |
| } |
| |
| |
| if ( !$backupsettingsloaded ) { |
| $yymain .= qq~ |
| $yymain .= qq~<tr> |
| <tr valign="middle"> |
| <td class="catbg"><b>$backup_txt{2}</b></td> |
| <td align="left" class="windowbg"> |
| </tr><tr> |
| $backup_txt{3} |
| <td> </td> |
| </td> |
| </tr>~; |
| </tr> |
| } |
| <tr valign="middle"> |
| |
| <td align="left" class="catbg"> |
| $yymain .= qq~<tr> |
| <b>$backup_txt{4}</b> |
| <td class="windowbg">$backup_txt{3}</td> |
| </td> |
| </tr><tr> |
| </tr> |
| <td class="catbg"><b>$backup_txt{4}</b></td> |
| <tr valign="middle"> |
| </tr><tr> |
| <td align="left" class="windowbg"> |
| <td class="windowbg"> |
| <input type="checkbox" name="YaBB_ALL" id="YaBB_ALL" value="1" onclick="masscheckYaBB(this.checked)" $allchecked/> <label for="YaBB_ALL">$backup_txt{5}<br /> |
| <input type="checkbox" name="YaBB_ALL" id="YaBB_ALL" value="1" onclick="masscheckYaBB(this.checked)" $allchecked /> <label for="YaBB_ALL">$backup_txt{5}<br /> |
| $backup_txt{6}</label> |
| $backup_txt{6}</label> |
| </td> |
| </td> |
| </tr> |
| </tr><tr> |
| <tr valign="middle"> |
| <td class="windowbg2"> |
| <td align="left" class="windowbg2"> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_src" id="YaBB_src" value="1" $pathchecklist{'src'}/> <label for="YaBB_src">Admin/ $backup_txt{'and'} Sources/ $backup_txt{13}</label> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_src" id="YaBB_src" value="1" $pathchecklist{'src'}/> <label for="YaBB_src">Admin/ $backup_txt{'and'} Sources/ $backup_txt{13}</label> |
| </td> |
| </td> |
| </tr><tr> |
| </tr> |
| <td class="windowbg2"> |
| <tr valign="middle"> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_bo" id="YaBB_bo" value="1" $pathchecklist{'bo'}/> <label for="YaBB_bo">Boards/ $backup_txt{7}</label> |
| <td align="left" class="windowbg2"> |
| </td> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_bo" id="YaBB_bo" value="1" $pathchecklist{'bo'}/> <label for="YaBB_bo">Boards/ $backup_txt{7}</label> |
| </tr><tr> |
| </td> |
| <td class="windowbg2"> |
| </tr> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_lan" id="YaBB_lan" value="1" $pathchecklist{'lan'}/> <label for="YaBB_lan">Languages/ $backup_txt{'and'} Help/ $backup_txt{11}</label> |
| <tr valign="middle"> |
| </td> |
| <td align="left" class="windowbg2"> |
| </tr><tr> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_lan" id="YaBB_lan" value="1" $pathchecklist{'lan'}/> <label for="YaBB_lan">Languages/ $backup_txt{'and'} Help/ $backup_txt{11}</label> |
| <td class="windowbg2"> |
| </td> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_mem" id="YaBB_mem" value="1" $pathchecklist{'mem'}/> <label for="YaBB_mem">Members/ $backup_txt{9}</label> |
| </tr> |
| </td> |
| <tr valign="middle"> |
| </tr><tr> |
| <td align="left" class="windowbg2"> |
| <td class="windowbg2"> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_mem" id="YaBB_mem" value="1" $pathchecklist{'mem'}/> <label for="YaBB_mem">Members/ $backup_txt{9}</label> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_mes" id="YaBB_mes" value="1" $pathchecklist{'mes'}/> <label for="YaBB_mes">Messages/ $backup_txt{8}</label> |
| </td> |
| </td> |
| </tr> |
| </tr><tr> |
| <tr valign="middle"> |
| <td class="windowbg2"> |
| <td align="left" class="windowbg2"> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_temp" id="YaBB_temp" value="1" $pathchecklist{'temp'}/> <label for="YaBB_temp">Templates/ $backup_txt{10} $backup_txt{'10a'}</label> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_mes" id="YaBB_mes" value="1" $pathchecklist{'mes'}/> <label for="YaBB_mes">Messages/ $backup_txt{8}</label> |
| </td> |
| </td> |
| </tr><tr> |
| </tr> |
| <td class="windowbg2"> |
| <tr valign="middle"> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_var" id="YaBB_var" value="1" $pathchecklist{'var'}/> <label for="YaBB_var">Variables/ $backup_txt{12}</label> |
| <td align="left" class="windowbg2"> |
| </td> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_temp" id="YaBB_temp" value="1" $pathchecklist{'temp'}/> <label for="YaBB_temp">Templates/ $backup_txt{10} $backup_txt{'10a'}</label> |
| </tr><tr> |
| </td> |
| <td class="windowbg2"> |
| </tr> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_html" id="YaBB_html" value="1" $pathchecklist{'html'}/> <label for="YaBB_html">yabbfiles $backup_txt{14}</label> |
| <tr valign="middle"> |
| </td> |
| <td align="left" class="windowbg2"> |
| </tr><tr> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_var" id="YaBB_var" value="1" $pathchecklist{'var'}/> <label for="YaBB_var">Variables/ $backup_txt{12}</label> |
| <td class="windowbg2"> |
| </td> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_upld" id="YaBB_upld" value="1" $pathchecklist{'upld'}/> <label for="YaBB_upld">yabbfiles/Attachments, yabbfiles/PMAttachments, $backup_txt{'and'} yabbfiles/avatars $backup_txt{'14a'}</label> |
| </tr> |
| </td> |
| <tr valign="middle"> |
| </tr><tr> |
| <td align="left" class="windowbg2"> |
| <td class="catbg"><b>$backup_txt{15}</b></td> |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_html" id="YaBB_html" value="1" $pathchecklist{'html'}/> <label for="YaBB_html">yabbfiles $backup_txt{14}</label> |
| </tr><tr> |
| </td> |
| <td class="windowbg">$backup_txt{16}</td> |
| </tr> |
| </tr>~; |
| <tr valign="middle"> |
| |
| <td align="left" class="windowbg2"> |
| # Make a list of modules that we can use with Tar::Archive |
| <input type="checkbox" onclick="checkYaBB()" name="YaBB_upld" id="YaBB_upld" value="1" $pathchecklist{'upld'}/> <label for="YaBB_upld">yabbfiles/Attachments $backup_txt{'and'} yabbfiles/avatars/UserAvatars $backup_txt{'14a'}</label> |
| $tarcompress1 = qq~<tr> |
| </td> |
| <td class="windowbg"> |
| </tr> |
| <input type="radio" name="tarmodulecompress" id="tarmodulecompress" value="none" $methodchecklist{'none'}/> <label for="tarmodulecompress">$backup_txt{17}</label> |
| <tr valign="middle"> |
| </td> |
| <td align="left" class="catbg"> |
| </tr>~; |
| <b>$backup_txt{15}</b> |
| |
| </td> |
| my $label_id; |
| </tr> |
| foreach my $module (qw(Compress::Zlib IO::Compress::Bzip2)) { |
| <tr valign="middle"> |
| $label_id++; |
| <td align="left" class="windowbg"> |
| $input = |
| $backup_txt{16} |
| qq~name="tarmodulecompress" id="label_$label_id" value="$module" $methodchecklist{$module}~; |
| </td> |
| eval "use $module();"; |
| </tr>~; |
| if ($@) { |
| |
| $input = qq~disabled="disabled" id="label_$label_id"~; |
| # Make a list of modules that we can use with Tar::Archive |
| $style = q~backup-disabled~; |
| $tarcompress1 = qq~ |
| $disabledtext = $backup_txt{41}; |
| <tr valign="middle"> |
| } |
| <td align="left" class="windowbg"> |
| else { |
| <input type="radio" name="tarmodulecompress" id="tarmodulecompress" value="none" $methodchecklist{'none'}/> <label for="tarmodulecompress">$backup_txt{17}</label> |
| ( $style, $disabledtext ) = ( q{}, q{} ); |
| </td> |
| } |
| </tr>~; |
| $tarcompress1 .= qq~<tr> |
| |
| <td class="windowbg $style"> |
| my $label_id; |
| <input type="radio" $input/> <label for="label_$label_id">$module $backup_txt{18} $disabledtext</label> |
| foreach $module (qw(Compress::Zlib Compress::Bzip2)) { |
| </td> |
| $label_id++; |
| </tr>~; |
| $input = qq~name="tarmodulecompress" id="label_$label_id" value="$module" $methodchecklist{$module}~; |
| } |
| eval "use $module();"; |
| |
| if ($@) { |
| $tarcompress1 .= q~<tr> |
| $input = qq~disabled="disabled"~; |
| <td class="windowbg"> </td> |
| $style = qq~style="font-style:italic; color:grey"~; |
| </tr>~; |
| $disabledtext = $backup_txt{41}; |
| |
| } else { |
| # Make a list of compression commands we can use with /usr/bin/tar |
| ($style,$disabledtext) = ('',''); |
| $tarcompress2 = qq~<tr> |
| } |
| <td class="windowbg"> |
| $tarcompress1 .= qq~ |
| <input type="radio" name="bintarcompress" id="bintarcompress" value="none" $methodchecklist{'none'}/> <label for="bintarcompress">$backup_txt{17}</label> |
| <tr valign="middle"> |
| </td> |
| <td align="left" class="windowbg" $style> |
| </tr>~; |
| <input type="radio" $input/> <label for="label_$label_id">$module $backup_txt{18} $disabledtext</label> |
| |
| </td> |
| foreach my $command ( "$backupprogbin/gzip", "$backupprogbin/bzip2" ) { |
| </tr>~; |
| $label_id++; |
| } |
| $input = |
| |
| qq~name="bintarcompress" id="label_$label_id" value="$command" $methodchecklist{$command}~; |
| $tarcompress1 .= qq~ |
| $newcommand = CheckPath($command); |
| <tr valign="middle"> |
| if ( !$newcommand ) { |
| <td align="left" class="windowbg"> |
| $input = qq~disabled="disabled" id="label_$label_id"~; |
| |
| $style = q~backup-disabled~; |
| </td> |
| $disabledtext = $backup_txt{41}; |
| </tr>~; |
| $newcommand = $command; |
| |
| } |
| # Make a list of compression commands we can use with /usr/bin/tar |
| else { |
| $tarcompress2 = qq~ |
| ( $style, $disabledtext ) = ( q{}, q{} ); |
| <tr valign="middle"> |
| } |
| <td align="left" class="windowbg"> |
| $tarcompress2 .= qq~<tr> |
| <input type="radio" name="bintarcompress" id="bintarcompress" value="none" $methodchecklist{'none'}/> <label for="bintarcompress">$backup_txt{17}</label> |
| <td class="windowbg $style"> |
| </td> |
| <input type="radio" $input/> <label for="label_$label_id">$newcommand $backup_txt{18} $disabledtext</label> |
| </tr>~; |
| </td> |
| |
| </tr>~; |
| foreach $command (qw( gzip bzip2)) { |
| } |
| $label_id++; |
| |
| $input = qq~name="bintarcompress" id="label_$label_id" value="$command" $methodchecklist{$command}~; |
| $tarcompress2 .= q~<tr> |
| $newcommand = &CheckPath($command); |
| <td class="windowbg"> </td> |
| if (!$newcommand) { |
| </tr>~; |
| $input = qq~disabled="disabled"~; |
| |
| $style = qq~style="font-style:italic; color:grey"~; |
| # Display the commands we can use for compression |
| $disabledtext = $backup_txt{41}; |
| # Non-translated here, as I doubt there are words to describe "tar" in another language |
| $newcommand = $command; |
| $input = |
| } else { |
| qq~name="backupmethod" id="backupmethod1" value="$backupprogusr/tar" onclick="domodulecheck('$backupprogusr/tar')" $methodchecklist{"$backupprogusr/tar"}~; |
| ($style,$disabledtext) = ('',''); |
| $newcommand = CheckPath("$backupprogusr/tar"); |
| } |
| if ($newcommand) { |
| $tarcompress2 .= qq~ |
| if ( |
| <tr valign="middle"> |
| ak_system( |
| <td align="left" class="windowbg" $style> |
| "tar -cf $vardir/backuptest.$curtime.tar ./$yyexec.$yyext") |
| <input type="radio" $input/> <label for="label_$label_id">$newcommand $backup_txt{18} $disabledtext</label> |
| ) |
| </td> |
| { |
| </tr>~; |
| ( $style, $disabledtext ) = ( q{}, q{} ); |
| } |
| unlink "$vardir/backuptest.$curtime.tar"; |
| |
| } |
| $tarcompress2 .= qq~ |
| else { |
| <tr valign="middle"> |
| $input = qq~disabled="disabled" id="backupmethod1"~; |
| <td align="left" class="windowbg"> |
| $style = q~backup-disabled~; |
| |
| $disabledtext = ": Tar $backup_txt{31}: $!. $backup_txt{32} " |
| </td> |
| . ( $CHILD_ERROR >> 8 ); |
| </tr>~; |
| } |
| |
| } |
| # Display the commands we can use for compression |
| else { |
| # Non-translated here, as I doubt there are words to describe "tar" in another language |
| $input = qq~disabled="disabled" id="backupmethod1"~; |
| $input = qq~name="backupmethod" id="backupmethod1" value="/tar" onclick="domodulecheck('/tar')" $methodchecklist{'/tar'}~; |
| $style = q~backup-disabled~; |
| $newcommand = &CheckPath('/tar'); |
| $disabledtext = $backup_txt{41}; |
| if ($newcommand) { |
| } |
| if (&ak_system("tar -cf $vardir/backuptest.$curtime.tar ./$yyexec.$yyext")) { |
| $yymain .= qq~<tr> |
| ($style,$disabledtext) = ('',''); |
| <td class="windowbg2"><label for="backupprogusr">$backup_txt{'path1'}</label> <input id="backupprogusr" type="text" value="$backupprogusr" size="20" name="backupprogusr" /> |
| unlink("$vardir/backuptest.$curtime.tar"); |
| <br /><label for="backupprogbin">$backup_txt{'path2'}</label> <input id="backupprogbin" type="text" value="$backupprogbin" size="20" name="backupprogbin" /> |
| } else { |
| <br />$backup_txt{'path3'} |
| $input = qq~disabled="disabled"~; |
| </td> |
| $style = qq~style="font-style:italic; color:grey"~; |
| </tr><tr> |
| $disabledtext = ": Tar $backup_txt{31}: $!. $backup_txt{32} " . ($? >> 8); |
| <td class="windowbg2 $style"> |
| } |
| <input type="radio" $input/> <label for="backupmethod1">Tar ($newcommand) $disabledtext</label> |
| } else { |
| </td> |
| $input = qq~disabled="disabled"~; |
| </tr>$tarcompress2~; |
| $style = qq~style="font-style:italic; color:grey"~; |
| |
| $disabledtext = $backup_txt{41}; |
| $input = |
| } |
| qq~name="backupmethod" id="backupmethod2" value="$backupprogusr/zip" onclick="domodulecheck('$backupprogusr/zip')" $methodchecklist{"$backupprogusr/zip"}~; |
| $yymain .= qq~ |
| $newcommand = CheckPath("$backupprogusr/zip"); |
| <tr valign="middle"> |
| if ($newcommand) { |
| <td align="left" class="windowbg2" $style> |
| if ( |
| <input type="radio" $input/> <label for="backupmethod1">Tar ($newcommand) $disabledtext</label> |
| ak_system( |
| </td> |
| "zip -gq $vardir/backuptest.$curtime.zip ./$yyexec.$yyext") |
| </tr>$tarcompress2~; |
| ) |
| |
| { |
| $input = qq~name="backupmethod" id="backupmethod2" value="/zip" onclick="domodulecheck('/zip')" $methodchecklist{'/zip'}~; |
| ( $style, $disabledtext ) = ( q{}, q{} ); |
| $newcommand = &CheckPath('/zip'); |
| unlink "$vardir/backuptest.$curtime.zip"; |
| if ($newcommand) { |
| } |
| if (&ak_system("zip -gq $vardir/backuptest.$curtime.zip ./$yyexec.$yyext")) { |
| else { |
| ($style,$disabledtext) = ('',''); |
| $input = qq~disabled="disabled" id="backupmethod2"~; |
| unlink("$vardir/backuptest.$curtime.zip"); |
| $style = q~backup-disabled~; |
| } else { |
| $disabledtext = ": Zip $backup_txt{31}: $!. $backup_txt{32} " |
| $input = qq~disabled="disabled"~; |
| . ( $CHILD_ERROR >> 8 ); |
| $style = qq~style="font-style:italic; color:grey"~; |
| } |
| $disabledtext = ": Zip $backup_txt{31}: $!. $backup_txt{32} " . ($? >> 8); |
| } |
| } |
| else { |
| } else { |
| $input = qq~disabled="disabled" id="backupmethod2"~; |
| $input = qq~disabled="disabled"~; |
| $style = q~backup-disabled~; |
| $style = qq~style="font-style:italic; color:grey"~; |
| $disabledtext = $backup_txt{41}; |
| $disabledtext = $backup_txt{41}; |
| } |
| } |
| $yymain .= qq~<tr> |
| $yymain .= qq~ |
| <td class="windowbg2 $style"> |
| <tr valign="middle"> |
| <input type="radio" $input/> <label for="backupmethod2">Zip ($newcommand) $disabledtext</label> |
| <td align="left" class="windowbg2" $style> |
| </td> |
| <input type="radio" $input/> <label for="backupmethod2">Zip ($newcommand) $disabledtext</label> |
| </tr><tr> |
| </td> |
| <td class="windowbg"> </td> |
| </tr> |
| </tr>~; |
| <tr valign="middle"> |
| |
| <td align="left" class="windowbg"> |
| # Display the modules that we can use |
| |
| foreach my $module (qw(Archive::Tar Archive::Zip)) { |
| </td> |
| $i++; |
| </tr>~; |
| $input = |
| |
| qq~name="backupmethod" id="backupmethod3_$i" value="$module" onclick="domodulecheck('$module')" $methodchecklist{$module}~; |
| # Display the modules that we can use |
| eval "use $module();"; |
| foreach $module (qw(Archive::Tar Archive::Zip)) { |
| if ($@) { |
| $i++; |
| $input = qq~disabled="disabled" id="backupmethod3_$i"~; |
| $input = qq~name="backupmethod" id="backupmethod3_$i" value="$module" onclick="domodulecheck('$module')" $methodchecklist{$module}~; |
| $style = q~backup-disabled~; |
| eval "use $module();"; |
| $disabledtext = $backup_txt{41}; |
| if ($@) { |
| } |
| $input = qq~disabled="disabled"~; |
| else { |
| $style = qq~style="font-style:italic; color:grey"~; |
| ( $style, $disabledtext ) = ( q{}, q{} ); |
| $disabledtext = $backup_txt{41}; |
| } |
| } else { |
| $yymain .= qq~<tr> |
| ($style,$disabledtext) = ('',''); |
| <td class="windowbg2 $style"> |
| } |
| <input type="radio" $input/> <label for="backupmethod3_$i">$module $disabledtext</label> |
| $yymain .= qq~ |
| </td> |
| <tr valign="middle"> |
| </tr>~; |
| <td align="left" class="windowbg2" $style> |
| if ( $module eq 'Archive::Tar' ) { $yymain .= $tarcompress1; } |
| <input type="radio" $input/> <label for="backupmethod3_$i">$module $disabledtext</label> |
| } |
| </td> |
| |
| </tr>~; |
| # Last but not least, the submit button and the $backupdir path. |
| if ($module eq 'Archive::Tar') { $yymain .= $tarcompress1; } |
| $backupdir ||= "$boarddir/Backups"; |
| } |
| if ( $backupdir =~ s/^\.\///xsm ) { |
| |
| $ENV{'SCRIPT_FILENAME'} =~ /(.*\/)/xsm; |
| # Last but not least, the submit button and the $backupdir path. |
| $backupdir = "$1$backupdir"; |
| $backupdir ||= "$boarddir/Backups"; |
| } |
| if ($backupdir =~ s|^\./||) { |
| $yymain .= qq~<tr> |
| $ENV{'SCRIPT_FILENAME'} =~ /(.*\/)/; |
| <td class="catbg"><b>$backup_txt{19}</b></td> |
| $backupdir = "$1$backupdir"; |
| </tr><tr> |
| } |
| <td class="windowbg2"> |
| $yymain .= qq~ |
| <label for="backupdir">$backup_txt{'19a'}</label>: <input type="text" name="backupdir" id="backupdir" value="$backupdir" size="80" /> |
| <tr valign="middle"> |
| </td> |
| <td align="left" class="catbg"> |
| </tr><tr> |
| <b>$backup_txt{19}</b> |
| <td class="catbg"><b>$backup_txt{'19b'}</b></td> |
| </td> |
| </tr><tr> |
| </tr> |
| <td class="windowbg2"> |
| <tr valign="middle"> |
| <label for="rememberbackup">$backup_txt{'19c'}</label> <input type="text" name="rememberbackup" id="rememberbackup" value="~ |
| <td align="left" class="windowbg2"> |
| . ( $rememberbackup / 86_400 ) |
| <label for="backupdir">$backup_txt{'19a'}</label>: <input type="text" name="backupdir" id="backupdir" value="$backupdir" size="80"/> |
| . qq~" size="3"/> <label for="rememberbackup">$backup_txt{'19d'}</label> |
| </td> |
| </td> |
| </tr> |
| </tr> |
| <tr valign="middle"> |
| </table> |
| <td align="left" class="catbg"> |
| </div> |
| <b>$backup_txt{'19b'}</b> |
| <div class="bordercolor rightboxdiv"> |
| </td> |
| <table class="border-space pad-cell"> |
| </tr> |
| <tr> |
| <tr valign="middle"> |
| <th class="titlebg">$admin_img{'prefimg'} $admin_txt{'10'}</th> |
| <td align="left" class="windowbg2"> |
| </tr><tr> |
| <label for="rememberbackup">$backup_txt{'19c'}</label> <input type="text" name="rememberbackup" id="rememberbackup" value="~ . ($rememberbackup / 86400) . qq~" size="3"/> <label for="rememberbackup">$backup_txt{'19d'}</label> |
| <td class="catbg center"> |
| </td> |
| <input type="submit" value="$backup_txt{20}" class="button" /> |
| </tr> |
| </td> |
| <tr valign="middle"> |
| </tr> |
| <td align="center" class="catbg"> |
| </table> |
| <input type="submit" name="submit" value="$backup_txt{20}" class="button" /> |
| </div> |
| </td> |
| </form> |
| </tr> |
| <script type="text/javascript"> |
| </table> |
| |
| </div> |
| |
| </form> |
| |
| <script type="text/javascript"> |
| |
| <!-- |
| |
| $presetjavascriptcode |
| $presetjavascriptcode |
| |
| |
| function BackupNewest(lastbackup) { |
| function BackupNewest(lastbackup) { |
| document.getElementsByName("backupnewest")[0].value = lastbackup; |
| document.getElementsByName("backupnewest")[0].value = lastbackup; |
| if (!window.submitted) { |
| if (!window.submitted) { |
| window.submitted = true; |
| window.submitted = true; |
| document.runbackup.submit(); |
| document.runbackup.submit(); |
| } |
| } |
| } |
| } |
| //--> |
| </script>~; |
| </script>~; |
| |
| |
| # Here we go again with another table. Here is the backup button area |
| # Here we go again with another table. Here's the backup button area |
| if ($backupsettingsloaded) { |
| if ($backupsettingsloaded) { |
| |
| # Look for the files. |
| # Look for the files. |
| opendir(BACKUPDIR, $backupdir); |
| opendir BACKUPDIR, $backupdir; |
| @backups = readdir(BACKUPDIR); |
| @backups = readdir BACKUPDIR; |
| closedir(BACKUPDIR); |
| closedir BACKUPDIR; |
| #@backup_paths = qw(Admin_Sources Boards Languages Members Messages Templates Variables yabbfiles); |
| |
| |
| my ( $lastbackupfiletime, $filename ); |
| my ($lastbackupfiletime,$filename); |
| foreach my $file ( |
| foreach $file (map { $_->[0] } sort { $b->[1] <=> $a->[1] } map { [$_, /(\d+)/, $_] } @backups) { |
| map { $_->[0] } |
| if ($file !~ /\A(backup)(n?)\.(\d+)\.([^\.]+)\.(.+)/) { next; } |
| reverse sort { $a->[1] <=> $b->[1] } |
| $lastbackupfiletime = $3 if !$lastbackupfiletime; |
| map { [ $_, /(\d+)/xsm, $_ ] } @backups |
| my $filesize = -s "$backupdir/$file"; |
| ) |
| $filesize = int($filesize / 1024); # Measure it in kilobytes |
| { |
| if ($filesize > 1024 * 4) { $filesize = int($filesize / 1024) . ' MB'; } # Measure it in megabytes |
| if ( $file !~ /\A(backup)(n?)\.(\d+)\.([^\.]+)\.(.+)/xsm ) { next; } |
| else { $filesize .= ' KB'; } # Label it |
| if ( !$lastbackupfiletime ) { $lastbackupfiletime = $3; } |
| my @dirs; |
| my $filesize = -s "$backupdir/$file"; |
| foreach (split(/_/, $4)) { |
| $filesize = int( $filesize / 1024 ); # Measure it in kilobytes |
| push(@dirs, $dirs{$_}); |
| if ( $filesize > 1024 * 4 ) { |
| } |
| $filesize = int( $filesize / 1024 ) . ' MB'; |
| |
| } # Measure it in megabytes |
| $filename = "$1$2.$3.$4.$5"; |
| else { $filesize .= ' KB'; } # Label it |
| $filelist .= qq~ <tr><td align="left">~ . &timeformat($3) . qq~</td><td align="right">$filesize</td><td align="left">- ~ . join('<br />- ', @dirs) . qq~</td><td align="left">~ . ($2 ? "<acronym title='$backup_txt{62}'>$backup_txt{'62a'}</acronym><br />" : '') . qq~$5</td><td><a href="$adminurl?action=downloadbackup;backupid=$file">$backup_txt{60}</a></td><td><a href="$adminurl?action=emailbackup;backupid=$file">$backup_txt{52}</a></td><td><a href="$adminurl?action=runbackup;runbackup_again=$1$2.0.$4.$5">$backup_txt{61}</a><br /><a href="$adminurl?action=runbackup;runbackup_again=$filename">$backup_txt{62}</a></td><td align="center">~ . (($5 =~ /^a\.tar/|| $5 !~ /tar/) ? '-' : qq~<a href="$adminurl?action=recoverbackup1;recoverfile=$filename">$backup_txt{63}</a>~) . qq~</td><td><a href="$adminurl?action=deletebackup;backupid=$file">$backup_txt{53}</a></td></tr>\n~; |
| my @dirs; |
| } |
| foreach ( split /_/xsm, $4 ) { |
| |
| push @dirs, $dirs{$_}; |
| $filelist ||= qq~ <tr><td align="left" colspan="9"><i>$backup_txt{38}</i></td></tr>\n~; |
| } |
| |
| |
| $yymain .= qq~ |
| $filename = "$1$2.$3.$4.$5"; |
| <br /> |
| $filelist .= q~ <tr> |
| <form action="$adminurl?action=runbackup" method="post" name="runbackup"> |
| <td>~ |
| <input type="hidden" name="backupnewest" value="0" /> |
| . timeformat($3) . qq~</td> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| <td class="right">$filesize</td> |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| <td>- ~ |
| <tr valign="middle"> |
| . join( '<br />- ', @dirs ) . q~</td> |
| <td align="left" class="titlebg" colspan="2"> |
| <td>~ |
| <img src="$imagesdir/preferences.gif" alt="" border="0" /><b>$backup_txt{21}</b> |
| . ( |
| </td> |
| $2 |
| </tr> |
| ? "<abbr title='$backup_txt{62}'>$backup_txt{'62a'}</abbr><br />" |
| <tr valign="middle"> |
| : q{} |
| <td align="left" class="windowbg2" colspan="2"> |
| ) |
| $backup_txt{22} <tt>$backupdir</tt> $backup_txt{23}<br /> |
| . qq~$5</td> |
| <br /> |
| <td><a href="$adminurl?action=downloadbackup;backupid=$file">$backup_txt{60}</a></td> |
| $backup_txt{24} |
| <td><a href="$adminurl?action=emailbackup;backupid=$file">$backup_txt{52}</a></td> |
| </td> |
| <td><a href="$adminurl?action=runbackup;runbackup_again=$1$2.0.$4.$5">$backup_txt{61}</a> |
| </tr> |
| <br /><a href="$adminurl?action=runbackup;runbackup_again=$filename">$backup_txt{62}</a></td> |
| <tr valign="middle"> |
| <td class="center">~ |
| <td align="center" class="catbg" colspan="2"> |
| . ( |
| <table width="100%"><tr><td align="center"> |
| ( $5 =~ /^a\.tar/xsm || $5 !~ /tar/xsm ) |
| <input type="button" name="submit1" value="$backup_txt{25}" onclick="BackupNewest(0);" class="button" />~; |
| ? q{-} |
| |
| : qq~<a href="$adminurl?action=recoverbackup1;recoverfile=$filename">$backup_txt{63}</a>~ |
| if ($lastbackupfiletime && $lastbackup == $lastbackupfiletime) { |
| ) |
| $lastbackupfiletime = &timeformat($lastbackup,1); |
| . qq~</td> |
| $lastbackupfiletime =~ s/<.*?>//g; |
| <td><a href="$adminurl?action=deletebackup;backupid=$file">$backup_txt{53}</a></td> |
| if ($backupmethod eq '/zip') { |
| </tr>~; |
| # $lastbackupfiletime =~ s/ .+//; |
| } |
| @lbt = split / /, $lastbackupfiletime; |
| |
| $lastbackupfiletime = join q{ }, $lbt[0],$lbt[1],$lbt[2]; |
| $filelist ||= qq~<tr> |
| } |
| <td colspan="9"><i>$backup_txt{38}</i></td> |
| $yymain .= qq~</td></tr><tr><td align="center"> |
| </tr>~; |
| <input type="button" name="submit2" value="$backup_txt{'25a'} $lastbackupfiletime" onclick="BackupNewest($lastbackup);" class="button" />~; |
| |
| } |
| $yymain .= qq~ |
| |
| <form action="$adminurl?action=runbackup" method="post" name="runbackup"> |
| $yymain .= qq~ |
| <input type="hidden" name="backupnewest" value="0" /> |
| </td></tr></table> |
| <div class="bordercolor rightboxdiv"> |
| </td> |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| </tr> |
| <tr> |
| </table> |
| <td class="titlebg" colspan="2">$admin_img{'prefimg'} <b>$backup_txt{21}</b></td> |
| </div> |
| </tr><tr> |
| </form> |
| <td class="windowbg2" colspan="2"> |
| |
| $backup_txt{22} <span style="font-family: monospace;">$backupdir</span> $backup_txt{23} |
| <br /> |
| <br /> |
| |
| <br /> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| $backup_txt{24} |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| </td> |
| <tr valign="middle"> |
| </tr> |
| <td align="left" class="titlebg" colspan="2"> |
| </table> |
| <img src="$imagesdir/preferences.gif" alt="" border="0" /><b>$backup_txt{35}</b> |
| </div> |
| </td> |
| <div class="bordercolor rightboxdiv"> |
| </tr> |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| <tr valign="middle"> |
| <tr> |
| <td align="left" class="windowbg2" colspan="2"> |
| <th class="titlebg">$admin_img{'prefimg'} $admin_txt{'10'}</th> |
| $backup_txt{37} <i>${$uid.$username}{'email'}</i> $backup_txt{'37a'}<br /> |
| </tr><tr> |
| $backup_txt{36} <tt>$backupdir</tt> |
| <td class="catbg center"> |
| <table border="1" cellspacing="1" cellpadding="4"> |
| <input type="button" name="submit1" value="$backup_txt{25}" onclick="BackupNewest(0);" class="button" />~; |
| <tr><td align="center">$backup_txt{70}</td><td align="center">$backup_txt{71}</td><td align="center">$backup_txt{72}</td><td align="center">$backup_txt{73}</td><td align="center" colspan="5">$backup_txt{74}</td></tr> |
| if ( $lastbackupfiletime && $lastbackup == $lastbackupfiletime ) { |
| $filelist |
| $lastbackupfiletime = timeformat( $lastbackup, 1 ); |
| </table> |
| $lastbackupfiletime =~ s/<.*?>//gxsm; |
| </td> |
| if ( $backupmethod eq "$backupprogusr/zip" ) { |
| </tr> |
| @lbt = split / /sm, $lastbackupfiletime; |
| </table> |
| $lastbackupfiletime = join q{ }, $lbt[0], $lbt[1], $lbt[2]; |
| </div>~; |
| } |
| } |
| $yymain .= qq~ |
| |
| <div style="margin-top: .5em;"><input type="button" name="submit2" value="$backup_txt{'25a'} $lastbackupfiletime" onclick="BackupNewest($lastbackup);" class="button" /></div>~; |
| |
| } |
| |
| $yymain .= qq~ |
| |
| </td> |
| |
| </tr> |
| |
| </table> |
| |
| </div> |
| |
| </form> |
| |
| <div class="bordercolor rightboxdiv"> |
| |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| |
| <tr> |
| |
| <td class="titlebg" colspan="2">$admin_img{'prefimg'} <b>$backup_txt{35}</b></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2" colspan="2"> |
| |
| $backup_txt{37} <i>${$uid.$username}{'email'}</i> $backup_txt{'37a'}<br /> |
| |
| $backup_txt{36} <span style="font-family: monospace;">$backupdir</span> |
| |
| <table class="border-space pad-cell border"> |
| |
| <tr> |
| |
| <td class="center">$backup_txt{70}</td> |
| |
| <td class="center">$backup_txt{71}</td> |
| |
| <td class="center">$backup_txt{72}</td> |
| |
| <td class="center">$backup_txt{73}</td> |
| |
| <td class="center" colspan="5">$backup_txt{74}</td> |
| |
| </tr> |
| |
| $filelist |
| |
| </table> |
| |
| </td> |
| |
| </tr> |
| |
| </table> |
| |
| </div>~; |
| |
| } |
| |
| |
| &AdminTemplate; |
| AdminTemplate(); |
| |
| return; |
| } |
| } |
| |
| |
| sub backupsettings2 { |
| sub backupsettings2 { |
| $backupmethod = $FORM{'backupmethod'}; |
| $backupmethod = $FORM{'backupmethod'}; |
| $compressmethod = $FORM{'bintarcompress'} || $FORM{'tarmodulecompress'} || 'none'; |
| $compressmethod = |
| |
| $FORM{'bintarcompress'} |
| # Handle the paths. |
| || $FORM{'tarmodulecompress'} |
| @backup_paths = (); |
| || 'none'; |
| if ($FORM{'YaBB_ALL'}) { # handle the magic select all checkbox so Javascript can be disabled and it still work |
| |
| @backup_paths = qw(src bo lan mem mes temp var html upld); |
| # Handle the paths. |
| } else { |
| @backup_paths = (); |
| foreach (qw(src bo lan mem mes temp var html upld)) { |
| if ( $FORM{'YaBB_ALL'} ) |
| if ($FORM{'YaBB_'.$_}) { push(@backup_paths, $_); } |
| { # handle the magic select all checkbox so Javascript can be disabled and it still work |
| } |
| @backup_paths = qw(src bo lan mem mes temp var html upld); |
| } |
| } |
| |
| else { |
| &check_backup_settings; |
| foreach (qw(src bo lan mem mes temp var html upld)) { |
| |
| if ( $FORM{ 'YaBB_' . $_ } ) { push @backup_paths, $_; } |
| # Set $backupdir |
| } |
| if (!-w $FORM{'backupdir'}) { &admin_fatal_error("","$backup_txt{42} '$FORM{'backupdir'}'. $backup_txt{43}"); } |
| } |
| |
| |
| $backupdir = $FORM{'backupdir'}; |
| check_backup_settings(); |
| $lastbackup = 0; # reset when saving settings new |
| |
| &print_BackupSettings; |
| # Set $backupdir |
| |
| if ( !-w $FORM{'backupdir'} ) { |
| # Set $rememberbackup for alert into Settings.pl |
| fatal_error( q{}, |
| if ($rememberbackup != $FORM{'rememberbackup'}) { |
| "$backup_txt{42} '$FORM{'backupdir'}'. $backup_txt{43}" ); |
| $rememberbackup = $FORM{'rememberbackup'}; |
| } |
| fopen(SETTINGS, "$vardir/Settings.pl"); |
| |
| @settings = <SETTINGS>; |
| $backupdir = $FORM{'backupdir'}; |
| fclose(SETTINGS); |
| $backupprogusr = $FORM{'backupprogusr'}; |
| for ($i = 0; $i < @settings; $i++) { |
| $backupprogbin = $FORM{'backupprogbin'} || '/usr/bin'; |
| if ($settings[$i] =~ /\$rememberbackup = \d+;/) { |
| |
| $rememberbackup = 0 if !$rememberbackup; |
| $lastbackup = 0; # reset when saving settings new |
| $rememberbackup *= 86400; # days in seconds |
| print_BackupSettings(); |
| $settings[$i] =~ s/\$rememberbackup = \d+;/\$rememberbackup = $rememberbackup;/; |
| |
| } |
| # Set $rememberbackup for alert into Settings.pm |
| } |
| if ( $rememberbackup != $FORM{'rememberbackup'} ) { |
| # if \$rememberbackup = is not allready in Settings.pl |
| $rememberbackup = $FORM{'rememberbackup'}; |
| if ($rememberbackup && $rememberbackup == $FORM{'rememberbackup'}) { |
| fopen( SETTINGS, "$vardir/Settings.pm" ); |
| $rememberbackup *= 86400; # days in seconds |
| @settings = <SETTINGS>; |
| unshift(@settings, "\$rememberbackup = $rememberbackup;\n"); |
| fclose(SETTINGS); |
| } |
| for my $i ( 0 .. ( @settings - 1 ) ) { |
| fopen(SETTINGS, ">$vardir/Settings.pl"); |
| if ( $settings[$i] =~ /\$rememberbackup = \d+;/sm ) { |
| print SETTINGS @settings; |
| if ( !$rememberbackup ) { $rememberbackup = 0; } |
| fclose(SETTINGS); |
| $rememberbackup *= 86_400; # days in seconds |
| } |
| $settings[$i] =~ |
| |
| s/\$rememberbackup = \d+;/\$rememberbackup = $rememberbackup;/sm; |
| $yySetLocation = qq~$adminurl?action=backupsettings~; |
| } |
| &redirectexit; |
| } |
| |
| |
| |
| # if \$rememberbackup = is not already in Settings.pm |
| |
| if ( $rememberbackup && $rememberbackup == $FORM{'rememberbackup'} ) { |
| |
| $rememberbackup *= 86_400; # days in seconds |
| |
| unshift @settings, "\$rememberbackup = $rememberbackup;\n"; |
| |
| } |
| |
| fopen( SETTINGS, ">$vardir/Settings.pm" ); |
| |
| print {SETTINGS} @settings or croak "$croak{'print'} SETTINGS"; |
| |
| fclose(SETTINGS); |
| |
| } |
| |
| |
| |
| $yySetLocation = qq~$adminurl?action=backupsettings~; |
| |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| sub check_backup_settings { |
| sub check_backup_settings { |
| if (!@backup_paths) { &admin_fatal_error("","$backup_txt{3}"); } |
| if ( !@backup_paths ) { fatal_error( q{}, "$backup_txt{3}" ); } |
| |
| |
| if (!$backupmethod) { &admin_fatal_error("","$backup_txt{29} ''"); } |
| if ( !$backupmethod ) { fatal_error( q{}, "$backup_txt{29}" ); } |
| |
| |
| if ($backupmethod =~ /::/) { # It's a module, test-require it |
| if ( $backupmethod =~ /::/xsm ) { # It is a module, test-require it |
| eval "use $backupmethod();"; |
| eval "use $backupmethod();"; |
| if ($@) { &admin_fatal_error("","$backup_txt{39} $backupmethod $backup_txt{41}"); } |
| if ($@) { |
| } else { |
| fatal_error( q{}, "$backup_txt{39} $backupmethod $backup_txt{41}" ); |
| my $newcommand = &CheckPath($backupmethod); |
| } |
| if (!$newcommand) { &admin_fatal_error("","$backup_txt{40} $backupmethod $backup_txt{41}"); } |
| } |
| } |
| else { |
| |
| my $newcommand = CheckPath($backupmethod); |
| # If we're using /usr/bin/tar, check for the compression method. |
| if ( !$newcommand ) { |
| if ($backupmethod eq '/tar' && $compressmethod ne 'none') { |
| fatal_error( q{}, "$backup_txt{40} $backupmethod $backup_txt{41}" ); |
| my $newcommand = &CheckPath($compressmethod); |
| } |
| if (!$newcommand) { &admin_fatal_error("","$backup_txt{40} $compressmethod $backup_txt{41}"); } |
| } |
| } |
| |
| # If we're using Archive::Tar, check for the compression method. |
| # If we are using $backupprogusr/tar, check for the compression method. |
| elsif ($backupmethod eq 'Archive::Tar' && $compressmethod ne 'none') { |
| if ( $backupmethod eq "$backupprogusr/tar" && $compressmethod ne 'none' ) { |
| eval "use $compressmethod();"; |
| my $newcommand = CheckPath($compressmethod); |
| if ($@) { &admin_fatal_error("","$backup_txt{39} $compressmethod $backup_txt{41}"); } |
| if ( !$newcommand ) { |
| } else { |
| fatal_error( q{}, |
| $compressmethod = 'none'; |
| "$backup_txt{40} $compressmethod $backup_txt{41}" ); |
| } |
| } |
| |
| } |
| |
| |
| |
| # If we are using Archive::Tar, check for the compression method. |
| |
| elsif ( $backupmethod eq 'Archive::Tar' && $compressmethod ne 'none' ) { |
| |
| eval "use $compressmethod();"; |
| |
| if ($@) { |
| |
| fatal_error( q{}, |
| |
| "$backup_txt{39} $compressmethod $backup_txt{41}" ); |
| |
| } |
| |
| } |
| |
| else { |
| |
| $compressmethod = 'none'; |
| |
| } |
| |
| return; |
| } |
| } |
| |
| |
| sub print_BackupSettings { |
| sub print_BackupSettings { |
| my @newpaths; |
| my @newpaths; |
| foreach my $path (qw(src bo lan mem mes temp var html upld)) { |
| foreach my $path (qw(src bo lan mem mes temp var html upld)) { |
| foreach (@backup_paths) { |
| foreach (@backup_paths) { |
| if ($_ eq $path) { push(@newpaths, $path); last; } |
| if ( $_ eq $path ) { push @newpaths, $path; last; } |
| } |
| } |
| } |
| } |
| @backup_paths = @newpaths; |
| @backup_paths = @newpaths; |
| $backupsettingsloaded = 1; |
| $backupsettingsloaded = 1; |
| |
| |
| require "$admindir/NewSettings.pl"; |
| require Admin::NewSettings; |
| &SaveSettingsTo('Settings.pl'); |
| SaveSettingsTo('Settings.pm'); |
| |
| return; |
| } |
| } |
| |
| |
| # This routine actually does the backup. |
| # This routine actually does the backup. |
| sub runbackup { |
| sub runbackup { |
| my(@settings, $prevmainsetting, $prevmaintext, $newmaintext, %pathconvert); |
| my ( @settings, %pathconvert ); |
| |
| |
| if ($INFO{'runbackup_again'}) { |
| |
| &admin_fatal_error("","$backup_txt{32} \$INFO{'runbackup_again'}=$INFO{'runbackup_again'}") if $INFO{'runbackup_again'} !~ /^backup/; |
| |
| |
| |
| my @again = split(/\./, $INFO{'runbackup_again'}); |
| if ( $INFO{'runbackup_again'} ) { |
| $FORM{'backupnewest'} = $again[1]; |
| fatal_error( q{}, |
| @backup_paths = split(/_/, $again[2]); |
| "$backup_txt{32} \$INFO{'runbackup_again'}=$INFO{'runbackup_again'}" |
| if ($again[3] eq 'a') { |
| ) if $INFO{'runbackup_again'} !~ /^backup/xsm; |
| $backupmethod = $again[4] eq 'tar' ? 'Archive::Tar' : 'Archive::Zip'; |
| |
| $compressmethod = $again[5] ? ($again[5] eq 'gz' ? 'Compress::Zlib' : 'Compress::Bzip2') : 'none'; |
| my @again = split /\./xsm, $INFO{'runbackup_again'}; |
| } else { |
| $FORM{'backupnewest'} = $again[1]; |
| $backupmethod = $again[3] eq 'tar' ? '/tar' : '/zip'; |
| @backup_paths = split /_/xsm, $again[2]; |
| $compressmethod = $again[4] ? ($again[4] eq 'gz' ? '/gzip' : '/bzip2') : 'none'; |
| if ( $again[3] eq 'a' ) { |
| } |
| $backupmethod = |
| &check_backup_settings; |
| $again[4] eq 'tar' ? 'Archive::Tar' : 'Archive::Zip'; |
| } |
| $compressmethod = |
| |
| $again[5] |
| my $backuptime = $INFO{'backuptime'} || time(); |
| ? ( $again[5] eq 'gz' ? 'Compress::Zlib' : 'Compress::Bzip2' ) |
| |
| : 'none'; |
| my $time_to_jump = time() + $max_process_time; |
| } |
| |
| else { |
| $curtime = $INFO{'curtime'} || $curtime; |
| $backupmethod = |
| $FORM{'backupnewest'} ||= $INFO{'backupnewest'}; |
| $again[3] eq 'tar' ? "$backupprogusr/tar" : "$backupprogusr/zip"; |
| $backuptype = 'n' if $FORM{'backupnewest'}; |
| $compressmethod = |
| if ($FORM{'backupnewest'} && $backupmethod eq '/zip') { |
| $again[4] |
| my ($day, $mon, $year); |
| ? ( |
| (undef, undef, undef, $day, $mon, $year, undef, undef, undef) = gmtime($FORM{'backupnewest'}); |
| $again[4] eq 'gz' |
| $FORM{'backupnewest'} = sprintf("%02d", ($mon+1)) . sprintf("%02d", $day) . (1900 + $year); |
| ? "$backupprogbin/gzip" |
| |
| : "$backupprogbin/bzip2" |
| } elsif ($FORM{'backupnewest'} && $backupmethod =~ /::/) { |
| ) |
| $FORM{'backupnewest'} = ($curtime - $FORM{'backupnewest'}) / 86400; |
| : 'none'; |
| } |
| } |
| my $filedirs = join('_', @backup_paths); |
| check_backup_settings(); |
| |
| } |
| # Verify that our method is possible, and load it if it's a module |
| |
| &BackupMethodInit($filedirs); |
| my $backuptime = $INFO{'backuptime'} || time; |
| |
| |
| # Handle the conversion of the informal backup_paths stored in the settings file to the real ones |
| my $time_to_jump = time + $max_process_time; |
| # I'll build a hash to quickly match them. |
| |
| # A pipe separates them in the case of needing multiple real paths to handle one informal path |
| $curtime = $INFO{'curtime'} || $curtime; |
| %pathconvert = ( |
| $FORM{'backupnewest'} ||= $INFO{'backupnewest'}; |
| 'src', "$admindir|$sourcedir|$boarddir/Modules|!$boarddir", |
| if ( $FORM{'backupnewest'} ) { $backuptype = 'n'; } |
| 'bo', $boardsdir, |
| if ( $FORM{'backupnewest'} && $backupmethod eq "$backupprogusr/zip" ) { |
| 'lan', "$langdir|$helpfile", |
| my ( undef, undef, undef, $day, $mon, $year, undef, undef, undef ) = |
| 'mem', $memberdir, |
| gmtime $FORM{'backupnewest'}; |
| 'mes', $datadir, |
| $FORM{'backupnewest'} = |
| 'temp', "$templatesdir|$forumstylesdir|$adminstylesdir", |
| sprintf( '%02d', ( $mon + 1 ) ) |
| 'var', $vardir, |
| . sprintf( '%02d', $day ) |
| 'html', "!$htmldir|!$htmldir/avatars|$htmldir/Buttons|$htmldir/googiespell|$htmldir/greybox|$htmldir/ModImages|$htmldir/Smilies|$htmldir/Templates", |
| . ( 1900 + $year ); |
| 'upld', "$htmldir/Attachments|$htmldir/avatars/UserAvatars", |
| } |
| ); |
| elsif ( $FORM{'backupnewest'} && $backupmethod =~ /::/xsm ) { |
| |
| $FORM{'backupnewest'} = ( $curtime - $FORM{'backupnewest'} ) / 86_400; |
| # Set the forum to maintenance mode. |
| } |
| &automaintenance('on'); |
| my $filedirs = join q{_}, @backup_paths; |
| |
| |
| # Looping to prevent runt into browser/server timeout |
| # Verify that our method is possible, and load it if it is a module |
| my ($i,$j,$key,$path); |
| BackupMethodInit($filedirs); |
| foreach $key (@backup_paths) { |
| |
| $i++; |
| # Handle the conversion of the informal backup_paths stored in the settings file to the real ones |
| if ($i >= $INFO{'loop1'}) { |
| # We will build a hash to quickly match them. |
| $j = 0; |
| # A pipe separates them in the case of needing multiple real paths to handle one informal path |
| foreach $path (split(/\|/, $pathconvert{$key})) { |
| |
| $j++; |
| $boarddir = $support_env_path; |
| if ($j > $INFO{'loop2'}) { |
| |
| $INFO{'loop2'} = 0; |
| %pathconvert = ( |
| |
| 'src' => "!$boarddir|$boarddir/Admin|$boarddir/Sources|$boarddir/Modules", |
| # To keep this simple, I'll just point to a generic subroutine that takes care of |
| 'bo' => $boardsdir, |
| # handling the differences in backup methods. |
| 'lan' => "$langdir|$helpfile", |
| if ($path =~ s|^\./||) { |
| 'mem' => $memberdir, |
| $ENV{'SCRIPT_FILENAME'} =~ /(.*\/)/; |
| 'mes' => $datadir, |
| $path = "$1$path"; |
| 'temp' => "$boarddir/Templates|$htmldir/Templates", |
| } |
| 'var' => $vardir, |
| &BackupDirectory($path,$filedirs); |
| 'html' => "!$htmldir|$htmldir/Bookmarks|$htmldir/Buttons|$htmldir/EventIcons|$htmldir/googiespell|$htmldir/greybox|$htmldir/ModImages|$htmldir/shjs|$htmldir/Smilies", |
| |
| 'upld' => "$htmldir/Attachments|$htmldir/PMAttachments|$htmldir/avatars", |
| if (time() > $time_to_jump) { |
| ); |
| &BackupMethodFinalize($filedirs,1); |
| |
| &runbackup_loop($i,$j,$curtime,$FORM{'backupnewest'},$backuptime); |
| # Set the forum to maintenance mode. |
| } |
| automaintenance('on'); |
| } |
| |
| } |
| # Looping to prevent running into browser/server timeout |
| $INFO{'loop2'} = 0; |
| my ( $i, $j, $key, $path ); |
| } |
| foreach my $key (@backup_paths) { |
| } |
| $i++; |
| |
| if ( $i >= $INFO{'loop1'} ) { |
| # Last, we'll finalize the archive. If it's a tar, we compress them, |
| $j = 0; |
| # if requested. This can NOT be done with the forum out of maintenance mode |
| foreach my $path ( split /\|/xsm, $pathconvert{$key} ) { |
| # due to the maintenance.lock file that is removed with &automaintenance('off') |
| $j++; |
| &BackupMethodFinalize($filedirs,0); |
| if ( $j > $INFO{'loop2'} ) { |
| |
| $INFO{'loop2'} = 0; |
| # Undo maintenance mode. |
| |
| &automaintenance('off'); |
| # To keep this simple, I will just point to a generic subroutine that takes care of |
| |
| # handling the differences in backup methods. |
| $lastbackup = $curtime; # save the last backup time with the actual settings |
| if ( $path =~ s/^\.\///xsm ) { |
| &print_BackupSettings; |
| $ENV{'SCRIPT_FILENAME'} =~ /(.*\/)/xsm; |
| |
| $path = "$1$path"; |
| # Display the amount of time it took to be nice ;) |
| } |
| $yySetLocation = qq~$adminurl?action=backupsettings;backupspendtime=~ . sprintf("%.4f", (time() - $backuptime)); |
| BackupDirectory( $path, $filedirs ); |
| &redirectexit; |
| |
| |
| if ( time() > $time_to_jump ) { |
| |
| BackupMethodFinalize( $filedirs, 1 ); |
| |
| runbackup_loop( $i, $j, $curtime, $FORM{'backupnewest'}, |
| |
| $backuptime ); |
| |
| } |
| |
| } |
| |
| } |
| |
| $INFO{'loop2'} = 0; |
| |
| } |
| |
| } |
| |
| |
| |
| # Last, we will finalize the archive. If it is a tar, we compress them, |
| |
| # if requested. This can NOT be done with the forum out of maintenance mode |
| |
| # due to the maintenance.lock file that is removed with &automaintenance('off') |
| |
| BackupMethodFinalize( $filedirs, 0 ); |
| |
| |
| |
| # Undo maintenance mode. |
| |
| automaintenance('off'); |
| |
| |
| |
| $lastbackup = $curtime; # save the last backup time with the actual settings |
| |
| print_BackupSettings(); |
| |
| |
| |
| # Display the amount of time it took to be nice ;) |
| |
| $yySetLocation = |
| |
| qq~$adminurl?action=backupsettings;backupspendtime=~ . sprintf '%.4f', |
| |
| ( time() - $backuptime ); |
| |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| # Checks once more that we can use the command or module given. If we can, we load module(s) here. |
| # Checks once more that we can use the command or module given. If we can, we load module(s) here. |
| sub BackupMethodInit { |
| sub BackupMethodInit { |
| my $filedirs = shift; |
| my $filedirs = shift; |
| |
| |
| # Check module types and load them at runtime (not compilation) |
| # Check module types and load them at runtime (not compilation) |
| if($backupmethod eq 'Archive::Tar') { |
| if ( $backupmethod eq 'Archive::Tar' ) { |
| eval 'use Archive::Tar;'; # Everything is exported at once |
| eval 'use Archive::Tar;'; # Everything is exported at once |
| if ($@) { &admin_fatal_error("","$backup_txt{28} Archive::Tar: $@"); } |
| if ($@) { |
| if ($compressmethod eq 'Compress::Zlib') { # Also using Zlib |
| fatal_error( q{}, "$backup_txt{28} Archive::Tar: $@" ); |
| eval 'use Compress::Zlib;'; # Zlib exports everything at once |
| } |
| if ($@) { &admin_fatal_error("","$backup_txt{28} Compres::Zlib: $@"); } |
| if ( $compressmethod eq 'Compress::Zlib' ) { # Also using Zlib |
| |
| eval 'use Compress::Zlib;'; # Zlib exports everything at once |
| } elsif ($compressmethod eq 'Compress::Bzip2') { |
| if ($@) { |
| eval 'use Compress::Bzip2 qw(:utilities);'; # Finally, something I can export just some code with |
| fatal_error( q{}, "$backup_txt{28} Compres::Zlib: $@" ); |
| if ($@) { &admin_fatal_error("","$backup_txt{28} Compress::Bzip2: $@"); } |
| } |
| |
| } |
| } else { $compressmethod = 'none'; } |
| elsif ( $compressmethod eq 'Compress::Bzip2' ) { |
| |
| eval 'use Compress::Bzip2 qw(:utilities);' |
| $tarball = Archive::Tar->new; |
| ; # Finally, something I can export just some code with |
| |
| if ($@) { |
| # We need this for the loops, when preventing to run into browser/server timeout. |
| fatal_error( q{}, "$backup_txt{28} Compress::Bzip2: $@" ); |
| if (-e "$backupdir/backup$backuptype.$curtime.$filedirs.a.tar") { |
| } |
| $tarball->read("$backupdir/backup$backuptype.$curtime.$filedirs.a.tar", 0); |
| } |
| unlink("$backupdir/backup$backuptype.$curtime.$filedirs.a.tar"); |
| else { $compressmethod = 'none'; } |
| } |
| |
| |
| $tarball = Archive::Tar->new; |
| } elsif ($backupmethod eq 'Archive::Zip') { |
| |
| eval 'use Archive::Zip;'; # Everything's exported by default here too |
| # We need this for the loops to keep from running into browser/server timeout. |
| if ($@) { &admin_fatal_error("","$backup_txt{28} Archive::Zip: $@"); } |
| if ( -e "$backupdir/backup$backuptype.$curtime.$filedirs.a.tar" ) { |
| $zipfile = Archive::Zip->new; |
| $tarball->read( |
| |
| "$backupdir/backup$backuptype.$curtime.$filedirs.a.tar", 0 ); |
| # We need this for the loops, when preventing to run into browser/server timeout. |
| unlink "$backupdir/backup$backuptype.$curtime.$filedirs.a.tar"; |
| if (-e "$backupdir/backup$backuptype.$curtime.$filedirs.a.zip") { |
| } |
| $zipfile->read("$backupdir/backup$backuptype.$curtime.$filedirs.a.zip"); |
| } |
| } |
| elsif ( $backupmethod eq 'Archive::Zip' ) { |
| |
| eval 'use Archive::Zip;'; # Everything is exported by default here too |
| } else { |
| if ($@) { |
| unless (&CheckPath($backupmethod)) { &admin_fatal_error("","$backup_txt{29} $backupmethod."); } |
| fatal_error( q{}, "$backup_txt{28} Archive::Zip: $@" ); |
| if ($compressmethod ne 'none' && !&CheckPath($compressmethod)) { |
| } |
| &admin_fatal_error("","$backup_txt{30} $compressmethod."); |
| $zipfile = Archive::Zip->new; |
| } |
| |
| } |
| # We need this for the loops, when preventing to run into browser/server timeout. |
| |
| if ( -e "$backupdir/backup$backuptype.$curtime.$filedirs.a.zip" ) { |
| |
| $zipfile->read( |
| |
| "$backupdir/backup$backuptype.$curtime.$filedirs.a.zip"); |
| |
| } |
| |
| } |
| |
| else { |
| |
| if ( !CheckPath($backupmethod) ) { |
| |
| fatal_error( q{}, "$backup_txt{29} $backupmethod." ); |
| |
| } |
| |
| if ( $compressmethod ne 'none' && !CheckPath($compressmethod) ) { |
| |
| fatal_error( q{}, "$backup_txt{30} $compressmethod." ); |
| |
| } |
| |
| } |
| |
| return; |
| } |
| } |
| |
| |
| sub BackupDirectory { |
| sub BackupDirectory { |
| # Handles all the fun of directly archiving a directory. |
| |
| my ($dir,$filedirs) = @_; |
| # Handles all the fun of directly archiving a directory. |
| my ($recursemode, $cr, $Nt); |
| my ( $dir, $filedirs ) = @_; |
| $recursemode = 1; |
| my ( $recursemode, $cr, $Nt ); |
| if ($dir =~ s/^!//) { $recursemode = 0; } |
| $recursemode = 1; |
| |
| if ( $dir =~ s/^!//xsm ) { $recursemode = 0; } |
| if ($backupmethod eq '/tar') { |
| |
| $cr = ($tarcreated || $INFO{'curtime'}) ? '-r' : '-c'; |
| if ( $backupmethod eq "$backupprogusr/tar" ) { |
| $tarcreated = 1; |
| $cr = ( $tarcreated || $INFO{'curtime'} ) ? '-r' : '-c'; |
| if (!$recursemode) { $dir .= '/*.*'; } |
| $tarcreated = 1; |
| if ($FORM{'backupnewest'}) { $Nt = "-N \@$FORM{'backupnewest'}"; } |
| if ( !$recursemode ) { $dir .= '/*.*'; } |
| $dir =~ s|^/||; # needet not to get server log messages like "Removing leading `/' from ..." |
| if ( $FORM{'backupnewest'} ) { $Nt = "-N \@$FORM{'backupnewest'}"; } |
| &ak_system("tar $cr -C / -f $backupdir/backup$backuptype.$curtime.$filedirs.tar $Nt $dir") || &admin_fatal_error("","'tar $cr -C / -f $backupdir/backup$backuptype.$curtime.$filedirs.tar $Nt $dir' $backup_txt{31}: $!. $backup_txt{32} " . ($? >> 8)); |
| $dir =~ s/^\///xsm; |
| |
| |
| } elsif ($backupmethod eq '/zip') { |
| # needed not to get server log messages like "Removing leading `/' from ..." |
| my $recurseoption; |
| ak_system( |
| if (!$recursemode) { $dir .= '/*.*'; } |
| "tar $cr -C / -f $backupdir/backup$backuptype.$curtime.$filedirs.tar $Nt $dir" |
| else { $recurseoption = 'r'; } |
| ) |
| if ($FORM{'backupnewest'}) { $Nt = "-t $FORM{'backupnewest'}"; } |
| || fatal_error( |
| &ak_system("zip -gq$recurseoption $Nt $backupdir/backup$backuptype.$curtime.$filedirs.zip $dir") || &admin_fatal_error("","'zip -gq$recurseoption $Nt $backupdir/backup$backuptype.$curtime.$filedirs.zip $dir' $backup_txt{31}: $!. $backup_txt{32} " . ($? >> 8)); |
| q{}, |
| |
| "'tar $cr -C / -f $backupdir/backup$backuptype.$curtime.$filedirs.tar $Nt $dir' $backup_txt{31}: $!. $backup_txt{32} " |
| } elsif ($backupmethod eq 'Archive::Tar') { |
| . ( $CHILD_ERROR >> 8 ) |
| $tarball->add_files(&RecurseDirectory($dir, $recursemode)); |
| ); |
| |
| } |
| } elsif ($backupmethod eq 'Archive::Zip') { |
| elsif ( $backupmethod eq "$backupprogusr/zip" ) { |
| map { $zipfile->addFile($_) } &RecurseDirectory($dir, $recursemode); |
| my $recurseoption; |
| } |
| if ( !$recursemode ) { $dir .= '/*.*'; } |
| |
| else { $recurseoption = 'r'; } |
| |
| if ( $FORM{'backupnewest'} ) { $Nt = "-t $FORM{'backupnewest'}"; } |
| |
| ak_system( |
| |
| "zip -gq$recurseoption $Nt $backupdir/backup$backuptype.$curtime.$filedirs.zip $dir" |
| |
| ) |
| |
| || fatal_error( |
| |
| q{}, |
| |
| "'zip -gq$recurseoption $Nt $backupdir/backup$backuptype.$curtime.$filedirs.zip $dir' $backup_txt{31}: $!. $backup_txt{32} " |
| |
| . ( $CHILD_ERROR >> 8 ) |
| |
| ); |
| |
| } |
| |
| elsif ( $backupmethod eq 'Archive::Tar' ) { |
| |
| $tarball->add_files( RecurseDirectory( $dir, $recursemode ) ); |
| |
| } |
| |
| elsif ( $backupmethod eq 'Archive::Zip' ) { |
| |
| map { $zipfile->addFile($_) } RecurseDirectory( $dir, $recursemode ); |
| |
| } |
| |
| return; |
| } |
| } |
| |
| |
| sub RecurseDirectory { |
| sub RecurseDirectory { |
| # Simple subroutine to run through every entry in a directory and return a giant list of the files/subdirs. |
| |
| my ($dir,$recursemode) = @_; |
| # Simple subroutine to run through every entry in a directory and return a giant list of the files/subdirs. |
| my ($item, @dirlist, @newcontents); |
| my ( $dir, $recursemode ) = @_; |
| |
| my ( $item, @dirlist, @newcontents ); |
| opendir(RECURSEDIR, $dir); |
| |
| @dirlist = readdir(RECURSEDIR); |
| opendir RECURSEDIR, $dir; |
| closedir(RECURSEDIR); |
| @dirlist = readdir RECURSEDIR; |
| |
| closedir RECURSEDIR; |
| foreach $item (@dirlist) { |
| |
| if ($recursemode && $item ne '.' && $item ne '..' && -d "$dir/$item") { push(@newcontents, &RecurseDirectory("$dir/$item", $recursemode)); } |
| foreach my $item (@dirlist) { |
| elsif (-f "$dir/$item" && (!$FORM{'backupnewest'} || $FORM{'backupnewest'} > -M "$dir/$item")) { |
| if ( $recursemode |
| push(@newcontents, "$dir/$item"); |
| && $item ne q{.} |
| } |
| && $item ne q{..} |
| } |
| && -d "$dir/$item" ) |
| @newcontents; |
| { |
| |
| push @newcontents, RecurseDirectory( "$dir/$item", $recursemode ); |
| |
| } |
| |
| elsif ( |
| |
| -f "$dir/$item" |
| |
| && ( !$FORM{'backupnewest'} |
| |
| || $FORM{'backupnewest'} > -M "$dir/$item" ) |
| |
| ) |
| |
| { |
| |
| push @newcontents, "$dir/$item"; |
| |
| } |
| |
| } |
| |
| return @newcontents; |
| } |
| } |
| |
| |
| # Compresses the tar |
| # Compresses the tar |
| sub BackupMethodFinalize { |
| sub BackupMethodFinalize { |
| my ($filedirs,$loop) = @_; |
| my ( $filedirs, $loop ) = @_; |
| if (!$loop && $backupmethod eq '/tar') { |
| if ( !$loop && $backupmethod eq "$backupprogusr/tar" ) { |
| if ($compressmethod eq '/bzip2') { |
| if ( $compressmethod eq "$backupprogbin/bzip2" ) { |
| &ak_system("bzip2 -z $backupdir/backup$backuptype.$curtime.$filedirs.tar") || &admin_fatal_error("","'bzip2 -z $backupdir/backup$backuptype.$curtime.$filedirs.tar.bz2' $backup_txt{31}: $!. $backup_txt{32} " . ($? >> 8)); |
| ak_system( |
| |
| "bzip2 -z $backupdir/backup$backuptype.$curtime.$filedirs.tar") |
| } elsif ($compressmethod eq '/gzip') { |
| || fatal_error( |
| &ak_system("gzip $backupdir/backup$backuptype.$curtime.$filedirs.tar") || &admin_fatal_error("","'gzip $backupdir/backup$backuptype.$curtime.$filedirs.tar.gz' $backup_txt{31}: $!. $backup_txt{32} " . ($? >> 8)); |
| q{}, |
| } |
| "'bzip2 -z $backupdir/backup$backuptype.$curtime.$filedirs.tar.bz2' $backup_txt{31}: $!. $backup_txt{32} " |
| |
| . ( $CHILD_ERROR >> 8 ) |
| } elsif ($backupmethod eq 'Archive::Tar') { |
| ); |
| if ($loop || $compressmethod eq 'none') { |
| |
| $tarball->write("$backupdir/backup$backuptype.$curtime.$filedirs.a.tar", 0); |
| } |
| |
| elsif ( $compressmethod eq "$backupprogbin/gzip" ) { |
| } elsif ($compressmethod eq 'Compress::Zlib') { # Gzip as a module |
| ak_system( |
| my ($gzip) = gzopen("$backupdir/backup$backuptype.$curtime.$filedirs.a.tar.gz", 'wb'); |
| "gzip $backupdir/backup$backuptype.$curtime.$filedirs.tar") |
| $gzip->gzwrite($tarball->write); |
| || fatal_error( |
| $gzip->gzclose(); |
| q{}, |
| unlink("$backupdir/backup$backuptype.$curtime.$filedirs.tar"); |
| "'gzip $backupdir/backup$backuptype.$curtime.$filedirs.tar.gz' $backup_txt{31}: $!. $backup_txt{32} " |
| |
| . ( $CHILD_ERROR >> 8 ) |
| } elsif ($compressmethod eq 'Compress::Bzip2') { # Bzip2 as a module |
| ); |
| my ($bzip2) = bzopen("$backupdir/backup$backuptype.$curtime.$filedirs.a.tar.bz2", 'wb'); |
| } |
| $bzip2->bzwrite($tarball->write); |
| } |
| $bzip2->bzclose(); |
| elsif ( $backupmethod eq 'Archive::Tar' ) { |
| unlink("$backupdir/backup$backuptype.$curtime.$filedirs.tar"); |
| if ( $loop || $compressmethod eq 'none' ) { |
| } |
| $tarball->write( |
| |
| "$backupdir/backup$backuptype.$curtime.$filedirs.a.tar", 0 ); |
| } elsif ($backupmethod eq 'Archive::Zip') { |
| } |
| $zipfile->overwriteAs("$backupdir/backup$backuptype.$curtime.$filedirs.a.zip"); |
| elsif ( $compressmethod eq 'Compress::Zlib' ) { # Gzip as a module |
| } |
| my ($gzip) = gzopen( |
| |
| "$backupdir/backup$backuptype.$curtime.$filedirs.a.tar.gz", |
| |
| 'wb' ); |
| |
| $gzip->gzwrite( $tarball->write ); |
| |
| $gzip->gzclose(); |
| |
| unlink "$backupdir/backup$backuptype.$curtime.$filedirs.tar"; |
| |
| } |
| |
| elsif ( $compressmethod eq 'Compress::Bzip2' ) { # Bzip2 as a module |
| |
| my ($bzip2) = bzopen( |
| |
| "$backupdir/backup$backuptype.$curtime.$filedirs.a.tar.bz2", |
| |
| 'wb' ); |
| |
| $bzip2->bzwrite( $tarball->write ); |
| |
| $bzip2->bzclose(); |
| |
| unlink "$backupdir/backup$backuptype.$curtime.$filedirs.tar"; |
| |
| } |
| |
| } |
| |
| elsif ( $backupmethod eq 'Archive::Zip' ) { |
| |
| $zipfile->overwriteAs( |
| |
| "$backupdir/backup$backuptype.$curtime.$filedirs.a.zip"); |
| |
| } |
| |
| return; |
| } |
| } |
| |
| |
| sub ak_system { # Returns a success code. The system's code returned is $? >> 8 |
| sub ak_system |
| CORE::system(@_); |
| { # Returns a success code. The system's code returned is $CHILD_ERROR >> 8 |
| if ($? == -1) { return ''; } # Failed to execute; return a null string. |
| @x = @_; |
| elsif ($? & 127) { return 0; } # Died, return 0. |
| CORE::system(@x); |
| 1; # Success; return 1. |
| if ( $CHILD_ERROR == -1 ) { |
| |
| return q{}; |
| |
| } # Failed to execute; return a null string. |
| |
| elsif ( $CHILD_ERROR & 127 ) { return 0; } # Died, return 0. |
| |
| return 1; # Success; return 1. |
| } |
| } |
| |
| |
| sub runbackup_loop { |
| sub runbackup_loop { |
| my ($i,$j,$curtime,$backupnewest,$backuptime) = @_; |
| my ( $i, $j, $curtime, $backupnewest, $backuptime ) = @_; |
| |
| |
| $yymain .= qq~</b> |
| $yymain .= qq~</b> |
| <p id="memcontinued"> |
| <p id="memcontinued"> |
| $admin_txt{'542'} <a href="$adminurl?action=runbackup;loop1=$i;loop2=$j;curtime=$curtime;backupnewest=$backupnewest;backuptime=$backuptime;runbackup_again=$INFO{'runbackup_again'}" onclick="PleaseWait();">$admin_txt{'543'}</a>.<br /> |
| $admin_txt{'542'} <a href="$adminurl?action=runbackup;loop1=$i;loop2=$j;curtime=$curtime;backupnewest=$backupnewest;backuptime=$backuptime;runbackup_again=$INFO{'runbackup_again'}" onclick="PleaseWait();">$admin_txt{'543'}</a>.<br /> |
| $backup_txt{'90'} |
| $backup_txt{'90'} |
| </p> |
| </p> |
| |
| |
| <script type="text/javascript"> |
| <script type="text/javascript"> |
| <!-- |
| function PleaseWait() { |
| function PleaseWait() { |
| document.getElementById("memcontinued").innerHTML = '<span style="color:important"><b>$backup_txt{'91'}</b></span><br /> <br /> '; |
| document.getElementById("memcontinued").innerHTML = '<font color="red"><b>$backup_txt{'91'}</b></font><br /> <br /> '; |
| } |
| } |
| |
| |
| function stoptick() { stop = 1; } |
| function stoptick() { stop = 1; } |
| |
| |
| stop = 0; |
| stop = 0; |
| function membtick() { |
| function membtick() { |
| if (stop != 1) { |
| if (stop != 1) { |
| PleaseWait(); |
| PleaseWait(); |
| location.href="$adminurl?action=runbackup;loop1=$i;loop2=$j;curtime=$curtime;backupnewest=$backupnewest;backuptime=$backuptime;runbackup_again=$INFO{'runbackup_again'}"; |
| location.href="$adminurl?action=runbackup;loop1=$i;loop2=$j;curtime=$curtime;backupnewest=$backupnewest;backuptime=$backuptime;runbackup_again=$INFO{'runbackup_again'}"; |
| } |
| } |
| } |
| } |
| |
| |
| |
| setTimeout("membtick()",2000); |
| |
| // --> |
| |
| </script>~; |
| |
| |
| |
| &AdminTemplate; |
| setTimeout("membtick()",2000); |
| |
| </script>~; |
| |
| |
| |
| AdminTemplate(); |
| |
| return; |
| } |
| } |
| |
| |
| sub CheckPath { |
| sub CheckPath { |
| my ($path, $file); |
| my ($file) = @_; |
| $file = $_[0]; |
| |
| |
| |
| if (-e $file) { return $file; } |
| if ( -e $file ) { return $file; } |
| |
| |
| $file =~ s~\A.*\/~~; |
| $file =~ s/\A.*\///xsm; |
| |
| |
| foreach $path (@ENVpaths) { |
| foreach my $path (@ENVpaths) { |
| $path =~ s~\/\Z~~; |
| $path =~ s/\/\Z//xsm; |
| if (-e "$path/$file") { return "$path/$file"; } |
| if ( -e "$path/$file" ) { return "$path/$file"; } |
| } |
| } |
| |
| return; |
| } |
| } |
| |
| |
| # Thanks to BBQ at PerlMonks for the basis of this routine: http://www.perlmonks.org/?node_id=9277 |
| # Thanks to BBQ at PerlMonks for the basis of this routine: http://www.perlmonks.org/?node_id=9277 |
| sub downloadbackup { |
| sub downloadbackup { |
| chdir($backupdir) || &admin_fatal_error("","$backup_txt{44} $backupdir",1); |
| chdir($backupdir) |
| my $filename = $INFO{'backupid'}; |
| || fatal_error( q{}, "$backup_txt{44} $backupdir", 1 ); |
| if ($filename !~ /\Abackup/ || $filename !~ /\d{9,10}/) { &admin_fatal_error("",$backup_txt{'45'}); } |
| my $filename = $INFO{'backupid'}; |
| my $filesize = -s $filename; |
| if ( $filename !~ /\Abackup/xsm || $filename !~ /\d{9,10}/xsm ) { |
| |
| fatal_error( q{}, $backup_txt{'45'} ); |
| # print full header |
| } |
| print "Content-disposition: inline; filename=$filename\n"; |
| my $filesize = -s $filename; |
| print "Content-Length: $filesize\n"; |
| |
| print "Content-Type: application/octet-stream\n\n"; |
| # print full header |
| |
| print "Content-disposition: inline; filename=$filename\n" |
| # open in binmode |
| or croak "$croak{'print'} Content-disposition"; |
| fopen(READ, $filename) || &admin_fatal_error("","$backup_txt{46} $filename",1); |
| print "Content-Length: $filesize\n" |
| binmode READ; |
| or croak "$croak{'print'} Content-Length"; |
| |
| print "Content-Type: application/octet-stream\n\n" |
| # stream it out |
| or croak "$croak{'print'} Content-Type"; |
| binmode STDOUT; |
| |
| while (<READ>) {print;} |
| # open in binmode |
| fclose(READ); |
| open( READ, $filename ) |
| |
| || fatal_error( q{}, "$backup_txt{46} $filename", 1 ); |
| |
| binmode READ; |
| |
| |
| |
| # stream it out |
| |
| binmode STDOUT; |
| |
| while (<READ>) { print; } |
| |
| close(READ); |
| |
| return; |
| } |
| } |
| |
| |
| sub deletebackup { |
| sub deletebackup { |
| my $filename = $INFO{'backupid'}; |
| my $filename = $INFO{'backupid'}; |
| if ($filename !~ /\Abackup/ || $filename !~ /\d{9,10}/) { &admin_fatal_error("",$backup_txt{'45'}); } |
| if ( $filename !~ /\Abackup/xsm || $filename !~ /\d{9,10}/xsm ) { |
| |
| fatal_error( q{}, $backup_txt{'45'} ); |
| |
| } |
| |
| |
| $yymain = qq~ |
| $yymain = qq~ |
| $backup_txt{47} $filename $backup_txt{48} |
| $backup_txt{47} $filename $backup_txt{48} |
| <br /> |
| <br /> |
| <br /><a href="$adminurl?action=deletebackup2;backupid=$filename">$backup_txt{49}</a> | <a href="$adminurl?action=backupsettings">$backup_txt{50}</a> |
| <br /><a href="$adminurl?action=deletebackup2;backupid=$filename">$backup_txt{49}</a> | <a href="$adminurl?action=backupsettings">$backup_txt{50}</a> |
| ~; |
| ~; |
| |
| |
| &AdminTemplate; |
| AdminTemplate(); |
| |
| return; |
| } |
| } |
| |
| |
| sub deletebackup2 { |
| sub deletebackup2 { |
| my $filename = $INFO{'backupid'}; |
| my $filename = $INFO{'backupid'}; |
| if ($filename !~ /\Abackup/ || $filename !~ /\d{9,10}/) { &admin_fatal_error("",$backup_txt{'45'}); } |
| if ( $filename !~ /\Abackup/xsm || $filename !~ /\d{9,10}/xsm ) { |
| |
| fatal_error( q{}, $backup_txt{'45'} ); |
| # Just remove it! |
| } |
| unlink("$backupdir/$filename") || &admin_fatal_error("","$backup_txt{51} $backupdir/$filename",1); |
| |
| |
| # Just remove it! |
| $yySetLocation = "$adminurl?action=backupsettings"; |
| unlink "$backupdir/$filename" |
| &redirectexit(); |
| || fatal_error( q{}, "$backup_txt{51} $backupdir/$filename", 1 ); |
| |
| |
| |
| $yySetLocation = "$adminurl?action=backupsettings"; |
| |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| sub emailbackup { |
| sub emailbackup { |
| # Unfourtantly, we can't use &sendmail() for this. |
| |
| # So, we'll load MIME::Lite and try that, as it should work. |
| |
| # If not, we'll email out a download link. |
| |
| my ($mainmessage, $filename); |
| |
| |
| |
| $filename = $INFO{'backupid'}; |
| |
| if ($filename !~ /\Abackup/ || $filename !~ /\d{9,10}/) { &admin_fatal_error("",$backup_txt{'45'}); } |
| |
| |
| |
| # Try to safely load MIME::Lite |
| |
| eval 'use MIME::Lite;'; |
| |
| if (!$@ && !$INFO{'linkmail'}) { # We can use MIME::Lite. |
| |
| my $filesize = -s "$backupdir/$filename"; |
| |
| $filesize = int($filesize / 1024); # Measure it in kilobytes |
| |
| if (!$INFO{'passwarning'} && $filesize > 1024 * 4) { # Warn if the file-size is to big for email (> 4 MB) |
| |
| if ($filesize > 1024 * 4) { $filesize = int($filesize / 1024) . ' MB'; } # Measure it in megabytes |
| |
| else { $filesize .= ' KB'; } # Label it |
| |
| |
| |
| $yymain = qq~ |
| # Unfortunately, we cannot use &sendmail() for this. |
| |
| # So, we will load MIME::Lite and try that, as it should work. |
| |
| # If not, we will email out a download link. |
| |
| my ( $mainmessage, $filename ); |
| |
| |
| |
| $filename = $INFO{'backupid'}; |
| |
| if ( $filename !~ /\Abackup/xsm || $filename !~ /\d{9,10}/xsm ) { |
| |
| fatal_error( q{}, $backup_txt{'45'} ); |
| |
| } |
| |
| |
| |
| # Try to safely load MIME::Lite |
| |
| eval 'use MIME::Lite;'; |
| |
| if ( !$@ && !$INFO{'linkmail'} ) { # We can use MIME::Lite. |
| |
| my $filesize = -s "$backupdir/$filename"; |
| |
| $filesize = int( $filesize / 1024 ); # Measure it in kilobytes |
| |
| if ( !$INFO{'passwarning'} && $filesize > 1024 * 4 ) |
| |
| { # Warn if the file-size is to big for email (> 4 MB) |
| |
| if ( $filesize > 1024 * 4 ) { |
| |
| $filesize = int( $filesize / 1024 ) . ' MB'; |
| |
| } # Measure it in megabytes |
| |
| else { $filesize .= ' KB'; } # Label it |
| |
| |
| |
| $yymain = qq~ |
| $backup_txt{54}?<br /> |
| $backup_txt{54}?<br /> |
| $backup_txt{55} <b>$filesize</b>!<br /> |
| $backup_txt{55} <b>$filesize</b>!<br /> |
| <br /> |
| <br /> |
| <a href="$adminurl?action=emailbackup;backupid=$INFO{'backupid'};passwarning=1">$backup_txt{56} <i>${$uid.$username}{'email'}</i></a><br /> |
| <a href="$adminurl?action=emailbackup;backupid=$INFO{'backupid'};passwarning=1">$backup_txt{56} <i>${$uid.$username}{'email'}</i></a><br /> |
| <a href="$adminurl?action=emailbackup;backupid=$INFO{'backupid'};linkmail=1">$backup_txt{57}</a><br /> |
| <a href="$adminurl?action=emailbackup;backupid=$INFO{'backupid'};linkmail=1">$backup_txt{57}</a><br /> |
| <a href="$adminurl?action=downloadbackup;backupid=$INFO{'backupid'}">$backup_txt{58}</a><br /> |
| <a href="$adminurl?action=downloadbackup;backupid=$INFO{'backupid'}">$backup_txt{58}</a><br /> |
| <a href="$adminurl?action=backupsettings">$backup_txt{59}</a> |
| <a href="$adminurl?action=backupsettings">$backup_txt{59}</a> |
| ~; |
| ~; |
| &AdminTemplate; |
| AdminTemplate(); |
| } |
| } |
| |
| |
| $mainmessage = $backup_txt{'mailmessage1'}; |
| $mainmessage = $backup_txt{'mailmessage1'}; |
| $mainmessage =~ s~USERNAME~${$uid.$username}{'realname'}~g; |
| $mainmessage =~ s/USERNAME/${$uid.$username}{'realname'}/gsm; |
| $mainmessage =~ s~LINK~$adminurl?action=downloadbackup;backupid=$filename~g; |
| $mainmessage =~ |
| $mainmessage =~ s~FILENAME~$filename~g; |
| s/LINK/$adminurl?action=downloadbackup;backupid=$filename/gsm; |
| |
| $mainmessage =~ s/FILENAME/$filename/gsm; |
| eval q^ |
| |
| my $msg = MIME::Lite->new( |
| eval q^ |
| To => ${$uid.$username}{'email'}, |
| my $msg = MIME::Lite->new( |
| From => $backup_txt{'mailfrom'}, |
| To => ${$uid.$username}{'email'}, |
| Subject => $backup_txt{'mailsubject'}, |
| From => $backup_txt{'mailfrom'}, |
| Type => 'multipart/mixed' |
| Subject => $backup_txt{'mailsubject'}, |
| ); |
| Type => 'multipart/mixed' |
| $msg->attach( |
| ); |
| Type => 'TEXT', |
| $msg->attach( |
| Data => $mainmessage |
| Type => 'TEXT', |
| ); |
| Data => $mainmessage |
| $msg->attach( |
| ); |
| Type => 'AUTO', # Let it be auto-detected. |
| $msg->attach( |
| Filename => $filename, |
| Type => 'AUTO', # Let it be auto-detected. |
| Path => "$backupdir/$filename", |
| Filename => $filename, |
| ); |
| Path => "$backupdir/$filename", |
| if (!$mailtype) { |
| ); |
| $msg->send(); |
| if (!$mailtype) { |
| } else { |
| $msg->send(); |
| my @arg = ("$smtp_server", Hello => "$smtp_server", Timeout => 30); |
| } else { |
| push(@arg, AuthUser => "$authuser") if $authuser; |
| my @arg = ("$smtp_server", Hello => "$smtp_server", Timeout => 30); |
| push(@arg, AuthPass => "$authpass") if $authpass; |
| push(@arg, AuthUser => "$authuser") if $authuser; |
| $msg->send('smtp', @arg); |
| push(@arg, AuthPass => "$authpass") if $authpass; |
| } |
| $msg->send('smtp', @arg); |
| ^; |
| } |
| } |
| ^; |
| |
| } |
| if ($@ || $INFO{'linkmail'}) { |
| |
| $mainmessage = ($INFO{'linkmail'} && !$@) ? $backup_txt{'mailmessage2'} : $backup_txt{'mailmessage3'}; |
| if ( $@ || $INFO{'linkmail'} ) { |
| $mainmessage =~ s~USERNAME~${$uid.$username}{'realname'}~; |
| $mainmessage = |
| $mainmessage =~ s~LINK~$adminurl?action=downloadbackup;backupid=$filename~; |
| ( $INFO{'linkmail'} && !$@ ) |
| $mainmessage =~ s~FILENAME~$filename~; |
| ? $backup_txt{'mailmessage2'} |
| $mainmessage =~ s~SYSTEMINFO~$@~; |
| : $backup_txt{'mailmessage3'}; |
| |
| $mainmessage =~ s/USERNAME/${$uid.$username}{'realname'}/sm; |
| require "$sourcedir/Mailer.pl"; |
| $mainmessage =~ |
| &sendmail(${$uid.$username}{'email'}, $backup_txt{'mailsubject'}, $mainmessage, $backup_txt{'mailfrom'}); |
| s/LINK/$adminurl?action=downloadbackup;backupid=$filename/sm; |
| |
| $mainmessage =~ s/FILENAME/$filename/sm; |
| $yySetLocation = "$adminurl?action=backupsettings&mailinfo=-1"; |
| $mainmessage =~ s/SYSTEMINFO/$@/sm; |
| } else { |
| |
| $yySetLocation = "$adminurl?action=backupsettings&mailinfo=1"; |
| require Sources::Mailer; |
| } |
| sendmail( |
| |
| ${ $uid . $username }{'email'}, |
| |
| $backup_txt{'mailsubject'}, |
| |
| $mainmessage, $backup_txt{'mailfrom'} |
| |
| ); |
| |
| |
| |
| $yySetLocation = "$adminurl?action=backupsettings&mailinfo=-1"; |
| |
| } |
| |
| else { |
| |
| $yySetLocation = "$adminurl?action=backupsettings&mailinfo=1"; |
| |
| } |
| |
| |
| &redirectexit(); |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| sub recoverbackup1 { |
| sub recoverbackup1 { |
| $INFO{'recoverfile'} =~ /\A(backup)(n?)\.(\d+)\.([^\.]+)\.(.+)/; |
| $INFO{'recoverfile'} =~ /\A(backup)(n?)\.(\d+)\.([^\.]+)\.(.+)/xsm; |
| |
| |
| my @dirs; |
| my @dirs; |
| foreach (split(/_/, $4)) { |
| foreach ( split /_/xsm, $4 ) { |
| push(@dirs, $dirs{$_}); |
| push @dirs, $dirs{$_}; |
| } |
| } |
| |
| |
| $yymain .= qq~ |
| $yymain .= qq~ |
| <script type="text/javascript"> |
| <script type="text/javascript"> |
| <!-- |
| function CheckCHMOD (v,min,t) { |
| function CheckCHMOD (v,min,t) { |
| if (v == '') { |
| if (v == '') { |
| return; |
| return; |
| } else if (/\\D/.test(v)) { |
| } else if (/\\D/.test(v)) { |
| alert('$backup_txt{112}'); |
| alert('$backup_txt{112}'); |
| t.value = ''; |
| t.value = ''; |
| } else if (v < min) { |
| } else if (v < min) { |
| alert('$backup_txt{110} ' + min); |
| alert('$backup_txt{110} ' + min); |
| t.value = min; |
| t.value = min; |
| } else if (v > 7) { |
| } else if (v > 7) { |
| alert('$backup_txt{111}'); |
| alert('$backup_txt{111}'); |
| t.value = 7; |
| t.value = 7; |
| } |
| } |
| } |
| } |
| |
| --> |
| |
| </script> |
| </script> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| <form action="$adminurl?action=recoverbackup2" method="post" name="recover"> |
| <form action="$adminurl?action=recoverbackup2" method="post" name="recover"> |
| <div class="bordercolor rightboxdiv"> |
| <table width="100%" cellspacing="1" cellpadding="10"> |
| <table class="border-space pad_10px" style="margin-bottom: .5em;"> |
| <tr valign="middle"> |
| <tr> |
| <td align="left" class="titlebg" colspan="2"> |
| <td class="titlebg" colspan="2">$admin_img{'prefimg'} <b>$backup_txt{100}</b></td> |
| <img src="$imagesdir/preferences.gif" alt="" border="0" /><b>$backup_txt{100}</b> |
| </tr><tr> |
| </td> |
| <td class="windowbg2" colspan="2"> |
| </tr> |
| $backup_txt{101}<br /> |
| <tr valign="middle"> |
| <br /> |
| <td align="left" class="windowbg2" colspan="2"> |
| - ~ . join( '<br />- ', @dirs ) . qq~<br /> |
| $backup_txt{101}<br /> |
| <br /> |
| <br /> |
| $backup_txt{102}<br /> |
| - ~ . join('<br />- ', @dirs) . qq~<br /> |
| <br /> |
| <br /> |
| <i>$INFO{'recoverfile'}</i>~ |
| $backup_txt{102}<br /> |
| . ( $2 ? " (<b>$backup_txt{62}</b>)" : q{} ) |
| <br /> |
| . qq~ $backup_txt{103} ~ |
| <i>$INFO{'recoverfile'}</i>~ . ($2 ? " (<b>$backup_txt{62}</b>)" : '') . qq~ $backup_txt{103} ~ . &timeformat($3) . qq~<br /> |
| . timeformat($3) |
| <br /> |
| . qq~ <br /> |
| <input type="button" onclick="window.location.href='$adminurl?action=backupsettings'" value="$backup_txt{125}" /><br /> |
| <br /> |
| <br /> |
| <input type="button" onclick="window.location.href='$adminurl?action=backupsettings'" value="$backup_txt{125}" /><br /> |
| $backup_txt{104},<br /> |
| <br /> |
| <br /> |
| $backup_txt{104},<br /> |
| <input type="checkbox" name="originalrestore" value="1" /> $backup_txt{105}<br /> |
| <br /> |
| <br /> |
| <input type="checkbox" name="originalrestore" value="1" /> $backup_txt{105}<br /> |
| $backup_txt{106}<br /> |
| <br /> |
| <table cellpadding="3"> |
| $backup_txt{106}<br /> |
| <tr><td align="center" valign="middle"><b>$backup_txt{107}</b></td><td align="center" valign="middle"><b>$backup_txt{108}</b></td></tr>\n~; |
| <table class="pad-cell"> |
| |
| <tr> |
| $INFO{'recoverfile'} =~ /\.tar(.*)$/; |
| <td class="center"><b>$backup_txt{107}</b></td> |
| my $recovertype = $1 eq '.gz' ? "tar -tzf $backupdir/$INFO{'recoverfile'} -C $backupdir/" : "tar -tf $backupdir/$INFO{'recoverfile'} -C $backupdir/"; |
| <td class="center"><b>$backup_txt{108}</b></td> |
| |
| </tr>~; |
| my %checkdir; |
| |
| foreach (split(/\n/, qx($recovertype))) { |
| $INFO{'recoverfile'} =~ /\.tar(.*)$/xsm; |
| next if -d "/$_/"; |
| my $recovertype = |
| $_ =~ /(.*\/)(.*)/; |
| $1 eq '.gz' |
| if (!$checkdir{$1} && $2) { |
| ? "tar -tzf $backupdir/$INFO{'recoverfile'} -C $backupdir/" |
| $checkdir{$1} = 1; |
| : "tar -tf $backupdir/$INFO{'recoverfile'} -C $backupdir/"; |
| $yymain .= qq~ <tr><td align="left">/$1 *$backup_txt{114}</td><td align="center"><input type="text" name="u-$1" value="6" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="g-$1" value="6" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="a-$1" value="" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,0,this);" /></td></tr>\n~; |
| |
| } |
| my %checkdir; |
| } |
| foreach ( split /\n/xsm, qx($recovertype) ) { |
| |
| next if -d "/$_/"; |
| $yymain .= qq~ |
| $_ =~ /(.*\/)(.*)/xsm; |
| <tr> |
| if ( !$checkdir{$1} && $2 ) { |
| <td align="left" colspan="2"> </td> |
| $checkdir{$1} = 1; |
| </tr> |
| $yymain .= qq~<tr> |
| <tr> |
| <td>/$1 *$backup_txt{114}</td> |
| <td align="left">$backup_txt{115} index.html $backup_txt{116}</td><td align="center"><input type="text" name="u-index" value="6" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="g-index" value="6" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="a-index" value="4" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,0,this);" /></td> |
| <td class="center"><input type="text" name="u-$1" value="6" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="g-$1" value="6" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="a-$1" value="" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,0,this);" /></td> |
| </tr> |
| </tr>~; |
| <tr> |
| } |
| <td align="left">$backup_txt{115} .htaccess $backup_txt{116}</td><td align="center"><input type="text" name="u-htaccess" value="6" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="g-htaccess" value="6" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="a-htaccess" value="4" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,0,this);" /></td> |
| } |
| </tr> |
| |
| <tr> |
| $yymain .= qq~<tr> |
| <td align="left" colspan="2"> </td> |
| <td colspan="2"> </td> |
| </tr> |
| </tr><tr> |
| <tr> |
| <td>$backup_txt{115} index.html $backup_txt{116}</td><td class="center"><input type="text" name="u-index" value="6" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="g-index" value="6" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="a-index" value="4" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,0,this);" /></td> |
| <td align="left">$backup_txt{120}</td><td align="center"><input type="text" name="u-newdir" value="7" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="g-newdir" value="5" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,5,this);" /> <input type="text" name="a-newdir" value="5" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,0,this);" /></td> |
| </tr><tr> |
| |
| <td>$backup_txt{115} .htaccess $backup_txt{116}</td><td class="center"><input type="text" name="u-htaccess" value="6" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="g-htaccess" value="6" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="a-htaccess" value="4" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,0,this);" /></td> |
| |
| </tr><tr> |
| |
| <td colspan="2"> </td> |
| |
| </tr> <tr> |
| |
| <td>$backup_txt{120}</td><td class="center"><input type="text" name="u-newdir" value="7" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,6,this);" /> <input type="text" name="g-newdir" value="5" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,5,this);" /> <input type="text" name="a-newdir" value="5" size="1" maxlength="1" onkeyup="CheckCHMOD(this.value,0,this);" /></td> |
| </tr> |
| </tr> |
| </table> |
| </table> |
| <br /> |
| </tr> |
| <input type="hidden" name="recoverfile" value="$INFO{'recoverfile'}" /> |
| |
| <input type="submit" value="$backup_txt{126}" /> |
| |
| </td> |
| |
| </tr> |
| |
| </table> |
| </table> |
| </form> |
| </div> |
| </div>~; |
| <div class="bordercolor rightboxdiv"> |
| |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| |
| <tr> |
| |
| <th class="titlebg">$admin_img{'prefimg'} $backup_txt{'100'}</th> |
| |
| </tr><tr> |
| |
| <td class="catbg center"> |
| |
| <input type="hidden" name="recoverfile" value="$INFO{'recoverfile'}" /> |
| |
| <input type="submit" value="$backup_txt{'126'}" class="button" /> |
| |
| </td> |
| |
| </tr> |
| |
| </table> |
| |
| </div> |
| |
| </form>~; |
| |
| |
| &AdminTemplate; |
| AdminTemplate(); |
| |
| return; |
| } |
| } |
| |
| |
| sub recoverbackup2 { |
| sub recoverbackup2 { |
| my ($output,$o,$CHMOD,%checkdirexists,%checkdir,$path); |
| my ( $output, $o, $CHMOD, %checkdirexists, %checkdir, $path ); |
| |
| |
| my $restore_root; |
| my $restore_root; |
| if ($FORM{'originalrestore'}) { |
| if ( $FORM{'originalrestore'} ) { |
| $restore_root = "/"; |
| $restore_root = q{/}; |
| } else { |
| } |
| $restore_root = "$backupdir/$date/"; |
| else { |
| mkdir($restore_root,oct("0$FORM{'u-newdir'}$FORM{'g-newdir'}$FORM{'a-newdir'}")); |
| $restore_root = "$backupdir/$date/"; |
| chmod(oct("0$FORM{'u-newdir'}$FORM{'g-newdir'}$FORM{'a-newdir'}"), $restore_root); # mkdir somtimes does not set the CHMOD as expected |
| mkdir $restore_root, |
| } |
| oct "0$FORM{'u-newdir'}$FORM{'g-newdir'}$FORM{'a-newdir'}"; |
| |
| chmod |
| $FORM{'recoverfile'} =~ /\.tar(.*)$/; |
| oct("0$FORM{'u-newdir'}$FORM{'g-newdir'}$FORM{'a-newdir'}"), |
| my $recovertype = $1 eq '.gz' ? "tar -tzf $backupdir/$FORM{'recoverfile'} -C $restore_root" : "tar -tf $backupdir/$FORM{'recoverfile'} -C $restore_root"; |
| $restore_root; # mkdir somtimes does not set the CHMOD as expected |
| $output = qx($recovertype); |
| } |
| $recovertype = $1 eq '.gz' ? "tar -xzf $backupdir/$FORM{'recoverfile'} -C $restore_root" : "tar -xf $backupdir/$FORM{'recoverfile'} -C $restore_root"; |
| |
| |
| $FORM{'recoverfile'} =~ /\.tar(.*)$/xsm; |
| # Check what directories do/do not exist |
| my $recovertype = |
| foreach $o (split(/\n/, $output)) { |
| $1 eq '.gz' |
| next if -d "/$o/"; |
| ? "tar -tzf $backupdir/$FORM{'recoverfile'} -C $restore_root" |
| $o =~ /(.*\/)(.*)/; |
| : "tar -tf $backupdir/$FORM{'recoverfile'} -C $restore_root"; |
| $path = ""; |
| $output = qx($recovertype); |
| foreach (split(/\//, $1)) { |
| $recovertype = |
| $path .= "$_/"; |
| $1 eq '.gz' |
| if (!$checkdirexists{$path}) { $checkdirexists{$path} = -d ($FORM{'originalrestore'} ? "/$path" : "$backupdir/$date/$path") ? 1 : -1; } |
| ? "tar -xzf $backupdir/$FORM{'recoverfile'} -C $restore_root" |
| } |
| : "tar -xf $backupdir/$FORM{'recoverfile'} -C $restore_root"; |
| } |
| |
| |
| # Check what directories do/do not exist |
| qx($recovertype); # must be done AFTER directory check! |
| foreach my $o ( split /\n/xsm, $output ) { |
| |
| next if -d "/$o/"; |
| $yymain .= qq~ |
| $o =~ /(.*\/)(.*)/xsm; |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| $path = q{}; |
| <table width="100%" cellspacing="1" cellpadding="10"> |
| foreach ( split /\//xsm, $1 ) { |
| <tr valign="middle"> |
| $path .= "$_/"; |
| <td align="left" class="titlebg" colspan="2"> |
| if ( !$checkdirexists{$path} ) { |
| <img src="$imagesdir/preferences.gif" alt="" border="0" /><b>$backup_txt{100}</b> |
| $checkdirexists{$path} = |
| </td> |
| -d ( |
| </tr> |
| $FORM{'originalrestore'} ? "/$path" |
| <tr valign="middle"> |
| : "$backupdir/$date/$path" |
| <td align="left" class="windowbg2" colspan="2"> |
| ) ? 1 |
| $backup_txt{130}<br /> |
| : -1; |
| <br /> |
| } |
| <pre>\n~; |
| } |
| |
| } |
| foreach $o (split(/\n/, $output)) { |
| |
| next if -d "/$o/"; |
| qx($recovertype); # must be done AFTER directory check! |
| $CHMOD = ""; |
| |
| $o =~ /(.*\/)(.*)/; |
| $yymain .= qq~ |
| if ($2 eq "index.html") { |
| <div class="bordercolor rightboxdiv"> |
| $CHMOD .= $FORM{'u-index'} < 6 ? 6 : $FORM{'u-index'}; |
| <table class="border-space pad_more" style="margin-bottom: .5em;"> |
| $CHMOD .= $FORM{'g-index'} < 6 ? 6 : $FORM{'g-index'}; |
| <tr> |
| $CHMOD .= $FORM{'a-index'} < 1 ? 0 : $FORM{'a-index'}; |
| <td class="titlebg" colspan="2">$admin_img{'prefimg'} <b>$backup_txt{100}</b></td> |
| |
| </tr><tr> |
| } elsif ($2 eq ".htaccess") { |
| <td class="windowbg2" colspan="2"> |
| $CHMOD .= $FORM{'u-htaccess'} < 6 ? 6 : $FORM{'u-htaccess'}; |
| $backup_txt{130}<br /> |
| $CHMOD .= $FORM{'g-htaccess'} < 6 ? 6 : $FORM{'g-htaccess'}; |
| <br /> |
| $CHMOD .= $FORM{'a-htaccess'} < 1 ? 0 : $FORM{'a-htaccess'}; |
| <pre>\n~; |
| |
| |
| } elsif ($2) { |
| foreach my $o ( split /\n/xsm, $output ) { |
| $CHMOD .= $FORM{'u-' . $1} < 6 ? 6 : $FORM{'u-' . $1}; |
| next if -d "/$o/"; |
| $CHMOD .= $FORM{'g-' . $1} < 6 ? 6 : $FORM{'g-' . $1}; |
| $CHMOD = q{}; |
| $CHMOD .= $FORM{'a-' . $1} < 1 ? 0 : $FORM{'a-' . $1}; |
| $o =~ /(.*\/)(.*)/xsm; |
| } |
| if ( $2 eq 'index.html' ) { |
| |
| $CHMOD .= $FORM{'u-index'} < 6 ? 6 : $FORM{'u-index'}; |
| $path = ""; |
| $CHMOD .= $FORM{'g-index'} < 6 ? 6 : $FORM{'g-index'}; |
| foreach (split(/\//, $1)) { |
| $CHMOD .= $FORM{'a-index'} < 1 ? 0 : $FORM{'a-index'}; |
| $path .= "$_/"; |
| |
| if (!$checkdir{$path}) { |
| } |
| $checkdir{$path} = 1; |
| elsif ( $2 eq '.htaccess' ) { |
| if ($checkdirexists{$path} == -1) { # set directories CHMOD |
| $CHMOD .= $FORM{'u-htaccess'} < 6 ? 6 : $FORM{'u-htaccess'}; |
| my $od = $FORM{'originalrestore'} ? "/$path" : "$backupdir/$date/$path"; |
| $CHMOD .= $FORM{'g-htaccess'} < 6 ? 6 : $FORM{'g-htaccess'}; |
| $yymain .= chmod(oct("0$FORM{'u-newdir'}$FORM{'g-newdir'}$FORM{'a-newdir'}"), $od) . " - CHMOD 0$FORM{'u-newdir'}$FORM{'g-newdir'}$FORM{'a-newdir'} - $od\n"; |
| $CHMOD .= $FORM{'a-htaccess'} < 1 ? 0 : $FORM{'a-htaccess'}; |
| } |
| |
| } |
| } |
| } |
| elsif ($2) { |
| |
| $CHMOD .= $FORM{ 'u-' . $1 } < 6 ? 6 : $FORM{ 'u-' . $1 }; |
| if ($CHMOD) { |
| $CHMOD .= $FORM{ 'g-' . $1 } < 6 ? 6 : $FORM{ 'g-' . $1 }; |
| $o = $FORM{'originalrestore'} ? "/$o" : "$backupdir/$date/$o"; |
| $CHMOD .= $FORM{ 'a-' . $1 } < 1 ? 0 : $FORM{ 'a-' . $1 }; |
| $yymain .= chmod(oct("0$CHMOD"), $o) . " - CHMOD 0$CHMOD - $o\n"; |
| } |
| } |
| |
| } |
| $path = q{}; |
| |
| foreach ( split /\//xsm, $1 ) { |
| $yymain .= qq~ </pre> |
| $path .= "$_/"; |
| $backup_txt{131}<br /> |
| if ( !$checkdir{$path} ) { |
| <br /> |
| $checkdir{$path} = 1; |
| <input type="button" onclick="window.location.href='$adminurl?action=backupsettings'" value="$backup_txt{132}" /> |
| if ( $checkdirexists{$path} == -1 ) { # set directories CHMOD |
| </td> |
| my $od = |
| </tr> |
| $FORM{'originalrestore'} |
| </table> |
| ? "/$path" |
| </div>~; |
| : "$backupdir/$date/$path"; |
| |
| $yymain .= chmod( |
| |
| oct( |
| |
| "0$FORM{'u-newdir'}$FORM{'g-newdir'}$FORM{'a-newdir'}" |
| |
| ), |
| |
| $od |
| |
| ) |
| |
| . " - CHMOD 0$FORM{'u-newdir'}$FORM{'g-newdir'}$FORM{'a-newdir'} - $od\n"; |
| |
| } |
| |
| } |
| |
| } |
| |
| |
| |
| if ($CHMOD) { |
| |
| $o = $FORM{'originalrestore'} ? "/$o" : "$backupdir/$date/$o"; |
| |
| $yymain .= chmod( oct("0$CHMOD"), $o ) . " - CHMOD 0$CHMOD - $o\n"; |
| |
| } |
| |
| } |
| |
| |
| |
| $yymain .= qq~ </pre> |
| |
| $backup_txt{131}<br /> |
| |
| </td> |
| |
| </tr> |
| |
| </table> |
| |
| </div> |
| |
| <div class="bordercolor rightboxdiv"> |
| |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| |
| <tr> |
| |
| <th class="titlebg">$admin_img{'prefimg'} $admin_txt{'193'}</th> |
| |
| </tr><tr> |
| |
| <td class="catbg center"> |
| |
| <input type="button" onclick="window.location.href='$adminurl?action=backupsettings'" value="$backup_txt{'132'}" /> |
| |
| </td> |
| |
| </tr> |
| |
| </table> |
| |
| </div>~; |
| |
| |
| &AdminTemplate; |
| AdminTemplate(); |
| |
| return; |
| } |
| } |
| |
| |
| 1; |
| 1; |
| |
| |