Show download.php syntax highlighted
<?php
/*
Copyright Intermesh 2003
Author: Merijn Schering <mschering@intermesh.nl>
Version: 1.0 Release date: 08 July 2003
This program 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.
*/
require_once("../../Group-Office.php");
//load file management class
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('filesystem');
require_once($GO_CONFIG->class_path.'filesystem.class.inc');
$fs = new filesystem();
$path = smart_stripslashes($_REQUEST['path']);
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'download';
if(!$fs->is_sub_dir(dirname($path),$GO_CONFIG->file_storage_path))
{
exit('Forbidden');
}
if ($fs->has_read_permission($GO_SECURITY->user_id, $path) || $fs->has_write_permission($GO_SECURITY->user_id, $path))
{
$filename = basename($path);
$extension = get_extension($filename);
$browser = detect_browser();
header('Content-Length: '.filesize($path));
header('Expires: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Transfer-Encoding: binary');
if ($browser['name'] == 'MSIE')
{
header('Content-Type: application/download');
if($mode == 'download')
{
header('Content-Disposition: attachment; filename="'.$filename.'"');
}else
{
header('Content-Disposition: inline; filename="'.$filename.'"');
}
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
}else
{
if($mode == 'download')
{
header('Content-Type: application/download');
header('Content-Disposition: attachment; filename="'.$filename.'"');
}else
{
header('Content-Type: '.mime_content_type($path));
header('Content-Disposition: inline; filename="'.$filename.'"');
}
header('Pragma: no-cache');
}
$fd = fopen($path,'rb');
while (!feof($fd)) {
print fread($fd, 32768);
}
fclose($fd);
}else
{
header('Location: '.$GO_CONFIG->host.'error_docs/401.php');
exit();
}
See more files for this project here
Group-Office is a powerfull modular Internet/Intranet application framework. It features calendaring, project management, e-mail, tasks, addressbook, file management.
Project homepage:
http://sourceforge.net/projects/group-office
Programming language(s): JavaScript,Pascal,PHP
License: other
classes/
filesystem.class.inc
filesystem_list.class.inc
filesystem_treeview.class.inc
filesystem_view.class.inc
language/
bg.inc
ca.inc
cs.inc
da.inc
de.inc
en.inc
es.inc
fi.inc
fr.inc
he.inc
hu.inc
it.inc
ja.inc
nl.inc
no.inc
pt-br.inc
pt.inc
ru.inc
sl.inc
sv.inc
th.inc
tr.inc
zh-tw.inc
zh_TW_big5.inc
sql/
13.inc
14.inc
filesystem.install.sql
filesystem.uninstall.sql
filesystem.updates.inc
add_file.inc
compress.inc
download.php
edit.php
filesystem.admin.inc
filesystem.js
filesystem.settings.inc
index.php
jupload.php
link_upload.php
links.inc
listview.inc
module.info
new_folder.inc
overwrite.inc
properties.inc
search.inc
shares.inc
statuses.php
upload.inc