forked from michalc/PDW-File-Browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.php
More file actions
208 lines (163 loc) · 6.22 KB
/
config.php
File metadata and controls
208 lines (163 loc) · 6.22 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?php
/*
PDW File Browser v1.3 beta
Date: October 19, 2010
Url: http://www.neele.name
Copyright (c) 2010 Guido Neele
*/
if(!isset($_SESSION)){ session_start();}
error_reporting(E_ALL);
/*
* UPLOAD PATH
*
* absolute path from root to upload folder (DON'T FORGET SLASHES)
*
* Example
* ---------------------------------------
* http://www.domain.com/images/upload/
* $uploadpath = '/images/upload/';
*
*/
$uploadpath = "/path/to/upload/folder/"; // absolute path from root to upload folder (DON'T FORGET SLASHES)
/*
* DEFAULT TIMEZONE
*
* If you use PHP 5 then set default timezone to avoid any date errors.
*
* Select the timezone you are in.
*
* Timezones to select from are http://nl3.php.net/manual/en/timezones.php
*
*/
//date_default_timezone_set('Europe/Amsterdam');
/*
* VIEW LAYOUT
*
* Set the default view layout when the file browser is first loaded
*
* Your options are: 'large_images', 'small_images', 'list', 'content', 'tiles' and 'details'
*
*/
$viewLayout = 'tiles';
/*
* DEFAULT LANGUAGE
*
* Set default language to load when &language=? is not included in url
*
* See lang directory for included languages. For now your options are 'en' and 'nl'
* But you are free to translate the language files in the /lang/ directory. Copy the
* en.php file and translate the lines after the =>
*
*/
$defaultLanguage = 'en';
/*
* ALLOWED ACTIONS
*
* Set an action to FALSE to prevent execution.
* Buttons will be removed from UI when an action is set to FALSE.
*
*/
$allowedActions = array(
'upload' => TRUE,
'settings' => TRUE,
'cut_paste' => TRUE,
'copy_paste' => TRUE,
'rename' => TRUE,
'delete' => TRUE,
'create_folder' => TRUE
);
/*
* PDW File Browser depends on $_SERVER['DOCUMENT_ROOT'] to resolve path/filenames. This value is usually
* correct, but has been known to be broken on some servers. This value allows you to override the default
* value.
* Do not modify from the auto-detect default value unless you are having problems.
*/
//define('DOCUMENTROOT', '/home/httpd/httpdocs');
//define('DOCUMENTROOT', 'c:\\webroot\\example.com\\www');
//define('DOCUMENTROOT', $_SERVER['DOCUMENT_ROOT']);
//define('DOCUMENTROOT', realpath((@$_SERVER['DOCUMENT_ROOT'] && file_exists(@$_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF'])) ? $_SERVER['DOCUMENT_ROOT'] : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace(DIRECTORY_SEPARATOR, '/', realpath('.')))));
define('DOCUMENTROOT', realpath((getenv('DOCUMENT_ROOT') && preg_match('#^'.preg_quote(realpath(getenv('DOCUMENT_ROOT'))).'#', realpath(__FILE__))) ? getenv('DOCUMENT_ROOT') : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace(DIRECTORY_SEPARATOR, '/', dirname(__FILE__)))));
/*
* CUSTOM FILTERS
*
* If you like to use custom filters then remove "//" to add your own filters.
* "name of filter" => ".extension1|.extension2"
*/
//$customFilters = array(
// "MS Office Documents (Custom filter)" => ".doc|.docx|.xsl|.xlsx|.ppt|.pptx",
// "PDF-Documents (Custom filter)" => ".pdf"
//);
/*
* DEFAULT SKIN
*
* Take a look inside the /skin/ folder to see which skins are available. If you leave the "//"
* then redmond (Windows 7 like) will be the default theme.
*/
//$defaultSkin="mountainview";
/*
* EDITOR
*
* Which editor are we dealing with? PDW File Browser can be used with TinyMCE and CKEditor.
*/
$editor = isset($_GET["editor"]) ? $_GET["editor"] : ''; // If you want to use the file browser for both editors and/or standalone
//$editor="tinymce";
//$editor="ckeditor";
//$editor="standalone";
/*
* UPLOAD SETTINGS
*
*/
// Maximum file size
$max_file_size_in_bytes = 1048576; // 1MB in bytes
// Characters allowed in the file name (in a Regular Expression format)
$valid_chars_regex = '.A-Z0-9_ !@#$%^&()+={}\[\]\',~`-';
// Allowed file extensions
// Remove an extension if you don't want to allow those files to be uploaded.
//$extension_whitelist = "7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip";
$extension_whitelist = "asf,avi,bmp,fla,flv,gif,jpeg,jpg,mov,mpeg,mpg,png,tif,tiff,wmv"; // Images, video and flash only
/*
* RETURN LINKS AS ABSOLUTE OR RELATIVE
*
* Ex. http://www.example.com/upload/file.jpg instead of /upload/file.jpg
*/
$absolute_url = FALSE; // When FALSE url will be returned relatieb, like /upload/file.jpg.
$absolute_url_disabled = FALSE; // When TRUE changing from absolute to relative is not possible.
//--------------------------DON'T EDIT BEYOND THIS LINE ----------------------------------
define('STARTINGPATH', DOCUMENTROOT . $uploadpath); //DON'T EDIT
//Check if upload folder exists
if(!@is_dir(STARTINGPATH)) die('Upload folder doesn\'t exist or $uploadpath in config.php is set wrong!');
//Check if editor is set
if(!isset($editor)) die('The variable $editor in config.php is not set!');
// Figure out which language file to load
if(!empty($_REQUEST['language'])) {
$language = $_REQUEST['language'];
} elseif (isset($_SESSION['language'])) {
$language = $_SESSION['language'];
} else {
$language = $defaultLanguage;
}
require_once("lang/".$language.".php");
$_SESSION['language'] = $language;
// Get local settings from language file
$datetimeFormat = $lang["datetime format"]; // 24 hours, AM/PM, etc...
$dec_seperator = $lang["decimal seperator"]; // character in front of the decimals
$thousands_separator = $lang["thousands separator"]; // character between every group of thousands
// Check post_max_size (http://us3.php.net/manual/en/features.file-upload.php#73762)
function let_to_num($v){ //This function transforms the php.ini notation for numbers (like '2M') to an integer (2*1024*1024 in this case)
$l = substr($v, -1);
$ret = substr($v, 0, -1);
switch(strtoupper($l)){
case 'P': $ret *= 1024;
case 'T': $ret *= 1024;
case 'G': $ret *= 1024;
case 'M': $ret *= 1024;
case 'K': $ret *= 1024;
break;
}
return $ret;
}
$max_upload_size = min(let_to_num(ini_get('post_max_size')), let_to_num(ini_get('upload_max_filesize')));
if ($max_file_size_in_bytes > $max_upload_size) {
$max_file_size_in_bytes = $max_upload_size;
}
?>