wp/wp-content/plugins/wp-filemanager/incl/view.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 ($AllowView && isset($_GET['filename']))
       
     8 {
       
     9  $filename = stripslashes($_GET['filename']);
       
    10 
       
    11  print "<table class='index' width=800 cellpadding=0 cellspacing=0>";
       
    12   print "<tr>";
       
    13    print "<td class='iheadline' height=21>";
       
    14     print "<font class='iheadline'>&nbsp;$StrViewing \"".htmlentities($filename)."\" $StrAt ".$_GET['size']."%</font>";
       
    15    print "</td>";
       
    16    print "<td class='iheadline' align='right' height=21>";
       
    17     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>";
       
    18    print "</td>";
       
    19   print "</tr>";
       
    20   print "<tr>";
       
    21    print "<td valign='top' colspan=2>";
       
    22 
       
    23    print "<center><br />";
       
    24 
       
    25     if (is_file($home_directory.$wp_fileman_path.$filename) && wp_fileman_is_viewable_file($filename))
       
    26     {
       
    27      $image_info = GetImageSize($home_directory.$wp_fileman_path.$filename);
       
    28      $size = $_GET['size'];
       
    29      $zoom_in = $ZoomArray[wp_fileman_get_current_zoom_level($size, 1)];
       
    30      $zoom_out = $ZoomArray[wp_fileman_get_current_zoom_level($size, -1)];
       
    31      $width = $image_info[0] * $size / 100;
       
    32      $height = $image_info[1] * $size / 100;
       
    33 
       
    34      $files = array();
       
    35      if ($open = @opendir($home_directory.$wp_fileman_path))
       
    36      {
       
    37       while ($file = @readdir($open))
       
    38        if (is_file($home_directory.$wp_fileman_path.$file) && wp_fileman_is_viewable_file($file))
       
    39         $files[] = $file;
       
    40       closedir($open);
       
    41       sort($files);
       
    42 
       
    43       if (count($files)>1)
       
    44       {
       
    45        for($i=0;$files[$i]!=$filename;$i++);
       
    46         if ($i==0) $prev = $files[$i+count($files)-1];
       
    47          else $prev = $files[$i-1];
       
    48           if ($i==(count($files)-1)) $next = $files[$i-count($files)+1];
       
    49            else $next = $files[$i+1];
       
    50       }
       
    51       else
       
    52       {
       
    53        $prev = $filename;
       
    54        $next = $filename;
       
    55       }
       
    56      }
       
    57 
       
    58      print "<table class='menu' cellpadding=2 cellspacing=0>";
       
    59       print "<tr>";
       
    60        print "<td align='center' valign='bottom'><a href='$base_url&amp;path=".htmlentities(rawurlencode($wp_fileman_path))."&amp;filename=".htmlentities(rawurlencode($filename))."&amp;action=view&amp;size=$zoom_in'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/plus.gif' width=11 height=11 border=0 alt='$StrZoomIn'>&nbsp;$StrZoomIn</a></td>";
       
    61        print "<td align='center' valign='bottom'><a href='$base_url&amp;path=".htmlentities(rawurlencode($wp_fileman_path))."&amp;filename=".htmlentities(rawurlencode($filename))."&amp;action=view&amp;size=$zoom_out'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/minus.gif' width=11 height=11 border=0 alt='$StrZoomOut'>&nbsp;$StrZoomOut</a></td>";
       
    62        print "<td align='center' valign='bottom'><a href='$base_url&amp;path=".htmlentities(rawurlencode($wp_fileman_path))."&amp;filename=".htmlentities(rawurlencode($filename))."&amp;action=view&amp;size=100'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/original.gif' width=11 height=11 border=0 alt='$StrOriginalSize'>&nbsp;$StrOriginalSize</a></td>";
       
    63        print "<td align='center' valign='bottom'><a href='$base_url&amp;path=".htmlentities(rawurlencode($wp_fileman_path))."&amp;filename=".htmlentities(rawurlencode($prev))."&amp;action=view&amp;size=$size'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/previous.gif' width=11 height=11 border=0 alt='$StrPrevious'>&nbsp;$StrPrevious</a></td>";
       
    64        print "<td align='center' valign='bottom'><a href='$base_url&amp;path=".htmlentities(rawurlencode($wp_fileman_path))."&amp;filename=".htmlentities(rawurlencode($next))."&amp;action=view&amp;size=$size'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/next.gif' width=11 height=11 border=0 alt='$StrNext'>&nbsp;$StrNext</a></td>";
       
    65       print "</tr>";
       
    66      print "</table><br />";
       
    67      //echo base
       
    68      //print "<img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/incl/libfile.php?path=".htmlentities(rawurlencode($wp_fileman_path))."&filename=".htmlentities(rawurlencode($filename))."&action=view' width='$width' height='$height' alt='$StrImage'>";
       
    69      if (is_file($home_directory.$wp_fileman_path.$filename))
       
    70 	$fullpath = $home_directory.$wp_fileman_path.$filename;
       
    71 	
       
    72      //$file_data=readfile($fullpath);
       
    73      print "<img src='data:".wp_fileman_get_mimetype($filename). ";base64," . base64_encode(@file_get_contents($fullpath)) . "' width='$width' height='$height' alt='$StrImage'>";
       
    74     }
       
    75     else
       
    76     {
       
    77      print "<font color='#CC0000'>$StrViewFail</font><br /><br />";
       
    78      print "$StrViewFailHelp";
       
    79     }
       
    80 
       
    81    print "<br /><br /></center>";
       
    82 
       
    83    print "</td>";
       
    84   print "</tr>";
       
    85  print "</table>";
       
    86 
       
    87  print "<input type='hidden' name='path' value=\"".htmlentities($wp_fileman_path)."\">";
       
    88 }
       
    89 else
       
    90  print "<font color='#CC0000'>$StrAccessDenied</font>";
       
    91 
       
    92 ?>