move code up one directory
[atutor.git] / mods / _core / backups / upload.php
1 <?php
2 /****************************************************************************/
3 /* ATutor                                                                                                                                       */
4 /****************************************************************************/
5 /* Copyright (c) 2002-2010                                                  */
6 /* Inclusive Design Institute                                               */
7 /* http://atutor.ca                                                                                                                     */
8 /*                                                                                                                                                      */
9 /* This program is free software. You can redistribute it and/or                        */
10 /* modify it under the terms of the GNU General Public License                          */
11 /* as published by the Free Software Foundation.                                                        */
12 /****************************************************************************/
13 // $Id$
14
15 define('AT_INCLUDE_PATH', '../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 authenticate(AT_PRIV_ADMIN); 
18
19 $_SESSION['done'] = 0;
20
21 require(AT_INCLUDE_PATH.'../mods/_core/backups/classes/Backup.class.php');
22 $Backup = new Backup($db, $_SESSION['course_id']);
23
24 if (isset($_POST['cancel'])) {
25         $msg->addFeedback('CANCELLED');
26         header('Location: index.php');
27         exit;
28 } else if (isset($_POST['upload']) && ($Backup->getNumAvailable() < AT_COURSE_BACKUPS)) {
29         $Backup->upload($_FILES, $_POST['description']);
30
31         $_SESSION['done'] = 1;
32
33         if($msg->containsErrors()) {
34                 header('Location: upload.php');
35                 exit;
36         } else {
37                 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
38                 header('Location: index.php');
39                 exit;
40         }
41 }
42
43 require(AT_INCLUDE_PATH.'header.inc.php');
44
45 ?>
46
47
48
49 <script language="javascript" type="text/javascript">
50 function openWindow(page) {
51         newWindow = window.open(page, "progWin", "width=400,height=200,toolbar=no,location=no");
52         newWindow.focus();
53 }
54 </script>
55
56 <?php 
57 $savant->assign('Backup', $Backup);
58 $savant->display('instructor/backups/upload.tmpl.php');
59 require (AT_INCLUDE_PATH.'footer.inc.php');  ?>