Location: PHPKode > projects > Basic Announce > Basic Announce Version 4.0/system/mod_backup.php
<?php
################################################################################
##              -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =-                 #
## --------------------------------------------------------------------------- #
##  ApPHP AdminPanel Pro                                                       #
##  Developed by:  ApPHP <hide@address.com>                                      #
##  License:       GNU LGPL v.3                                                #
##  Site:          http://www.apphp.com/php-adminpanel/                        #
##  Copyright:     ApPHP AdminPanel (c) 2006-2011. All rights reserved.        #
##                                                                             #
################################################################################

    // Initialize the session.
    session_start();
    
    require_once("../inc/classes/session.class.php");	
    require_once("../inc/checkAdminPagePermissions.php");
	
	require_once("../inc/functions.inc.php");
    require_once("../inc/config.inc.php");
    require_once("../inc/settings.inc.php");
	require_once("../inc/classes/backup.class.php");
	require_once("../inc/languages/".$SETTINGS['site_language'].".php");

	if(!module_istalled('backup')) redirect_to("access_denied.php");
    if(!page_access_allowed($_SERVER['SCRIPT_NAME'])) redirect_to("access_denied.php");

	ob_start();
	
	$submition_type = isset($_POST['submition_type']) ? $_POST['submition_type'] : "";
	$backup_file 	= isset($_POST['backup_file']) ? remove_bad_chars($_POST['backup_file'], "medium") : "";
	$st 			= isset($_GET['st']) ? $_GET['st'] : "";
	$fname 		    = isset($_GET['fname']) ? $_GET['fname'] : "";
	$msg            = draw_message("normal", lang('msg_bk_module_allows'), false, "100%", "../");;

	$objBackup = new Backup($db);
	
	if($submition_type == "1"){		
		// save backup
		if($objBackup->ExecuteBackup($backup_file)){
			$msg = draw_message("success", str_replace("_FILE_NAME_", $backup_file, lang('msg_bk_backup_was_created')), false, "100%", "../");
		}else{
			$msg = draw_message("error", $objBackup->error, false, "100%", "../");
		}		
	}else if($st == "delete"){
		// delete previouse backup		
		if($objBackup->DeleteBackup($fname)){
			$msg = draw_message("success", str_replace("_FILE_NAME_", $fname, lang('msg_bk_backup_was_deleted')), false, "100%", "../");
		}else{
			$msg = draw_message("error", $objBackup->error, false, "100%", "../");
		}
	}else if($st == "restore"){
		// restore previouse backup		
		if($objBackup->RestoreBackup($fname)){
			$msg = draw_message("success", str_replace("_FILE_NAME_", $fname, lang('msg_bk_backup_was_restored')), false, "100%", "../");
		}else{
			$msg = draw_message("error", $objBackup->error, false, "100%", "../");
		}
	}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title><?php echo $SETTINGS['site_name']; ?> :: <?php echo lang('admin_panel'); ?> :: <?php echo lang('backup'); ?></title>
    <meta http-equiv=Content-Type content="text/html; charset=utf-8">
    <link href="../styles/<?php echo $SETTINGS['css_style'];?>/style.css" type="text/css" rel="stylesheet">
	<script type="text/javascript">
		function btnSubmit_OnClick(){
			document.getElementById("btnSubmit").disabled = true;
			document.getElementById("frmBackup").submit();
		}		
		function btnSubmit_Activate(){
			document.getElementById("btnSubmit").disabled = false;
		}
	</script>
</head>

<body dir="<?php echo $SETTINGS['language_dir'];?>">
<?php echo page_breadcrumbs(); ?>
<br />
	<table align="center" width="800px" border="0" cellspacing="0" cellpadding="3" class="main_text">
	<tr valign="middle">
		<td colspan="2"><?php echo $msg; ?></td>
    </tr>    
	<tr valign="top">
		<td width="260px" align="right">
			<form id="frmBackup" class="panel_form" action="mod_backup.php" method="post">
			<input type="hidden" name="submition_type" value="1" />
			<table align="right" width="100%" border="0" cellspacing="0" cellpadding="3" class="main_text">
			<tr><td colspan="2">&nbsp;</td></tr>
			<tr>
				<td align="left" colspan="2"><b>Backup you site: </b></td>		
			</tr>
			<tr><td colspan="2">&nbsp;</td></tr>
			<tr>
				<td align="left" width="1%"><input type="text" name="backup_file" value="<?php echo @date("M-d-Y H:i:s");?>" size="24" maxlength="24" /></td>
				<td align="left"><input class="form_button" type="button" name="btnSubmit" disabled="disabled" id="btnSubmit" value="<?php echo lang('backup'); ?>" onclick="btnSubmit_OnClick()" /></td>
			</tr>
			</table>
			</form>
		</td>
		<td align="left">
			<table align="center" width="100%" border="0" cellspacing="0" cellpadding="3" class="main_text">
			<tr><td colspan="6">&nbsp;</td></tr>
			<tr>
				<td align="left" colspan="6"><b><?php echo lang('existing_backups'); ?>: </b></td>		
			</tr>
			<tr><td colspan="6">&nbsp;</td></tr>
			<?php
				$objBackup->ShowPreviouseBackups("delete,restore");
			?>
		</table>			
		</td>
	</tr>
	</table>
<br />
<?php
	if($submition_type == "1"){
		echo "<script type='text/javascript'>setTimeout('btnSubmit_Activate()', 1200); </script>";	
	}else{
		echo "<script type='text/javascript'>setTimeout('btnSubmit_Activate()', 500); </script>";	
	}
?>
<br />
</body>
</html>
<?php
	ob_end_flush();
?>
Return current item: Basic Announce