1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* osCommerce Online Merchant |
4
|
|
|
* |
5
|
|
|
* @copyright (c) 2016 osCommerce; https://www.oscommerce.com |
6
|
|
|
* @license MIT; https://www.oscommerce.com/license/mit.txt |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
use OSC\OM\FileSystem; |
10
|
|
|
use OSC\OM\HTML; |
11
|
|
|
use OSC\OM\OSCOM; |
12
|
|
|
|
13
|
|
|
require('includes/application_top.php'); |
14
|
|
|
|
15
|
|
|
function tep_opendir($path) { |
16
|
|
|
$path = rtrim($path, '/') . '/'; |
17
|
|
|
|
18
|
|
|
$exclude_array = array('.', '..', '.DS_Store', 'Thumbs.db'); |
19
|
|
|
|
20
|
|
|
$result = array(); |
21
|
|
|
|
22
|
|
|
if ($handle = opendir($path)) { |
23
|
|
|
while (false !== ($filename = readdir($handle))) { |
24
|
|
|
if (!in_array($filename, $exclude_array)) { |
25
|
|
|
$file = array('name' => $path . $filename, |
26
|
|
|
'is_dir' => is_dir($path . $filename), |
27
|
|
|
'writable' => FileSystem::isWritable($path . $filename)); |
28
|
|
|
|
29
|
|
|
$result[] = $file; |
30
|
|
|
|
31
|
|
|
if ($file['is_dir'] == true) { |
|
|
|
|
32
|
|
|
$result = array_merge($result, tep_opendir($path . $filename)); |
33
|
|
|
} |
34
|
|
|
} |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
closedir($handle); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
return $result; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
$whitelist_array = []; |
44
|
|
|
|
45
|
|
|
$Qwhitelist = $OSCOM_Db->get('sec_directory_whitelist', 'directory'); |
46
|
|
|
|
47
|
|
|
while ($Qwhitelist->fetch()) { |
48
|
|
|
$whitelist_array[] = $Qwhitelist->value('directory'); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
$admin_dir = basename(OSCOM::getConfig('dir_root')); |
52
|
|
|
|
53
|
|
|
if ($admin_dir != 'admin') { |
54
|
|
|
for ($i=0, $n=sizeof($whitelist_array); $i<$n; $i++) { |
55
|
|
|
if (substr($whitelist_array[$i], 0, 6) == 'admin/') { |
56
|
|
|
$whitelist_array[$i] = $admin_dir . substr($whitelist_array[$i], 5); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
require($oscTemplate->getFile('template_top.php')); |
62
|
|
|
?> |
63
|
|
|
|
64
|
|
|
<table border="0" width="100%" cellspacing="0" cellpadding="2"> |
65
|
|
|
<tr> |
66
|
|
|
<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> |
67
|
|
|
<tr> |
68
|
|
|
<td class="pageHeading"><?php echo OSCOM::getDef('heading_title'); ?></td> |
69
|
|
|
</tr> |
70
|
|
|
</table></td> |
71
|
|
|
</tr> |
72
|
|
|
<tr> |
73
|
|
|
<td><table border="0" width="100%" cellspacing="0" cellpadding="0"> |
74
|
|
|
<tr> |
75
|
|
|
<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> |
76
|
|
|
<tr class="dataTableHeadingRow"> |
77
|
|
|
<td class="dataTableHeadingContent"><?php echo OSCOM::getDef('table_heading_directories'); ?></td> |
78
|
|
|
<td class="dataTableHeadingContent" align="center"><?php echo OSCOM::getDef('table_heading_writable'); ?></td> |
79
|
|
|
<td class="dataTableHeadingContent" align="center"><?php echo OSCOM::getDef('table_heading_recommended'); ?></td> |
80
|
|
|
</tr> |
81
|
|
|
<?php |
82
|
|
|
foreach (tep_opendir(OSCOM::getConfig('dir_root', 'Shop')) as $file) { |
83
|
|
|
if ($file['is_dir']) { |
84
|
|
|
?> |
85
|
|
|
<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"> |
86
|
|
|
<td class="dataTableContent"><?php echo substr($file['name'], strlen(OSCOM::getConfig('dir_root', 'Shop'))); ?></td> |
87
|
|
|
<td class="dataTableContent" align="center"><?php echo HTML::image(OSCOM::linkImage('icons/' . (($file['writable'] == true) ? 'tick.gif' : 'cross.gif'))); ?></td> |
88
|
|
|
<td class="dataTableContent" align="center"><?php echo HTML::image(OSCOM::linkImage('icons/' . (in_array(substr($file['name'], strlen(OSCOM::getConfig('dir_root', 'Shop'))), $whitelist_array) ? 'tick.gif' : 'cross.gif'))); ?></td> |
89
|
|
|
</tr> |
90
|
|
|
<?php |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
?> |
94
|
|
|
<tr> |
95
|
|
|
<td colspan="3" class="smallText"><?php echo OSCOM::getDef('text_directory') . ' ' . OSCOM::getConfig('dir_root', 'Shop'); ?></td> |
96
|
|
|
</tr> |
97
|
|
|
</table></td> |
98
|
|
|
</tr> |
99
|
|
|
</table></td> |
100
|
|
|
</tr> |
101
|
|
|
</table> |
102
|
|
|
|
103
|
|
|
<?php |
104
|
|
|
require($oscTemplate->getFile('template_bottom.php')); |
105
|
|
|
require('includes/application_bottom.php'); |
106
|
|
|
?> |
107
|
|
|
|
When comparing two booleans, it is generally considered safer to use the strict comparison operator.