wp/wp-content/plugins/wp-filemanager/incl/upload.inc.php
changeset 0 d970ebf37754
equal deleted inserted replaced
-1:000000000000 0:d970ebf37754
       
     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 ($AllowUpload && isset($_GET['upload']))
       
     8 {
       
     9  print "<table cellspacing=0 cellpadding=0 class='upload'>";
       
    10 
       
    11  if (!isset($_FILES['userfile']))
       
    12   // maximum post size reached
       
    13   print $StrUploadFailPost;
       
    14  else
       
    15  {
       
    16   for($i=0;$i<count($_FILES['userfile']['tmp_name']);$i++)
       
    17   {
       
    18    $_FILES['userfile']['name'][$i] = stripslashes($_FILES['userfile']['name'][$i]);
       
    19 if (@move_uploaded_file($_FILES['userfile']['tmp_name'][$i], realpath($home_directory.$wp_fileman_path)."/".$_FILES['userfile']['name'][$i])) {
       
    20 print "<tr><td width='250'>$StrUploading ".$_FILES['userfile']['name'][$i]."</td><td width='50' align='center'>[<font color='#009900'>$StrUploadSuccess</font>]</td></tr>";
       
    21 $new_file = @realpath($home_directory.$wp_fileman_path).'/'.$_FILES['userfile']['name'][$i];
       
    22 $stat = @stat( dirname( $new_file ));
       
    23 $perms = $stat['mode'] & 0000666;
       
    24 @chmod( $new_file, $perms );
       
    25  } else if ($_FILES['userfile']['name'][$i])
       
    26    print "<tr><td width='250'>$StrUploading ".$_FILES['userfile']['name'][$i]."</td><td width='50' align='center'>[<font color='#CC0000'>$StrUploadFail</font>]</td></tr>";
       
    27  }
       
    28  }
       
    29  print "</table>";
       
    30 } 
       
    31 
       
    32 else if ($AllowUpload)
       
    33 {
       
    34  print "<table class='index' width=500 cellpadding=0 cellspacing=0>";
       
    35   print "<tr>";
       
    36    print "<td class='iheadline' height=21>";
       
    37     print "<font class='iheadline'>&nbsp;$StrUploadFilesTo \"/".htmlentities($wp_fileman_path)."\"</font>";
       
    38    print "</td>";
       
    39    print "<td class='iheadline' align='right' height=21>";
       
    40     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>";
       
    41    print "</td>";
       
    42   print "</tr>";
       
    43   print "<tr>";
       
    44    print "<td valign='top' colspan=2>";
       
    45 $max_upload = (int)(ini_get('upload_max_filesize'));
       
    46 $max_post = (int)(ini_get('post_max_size'));
       
    47 $memory_limit = (int)(ini_get('memory_limit'));
       
    48 $upload_mb = min($max_upload, $max_post, $memory_limit);
       
    49 $max_files = (int)(ini_get('max_file_uploads'));
       
    50 
       
    51 //	print "MAX UPload : $max_upload MB, MAX POST : $max_post MB, MEM LIMIT : $memory_limit MB";
       
    52 print "<br /><b>&nbsp;&nbsp;Maximum File Size Allowed : $upload_mb MB</b>";
       
    53 print "<br /><b>&nbsp;&nbsp;Maximum Number of Files Allowed : $max_files</b>";
       
    54 // FIXME : add link to howto on how to change the upload size.
       
    55     print "<center><br />";
       
    56 
       
    57 
       
    58     print "$StrUploadQuestion<br />";   
       
    59     print "<form action='$base_url&amp;output=upload&amp;upload=true' method='post' enctype='multipart/form-data'>";
       
    60 
       
    61     print "<table class='upload'>";
       
    62      print "<tr><td>$StrFirstFile</td><td><input type='file' name='userfile[]' size=30 multiple='multiple'></td></tr>";
       
    63        print "</table>";
       
    64 
       
    65     print "<input class='bigbutton' type='submit' value='$StrUpload'>";
       
    66     print "<input type='hidden' name=path value=\"".htmlentities($wp_fileman_path)."\">";
       
    67     print "</form>";
       
    68     print "<br /><br /></center>";
       
    69 
       
    70    print "</td>";
       
    71   print "</tr>";
       
    72  print "</table>";
       
    73 }
       
    74 else
       
    75  print "<font color='#CC0000'>$StrAccessDenied</font>";
       
    76 
       
    77 ?>