blob: cccab6973b48c7925c3ce404ec9af29d1f3cd453 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
<?php
/**
*
* @author Nathan Guse (EXreaction) http://lithiumstudios.org
* @author David Lewis (Highway of Life) highwayoflife@gmail.com
* @package umil
* @version $Id$
* @copyright (c) 2008 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewtopic');
$file = request_var('file', '');
$filename = $phpbb_root_path . 'umil/error_files/' . $file . '.txt';
if ($user->data['user_type'] != USER_FOUNDER || // Only founders can access this.
!$file || // Do we have a file name?
strpos($file, '/') || strpos($file, '.')) // Make sure they are not attempting to grab files outside of the umil/error_files/ directory
{
header('HTTP/1.0 403 Forbidden');
trigger_error($user->lang['LINKAGE_FORBIDDEN']);
}
// Check if headers already sent or not able to get the file contents.
if (headers_sent() || !@file_exists($filename) || !@is_readable($filename))
{
// PHP track_errors setting On?
if (!empty($php_errormsg))
{
trigger_error($user->lang['UNABLE_TO_DELIVER_FILE'] . '<br />' . sprintf($user->lang['TRACKED_PHP_ERROR'], $php_errormsg));
}
trigger_error('UNABLE_TO_DELIVER_FILE');
}
header('Content-type: text/plain');
header('Content-Disposition: filename="' . $file . '.txt"');
$size = @filesize($filename);
if ($size)
{
header("Content-Length: $size");
}
$fp = @fopen($filename, 'rb');
if ($fp !== false)
{
while (!feof($fp))
{
echo fread($fp, 8192);
}
fclose($fp);
}
garbage_collection();
exit_handler();
?>
|