2 /***********************************************************************/
4 /***********************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
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');
18 include (AT_PA_INCLUDE.'lib.inc.php');
20 $aid = intval($_GET['aid']);
21 $pid = intval($_GET['pid']);
22 if(isset($_POST['aid'])){
23 $aid = intval($_POST['aid']);
25 if(isset($_POST['pid'])){
26 $pid = intval($_POST['pid']);
30 $pa = new PhotoAlbum($aid);
33 if(!($pa->checkPhotoPriv($pid, $_SESSION['member_id']) || $pa->checkAlbumPriv($_SESSION['member_id']))){
34 $msg->addError("ACCESS_DENIED");
35 header('location: index.php');
42 $photos = array($pa->getPhotoInfo($pid));
44 $photos = $pa->getAlbumPhotos();
46 $album_info = $pa->getAlbumInfo();
50 $_pages[AT_PA_BASENAME.'albums.php?id='.$aid]['title'] = _AT('pa_albums') .' - '.$album_info['name'];
51 $_pages[AT_PA_BASENAME.'albums.php?id='.$aid]['parent'] = AT_PA_BASENAME.'index.php';
52 $_pages[AT_PA_BASENAME.'albums.php?id='.$aid]['children'] = array(
53 AT_PA_BASENAME.'edit_photos.php',
55 $_pages[AT_PA_BASENAME.'edit_photos.php']['parent'] = AT_PA_BASENAME.'albums.php?id='.$aid;
57 $_pages[AT_PA_BASENAME.'albums.php?id='.$aid]['parent'] = AT_PA_BASENAME.'index_admin.php';
62 if(isset($_GET['org'])){
63 $_custom_head .= '<script type="text/javascript" src="'.AT_PA_BASENAME.'include/imageReorderer.js"></script>';
64 //$_custom_css = $_base_path . AT_PA_BASENAME . 'module.css'; // use a custom stylesheet
66 $_pages[AT_PA_BASENAME.'edit_photos.php']['title'] = _AT('pa_organize_photos');
68 if (isset($_POST['submit'])){
69 foreach($photos as $index=>$photo_array){
70 $ordering = $_POST['image_'.$photo_array['id']];
72 $result = $pa->editPhotoOrder($photo_array['id'], $ordering);
74 $msg->addError('PA_EDIT_PHOTO_FAILED');
80 include (AT_INCLUDE_PATH.'header.inc.php');
81 $savant->assign('album_info', $album_info);
82 $savant->assign('photos', $photos);
83 $savant->display('photos/pa_organize_photos.tmpl.php');
84 include (AT_INCLUDE_PATH.'footer.inc.php');
88 //printer header iff this is not a POST request
89 //a hack to avoid 'header already sent...' error.
90 if (!isset($_POST['submit']) && !isset($_POST['cancel'])){
91 //$_custom_css = $_base_path . AT_PA_BASENAME . 'module.css'; // use a custom stylesheet
92 require(AT_INCLUDE_PATH.'header.inc.php');
95 require(AT_PA_INCLUDE.'edit_photos.inc.php');
96 require(AT_INCLUDE_PATH.'footer.inc.php');