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_PA_INCLUDE.'classes/PhotoAlbum.class.php');
19 //validates if this is me/have the privilege to delete.
20 $pid = intval($_REQUEST['pid']);
21 $aid = intval($_REQUEST['aid']);
22 $comment_id = intval($_REQUEST['comment_id']);
25 $_pages[AT_PA_BASENAME.'albums.php?id='.$aid]['title'] = _AT('pa_albums');
26 $_pages[AT_PA_BASENAME.'albums.php?id='.$aid]['parent'] = AT_PA_BASENAME.'index.php';
27 //$_pages[AT_PA_BASENAME.'albums.php?id='.$aid]['children'] = array(AT_PA_BASENAME.'photo.php');
28 $_pages[AT_PA_BASENAME.'photo.php?pid='.$pid.SEP.'aid='.$aid]['title'] = _AT('pa_photo');
29 $_pages[AT_PA_BASENAME.'photo.php?pid='.$pid.SEP.'aid='.$aid]['parent'] = AT_PA_BASENAME.'albums.php?id='.$aid;
30 $_pages[AT_PA_BASENAME.'delete_comment.php']['parent'] = AT_PA_BASENAME.'photo.php?pid='.$pid.SEP.'aid='.$aid;
33 $pa = new PhotoAlbum($aid);
43 //owner of comments and album owner can delete comments.
44 if (!$pa->checkCommentPriv($comment_id, $_SESSION['member_id'], $isPhoto) &&
45 !$pa->checkAlbumPriv($_SESSION['member_id'])){
46 $msg->addError('ACCESS_DENIED');
47 header('Location: index.php');
51 if ($_POST['submit_no']) {
52 $msg->addFeedback('CANCELLED');
54 header('Location: photo.php?pid='.$pid.SEP.'aid='.$aid);
56 header('Location: albums.php?id='.$aid);
61 if ($_POST['submit_yes']) {
65 $pa->deleteComment($comment_id, false);
66 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
67 Header('Location: albums.php?id='.$aid);
70 $pa->deleteComment($comment_id, true);
71 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
72 Header('Location: photo.php?pid='.$pid.SEP.'aid='.$aid);
77 require(AT_INCLUDE_PATH.'header.inc.php');
79 $hidden_vars['comment_id'] = $comment_id;
80 $hidden_vars['aid'] = $aid;
81 $hidden_vars['pid'] = $pid;
84 $msg->addConfirm(array('PA_DELETE_COMMENT'), $hidden_vars);
87 require(AT_INCLUDE_PATH.'footer.inc.php');