wp/wp-content/plugins/wp-filemanager/incl/create.inc.php
changeset 14 00ac8f60d73f
parent 13 d255fe9cd479
child 15 3d4e9c994f10
equal deleted inserted replaced
13:d255fe9cd479 14:00ac8f60d73f
     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 
       
     7 if ($AllowCreateFolder && isset($_GET['create']) && isset($_POST['directory_name']))
       
     8 {
       
     9  $umask = @umask(0);
       
    10  if (!wp_fileman_is_valid_name(stripslashes($_POST['directory_name'])))
       
    11   print "<font color='#CC0000'>$StrFolderInvalidName</font>";
       
    12  else if (file_exists($home_directory.$wp_fileman_path.stripslashes($_POST['directory_name']."/")))
       
    13   print "<font color='#CC0000'>$StrAlreadyExists</font>";
       
    14  else if (@mkdir($home_directory.$wp_fileman_path.stripslashes($_POST['directory_name']), 0777))
       
    15   print "<font color='#009900'>$StrCreateFolderSuccess</font>";
       
    16  else
       
    17  {
       
    18   print "<font color='#CC0000'>$StrCreateFolderFail</font><br /><br />";
       
    19   print $StrCreateFolderFailHelp;
       
    20  }
       
    21  @umask($umask);
       
    22 }
       
    23 
       
    24 else if ($AllowCreateFile && isset($_GET['create']) && isset($_POST['filename']))
       
    25 {
       
    26  if (!wp_fileman_is_valid_name(stripslashes($_POST['filename'])))
       
    27   print "<font color='#CC0000'>$StrFileInvalidName</font>";
       
    28  else if (file_exists($home_directory.$wp_fileman_path.stripslashes($_POST['filename'])))
       
    29   print "<font color='#CC0000'>$StrAlreadyExists</font>";
       
    30  else if (@fopen($home_directory.$wp_fileman_path.stripslashes($_POST['filename']), "w+"))
       
    31   print "<font color='#009900'>$StrCreateFileSuccess</font>";
       
    32  else
       
    33  {
       
    34   print "<font color='#CC0000'>$StrCreateFileFail</font><br /><br />";
       
    35   print $StrCreateFileFailHelp;
       
    36  }
       
    37 }
       
    38 
       
    39 else if ($AllowCreateFolder || $AllowCreateFile)
       
    40 {
       
    41  print "<table class='index' width=500 cellpadding=0 cellspacing=0>";
       
    42   print "<tr>";
       
    43    print "<td class='iheadline' height=21>";
       
    44     if ($_GET['type'] == "directory") print "<font class='iheadline'>&nbsp;$StrCreateFolder</font>";
       
    45     else if ($_GET['type'] == "file") print "<font class='iheadline'>&nbsp;$StrCreateFile</font>";
       
    46    print "</td>";
       
    47    print "<td class='iheadline' align='right' height=21>";
       
    48     print "<font class='iheadline'><a href='$base_url&amp;path=".htmlentities(rawurlencode($wp_fileman_path))."'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/back.gif' border=0 alt='$StrBack'></a></font>";
       
    49    print "</td>";
       
    50   print "</tr>";
       
    51   print "<tr>";
       
    52    print "<td valign='top' colspan=2>";
       
    53 
       
    54     print "<center><br />";
       
    55 
       
    56     if ($_GET['type'] == "directory") print "$StrCreateFolderQuestion<br /><br />";
       
    57     else if ($_GET['type'] == "file") print "$StrCreateFileQuestion<br /><br />";
       
    58     print "<form action='$base_url&amp;output=create&amp;create=true' method='post'>";
       
    59     if ($_GET['type'] == "directory") print "<input name='directory_name' size=40>&nbsp;";
       
    60     else if ($_GET['type'] == "file") print "<input name='filename' size=40>&nbsp;";
       
    61     print "<input class='bigbutton' type='submit' value='$StrCreate'>";
       
    62     print "<input type='hidden' name=path value=\"".htmlentities($wp_fileman_path)."\">";
       
    63     print "</form>";
       
    64 
       
    65     print "<br /><br /></center>";
       
    66 
       
    67    print "</td>";
       
    68   print "</tr>";
       
    69  print "</table>";
       
    70 }
       
    71 else
       
    72  print "<font color='#CC0000'>$StrAccessDenied</font>";
       
    73 
       
    74 ?>