Copyright (C) 2004-2006, Ryan Djurovich Website Baker is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Website Baker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Website Baker; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ require('../../config.php'); require(WB_PATH.'/framework/functions.php'); require(WB_PATH.'/framework/class.wb.php'); $file_id = ''; if(!isset($_GET['file']) OR !is_numeric($_GET['file'])) { header('Location: ../index.php'); } else { $file_id = (int) $_GET['file']; } $query_files = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_download_gallery_files WHERE file_id = '$file_id'"); $fetch_file = $query_files->fetchRow(); $query_page=$database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id='".$fetch_file['page_id']."'"); $page_info=$query_page->fetchRow(); $groups=explode(",",$page_info['viewing_groups']); if(($page_info['visibility'] == 'public' OR $page_info['visibility']=="hidden") OR ((isset($_SESSION['USER_ID']) AND $_SESSION['USER_ID'] != "" AND is_numeric($_SESSION['USER_ID']) ) AND ($page_info['visibility']=="registered" OR $page_info['visibility']=="private") AND in_array($_SESSION['GROUP_ID'],$groups) )){ $orgfile=WB_PATH.MEDIA_DIRECTORY."/".substr($fetch_file['link'],strpos($fetch_file['link'],"download_gallery")); $orgfile2=$fetch_file['link']; $mimetype=mime_content_type($orgfile); header('Content-type: $mimetype'); header('Content-Disposition: attachment; filename="'.$fetch_file['filename'].'"'); readfile($orgfile); exit; //header('Location: '.$orgfile2); } else { exit; } ?>