remove old readme
[atutor.git] / mods / _standard / photos / remove_uploaded_photo.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 define('AT_INCLUDE_PATH', '../../../include/');
15 require (AT_INCLUDE_PATH.'vitals.inc.php');
16 include (AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');     //clr_dir()
17 //include (AT_INCLUDE_PATH.'lib/filemanager.inc.php');  //clr_dir()
18 include (AT_PA_INCLUDE.'lib.inc.php');  //album_filepath
19 include (AT_PA_INCLUDE.'classes/PhotoAlbum.class.php');
20
21 //validates if this is me/have the privilege to delete.
22 $pid = intval($_GET['pid']);
23 $aid = intval($_GET['aid']);
24
25 //init
26 $pa = new PhotoAlbum($aid);
27
28 if ($pid<1 || $aid <1){
29         $msg->addError('PA_PHOTO_NOT_FOUND');   //no such picture
30         header('Location: index.php');
31         exit;
32 } elseif (!$pa->checkPhotoPriv($pid, $_SESSION['member_id'])){
33         $msg->addError('ACCESS_DENIED');        
34         header('Location: albums.php?id='.$aid);
35         exit;
36
37
38 if ($pa->deletePhoto($pid)){
39         header('HTTP/1.1 200 OK');
40 } else {
41         header('HTTP/1.1 500 Internal Server Error');
42 }
43 exit;
44 ?>