made a copy
[atutor.git] / tools / backup / delete.php
1 <?php\r
2 /****************************************************************************/\r
3 /* ATutor                                                                                                                                       */\r
4 /****************************************************************************/\r
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton        */\r
6 /* Adaptive Technology Resource Centre / University of Toronto                          */\r
7 /* http://atutor.ca                                                                                                                     */\r
8 /*                                                                                                                                                      */\r
9 /* This program is free software. You can redistribute it and/or                        */\r
10 /* modify it under the terms of the GNU General Public License                          */\r
11 /* as published by the Free Software Foundation.                                                        */\r
12 /****************************************************************************/\r
13 // $Id$\r
14 \r
15 define('AT_INCLUDE_PATH', '../../include/');\r
16 require(AT_INCLUDE_PATH.'vitals.inc.php');\r
17 \r
18 authenticate(AT_PRIV_ADMIN); \r
19 \r
20 $_section[0][0] = _AT('tools');\r
21 $_section[0][1] = 'tools/';\r
22 $_section[1][0] = _AT('backup_manager');\r
23 $_section[1][1] = 'tools/backup/index.php';\r
24 $_section[2][0] = _AT('delete');\r
25 \r
26 \r
27 if (isset($_POST['submit_yes'])) {\r
28         require(AT_INCLUDE_PATH.'classes/Backup/Backup.class.php');\r
29         $Backup = new Backup($db, $_SESSION['course_id']);\r
30         $Backup->delete($_POST['backup_id']);\r
31         $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');\r
32         header('Location: index.php');\r
33         exit;\r
34 }\r
35 \r
36 else if (isset($_POST['submit_no'])) {\r
37         $msg->addFeedback('CANCELLED');\r
38         header('Location: index.php');\r
39         exit;\r
40 }\r
41 \r
42 require(AT_INCLUDE_PATH.'header.inc.php');\r
43 \r
44         $delete_backup = intval($_REQUEST['backup_id']);\r
45         $sql = "SELECT * from ".TABLE_PREFIX."backups WHERE backup_id = '$delete_backup'";\r
46         $result = mysql_query($sql, $db);\r
47 \r
48 \r
49 while ($row = mysql_fetch_assoc($result)){\r
50         $title = $row['file_name'];\r
51 }\r
52         $index['backup_id'] = $_GET['backup_id'];\r
53         $msg->addConfirm(array('DELETE', $title ), $index);\r
54         $msg->printConfirm();\r
55 \r
56 require (AT_INCLUDE_PATH.'footer.inc.php');\r
57 \r
58 ?>