| 
<?
/**********************************************
 * COPIA DE SEGURIDAD
 * Autor: Guillermo Domínguez
 * 06-02-2005
 * Email bugs/suggestions to [email protected]
 * *********************************************
 * * NEED Devin Doucette CLASS:
 * *     TAR/GZIP/BZIP2/ZIP ARCHIVE CLASSES 2.0
 * *********************************************
 ***********************************************/
 
 if (isset($comprimir)){
 include ("./archive.php");    //  Devin Doucette TAR/GZIP/BZIP2/ZIP ARCHIVE CLASSES 2.0
 if(isset($ARCHIVOZIP)){
 if(strlen($ARCHIVOZIP)<1){
 $ARCHIVOZIP="COPIA" . date("Y_m_d");
 }
 }else{
 $ARCHIVOZIP="COPIA" . date("Y_m_d");
 }
 if (file_exists($ARCHIVOZIP.".tgz"))
 unlink($ARCHIVOZIP.".tgz");
 $test = new gzip_file($ARCHIVOZIP.".tgz");
 $test->set_options(array('basedir'=>".",'overwrite'=>1,'level'=>1));
 $directorio="";
 foreach( $_POST as $key => $value ){
 if (strstr($key,"D")){
 if(!strstr($key,"A")){
 $directorio=$key;
 $test->add_files($value );
 }else{
 if($directorio<>""){
 if(!strstr($key,$directorio)){
 $test->add_files($value );
 }
 }
 }
 }
 }
 $test->create_archive();
 echo ("<script language=\"javascript\"> window.location ='" . $ARCHIVOZIP. ".tgz';</script>\n");
 
 
 
 
 }
 
 
 class CSEGURIDAD
 {
 var $basedir = "";
 var $xarch=Array();
 var $xdir=Array();
 var $url="";
 
 function inicia()
 {
 $d= dir($this->basedir);
 while($entry=$d->read()) {
 if (is_dir($this->basedir . "" . $entry)){
 if(!($entry=="." or $entry=="..")){
 $xxdir= new CSEGURIDAD();
 $xxdir->basedir=$this->basedir."".$entry ."/";
 $xxdir->tab=$this->tab . "    ";
 $xxdir->inicia();
 $this->xdir[$entry]=$xxdir;
 }
 }else{
 $this->xarch[$entry]=false;
 }
 }
 }
 
 function formulario($hereda="")
 {
 $nom = $hereda . "D" . rand(rand(2,time()),time());
 
 ?>
 <table width="100%" border=0>
 <tr class="DIR">
 <td width="10%">
 <input onClick="seleccionardir('<? echo $nom; ?>');" type="checkbox" value="<? echo $this->resuelvenombre($this->basedir); ?>" name="<? echo $nom; ?>">
 </td>
 <td width="90%">
 <?
 echo( $this->basedir . "</td></tr>");
 $item=0;
 foreach( $this->xarch as $key => $value ) {
 $item++;
 ?>
 <tr class="ARCH">
 <td width="10%">
 <input onClick="seleccionararchivo('<? echo ($nom ); ?>');" type="checkbox" value="<? echo $this->resuelvenombre($this->basedir . $key); ?>" name="<? echo $nom ."A".$item; ?>"></td><td>
 <?
 
 echo( $key . "</td></tr>");
 }
 ?>
 </table>
 <?
 foreach($this->xdir as $entry ) {
 $entry->formulario($nom);
 }
 ?>
 <?
 }
 
 function  resuelvenombre($cad){
 return htmlspecialchars ($cad);
 
 }
 
 
 function pagina(){
 $this->inicia();
 $this->iniciahtml();
 $this->formulario();
 $this->finhtml();
 }
 
 function iniciahtml(){
 $a=1;
 ?>
 <html>
 <head>
 <title>HOST - BAKCUP</title>
 
 <STYLE TYPE="text/css" MEDIA="screen">
 <!--
 .text {
 font-family: Arial;
 font-size: 12px;
 font-weight: bold;
 LINE-HEIGHT: 13px;
 color: #222222;
 }
 .textfi {
 font-family: Arial;
 font-size: 12px;
 font-weight: normal;
 LINE-HEIGHT: 14px;
 text-decoration: none;
 color: #333333;
 
 }
 .form {
 font-family: Arial;
 font-size: 11px;
 font-weight: bold;
 LINE-HEIGHT: 11px;
 color: #222222;
 }
 .DIR {
 font-family: Arial;
 font-size: 11px;
 font-weight: bold;
 LINE-HEIGHT: 11px;
 color: #FFFFFF;
 background-color: #5A7994;
 }
 .ARCH {
 font-family: Arial;
 font-size: 11px;
 font-weight: normal;
 LINE-HEIGHT: 11px;
 color: #222222;
 background-color: #F7CB08;
 }
 -->
 </STYLE>
 
 <script languaje="javascript">
 function seleccionardir(cual){
 
 if (eval("document.formback." + cual + ".checked")){
 for (a=0;a<eval("document.formback.elements.length");a++){
 
 if (!(eval("document.formback.elements[a].name") == cual)){
 if (eval("document.formback.elements[a].name.indexOf('" + cual + "')")>-1){
 eval("document.formback.elements[a].checked=true");
 }
 }
 }
 }else{
 for (a=0;a<eval("document.formback.elements.length");a++){
 if (!(eval("document.formback.elements[a].name") == cual)){
 if (eval("document.formback.elements[a].name.indexOf('" + cual + "')")>-1){
 eval("document.formback.elements[a].checked=false");
 }
 }
 }
 seleccionararchivo(cual);
 }
 }
 
 function seleccionararchivo(cualdir){
 
 var t=cualdir.split("D");
 cual="D"+t[1];
 eval("document.formback." + cual + ".checked=false");
 for(b=2;b<=t.length;b++){
 cual=cual+"D"+t[b];
 eval("document.formback." + cual + ".checked=false");
 }
 
 }
 </script>
 </head>
 <body>
 <table class="text">
 <tr>
 <td class="text">
 <form name="formback" action="cseguridad.php"  method="post">
 <input type=hidden name="url" value="<? echo $this->url ?>">
 <?
 }
 
 
 function finhtml(){
 ?>
 </td>
 </tr>
 <tr>
 <td class="text">ARCHIVO</td>
 <td><input name="ARCHIVOZIP" type=TEXT value=""></td>
 </tr>
 <tr>
 <td>
 <input type=submit value="COMPRIMIR" name ="comprimir">
 </td></tr>
 </table>
 <body>
 <help>
 <?
 }
 
 }
 
 ?>
 
 |