2 /***********************************************************************/
4 /***********************************************************************/
5 /* Copyright (c) 2002-2009 */
6 /* Adaptive Technology Resource Centre / Inclusive Design Institution */
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 /***********************************************************************/
14 $_user_location = 'public';
15 define('AT_INCLUDE_PATH', '../../include/');
16 require (AT_INCLUDE_PATH.'vitals.inc.php');
17 //include (AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); //clr_dir()
18 include (AT_INCLUDE_PATH.'lib/filemanager.inc.php'); //clr_dir()
19 include (AT_PA_INCLUDE.'lib.inc.php'); //album_filepath
20 include (AT_PA_INCLUDE.'classes/PhotoAlbum.class.php');
22 //validates if this is me/have the privilege to delete.
23 $pid = intval($_REQUEST['pid']);
24 $aid = intval($_REQUEST['aid']);
27 $_pages[AT_PA_BASENAME.'albums.php?id='.$aid]['title'] = _AT('pa_albums');
28 $_pages[AT_PA_BASENAME.'albums.php?id='.$aid]['parent'] = AT_PA_BASENAME.'index.php';
29 //$_pages[AT_PA_BASENAME.'albums.php?id='.$aid]['children'] = array(AT_PA_BASENAME.'photo.php');
30 $_pages[AT_PA_BASENAME.'photo.php?pid='.$pid.SEP.'aid='.$aid]['title'] = _AT('pa_photo');
31 $_pages[AT_PA_BASENAME.'photo.php?pid='.$pid.SEP.'aid='.$aid]['parent'] = AT_PA_BASENAME.'albums.php?id='.$aid;
32 $_pages[AT_PA_BASENAME.'delete_photo.php']['parent'] = AT_PA_BASENAME.'photo.php?pid='.$pid.SEP.'aid='.$aid;
36 $pa = new PhotoAlbum($aid);
38 if ($pid<1 || $aid <1){
39 $msg->addError('PA_PHOTO_NOT_FOUND'); //no such picture
40 header('Location: index.php');
42 } elseif (!$pa->checkPhotoPriv($pid, $_SESSION['member_id']) && !$pa->checkAlbumPriv($_SESSION['member_id'])){
43 $msg->addError('ACCESS_DENIED');
44 header('Location: albums.php?id='.$aid);
48 if ($_POST['submit_no']) {
49 $msg->addFeedback('CANCELLED');
50 Header('Location: photo.php?aid='.$aid.SEP.'pid='.$pid);
54 if ($_POST['submit_yes']) {
56 $pa->deletePhoto($pid);
58 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
59 header('Location: albums.php?id='.$aid);
63 require(AT_INCLUDE_PATH.'header.inc.php');
65 $hidden_vars['pid'] = $pid;
66 $hidden_vars['aid'] = $aid;
68 $msg->addConfirm(array('PA_DELETE_PHOTO'), $hidden_vars);
71 require(AT_INCLUDE_PATH.'footer.inc.php');