move code up one directory
[atutor.git] / mods / _standard / photos / delete_album.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 $_user_location = 'public';
15
16 define('AT_INCLUDE_PATH', '../../../include/');
17 require (AT_INCLUDE_PATH.'vitals.inc.php');
18 include (AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');     //clr_dir()
19 //include (AT_INCLUDE_PATH.'lib/filemanager.inc.php');  //clr_dir()
20 include (AT_PA_INCLUDE.'lib.inc.php');  //album_filepath
21 include (AT_PA_INCLUDE.'classes/PhotoAlbum.class.php');
22
23 //validates if this is me/have the privilege to delete.
24 $id = intval($_REQUEST['id']);
25 $pa = new PhotoAlbum($id);
26 $info = $pa->getAlbumInfo();
27
28 if (!$pa->checkAlbumPriv($_SESSION['member_id'])){
29         $msg->addError('ACCESS_DENIED');
30         header('Location: index.php');
31         exit;
32 }
33
34 if ($_POST['submit_no']) {
35         $msg->addFeedback('CANCELLED');
36         Header('Location: index.php');
37         exit;
38 }
39
40 if ($_POST['submit_yes']) {
41         //delete
42         $pa->deleteAlbum();
43
44         $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
45
46         if($info['type_id']== AT_PA_TYPE_COURSE_ALBUM){
47                 Header('Location: course_albums.php');
48                 exit;
49         }else{
50                 Header('Location: index.php');
51                 exit;
52         }
53
54 }
55
56 require(AT_INCLUDE_PATH.'header.inc.php');
57
58 $hidden_vars['id'] = $id;
59 $msg->addConfirm(array('PA_DELETE_ALBUM', AT_print($info['name'], 'photo_albums.name')), $hidden_vars);
60 $msg->printConfirm();
61
62 require(AT_INCLUDE_PATH.'footer.inc.php');
63 ?>