0
|
1 |
<?php |
|
2 |
if ( ! defined( 'ABSPATH' ) ) |
|
3 |
die(); |
|
4 |
if (!@include_once(WP_CONTENT_DIR . "/plugins/wp-filemanager/incl/auth.inc.php")) |
|
5 |
include_once(WP_CONTENT_DIR . "/plugins/wp-filemanager/incl/auth.inc.php"); |
|
6 |
include_once(WP_CONTENT_DIR . "/plugins/wp-filemanager/lang/$language.inc.php"); |
|
7 |
include_once(WP_CONTENT_DIR . "/plugins/wp-filemanager/incl/header.inc.php"); |
|
8 |
if ($AllowRename && isset($_GET['directory_name']) || $AllowRename && isset($_GET['filename']) || $AllowRename && isset($_POST['directory_name']) || $AllowRename && isset($_POST['filename'])) |
|
9 |
{ |
|
10 |
$filename = stripslashes($_GET['filename']); |
|
11 |
if (isset($_GET['rename']) && isset($_POST['directory_name'])) |
|
12 |
{ |
|
13 |
if (!wp_fileman_is_valid_name(substr($new_directory_name, 0, -1))) |
|
14 |
print "<font color='#CC0000'>$StrFolderInvalidName</font>"; |
|
15 |
else if (@file_exists($home_directory.$wp_fileman_path.$new_directory_name)) |
|
16 |
print "<font color='#CC0000'>$StrAlreadyExists</font>"; |
|
17 |
else if (@rename($home_directory.$wp_fileman_path.$directory_name, $home_directory.$wp_fileman_path.$new_directory_name)) |
|
18 |
print "<font color='#009900'>$StrRenameFolderSuccess</font>"; |
|
19 |
else |
|
20 |
{ |
|
21 |
print "<font color='#CC0000'>$StrRenameFolderFail</font><br /><br />"; |
|
22 |
print $StrRenameFolderFailHelp; |
|
23 |
} |
|
24 |
} |
|
25 |
|
|
26 |
else if (isset($_GET['rename']) && isset($_POST['filename'])) |
|
27 |
{ |
|
28 |
$filename = stripslashes($_POST['filename']); |
|
29 |
if (!wp_fileman_is_valid_name($new_filename)) |
|
30 |
print "<font color='#CC0000'>$StrFileInvalidName</font>"; |
|
31 |
else if (@file_exists($home_directory.$wp_fileman_path.$new_filename)) |
|
32 |
print "<font color='#CC0000'>$StrAlreadyExists</font>"; |
|
33 |
else if (@rename($home_directory.$wp_fileman_path.$filename, $home_directory.$wp_fileman_path.$new_filename)) |
|
34 |
print "<font color='#009900'>$StrRenameFileSuccess</font>"; |
|
35 |
else |
|
36 |
{ |
|
37 |
echo $home_directory.$wp_fileman_path.$filename; |
|
38 |
//print rename($home_directory.$wp_fileman_path.$filename, $home_directory.$wp_fileman_path.$new_filename); |
|
39 |
print "<font color='#CC0000'>$StrRenameFileFail</font><br /><br />"; |
|
40 |
print $StrRenameFileFailHelp; |
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
else |
|
45 |
{ |
|
46 |
print "<table class='index' width=350 cellpadding=0 cellspacing=0 border=0>"; |
|
47 |
print "<tr>"; |
|
48 |
print "<td class='iheadline' height=21>"; |
|
49 |
if (isset($_GET['directory_name'])) print "<font class='iheadline'> $StrRenameFolder \"".htmlentities(basename($directory_name))."\"</font>"; |
|
50 |
else if (isset($_GET['filename'])) print "<font class='iheadline'> $StrRenameFile \"".htmlentities(stripslashes($_GET['filename']))."\"</font>"; |
|
51 |
print "</td>"; |
|
52 |
print "<td class='iheadline' align='right' height=21>"; |
|
53 |
print "<font class='iheadline'><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/back.gif' border=0 alt='$StrBack'></a></font>"; |
|
54 |
print "</td>"; |
|
55 |
print "</tr>"; |
|
56 |
print "<tr>"; |
|
57 |
print "<td valign='top' colspan=2>"; |
|
58 |
|
|
59 |
print "<center><br />"; |
|
60 |
|
|
61 |
if (isset($_GET['directory_name'])) print "$StrRenameFolderQuestion<br /><br />"; |
|
62 |
else if (isset($_GET['filename'])) print "$StrRenameFileQuestion<br /><br />"; |
|
63 |
print "<form action='$base_url&output=rename&rename=true' method='post'>"; |
|
64 |
if (isset($_GET['directory_name'])) print "<input name='new_directory_name' value=\"".htmlentities(basename($directory_name))."\" size=40> "; |
|
65 |
else if (isset($_GET['filename'])) print "<input name='new_filename' value=\"".htmlentities(stripslashes($_GET['filename']))."\" size=40> "; |
|
66 |
print "<input class='bigbutton' type='submit' value='$StrRename'>"; |
|
67 |
if (isset($_GET['directory_name'])) print "<input type='hidden' name=directory_name value=\"".htmlentities($directory_name)."\">"; |
|
68 |
else if (isset($_GET['filename'])) print "<input type='hidden' name=filename value=\"".htmlentities(stripslashes($_GET['filename']))."\">"; |
|
69 |
print "<input type='hidden' name=path value=\"".htmlentities($wp_fileman_path)."\">"; |
|
70 |
print "</form>"; |
|
71 |
|
|
72 |
print "<br /><br /></center>"; |
|
73 |
|
|
74 |
print "</td>"; |
|
75 |
print "</tr>"; |
|
76 |
print "</table>"; |
|
77 |
} |
|
78 |
} |
|
79 |
else |
|
80 |
print "<font color='#CC0000'>$StrAccessDenied</font>"; |
|
81 |
|
|
82 |
?> |