|
@@ -1,5 +1,5 @@ discard block |
|
|
block discarded – undo |
|
1
|
1
|
<?php |
|
2
|
|
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
|
2
|
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3
|
3
|
die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4
|
4
|
} |
|
5
|
5
|
if (!$modx->hasPermission('file_manager')) { |
|
@@ -9,15 +9,15 @@ discard block |
|
|
block discarded – undo |
|
9
|
9
|
$newToken = makeToken(); |
|
10
|
10
|
|
|
11
|
11
|
// settings |
|
12
|
|
-$theme_image_path = $modx->config['site_manager_url'] . 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
|
|
12
|
+$theme_image_path = $modx->config['site_manager_url'].'media/style/'.$modx->config['manager_theme'].'/images/'; |
|
13
|
13
|
$excludes = array( |
|
14
|
14
|
'.', |
|
15
|
15
|
'..', |
|
16
|
16
|
'.svn' |
|
17
|
17
|
); |
|
18
|
|
-$alias_suffix = (!empty($friendly_url_suffix)) ? ',' . ltrim($friendly_url_suffix, '.') : ''; |
|
19
|
|
-$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix); |
|
20
|
|
-$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix); |
|
|
18
|
+$alias_suffix = (!empty($friendly_url_suffix)) ? ','.ltrim($friendly_url_suffix, '.') : ''; |
|
|
19
|
+$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix); |
|
|
20
|
+$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix); |
|
21
|
21
|
$viewablefiles = explode(',', 'jpg,gif,png,ico'); |
|
22
|
22
|
|
|
23
|
23
|
$editablefiles = add_dot($editablefiles); |
|
@@ -30,31 +30,31 @@ discard block |
|
|
block discarded – undo |
|
30
|
30
|
{ |
|
31
|
31
|
*/ |
|
32
|
32
|
$protected_path[] = $modx->config['site_manager_path']; |
|
33
|
|
-$protected_path[] = $modx->config['base_path'] . 'temp/backup'; |
|
34
|
|
-$protected_path[] = $modx->config['base_path'] . 'assets/backup'; |
|
|
33
|
+$protected_path[] = $modx->config['base_path'].'temp/backup'; |
|
|
34
|
+$protected_path[] = $modx->config['base_path'].'assets/backup'; |
|
35
|
35
|
|
|
36
|
36
|
if (!$modx->hasPermission('save_plugin')) { |
|
37
|
|
- $protected_path[] = $modx->config['base_path'] . 'assets/plugins'; |
|
|
37
|
+ $protected_path[] = $modx->config['base_path'].'assets/plugins'; |
|
38
|
38
|
} |
|
39
|
39
|
if (!$modx->hasPermission('save_snippet')) { |
|
40
|
|
- $protected_path[] = $modx->config['base_path'] . 'assets/snippets'; |
|
|
40
|
+ $protected_path[] = $modx->config['base_path'].'assets/snippets'; |
|
41
|
41
|
} |
|
42
|
42
|
if (!$modx->hasPermission('save_template')) { |
|
43
|
|
- $protected_path[] = $modx->config['base_path'] . 'assets/templates'; |
|
|
43
|
+ $protected_path[] = $modx->config['base_path'].'assets/templates'; |
|
44
|
44
|
} |
|
45
|
45
|
if (!$modx->hasPermission('save_module')) { |
|
46
|
|
- $protected_path[] = $modx->config['base_path'] . 'assets/modules'; |
|
|
46
|
+ $protected_path[] = $modx->config['base_path'].'assets/modules'; |
|
47
|
47
|
} |
|
48
|
48
|
if (!$modx->hasPermission('empty_cache')) { |
|
49
|
|
- $protected_path[] = $modx->config['base_path'] . 'assets/cache'; |
|
|
49
|
+ $protected_path[] = $modx->config['base_path'].'assets/cache'; |
|
50
|
50
|
} |
|
51
|
51
|
if (!$modx->hasPermission('import_static')) { |
|
52
|
|
- $protected_path[] = $modx->config['base_path'] . 'temp/import'; |
|
53
|
|
- $protected_path[] = $modx->config['base_path'] . 'assets/import'; |
|
|
52
|
+ $protected_path[] = $modx->config['base_path'].'temp/import'; |
|
|
53
|
+ $protected_path[] = $modx->config['base_path'].'assets/import'; |
|
54
|
54
|
} |
|
55
|
55
|
if (!$modx->hasPermission('export_static')) { |
|
56
|
|
- $protected_path[] = $modx->config['base_path'] . 'temp/export'; |
|
57
|
|
- $protected_path[] = $modx->config['base_path'] . 'assets/export'; |
|
|
56
|
+ $protected_path[] = $modx->config['base_path'].'temp/export'; |
|
|
57
|
+ $protected_path[] = $modx->config['base_path'].'assets/export'; |
|
58
|
58
|
} |
|
59
|
59
|
/* |
|
60
|
60
|
} |
|
@@ -83,7 +83,7 @@ discard block |
|
|
block discarded – undo |
|
83
|
83
|
{ |
|
84
|
84
|
$count = count($array); |
|
85
|
85
|
for ($i = 0; $i < $count; $i++) { |
|
86
|
|
- $array[$i] = '.' . strtolower(trim($array[$i])); // add a dot :) |
|
|
86
|
+ $array[$i] = '.'.strtolower(trim($array[$i])); // add a dot :) |
|
87
|
87
|
} |
|
88
|
88
|
return $array; |
|
89
|
89
|
} |
|
@@ -108,15 +108,15 @@ discard block |
|
|
block discarded – undo |
|
108
|
108
|
$rw = realpath('../'); |
|
109
|
109
|
$webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf)); |
|
110
|
110
|
if (substr($webstart_path, 0, 1) == '/') { |
|
111
|
|
- $webstart_path = '..' . $webstart_path; |
|
|
111
|
+ $webstart_path = '..'.$webstart_path; |
|
112
|
112
|
} else { |
|
113
|
|
- $webstart_path = '../' . $webstart_path; |
|
|
113
|
+ $webstart_path = '../'.$webstart_path; |
|
114
|
114
|
} |
|
115
|
115
|
|
|
116
|
116
|
?> |
|
117
|
117
|
<script type="text/javascript"> |
|
118
|
118
|
|
|
119
|
|
- var current_path = '<?= $startpath;?>'; |
|
|
119
|
+ var current_path = '<?= $startpath; ?>'; |
|
120
|
120
|
|
|
121
|
121
|
function viewfile (url) |
|
122
|
122
|
{ |
|
@@ -152,7 +152,7 @@ discard block |
|
|
block discarded – undo |
|
152
|
152
|
function unzipFile (file) |
|
153
|
153
|
{ |
|
154
|
154
|
if (confirmUnzip()) { |
|
155
|
|
- window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>"; |
|
|
155
|
+ window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>"; |
|
156
|
156
|
return false; |
|
157
|
157
|
} |
|
158
|
158
|
} |
|
@@ -174,7 +174,7 @@ discard block |
|
|
block discarded – undo |
|
174
|
174
|
function deleteFolder (folder, status) |
|
175
|
175
|
{ |
|
176
|
176
|
if (confirmDeleteFolder(status)) { |
|
177
|
|
- window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>"; |
|
|
177
|
+ window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>"; |
|
178
|
178
|
return false; |
|
179
|
179
|
} |
|
180
|
180
|
} |
|
@@ -182,7 +182,7 @@ discard block |
|
|
block discarded – undo |
|
182
|
182
|
function deleteFile (file) |
|
183
|
183
|
{ |
|
184
|
184
|
if (confirmDelete()) { |
|
185
|
|
- window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>"; |
|
|
185
|
+ window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>"; |
|
186
|
186
|
return false; |
|
187
|
187
|
} |
|
188
|
188
|
} |
|
@@ -191,7 +191,7 @@ discard block |
|
|
block discarded – undo |
|
191
|
191
|
{ |
|
192
|
192
|
var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
|
193
|
193
|
if (newFilename !== null && newFilename !== file) { |
|
194
|
|
- window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
|
194
|
+ window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
195
|
195
|
} |
|
196
|
196
|
} |
|
197
|
197
|
|
|
@@ -199,7 +199,7 @@ discard block |
|
|
block discarded – undo |
|
199
|
199
|
{ |
|
200
|
200
|
var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir); |
|
201
|
201
|
if (newDirname !== null && newDirname !== dir) { |
|
202
|
|
- window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>"; |
|
|
202
|
+ window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>"; |
|
203
|
203
|
} |
|
204
|
204
|
} |
|
205
|
205
|
|
|
@@ -207,7 +207,7 @@ discard block |
|
|
block discarded – undo |
|
207
|
207
|
{ |
|
208
|
208
|
var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
|
209
|
209
|
if (newFilename !== null && newFilename !== file) { |
|
210
|
|
- window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
|
210
|
+ window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
211
|
211
|
} |
|
212
|
212
|
} |
|
213
|
213
|
|
|
@@ -226,7 +226,7 @@ discard block |
|
|
block discarded – undo |
|
226
|
226
|
<?php endif ?> |
|
227
|
227
|
<?php |
|
228
|
228
|
if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') { |
|
229
|
|
- $href = 'a=31&path=' . urlencode($_REQUEST['path']); |
|
|
229
|
+ $href = 'a=31&path='.urlencode($_REQUEST['path']); |
|
230
|
230
|
} else { |
|
231
|
231
|
$href = 'a=2'; |
|
232
|
232
|
} |
|
@@ -236,12 +236,12 @@ discard block |
|
|
block discarded – undo |
|
236
|
236
|
$tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>'; |
|
237
|
237
|
$ph['image'] = $_style['files_folder-open']; |
|
238
|
238
|
$ph['subject'] = $_lang['add_folder']; |
|
239
|
|
- $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name='; |
|
|
239
|
+ $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name='; |
|
240
|
240
|
$_ = parsePlaceholder($tpl, $ph); |
|
241
|
241
|
|
|
242
|
|
- $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>'; |
|
|
242
|
+ $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>'; |
|
243
|
243
|
$ph['image'] = $_style['files_page_html']; |
|
244
|
|
- $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name='; |
|
|
244
|
+ $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name='; |
|
245
|
245
|
$_ .= parsePlaceholder($tpl, $ph); |
|
246
|
246
|
echo $_; |
|
247
|
247
|
} |
|
@@ -271,12 +271,12 @@ discard block |
|
|
block discarded – undo |
|
271
|
271
|
$ph = array(); |
|
272
|
272
|
$ph['style_path'] = $theme_image_path; |
|
273
|
273
|
// To Top Level with folder icon to the left |
|
274
|
|
- if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) { |
|
275
|
|
- $ph['image'] = '' . $_style['files_top'] . ''; |
|
|
274
|
+ if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) { |
|
|
275
|
+ $ph['image'] = ''.$_style['files_top'].''; |
|
276
|
276
|
$ph['subject'] = '<span>Top</span>'; |
|
277
|
277
|
} else { |
|
278
|
|
- $ph['image'] = '' . $_style['files_top'] . ''; |
|
279
|
|
- $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/'; |
|
|
278
|
+ $ph['image'] = ''.$_style['files_top'].''; |
|
|
279
|
+ $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/'; |
|
280
|
280
|
} |
|
281
|
281
|
|
|
282
|
282
|
echo parsePlaceholder($tpl, $ph); |
|
@@ -293,12 +293,12 @@ discard block |
|
|
block discarded – undo |
|
293
|
293
|
if (empty($v)) { |
|
294
|
294
|
continue; |
|
295
|
295
|
} |
|
296
|
|
- $path .= rtrim($v, '/') . '/'; |
|
|
296
|
+ $path .= rtrim($v, '/').'/'; |
|
297
|
297
|
if (1 < $count) { |
|
298
|
|
- $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path); |
|
299
|
|
- $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>'; |
|
|
298
|
+ $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path); |
|
|
299
|
+ $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>'; |
|
300
|
300
|
} else { |
|
301
|
|
- $pieces[$i] = '<span>' . trim($v, '/') . '</span>'; |
|
|
301
|
+ $pieces[$i] = '<span>'.trim($v, '/').'</span>'; |
|
302
|
302
|
} |
|
303
|
303
|
$count--; |
|
304
|
304
|
} |
|
@@ -311,16 +311,16 @@ discard block |
|
|
block discarded – undo |
|
311
|
311
|
</div> |
|
312
|
312
|
<?php |
|
313
|
313
|
// check to see user isn't trying to move below the document_root |
|
314
|
|
- if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) { |
|
|
314
|
+ if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) { |
|
315
|
315
|
$modx->webAlertAndQuit($_lang["files_access_denied"]); |
|
316
|
316
|
} |
|
317
|
317
|
|
|
318
|
318
|
// Unzip .zip files - by Raymond |
|
319
|
319
|
if ($enablefileunzip && $_REQUEST['mode'] == 'unzip' && is_writable($startpath)) { |
|
320
|
|
- if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) { |
|
321
|
|
- echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />'; |
|
|
320
|
+ if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) { |
|
|
321
|
+ echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />'; |
|
322
|
322
|
} else { |
|
323
|
|
- echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />'; |
|
|
323
|
+ echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />'; |
|
324
|
324
|
} |
|
325
|
325
|
} |
|
326
|
326
|
// End Unzip - Raymond |
|
@@ -332,9 +332,9 @@ discard block |
|
|
block discarded – undo |
|
332
|
332
|
if ($_REQUEST['mode'] == 'deletefolder') { |
|
333
|
333
|
$folder = $_REQUEST['folderpath']; |
|
334
|
334
|
if (!$token_check || !@rrmdir($folder)) { |
|
335
|
|
- echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />'; |
|
|
335
|
+ echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />'; |
|
336
|
336
|
} else { |
|
337
|
|
- echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />'; |
|
|
337
|
+ echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />'; |
|
338
|
338
|
} |
|
339
|
339
|
} |
|
340
|
340
|
|
|
@@ -345,10 +345,10 @@ discard block |
|
|
block discarded – undo |
|
345
|
345
|
if (!mkdirs("{$startpath}/{$foldername}", 0777)) { |
|
346
|
346
|
echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
|
347
|
347
|
} else { |
|
348
|
|
- if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) { |
|
349
|
|
- echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />'; |
|
|
348
|
+ if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) { |
|
|
349
|
+ echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />'; |
|
350
|
350
|
} else { |
|
351
|
|
- echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />'; |
|
|
351
|
+ echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />'; |
|
352
|
352
|
} |
|
353
|
353
|
} |
|
354
|
354
|
umask($old_umask); |
|
@@ -360,7 +360,7 @@ discard block |
|
|
block discarded – undo |
|
360
|
360
|
$filename = $modx->db->escape($filename); |
|
361
|
361
|
|
|
362
|
362
|
if (!checkExtension($filename)) { |
|
363
|
|
- echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
|
363
|
+ echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
364
|
364
|
} elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) { |
|
365
|
365
|
echo $_lang['files.dynamic.php3']; |
|
366
|
366
|
} else { |
|
@@ -382,11 +382,11 @@ discard block |
|
|
block discarded – undo |
|
382
|
382
|
$newFilename = $modx->db->escape($newFilename); |
|
383
|
383
|
|
|
384
|
384
|
if (!checkExtension($newFilename)) { |
|
385
|
|
- echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
|
385
|
+ echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
386
|
386
|
} elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
|
387
|
387
|
echo $_lang['files.dynamic.php3']; |
|
388
|
388
|
} else { |
|
389
|
|
- if (!copy($filename, MODX_BASE_PATH . $newFilename)) { |
|
|
389
|
+ if (!copy($filename, MODX_BASE_PATH.$newFilename)) { |
|
390
|
390
|
echo $_lang['files.dynamic.php5']; |
|
391
|
391
|
} |
|
392
|
392
|
umask($old_umask); |
|
@@ -395,7 +395,7 @@ discard block |
|
|
block discarded – undo |
|
395
|
395
|
// Rename folder here |
|
396
|
396
|
if ($_REQUEST['mode'] == 'renameFolder') { |
|
397
|
397
|
$old_umask = umask(0); |
|
398
|
|
- $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname']; |
|
|
398
|
+ $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname']; |
|
399
|
399
|
$dirname = $modx->db->escape($dirname); |
|
400
|
400
|
$newDirname = str_replace(array( |
|
401
|
401
|
'..\\', |
|
@@ -407,7 +407,7 @@ discard block |
|
|
block discarded – undo |
|
407
|
407
|
|
|
408
|
408
|
if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) { |
|
409
|
409
|
echo $_lang['files.dynamic.php3']; |
|
410
|
|
- } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) { |
|
|
410
|
+ } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) { |
|
411
|
411
|
echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
|
412
|
412
|
} |
|
413
|
413
|
umask($old_umask); |
|
@@ -427,11 +427,11 @@ discard block |
|
|
block discarded – undo |
|
427
|
427
|
$newFilename = $modx->db->escape($newFilename); |
|
428
|
428
|
|
|
429
|
429
|
if (!checkExtension($newFilename)) { |
|
430
|
|
- echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
|
430
|
+ echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
431
|
431
|
} elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
|
432
|
432
|
echo $_lang['files.dynamic.php3']; |
|
433
|
433
|
} else { |
|
434
|
|
- if (!rename($filename, $path . '/' . $newFilename)) { |
|
|
434
|
+ if (!rename($filename, $path.'/'.$newFilename)) { |
|
435
|
435
|
echo $_lang['files.dynamic.php5']; |
|
436
|
436
|
} |
|
437
|
437
|
umask($old_umask); |
|
@@ -464,7 +464,7 @@ discard block |
|
|
block discarded – undo |
|
464
|
464
|
ls($startpath); |
|
465
|
465
|
echo "\n\n\n"; |
|
466
|
466
|
if ($folders == 0 && $files == 0) { |
|
467
|
|
- echo '<tr><td colspan="4"><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> ' . $_lang['files_directory_is_empty'] . ' </span></td></tr>'; |
|
|
467
|
+ echo '<tr><td colspan="4"><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> '.$_lang['files_directory_is_empty'].' </span></td></tr>'; |
|
468
|
468
|
} |
|
469
|
469
|
?> |
|
470
|
470
|
</table> |
|
@@ -473,10 +473,10 @@ discard block |
|
|
block discarded – undo |
|
473
|
473
|
<div class="container"> |
|
474
|
474
|
<p> |
|
475
|
475
|
<?php |
|
476
|
|
- echo $_lang['files_directories'] . ': <b>' . $folders . '</b> '; |
|
477
|
|
- echo $_lang['files_files'] . ': <b>' . $files . '</b> '; |
|
478
|
|
- echo $_lang['files_data'] . ': <b><span dir="ltr">' . $modx->nicesize($filesizes) . '</span></b> '; |
|
479
|
|
- echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>' |
|
|
476
|
+ echo $_lang['files_directories'].': <b>'.$folders.'</b> '; |
|
|
477
|
+ echo $_lang['files_files'].': <b>'.$files.'</b> '; |
|
|
478
|
+ echo $_lang['files_data'].': <b><span dir="ltr">'.$modx->nicesize($filesizes).'</span></b> '; |
|
|
479
|
+ echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>' |
|
480
|
480
|
?> |
|
481
|
481
|
</p> |
|
482
|
482
|
|
|
@@ -501,7 +501,7 @@ discard block |
|
|
block discarded – undo |
|
501
|
501
|
</form> |
|
502
|
502
|
<?php |
|
503
|
503
|
} else { |
|
504
|
|
- echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>"; |
|
|
504
|
+ echo "<p>".$_lang['files_upload_inhibited_msg']."</p>"; |
|
505
|
505
|
} |
|
506
|
506
|
?> |
|
507
|
507
|
<div id="imageviewer"></div> |
|
@@ -586,7 +586,7 @@ discard block |
|
|
block discarded – undo |
|
586
|
586
|
if ($file == $selFile) { |
|
587
|
587
|
$icon = isset($icons[$mode]) ? $icons[$mode] : $icons['default']; |
|
588
|
588
|
} |
|
589
|
|
- return '<i class="' . $icon . ' FilesPage"></i>'; |
|
|
589
|
+ return '<i class="'.$icon.' FilesPage"></i>'; |
|
590
|
590
|
} |
|
591
|
591
|
|
|
592
|
592
|
/** |
|
@@ -604,7 +604,7 @@ discard block |
|
|
block discarded – undo |
|
604
|
604
|
); |
|
605
|
605
|
if ($file == $selFile) { |
|
606
|
606
|
$class = isset($classNames[$mode]) ? $classNames[$mode] : $classNames['default']; |
|
607
|
|
- return ' class="' . $class . '"'; |
|
|
607
|
+ return ' class="'.$class.'"'; |
|
608
|
608
|
} |
|
609
|
609
|
return ''; |
|
610
|
610
|
} |
|
@@ -618,7 +618,7 @@ discard block |
|
|
block discarded – undo |
|
618
|
618
|
global $excludes, $protected_path, $editablefiles, $inlineviewablefiles, $viewablefiles, $enablefileunzip, $enablefiledownload, $uploadablefiles, $folders, $files, $filesizes, $len, $dirs_array, $files_array, $webstart_path, $modx; |
|
619
|
619
|
$dircounter = 0; |
|
620
|
620
|
$filecounter = 0; |
|
621
|
|
- $curpath = str_replace('//', '/', $curpath . '/'); |
|
|
621
|
+ $curpath = str_replace('//', '/', $curpath.'/'); |
|
622
|
622
|
|
|
623
|
623
|
if (!is_dir($curpath)) { |
|
624
|
624
|
echo 'Invalid path "', $curpath, '"<br />'; |
|
@@ -628,7 +628,7 @@ discard block |
|
|
block discarded – undo |
|
628
|
628
|
|
|
629
|
629
|
// first, get info |
|
630
|
630
|
foreach ($dir as $file) { |
|
631
|
|
- $newpath = $curpath . $file; |
|
|
631
|
+ $newpath = $curpath.$file; |
|
632
|
632
|
if ($file === '..' || $file === '.') { |
|
633
|
633
|
continue; |
|
634
|
634
|
} |
|
@@ -638,7 +638,7 @@ discard block |
|
|
block discarded – undo |
|
638
|
638
|
if ($file === '..' || $file === '.') { |
|
639
|
639
|
continue; |
|
640
|
640
|
} elseif (!in_array($file, $excludes) && !in_array($newpath, $protected_path)) { |
|
641
|
|
- $dirs_array[$dircounter]['text'] = '<i class="' . $_style['files_folder'] . ' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path=' . urlencode($newpath) . '"><b>' . $file . '</b></a>'; |
|
|
641
|
+ $dirs_array[$dircounter]['text'] = '<i class="'.$_style['files_folder'].' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path='.urlencode($newpath).'"><b>'.$file.'</b></a>'; |
|
642
|
642
|
|
|
643
|
643
|
$dfiles = scandir($newpath); |
|
644
|
644
|
foreach ($dfiles as $i => $infile) { |
|
@@ -651,13 +651,13 @@ discard block |
|
|
block discarded – undo |
|
651
|
651
|
} |
|
652
|
652
|
$file_exists = (0 < count($dfiles)) ? 'file_exists' : ''; |
|
653
|
653
|
|
|
654
|
|
- $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\'' . urlencode($file) . '\',\'' . $file_exists . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></a>' : ''; |
|
|
654
|
+ $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\''.urlencode($file).'\',\''.$file_exists.'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></a>' : ''; |
|
655
|
655
|
} else { |
|
656
|
|
- $dirs_array[$dircounter]['text'] = '<span><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> ' . $file . '</span>'; |
|
657
|
|
- $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></span>' : ''; |
|
|
656
|
+ $dirs_array[$dircounter]['text'] = '<span><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> '.$file.'</span>'; |
|
|
657
|
+ $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></span>' : ''; |
|
658
|
658
|
} |
|
659
|
659
|
|
|
660
|
|
- $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" title="' . $_lang['rename'] . '"></i></a> ' : ''; |
|
|
660
|
+ $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" title="'.$_lang['rename'].'"></i></a> ' : ''; |
|
661
|
661
|
|
|
662
|
662
|
// increment the counter |
|
663
|
663
|
$dircounter++; |
|
@@ -665,14 +665,14 @@ discard block |
|
|
block discarded – undo |
|
665
|
665
|
$type = getExtension($newpath); |
|
666
|
666
|
$files_array[$filecounter]['file'] = $newpath; |
|
667
|
667
|
$files_array[$filecounter]['stats'] = lstat($newpath); |
|
668
|
|
- $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']) . ' ' . $file; |
|
669
|
|
- $files_array[$filecounter]['view'] = (in_array($type, $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\'' . $webstart_path . substr($newpath, $len, strlen($newpath)) . '\');"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : (($enablefiledownload && in_array($type, $uploadablefiles)) ? '<a href="' . $webstart_path . implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, strlen($newpath))))) . '" style="cursor:pointer;"><i class="' . $_style['files_download'] . '" title="' . $_lang['file_download_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></span>'); |
|
670
|
|
- $files_array[$filecounter]['view'] = (in_array($type, $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path=' . urlencode($newpath) . '"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : $files_array[$filecounter]['view']; |
|
671
|
|
- $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_unzip'] . '" title="' . $_lang['file_download_unzip'] . '"></i></a>' : ''; |
|
672
|
|
- $files_array[$filecounter]['edit'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path=' . urlencode($newpath) . '#file_editfile"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></span>'; |
|
673
|
|
- $files_array[$filecounter]['duplicate'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_duplicate'] . '" title="' . $_lang['duplicate'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_duplicate'] . '" align="absmiddle" title="' . $_lang['duplicate'] . '"></i></span>'; |
|
674
|
|
- $files_array[$filecounter]['rename'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></span>'; |
|
675
|
|
- $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></span>'; |
|
|
668
|
+ $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']).' '.$file; |
|
|
669
|
+ $files_array[$filecounter]['view'] = (in_array($type, $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\''.$webstart_path.substr($newpath, $len, strlen($newpath)).'\');"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : (($enablefiledownload && in_array($type, $uploadablefiles)) ? '<a href="'.$webstart_path.implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, strlen($newpath))))).'" style="cursor:pointer;"><i class="'.$_style['files_download'].'" title="'.$_lang['file_download_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></span>'); |
|
|
670
|
+ $files_array[$filecounter]['view'] = (in_array($type, $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path='.urlencode($newpath).'"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : $files_array[$filecounter]['view']; |
|
|
671
|
+ $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\''.urlencode($file).'\');"><i class="'.$_style['files_unzip'].'" title="'.$_lang['file_download_unzip'].'"></i></a>' : ''; |
|
|
672
|
+ $files_array[$filecounter]['edit'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path='.urlencode($newpath).'#file_editfile"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></span>'; |
|
|
673
|
+ $files_array[$filecounter]['duplicate'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\''.urlencode($file).'\');"><i class="'.$_style['files_duplicate'].'" title="'.$_lang['duplicate'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_duplicate'].'" align="absmiddle" title="'.$_lang['duplicate'].'"></i></span>'; |
|
|
674
|
+ $files_array[$filecounter]['rename'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></span>'; |
|
|
675
|
+ $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\''.urlencode($file).'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></span>'; |
|
676
|
676
|
|
|
677
|
677
|
// increment the counter |
|
678
|
678
|
$filecounter++; |
|
@@ -685,9 +685,9 @@ discard block |
|
|
block discarded – undo |
|
685
|
685
|
for ($i = 0; $i < $folders; $i++) { |
|
686
|
686
|
$filesizes += $dirs_array[$i]['stats']['7']; |
|
687
|
687
|
echo '<tr>'; |
|
688
|
|
- echo '<td>' . $dirs_array[$i]['text'] . '</td>'; |
|
689
|
|
- echo '<td class="text-nowrap">' . $modx->toDateFormat($dirs_array[$i]['stats']['9']) . '</td>'; |
|
690
|
|
- echo '<td class="text-right">' . $modx->nicesize($dirs_array[$i]['stats']['7']) . '</td>'; |
|
|
688
|
+ echo '<td>'.$dirs_array[$i]['text'].'</td>'; |
|
|
689
|
+ echo '<td class="text-nowrap">'.$modx->toDateFormat($dirs_array[$i]['stats']['9']).'</td>'; |
|
|
690
|
+ echo '<td class="text-right">'.$modx->nicesize($dirs_array[$i]['stats']['7']).'</td>'; |
|
691
|
691
|
echo '<td class="actions text-right">'; |
|
692
|
692
|
echo $dirs_array[$i]['rename']; |
|
693
|
693
|
echo $dirs_array[$i]['delete']; |
|
@@ -700,10 +700,10 @@ discard block |
|
|
block discarded – undo |
|
700
|
700
|
sort($files_array); // sorting the array alphabetically (Thanks pxl8r!) |
|
701
|
701
|
for ($i = 0; $i < $files; $i++) { |
|
702
|
702
|
$filesizes += $files_array[$i]['stats']['7']; |
|
703
|
|
- echo '<tr ' . markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']) . '>'; |
|
704
|
|
- echo '<td>' . $files_array[$i]['text'] . '</td>'; |
|
705
|
|
- echo '<td class="text-nowrap">' . $modx->toDateFormat($files_array[$i]['stats']['9']) . '</td>'; |
|
706
|
|
- echo '<td class="text-right">' . $modx->nicesize($files_array[$i]['stats']['7']) . '</td>'; |
|
|
703
|
+ echo '<tr '.markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']).'>'; |
|
|
704
|
+ echo '<td>'.$files_array[$i]['text'].'</td>'; |
|
|
705
|
+ echo '<td class="text-nowrap">'.$modx->toDateFormat($files_array[$i]['stats']['9']).'</td>'; |
|
|
706
|
+ echo '<td class="text-right">'.$modx->nicesize($files_array[$i]['stats']['7']).'</td>'; |
|
707
|
707
|
echo '<td class="actions text-right">'; |
|
708
|
708
|
echo $files_array[$i]['unzip']; |
|
709
|
709
|
echo $files_array[$i]['view']; |
|
@@ -840,17 +840,17 @@ discard block |
|
|
block discarded – undo |
|
840
|
840
|
$zip = zip_open($file); |
|
841
|
841
|
if ($zip) { |
|
842
|
842
|
$old_umask = umask(0); |
|
843
|
|
- $path = rtrim($path, '/') . '/'; |
|
|
843
|
+ $path = rtrim($path, '/').'/'; |
|
844
|
844
|
while ($zip_entry = zip_read($zip)) { |
|
845
|
845
|
if (zip_entry_filesize($zip_entry) > 0) { |
|
846
|
846
|
// str_replace must be used under windows to convert "/" into "\" |
|
847
|
847
|
$zip_entry_name = zip_entry_name($zip_entry); |
|
848
|
|
- $complete_path = $path . str_replace('\\', '/', dirname($zip_entry_name)); |
|
849
|
|
- $complete_name = $path . str_replace('\\', '/', $zip_entry_name); |
|
|
848
|
+ $complete_path = $path.str_replace('\\', '/', dirname($zip_entry_name)); |
|
|
849
|
+ $complete_name = $path.str_replace('\\', '/', $zip_entry_name); |
|
850
|
850
|
if (!file_exists($complete_path)) { |
|
851
|
851
|
$tmp = ''; |
|
852
|
852
|
foreach (explode('/', $complete_path) AS $k) { |
|
853
|
|
- $tmp .= $k . '/'; |
|
|
853
|
+ $tmp .= $k.'/'; |
|
854
|
854
|
if (!is_dir($tmp)) { |
|
855
|
855
|
mkdir($tmp, 0777); |
|
856
|
856
|
} |
|
@@ -875,7 +875,7 @@ discard block |
|
|
block discarded – undo |
|
875
|
875
|
*/ |
|
876
|
876
|
function rrmdir($dir) |
|
877
|
877
|
{ |
|
878
|
|
- foreach (glob($dir . '/*') as $file) { |
|
|
878
|
+ foreach (glob($dir.'/*') as $file) { |
|
879
|
879
|
if (is_dir($file)) { |
|
880
|
880
|
rrmdir($file); |
|
881
|
881
|
} else { |
|
@@ -894,7 +894,7 @@ discard block |
|
|
block discarded – undo |
|
894
|
894
|
$msg = ''; |
|
895
|
895
|
foreach ($_FILES['userfile']['name'] as $i => $name) { |
|
896
|
896
|
if (empty($_FILES['userfile']['tmp_name'][$i])) continue; |
|
897
|
|
- $userfile= array(); |
|
|
897
|
+ $userfile = array(); |
|
898
|
898
|
|
|
899
|
899
|
$userfile['tmp_name'] = $_FILES['userfile']['tmp_name'][$i]; |
|
900
|
900
|
$userfile['error'] = $_FILES['userfile']['error'][$i]; |
|
@@ -911,12 +911,12 @@ discard block |
|
|
block discarded – undo |
|
911
|
911
|
$userfile['type'] = $_FILES['userfile']['type'][$i]; |
|
912
|
912
|
|
|
913
|
913
|
// this seems to be an upload action. |
|
914
|
|
- $path = $modx->config['site_url'] . substr($startpath, strlen($filemanager_path), strlen($startpath)); |
|
915
|
|
- $path = rtrim($path, '/') . '/' . $userfile['name']; |
|
|
914
|
+ $path = $modx->config['site_url'].substr($startpath, strlen($filemanager_path), strlen($startpath)); |
|
|
915
|
+ $path = rtrim($path, '/').'/'.$userfile['name']; |
|
916
|
916
|
$msg .= $path; |
|
917
|
917
|
if ($userfile['error'] == 0) { |
|
918
|
|
- $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="' . $path . '" height="75" />' : ''; |
|
919
|
|
- $msg .= "<p>" . $_lang['files_file_type'] . $userfile['type'] . ", " . $modx->nicesize(filesize($userfile['tmp_name'])) . $img . '</p>'; |
|
|
918
|
+ $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="'.$path.'" height="75" />' : ''; |
|
|
919
|
+ $msg .= "<p>".$_lang['files_file_type'].$userfile['type'].", ".$modx->nicesize(filesize($userfile['tmp_name'])).$img.'</p>'; |
|
920
|
920
|
} |
|
921
|
921
|
|
|
922
|
922
|
$userfilename = $userfile['tmp_name']; |
|
@@ -924,15 +924,15 @@ discard block |
|
|
block discarded – undo |
|
924
|
924
|
if (is_uploaded_file($userfilename)) { |
|
925
|
925
|
// file is uploaded file, process it! |
|
926
|
926
|
if (!checkExtension($userfile['name'])) { |
|
927
|
|
- $msg .= '<p><span class="warning">' . $_lang['files_filetype_notok'] . '</span></p>'; |
|
|
927
|
+ $msg .= '<p><span class="warning">'.$_lang['files_filetype_notok'].'</span></p>'; |
|
928
|
928
|
} else { |
|
929
|
|
- if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'] . '/' . $userfile['name'])) { |
|
|
929
|
+ if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'].'/'.$userfile['name'])) { |
|
930
|
930
|
// Ryan: Repair broken permissions issue with file manager |
|
931
|
931
|
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { |
|
932
|
|
- @chmod($_POST['path'] . "/" . $userfile['name'], $new_file_permissions); |
|
|
932
|
+ @chmod($_POST['path']."/".$userfile['name'], $new_file_permissions); |
|
933
|
933
|
} |
|
934
|
934
|
// Ryan: End |
|
935
|
|
- $msg .= '<p><span class="success">' . $_lang['files_upload_ok'] . '</span></p><hr/>'; |
|
|
935
|
+ $msg .= '<p><span class="success">'.$_lang['files_upload_ok'].'</span></p><hr/>'; |
|
936
|
936
|
|
|
937
|
937
|
// invoke OnFileManagerUpload event |
|
938
|
938
|
$modx->invokeEvent('OnFileManagerUpload', array( |
|
@@ -940,13 +940,13 @@ discard block |
|
|
block discarded – undo |
|
940
|
940
|
'filename' => $userfile['name'] |
|
941
|
941
|
)); |
|
942
|
942
|
// Log the change |
|
943
|
|
- logFileChange('upload', $_POST['path'] . '/' . $userfile['name']); |
|
|
943
|
+ logFileChange('upload', $_POST['path'].'/'.$userfile['name']); |
|
944
|
944
|
} else { |
|
945
|
|
- $msg .= '<p><span class="warning">' . $_lang['files_upload_copyfailed'] . '</span> ' . $_lang["files_upload_permissions_error"] . '</p>'; |
|
|
945
|
+ $msg .= '<p><span class="warning">'.$_lang['files_upload_copyfailed'].'</span> '.$_lang["files_upload_permissions_error"].'</p>'; |
|
946
|
946
|
} |
|
947
|
947
|
} |
|
948
|
948
|
} else { |
|
949
|
|
- $msg .= '<br /><span class="warning"><b>' . $_lang['files_upload_error'] . ':</b>'; |
|
|
949
|
+ $msg .= '<br /><span class="warning"><b>'.$_lang['files_upload_error'].':</b>'; |
|
950
|
950
|
switch ($userfile['error']) { |
|
951
|
951
|
case 0: //no error; possible file attack! |
|
952
|
952
|
$msg .= $_lang['files_upload_error0']; |
|
@@ -970,7 +970,7 @@ discard block |
|
|
block discarded – undo |
|
970
|
970
|
$msg .= '</span><br />'; |
|
971
|
971
|
} |
|
972
|
972
|
} |
|
973
|
|
- return $msg . '<br/>'; |
|
|
973
|
+ return $msg.'<br/>'; |
|
974
|
974
|
} |
|
975
|
975
|
|
|
976
|
976
|
/** |
|
@@ -986,9 +986,9 @@ discard block |
|
|
block discarded – undo |
|
986
|
986
|
|
|
987
|
987
|
// Write $content to our opened file. |
|
988
|
988
|
if (file_put_contents($filename, $content) === false) { |
|
989
|
|
- $msg .= '<span class="warning"><b>' . $_lang['file_not_saved'] . '</b></span><br /><br />'; |
|
|
989
|
+ $msg .= '<span class="warning"><b>'.$_lang['file_not_saved'].'</b></span><br /><br />'; |
|
990
|
990
|
} else { |
|
991
|
|
- $msg .= '<span class="success"><b>' . $_lang['file_saved'] . '</b></span><br /><br />'; |
|
|
991
|
+ $msg .= '<span class="success"><b>'.$_lang['file_saved'].'</b></span><br /><br />'; |
|
992
|
992
|
$_REQUEST['mode'] = 'edit'; |
|
993
|
993
|
} |
|
994
|
994
|
// Log the change |
|
@@ -1007,9 +1007,9 @@ discard block |
|
|
block discarded – undo |
|
1007
|
1007
|
|
|
1008
|
1008
|
$file = $_REQUEST['path']; |
|
1009
|
1009
|
if (!$token_check || !@unlink($file)) { |
|
1010
|
|
- $msg .= '<span class="warning"><b>' . $_lang['file_not_deleted'] . '</b></span><br /><br />'; |
|
|
1010
|
+ $msg .= '<span class="warning"><b>'.$_lang['file_not_deleted'].'</b></span><br /><br />'; |
|
1011
|
1011
|
} else { |
|
1012
|
|
- $msg .= '<span class="success"><b>' . $_lang['file_deleted'] . '</b></span><br /><br />'; |
|
|
1012
|
+ $msg .= '<span class="success"><b>'.$_lang['file_deleted'].'</b></span><br /><br />'; |
|
1013
|
1013
|
} |
|
1014
|
1014
|
|
|
1015
|
1015
|
// Log the change |