wp/wp-content/plugins/wp-filemanager/incl/download.inc.php
changeset 14 00ac8f60d73f
parent 13 d255fe9cd479
child 15 3d4e9c994f10
equal deleted inserted replaced
13:d255fe9cd479 14:00ac8f60d73f
     1 <?php
       
     2 /*
       
     3 Logic has shifted to a different place all together this file can be deleted at later stage
       
     4 if ( ! defined( 'ABSPATH' ) )
       
     5 	die();
       
     6 if (!@include_once(WP_CONTENT_DIR . "/plugins/wp-filemanager/incl/auth.inc.php"))
       
     7  include_once(WP_CONTENT_DIR . "/plugins/wp-filemanager/incl/auth.inc.php");
       
     8 if ($AllowDownload)
       
     9 {
       
    10 if (isset($_GET['action']) && $_GET['action'] == "download")
       
    11 {
       
    12     session_cache_limiter("public, post-check=50");
       
    13 //    header("Cache-Control: private");
       
    14 //    echo "Download";
       
    15 }
       
    16 //echo "Download";
       
    17 if (isset($session_save_path)) 
       
    18 	session_save_path($session_save_path);
       
    19 if (isset($_GET['path'])) 
       
    20 	$wp_fileman_path = wp_fileman_validate_path($_GET['path']);
       
    21 if (!isset($wp_fileman_path)) 
       
    22 	$wp_fileman_path = FALSE;
       
    23 if ($wp_fileman_path == "./" || $wp_fileman_path == ".\\" || $wp_fileman_path == "/" || $wp_fileman_path == "\\") 
       
    24 	$wp_fileman_path = FALSE;
       
    25 if (isset($_GET['filename'])) 
       
    26 	$filename = basename(stripslashes($_GET['filename']));
       
    27 //echo "Download";
       
    28 if (isset($_GET['filename']) && isset($_GET['action']) && is_file($home_directory.$wp_fileman_path.$filename) || is_file("../../../".$home_directory.$wp_fileman_path.$filename)) 
       
    29 {
       
    30  //echo "file found";
       
    31   if (is_file($home_directory.$wp_fileman_path.$filename) && !strstr($home_directory, "./") && !strstr($home_directory, ".\\"))
       
    32    $fullpath = $home_directory.$wp_fileman_path.$filename;
       
    33   else if (is_file("../../../".$home_directory.$wp_fileman_path.$filename))
       
    34    $fullpath = "../../../".$home_directory.$wp_fileman_path.$filename;
       
    35 echo $fullpath;
       
    36   if (!$AllowDownload && $AllowView && !wp_fileman_is_viewable_file($filename))
       
    37   {
       
    38    print "<font color='#CC0000'>$StrAccessDenied</font>";
       
    39    exit();
       
    40   }
       
    41 
       
    42 //  header("Content-Type: ".get_mimetype($filename));
       
    43 //  header("Content-Length: ".filesize($fullpath));
       
    44 //  if ($_GET['action'] == "download");
       
    45   // header("Content-Disposition: attachment; filename=$filename");
       
    46 
       
    47 //  readfile($fullpath);
       
    48 }
       
    49   print "<table class='index' width=500 cellpadding=0 cellspacing=0>";
       
    50    print "<tr>";
       
    51     print "<td class='iheadline' height=21>";
       
    52      print "<font class='iheadline'>&nbsp;$StrDownload \"".htmlentities($filename)."\"</font>";
       
    53     print "</td>";
       
    54     print "<td class='iheadline' align='right' height=21>";
       
    55      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>";
       
    56     print "</td>";
       
    57    print "</tr>";
       
    58    print "<tr>";
       
    59     print "<td valign='top' colspan=2>";
       
    60      print "<center><br />";
       
    61       print "$StrDownloadClickLink<br /><br />";
       
    62       print "<a href='" . WP_CONTENT_URL . "/plugins/wp-filemanager/incl/libfile.php?".SID."&amp;path=".htmlentities(rawurlencode($wp_fileman_path))."&amp;filename=".htmlentities(rawurlencode($filename))."&amp;action=download'>$StrDownloadClickHere <i>\"".htmlentities($filename)."\"</i></a>";
       
    63      print "<br /><br /></center>";
       
    64      print "</td>";
       
    65    print "</tr>";
       
    66   print "</table>";
       
    67 }
       
    68 else
       
    69  print "<font color='#CC0000'>$StrAccessDenied</font>";
       
    70 */
       
    71 ?>