<?php
/****************************************************************************/
/* ATutor																	*/
/****************************************************************************/
/* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton	*/
/* Adaptive Technology Resource Centre / University of Toronto				*/
/* http://atutor.ca															*/
/*																			*/
/* This program is free software. You can redistribute it and/or			*/
/* modify it under the terms of the GNU General Public License				*/
/* as published by the Free Software Foundation.							*/
/****************************************************************************/
// $Id: delete.php 7541 2008-05-20 17:30:39Z greg $

define('AT_INCLUDE_PATH', '../../include/');
require(AT_INCLUDE_PATH.'vitals.inc.php');

authenticate(AT_PRIV_ADMIN); 

$_section[0][0] = _AT('tools');
$_section[0][1] = 'tools/';
$_section[1][0] = _AT('backup_manager');
$_section[1][1] = 'tools/backup/index.php';
$_section[2][0] = _AT('delete');


if (isset($_POST['submit_yes'])) {
	require(AT_INCLUDE_PATH.'classes/Backup/Backup.class.php');
	$Backup =& new Backup($db, $_SESSION['course_id']);
	$Backup->delete($_POST['backup_id']);
	$msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
	header('Location: index.php');
	exit;
}

else if (isset($_POST['submit_no'])) {
	$msg->addFeedback('CANCELLED');
	header('Location: index.php');
	exit;
}

require(AT_INCLUDE_PATH.'header.inc.php');

	$delete_backup = intval($_REQUEST['backup_id']);
	$sql = "SELECT * from ".TABLE_PREFIX."backups WHERE backup_id = '$delete_backup'";
	$result = mysql_query($sql, $db);


while ($row = mysql_fetch_assoc($result)){
	$title = $row['file_name'];
}
	$index['backup_id'] = $_GET['backup_id'];
	$msg->addConfirm(array('DELETE', $title ), $index);
	$msg->printConfirm();

require (AT_INCLUDE_PATH.'footer.inc.php');

?>