Example #1
0
function generateBackup($cid, $option)
{
    // ----------------------------------------------------------
    // Routine to generate recurse a folder structure and record
    // the files, their sizes and parent folders
    // ----------------------------------------------------------
    global $_CONFIG;
    # generate database backup if required
    if (!$_CONFIG['enable_db_backup']) {
        $backupDatabase = 0;
    } else {
        $backupDatabase = $_REQUEST['dbbackup'];
    }
    if ($_REQUEST[cron_access]) {
        $_CONFIG['backup_refresh'] = 0;
        $_REQUEST['dbbackup_drop'] = $_CONFIG['cron_sql_drop'];
        if ($_CONFIG[cron_btype] == '1') {
            $backupDatabase = 0;
        }
    }
    if (!is_writeable($_CONFIG['clonerPath'])) {
        E_print("Your backup directory " . $_CONFIG['clonerPath'] . " is not writeable or does not exists!");
        return;
    }
    if (!is_writeable($_CONFIG['backups_dir'])) {
        E_print("Required sql backup directory " . $_CONFIG['backups_dir'] . " is not writeable or does not exists!");
        return;
    }
    # generate the backup set filename
    #$urlinfo = parse_url($mosConfig_live_site);
    #$domainname = strtolower(str_replace('.','_',$urlinfo[host]));
    #$domainname= $_SERVER['HTTP_HOST'];
    $domainname = $_CONFIG['mosConfig_live_site'];
    if ($_CONFIG['mem'] && $_CONFIG['backup_refresh']) {
        $f_ext = '.tar';
        $_CONFIG['tarcompress'] = '';
    } elseif ($_CONFIG['backup_compress']) {
        $f_ext = '.tgz';
        $_CONFIG['tarcompress'] = 'z';
    } else {
        $f_ext = '.tar';
        $_CONFIG['tarcompress'] = '';
    }
    /*if($_CONFIG['backup_refresh']){
         $f_ext = ".tar";
        }
        elseif($_REQUEST[cron_dbonly]){
    	 $f_ext = ".tar";
    	}
    	else{
    	 $f_ext = ".tgz";
    	}*/
    if ($_REQUEST['bname'] == "") {
        if ($backupDatabase == 1) {
            if ($_REQUEST['dbbackup_drop']) {
                $filename1 = 'backup_' . date("Y-m-d_H-i") . '_' . $domainname . '-sql-drop' . $f_ext;
            } else {
                $filename1 = 'backup_' . date("Y-m-d_H-i") . '_' . $domainname . '-sql-nodrop' . $f_ext;
            }
        } else {
            $filename1 = 'backup_' . date("Y-m-d_H-i") . '_' . $domainname . '-nosql' . $f_ext;
        }
    } else {
        $filename1 = $_REQUEST['bname'] . $f_ext;
    }
    $sql_file = array();
    if ($backupDatabase == 1) {
        $tables = array();
        $tables[0] = 'all';
        $excltables = $_REQUEST['excltables'];
        $sql_file[] = doBackup($tables, 'sql', 'local', 'both', $_SERVER['HTTP_USER_AGENT'], $_CONFIG['backups_dir'], $databaseResult, 'database', $excltables, $_CONFIG['mysql_database']);
        $databaseResult = "<b>" . $_CONFIG['mysql_database'] . ":</b> " . $databaseResult;
        ############## ADD multiple databases #######################
        $databases_incl = $_REQUEST['databases_incl'];
        if (is_array($databases_incl)) {
            foreach ($databases_incl as $database_name) {
                if ($database_name != '') {
                    $excltables = "";
                    mysql_query("USE  {$database_name}");
                    $sql_file[] = doBackup($tables, 'sql', 'local', 'both', $_SERVER['HTTP_USER_AGENT'], $_CONFIG['backups_dir'], $databaseResult_incl, $database_name, $excltables, $database_name);
                    $databaseResult .= "<br /> <b>{$database_name}:</b> " . $databaseResult_incl;
                }
            }
            mysql_query("USE  " . $_CONFIG['mysql_database']);
        }
    } else {
        $databaseResult = LM_DATABASE_EXCLUDED;
    }
    $excluded = array();
    $data = "";
    $excluded[] = $_CONFIG['backups_dir'] . "/" . $filename1;
    if ($_REQUEST['cron_access']) {
        $data = $_CONFIG['cron_exclude'];
    } elseif ($_CONFIG[select_folders] == 1) {
        $data = $_REQUEST['exluded'];
    }
    ##### START THE EXCLUSION FILTER
    if (($fp = @fopen($_CONFIG['exfile'], "r")) && !$_REQUEST['cron_access']) {
        while (!feof($fp)) {
            $data .= fread($fp, 1024);
        }
        fclose($fp);
    }
    if (sizeof($_REQUEST[cid]) > 0) {
        $data .= implode("\r\n", $_REQUEST[cid]);
    }
    $_COOKIES = explode("\r\n", $data);
    if (is_array($_COOKIES)) {
        foreach ($_COOKIES as $key => $value) {
            if ($value != "") {
                $value = str_replace($_CONFIG['backup_path'], "", $value);
                if ($value[0] != '/') {
                    $value = '/' . $value;
                }
                if (substr($value, strlen($value) - 1, 1) == '/' && strlen($value) != 1) {
                    $value = substr($value, 0, strlen($value) - 1);
                }
                if ($value != "" && $value != '/administrator/backups') {
                    if (trim($value) != '/administrator') {
                        $excluded[] = str_replace("//", "/", $_CONFIG['backup_path'] . "/" . $value);
                    } else {
                        if ($handle = opendir($_CONFIG['backup_path'] . '/administrator')) {
                            while (false !== ($file = readdir($handle))) {
                                if ($file != "." && $file != ".." && $file != "backups") {
                                    $excluded[] = str_replace("//", "/", $_CONFIG['backup_path'] . "/administrator/" . $file);
                                }
                            }
                            closedir($handle);
                        }
                    }
                }
            }
        }
    }
    #### END EXCLUSION FILTER
    if (!$_CONFIG['add_backups_dir']) {
        # initialise list arrays, directories and files separately and array counters for them
        $d_arr = array();
        $d = 0;
        $f_arr = array();
        $f = 0;
        $s_arr = array();
        $s = 0;
        getBackupFiles($d_arr, $f_arr, $s_arr, $d, $f);
        $i = 0;
        while ($i < sizeof($f_arr)) {
            $excluded[] = $_CONFIG['clonerPath'] . "/" . $f_arr[$i];
            $i++;
        }
    }
    # obtain list of folders included in the backup
    $includeFolder = array();
    #print_r($excluded);exit;
    #$includeFolder = confirmBackup('nohtml');
    #initialise list arrays, directories and files separately and array counters for them
    $d_arr = array();
    $d = 0;
    $ds_arr = array();
    $f_arr = array();
    $f = 0;
    $s_arr = array();
    $s = 0;
    $mdir = 0;
    $perm_file = $_CONFIG['backups_dir'] . "/perm.txt";
    @unlink($perm_file);
    $fperm = fopen($perm_file, "w");
    for ($i = 0; $i < sizeof($excluded); $i++) {
        $excluded[$i] = str_replace("//", "/", $excluded[$i]);
    }
    #print_r($excluded);exit;
    # obtain the list of files by recursing the mambo file store
    recurseFiles($d_arr, $ds_arr, $f_arr, $s_arr, $d, $f, $s, $includeFolder, '', $excluded, $fperm);
    @fclose($fperm);
    @chmod($perm_file, 0777);
    # format total archive size
    $originalSize = getFileSizeText($s);
    # extend the file locations to include the full path
    for ($i = 0; $i < count($f_arr); $i++) {
        if (!file_exists($f_arr[$i])) {
            unset($f_arr[$i]);
        }
    }
    #if((file_exists($perm_file))&&(!in_array($perm_file, $f_arr)))
    # $f_arr[] = $perm_file;
    # add sql file to the backup
    if ($_REQUEST[cron_access]) {
        if (is_array($sql_file)) {
            foreach ($sql_file as $key => $sqlfile) {
                if ($backupDatabase == 1 && !in_array($_CONFIG['backups_dir'] . $sqlfile, $f_arr)) {
                    $f_arr[] = $sqlfile;
                }
            }
        }
    }
    $filename = $_CONFIG['clonerPath'] . '/' . $filename1;
    $f_arr = array_unique($f_arr);
    # create the Zip file from the fileset array
    @unlink($filename);
    $perm_lines = 0;
    $handle = @fopen($perm_file, "r");
    if ($handle) {
        while (!feof($handle)) {
            fgets($handle, 4096);
            $perm_lines++;
        }
        fclose($handle);
    }
    if (!$_CONFIG['mem']) {
        #### START TAR MANUAL MODE ############################################################
        if ($_CONFIG['backup_refresh']) {
            $f_arr = array($_CONFIG['backups_dir'] . "/index.html");
        }
        if ($_CONFIG['backup_refresh']) {
            $tar_type = "tar";
        } else {
            $tar_type = "tgz";
        }
        $tar_object = new Archive_Tar($filename, compression($tar_type));
        #$tar_object->setErrorHandling(PEAR_ERROR_PRINT);  // Optional error handling
        $return = $tar_object->addModify($f_arr, '', $_CONFIG['backup_path']);
        if ($return != 1) {
            echo "Backup failed using tar mode, error code {$return}!";
        }
        if ($_CONFIG['backup_refresh']) {
            echo "Starting the manual backup process!<br />";
            echo "Database backup: " . $databaseResult . "<br /><br />";
            if (file_exists($filename)) {
                echo "Backup {$filename} created, we may continue!<br />";
                #echo "Database backup: ".$databaseResult ."<br />";
                echo "<a href='index2.php?option=com_cloner&lines=" . $perm_lines . "&task=refresh&backup={$filename}&excl_manual={$excl_manual}'>Please click here to continue!</a>";
                return;
            } else {
                E_print("Backup failed, please check your tar server utility support!");
                return;
            }
        }
        #### END TAR MODE ############################################################
    } else {
        #### CREATE BACKUP USING SERVER UTILITIES
        $i = 0;
        chdir($_CONFIG['backup_path']);
        $excl_files = "";
        while ($i < sizeof($excluded)) {
            $file = $excluded[$i];
            $file = str_replace($_CONFIG['backup_path'], "", $file);
            $file = "##" . $file;
            $file = str_replace("##//", "", $file);
            $file = str_replace("##/", "", $file);
            $file = str_replace("##", "", $file);
            $excl_files .= "/" . $file . "* ";
            $i++;
        }
        chdir($_CONFIG['backup_path']);
        $excl_cmd = "";
        if ($fp = fopen($_CONFIG['exfile_tar'], "w")) {
            $i = 0;
            while ($i < sizeof($excluded)) {
                $file = $excluded[$i];
                $file = str_replace($_CONFIG['backup_path'], "", $file);
                $file = "##" . $file;
                $file = str_replace("##//", "", $file);
                $file = str_replace("##/", "", $file);
                $file = str_replace("##", "", $file);
                $excl_cmd .= " --exclude=./" . $file . " ";
                $excl_files = "./" . $file . "\r\n";
                fwrite($fp, $excl_files);
                $i++;
            }
            fclose($fp);
        }
        if ($_CONFIG['backup_refresh']) {
            ########## STARTING THE MANUAL BACKUP ######################################################
            $exclude = $excl_cmd . " -X " . $_CONFIG['exfile_tar'];
            $excl_manual = $_CONFIG['exfile_tar'] . "_manual";
            if ($fp = fopen($excl_manual, "w")) {
                fwrite($fp, $exclude);
                fclose($fp);
            }
            echo "Starting the manual backup process!<br />";
            echo "Database backup: " . $databaseResult . "<br /><br />";
            chdir($_CONFIG['backup_path']);
            #$filename = str_replace(".tgz",".tar",$filename);
            exec($_CONFIG[tarpath] . " {$exclude} -c" . $_CONFIG['tarcompress'] . "vf {$filename} ./administrator/backups/index.html");
            exec($_CONFIG[tarpath] . " -" . $_CONFIG['tarcompress'] . "vf {$filename} --update ./administrator/backups/database-sql.sql");
            exec($_CONFIG[tarpath] . " -" . $_CONFIG['tarcompress'] . "vf {$filename} --update ./administrator/backups/htaccess.txt");
            exec($_CONFIG[tarpath] . " -" . $_CONFIG['tarcompress'] . "vf {$filename} --update ./administrator/backups/perm.txt");
            if (file_exists($filename)) {
                echo "Backup {$filename} created, we may continue!<br />";
                #echo "Database backup: ".$databaseResult."<br />" ;
                echo "<a href='index2.php?option=com_cloner&lines=" . $perm_lines . "&task=refresh&backup={$filename}&excl_manual={$excl_manual}'>Please click here to continue!</a>";
                return;
            } else {
                E_print("Backup failed, please check your tar server utility support!");
                return;
            }
            return;
        }
        if ($_REQUEST[cron_dbonly] != 1) {
            exec($_CONFIG[tarpath] . " {$excl_cmd} " . " -X " . $_CONFIG['exfile_tar'] . "  -chv" . $_CONFIG['tarcompress'] . "f {$filename} ./");
        } else {
            exec($_CONFIG[tarpath] . "  -" . $_CONFIG['tarcompress'] . "cvf {$filename} ./administrator/backups/database-sql.sql");
            if (is_array($databases_incl)) {
                foreach ($databases_incl as $database_name) {
                    if ($database_name != "") {
                        exec($_CONFIG[tarpath] . "  -" . $_CONFIG['tarcompress'] . "vf {$filename} --update  ./administrator/backups/" . $database_name . "-sql.sql");
                    }
                }
            }
        }
        #######END
        chdir($_CONFIG['script_path']);
        #### END
    }
    if (!file_exists($filename)) {
        if ($_CONFIG[archive_type] == 1) {
            echo LM_MSG_BACK_12;
        } else {
            echo LM_MSG_BACK_13;
        }
        return;
    }
    # format the compressed size of the fileset
    $archiveSize = getFileSizeText(filesize($filename));
    # load presentation layer
    if ($option != 'nohtml') {
        HTML_cloner::generateBackup($filename1, $archiveSize, $originalSize, $mdir, $f, $databaseResult, $option);
    } else {
        logxx(HTML_cloner::generateBackup_text($filename1, $archiveSize, $originalSize, $mdir, $f, $databaseResult, $option));
    }
    if (is_array($databases_incl)) {
        foreach ($databases_incl as $database_name) {
            @unlink($_CONFIG['backups_dir'] . "/" . $database_name . "-sql.sql");
        }
    }
    @unlink($_CONFIG['backups_dir'] . "/database-sql.sql");
    @unlink($sql_file);
    @unlink($perm_file);
    @unlink($htaccess);
    @unlink($_CONFIG['exfile']);
    @unlink($_CONFIG['exfile_tar']);
    return $filename1;
}
Example #2
0
$_CONFIG['backups_dir'] = str_replace("//administrator", "/administrator", $_CONFIG['backup_path'] . "/administrator/backups");
$_CONFIG['backup_path'] = str_replace("\\", "/", $_CONFIG['backup_path']);
$_CONFIG['backups_dir'] = str_replace("\\", "/", $_CONFIG['backups_dir']);
$_CONFIG['exfile'] = $_CONFIG['backups_dir'] . "/.excl";
$_CONFIG['exfile_tar'] = $_CONFIG['backups_dir'] . "/.excl_tar";
$_CONFIG['logfile'] = $_CONFIG['backups_dir'] . "/xcloner.log";
$_CONFIG['commentsfile'] = $_CONFIG['backups_dir'] . "/.comments";
#$_REQUEST['backupComments']
$_CONFIG['script_path'] = str_replace("\\", "/", dirname(__FILE__));
$lang_dir = __DIR__ . "/language/";
$task = $_REQUEST['task'];
####################################
if ($_CONFIG['enable_db_backup']) {
    ### Connecting to the mysql server
    $link = @mysql_connect($_CONFIG['mysql_host'], $_CONFIG['mysql_user'], $_CONFIG['mysql_pass']) or E_print("Could not connect: " . mysql_error());
    @mysql_select_db($_CONFIG['mysql_database']) or E_print("Unable to select database " . $_CONFIG['mysql_database']);
    @mysql_query("SET NAMES 'utf8'");
}
### loading language
if ($_CONFIG['select_lang'] != "") {
    $mosConfig_lang = $_CONFIG['select_lang'];
}
if (file_exists($lang_dir . $mosConfig_lang . ".php")) {
    include_once $lang_dir . $mosConfig_lang . ".php";
    @(include_once $lang_dir . "english.php");
} else {
    include_once "language/english.php";
}
$version = str_replace(".", "", phpversion());
if (version_compare(PHP_VERSION, '5.2.3') < 0) {
    $_CONFIG['refresh_mode'] = "0";
    function goRefreshHtml($filename, $perm_lines, $excl_manual)
    {
        global $_CONFIG;
        $f = pathinfo($filename);
        $backupFile = $f['basename'];
        if (file_exists($filename)) {
            echo "<h2>Initializing backup...</h2>";
            echo "<h3 >Backup <b>{$filename}</b> created, we may continue!</h3><br />";
            $urlReturn = "index2.php?option=com_cloner&lines=" . $perm_lines . "&task=refresh&backup={$backupFile}&excl_manual={$excl_manual}";
            if (!$_CONFIG['refresh_mode']) {
                echo "<a href=\"" . $urlReturn . "\" id='cLink'>Please click here to continue!</a>";
                echo " <strong id='countdown'>5</strong>";
                echo "<script type='text/javascript'>cLink_load();</script>";
            } else {
                echo "<script>var dbbackup = " . intval($_REQUEST['dbbackup']) . ";</script>";
                ?>
				<!--Start ProgressBar-->
				<script type="text/javascript">

				$(document).ready(function() {

					var globalUrl;
					var step = "r1";
					var count = 0;
					var counter = 0;
					var counter_old = 0;
					var completeSize = 0;
					var oldBackupName = "";
					var parts = 0;
					var oldSize = 0;

					$("#progressbar").progressbar({ value: 0 });

					$.ajaxSetup({
					"error":function(request, status, error) {
					//reset state here;
						$("#error").show();
						$("#errorText").append(status+" -- "+error);
						$("#errorText").append("<br /><br />JSON url: "+globalUrl);
					}});

					function getSize(bytes, conv){

						return (parseInt(bytes)/parseInt(conv)).toFixed(2);

						}
					function appendIcon(icon){

						return '<span class="ui-icon ui-icon-'+icon+'" style="float:left;"></span>';

						}

					function xclonerRecurseMYSQL(url){
					// create database backup
						globalUrl = url;
						step = "r1";

						$.getJSON(url, function(json) {

						if(!json){
							$("#error").show();
							$("#errorText").text(url);
						}

						if(json.dumpsize && !json.endDump){
									$("#mysqlProcess").append(" ("+getSize(json.dumpsize, 1024*1024)+" MB) <br />");
								}

						if(json.newDump){
								count++;
								//$("#mysqlProcess").append(appendIcon("arrowthick-1-e"));
								if(json.databaseName!="")
									$("#mysqlProcess").append("<b>["+json.databaseName+"]</b> <span id='db"+count+"'></span> tables ");
								counter = parseInt(json.startAtLine);

						}else{
								$("#db"+count).text(json.startAtLine - counter);
							}

						if(!parseInt(json.finished)){
						//get next records

							$("#db"+count).text(json.startAtLine - counter);

							recurseUrl = "index2.php?task=recurse_database&nohtml=1&dbbackup_comp="+json.dbbackup_comp+"&dbbackup_drop="+json.dbbackup_drop+"&startAtLine="+json.startAtLine+"&startAtRecord="+json.startAtRecord+"&dumpfile="+json.dumpfile;
							xclonerRecurseMYSQL(recurseUrl);

							}
						else{

							$("#fileSystem").show();
							var recurseUrl="index2.php?task=recurse_files&mode=start&nohtml=1";
							xclonerRecurseJSON(recurseUrl);

							}


						});
					}

					function xclonerRecurseJSON(url){
					//scan file system
						$("#result").hide();

						globalUrl = url;
						step = "r2";

						$.getJSON(url, function(json) {

						if(!json){
							$("#error").show();
							$("#errorText").text(url);
						}

						if(!parseInt(json.finished)){

							$("#recurseStatus").text(json.tfiles);

							var recurseUrl = "index2.php?task=recurse_files&mode="+json.mode+"&nohtml=1";
							xclonerRecurseJSON(recurseUrl);

							}
						else{
							var size = parseFloat(json.size)/(1024*1024);
							$("#recurseStatus").text(" done! (Estimated size:"+size.toFixed(2)+"MB) in "+json.tfiles+" files");
							$("#result").show();

							if(json.overlimit.length > 0){
								$("#overlimit").show();
								for(var i=0; i < json.overlimit.length; i++){

									$("#overlimit").append("<span class='oversizedFile'></span>"+json.overlimit[i]+"<br />");

									}
							}

							//xclonerGetJSON("<?php 
                echo $urlReturn;
                ?>
");
							returnUrl = "index2.php?option=com_cloner&lines="+json.tfiles+"&task=refresh&backup=<?php 
                echo $backupFile;
                ?>
&excl_manual=";
							xclonerGetJSON(returnUrl);

							}


						});
					}

					function xclonerGetJSON(url){
					//create backup archive
					globalUrl = url;
					step = "r3";

					$.getJSON(url, function(json) {

						if(!json){
							$("#error").show();
							$("#errorText").append(url);
						}

						var percent = parseInt(json.percent);
						$("#progressbar").progressbar({ value: percent });
						$("#backupSize").text(getSize(json.backupSize, 1024*1024));
						$("#nFiles").text(json.startf);
						$("#percent").text(json.percent);
						$("#backupName").text(json.backup);
						if(!json.finished){

							if(oldBackupName != json.backup){
								oldBackupName = json.backup;
								completeSize  = completeSize + oldSize;
								parts++;
							}else{
								oldSize = parseInt(json.backupSize);
								}

							var url = "index2.php?option="+json.option+"&task="+json.task+"&json="+json.json+"&startf="+json.startf+"&lines="+json.lines+"&backup="+json.backup+"&excl_manual="+json.excl_manual;
							xclonerGetJSON(url);
						}else{

							//all done
							url = "index2.php?task=cleanup&nohtml=1";
							$.getJSON(url, function(json) {
							});

							$("#complete").show();
							$("#nFiles").text(json.lines);
							if(parts > 0){
								$("#backupParts").show();
								$("#backupPartsNr").text(parts);
							}
							$("#backupFiles").text(json.lines);
							$("#backupSizeComplete").append(getSize(completeSize+parseInt(json.backupSize), 1024*1024));
							$("#backupNameC").text(json.backup);
							$( "#dialog:ui-dialog" ).dialog( "destroy" );
							$( "#dialog-message" ).dialog({
								modal: true,
								width: 600,
								buttons: {
									Close: function() {
										$( this ).dialog( "close" );
									}
								}
							});

						}

					});

					}

					//Main program here

					$("#retry").click(function(){
						$("#error").hide();
						$("#errorText").empty();
						if(step == "r1"){
							xclonerRecurseMYSQL(globalUrl);
						}
						else
						if(step == "r2"){
							xclonerRecurseJSON(globalUrl);
						}
						else if(step == "r3"){
							xclonerGetJSON(globalUrl);
						}
					});

					$("#result").hide();
					$("#fileSystem").hide();

					if(dbbackup){
						recurseUrl = "index2.php?task=recurse_database&nohtml=1&dbbackup_comp=<?php 
                echo $_REQUEST['dbbackup_comp'];
                ?>
&dbbackup_drop=<?php 
                echo $_REQUEST['dbbackup_drop'];
                ?>
";
						xclonerRecurseMYSQL(recurseUrl);
					}else{
						$("#fileSystem").show();
					    var recurseUrl="index2.php?task=recurse_files&mode=start&nohtml=1";
					    xclonerRecurseJSON(recurseUrl);

					}

				});
				</script>

				<?php 
                if ($_REQUEST['dbbackup']) {
                    //lets start the incremental procedure
                    ?>

				<div id="mysqlBackup">
					<h2>Database backup...</h2><br />
					<div id="mysqlProcess"></div><div id="counter"></div>
				</div>

				<?php 
                }
                ?>

				<div id="fileSystem">
					<h2>Filesystem backup...</h2>

					<div id="recurseFiles">
							<br /><strong>Scanning files system...</strong> <span id="recurseStatus"></span>
							<br /><div id="overlimit" style="display:none"><b>Excluded oversized files:</b><br /> </div>
					</div>

					<div id="result">
					<br /> <strong>Processing Files:</strong> <span id="percent">0</span>% (<span id="nFiles"></span> files)
					<br /><br /> <strong>Backup Name: </strong><span id="backupName"></span>
					<br /><br /> <strong>Backup Size: </strong><span id="backupSize"></span>MB
					<br /><br /> <div id="progressbar"></div>
					</div>

					<div id="complete">
						<br /><h2>Backup completed!</h2>

						<form action="index2.php" name="adminForm" method="post">
						<input type=hidden name=files[1] value='<?php 
                echo $backupFile;
                ?>
'>
						<input type=hidden name=cid[1] value='<?php 
                echo $backupFile;
                ?>
'>
						<input type="hidden" name="option" value="<?php 
                echo $option;
                ?>
"/>
						<input type="hidden" name="task" value=""/>
						</form>

						<div id="dialog-message" title="Backup completed">
							<p>
								<span class="ui-icon ui-icon-arrowthick-1-e" style="float:left;"></span>
								<strong>Backup name:</strong> <span id="backupNameC"></span>
							</p>
							<p>
								<span class="ui-icon ui-icon-arrowthick-1-e" style="float:left;"></span><strong>Backup size:</strong> <span id="backupSizeComplete"></span>MB
							</p>
							<p>
								<span class="ui-icon ui-icon-arrowthick-1-e" style="float:left;"></span><strong>Number of files:</strong> <span id="backupFiles"></span>
							</p>
							<p class="backupParts">
								<span class="ui-icon ui-icon-arrowthick-1-e" style="float:left;"></span><strong>Backup Parts:</strong> <span id="backupPartsNr"></span>
							</p>
						</div>

					</div>
				</div>

				<div id="error" style="display:none;">
					<br /><h2 style="color:Red"><?php 
                echo LM_REFRESH_ERROR;
                ?>
</h2>
					<br /><b>Details:</b> <span id="errorText"></span>
					<br /><br />
					<a href="#" id="retry"><h3>Click to Retry >></h3></a>

				</div>

				<!-- End ProgressBar -->

					  <?php 
            }
            return;
        } else {
            E_print("Backup failed, please check your tar server utility support!");
            return;
        }
    }
Example #4
0
$_CONFIG['logfile'] = $_CONFIG['backups_dir'] . "/xcloner.log";
$_CONFIG['commentsfile'] = $_CONFIG['backups_dir'] . "/.comments";
#$_REQUEST['backupComments']
$_CONFIG['script_path'] = str_replace("\\", "/", dirname(__FILE__));
$lang_dir = __XCLONERDIR__ . "/language";
$task = $_REQUEST['task'];
####################################
if (!class_exists("mysqli")) {
    E_print("mysqli php module is not supported, mysql backup will be disabled. Please reinstall or upgrade php to support the mysqli extension.");
    $_CONFIG['enable_db_backup'] = 0;
}
if ($_CONFIG['enable_db_backup'] and !$_REQUEST['nohtml']) {
    ### Connecting to the mysql server
    $_CONFIG['mysqli'] = new mysqli($_CONFIG['mysql_host'], $_CONFIG['mysql_user'], $_CONFIG['mysql_pass'], $_CONFIG['mysql_database']);
    if (mysqli_connect_errno()) {
        E_print("Connect failed: " . mysqli_connect_error());
        //exit();
        $_CONFIG['disable_mysql'] = 1;
        $_CONFIG['enable_db_backup'] = 0;
    } else {
        $_CONFIG['mysqli']->query("SET NAMES 'utf8'");
    }
}
### loading language
if ($_CONFIG['select_lang'] != "") {
    $mosConfig_lang = $_CONFIG['select_lang'];
}
if (file_exists(__XCLONERDIR__ . "/language/" . $mosConfig_lang . ".php")) {
    include_once __XCLONERDIR__ . "/language/" . $mosConfig_lang . ".php";
    @(include_once __XCLONERDIR__ . "/language/english.php");
} else {