-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconf.php
More file actions
82 lines (68 loc) · 2.37 KB
/
conf.php
File metadata and controls
82 lines (68 loc) · 2.37 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
<?php
if(!isset($cfg))
{
$cfg = new StdClass();
}
$cfg->authentification_needed = true;
/* When Kams File Manager is used on online system, it must be set true.*/
$cfg->rootdir = dirname((__FILE__))."/content/upload";
/* Root directory for uploaded file. Use .htaccess file to protect this directory from executing PHP files.*/
$cfg->hiddendir = array();
/* File or directory under root directory to be hidden and forbidden to access it.*/
$cfg->rooturl = "content/upload";
/* Root url for uploaded file. It can be relative or absoulute.*/
$cfg->thumbnail = true;
/* Thumbnail for image files.*/
$cfg->thumbnail_quality = 75;
/* Quality for thumbnail image.*/
$cfg->thumbnail_max_size = 5000000;
/* Maximum file size to show with thumbnail */
$cfg->readonly = false;
/* Is user allowed to modify the file or the directory including upload, delete, or extract files.*/
$cfg->allow_upload_all_file = true;
/* Is user allowed to upload file beside image.*/
$cfg->allow_upload_image = true;
/* Is user allowed to upload images.*/
$cfg->cache_max_age_file = 3600; /* Maximum age for file thumbnail cache (in second) */
$cfg->cache_max_age_dir = 120; /* Maximum age for directory thumbnail cache (in second) */
$cfg->delete_forbidden_extension = true;
/* Delete forbidden files on upload, rename, copy, or extract operation */
$cfg->forbidden_extension = array();
/* Note
You can permit user to upload images but not other type for security reason.
You can add .htaccess file to prevent user executing PHP script but its location is not on {$cfg->rootdir}
For example:
Your root document of your system is
/home/youname/public_html
You set upload directory to
/home/yourname/public_html/upload
You can place an .htaccess file in
/home/youname/public_html
to redirect client access
*/
if(strlen(@$cfg->rootdir) && !file_exists($cfg->rootdir))
{
mkdir($cfg->rootdir);
}
$cfg->users = '';
$htpasswdPath = dirname(__FILE__)."/.htpasswd";
if(file_exists($htpasswdPath))
{
$cfg->users = '';
$row = file($htpasswdPath);
foreach($row as $idx=>$line)
{
$row[$idx] = trim($line, " \r\n\t ");
}
$cfg->users = implode("\r\n", $row);
}
else
{
$cfg->users = 'administrator:$apr1$ZlYfGv7V$0cAZNh8Si4WKBgY5H1mS1/';
file_put_contents($htpasswdPath, $cfg->users);
}
/*
0 = username
1 = password
2 = type of password (plain, md5, sha1)
*/