wp/wp-content/plugins/wp-filemanager/incl/view.inc.php
author ymh <ymh.work@gmail.com>
Wed, 06 Nov 2013 03:21:17 +0000
changeset 0 d970ebf37754
permissions -rw-r--r--
first import
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
if (!defined( 'ABSPATH' ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
	die();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
if (!@include_once(WP_CONTENT_DIR . "/plugins/wp-filemanager/incl/auth.inc.php"))
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 include_once(WP_CONTENT_DIR . "/plugins/wp-filemanager/incl/auth.inc.php");
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
if ($AllowView && isset($_GET['filename']))
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
{
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 $filename = stripslashes($_GET['filename']);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
 print "<table class='index' width=800 cellpadding=0 cellspacing=0>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
  print "<tr>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
   print "<td class='iheadline' height=21>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
    print "<font class='iheadline'>&nbsp;$StrViewing \"".htmlentities($filename)."\" $StrAt ".$_GET['size']."%</font>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
   print "</td>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
   print "<td class='iheadline' align='right' height=21>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    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>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
   print "</td>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
  print "</tr>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
  print "<tr>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
   print "<td valign='top' colspan=2>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
   print "<center><br />";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
    if (is_file($home_directory.$wp_fileman_path.$filename) && wp_fileman_is_viewable_file($filename))
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
    {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
     $image_info = GetImageSize($home_directory.$wp_fileman_path.$filename);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
     $size = $_GET['size'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
     $zoom_in = $ZoomArray[wp_fileman_get_current_zoom_level($size, 1)];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
     $zoom_out = $ZoomArray[wp_fileman_get_current_zoom_level($size, -1)];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
     $width = $image_info[0] * $size / 100;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
     $height = $image_info[1] * $size / 100;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
     $files = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
     if ($open = @opendir($home_directory.$wp_fileman_path))
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
     {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
      while ($file = @readdir($open))
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
       if (is_file($home_directory.$wp_fileman_path.$file) && wp_fileman_is_viewable_file($file))
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
        $files[] = $file;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
      closedir($open);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
      sort($files);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
      if (count($files)>1)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
      {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
       for($i=0;$files[$i]!=$filename;$i++);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
        if ($i==0) $prev = $files[$i+count($files)-1];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
         else $prev = $files[$i-1];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
          if ($i==(count($files)-1)) $next = $files[$i-count($files)+1];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
           else $next = $files[$i+1];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
      }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
      else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
      {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
       $prev = $filename;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
       $next = $filename;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
      }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
     }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
     print "<table class='menu' cellpadding=2 cellspacing=0>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
      print "<tr>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    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>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    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>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    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>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    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>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    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>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
      print "</tr>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
     print "</table><br />";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
     //echo base
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    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'>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
     if (is_file($home_directory.$wp_fileman_path.$filename))
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
	$fullpath = $home_directory.$wp_fileman_path.$filename;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
	
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
     //$file_data=readfile($fullpath);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
     print "<img src='data:".wp_fileman_get_mimetype($filename). ";base64," . base64_encode(@file_get_contents($fullpath)) . "' width='$width' height='$height' alt='$StrImage'>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
    }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
    else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
    {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
     print "<font color='#CC0000'>$StrViewFail</font><br /><br />";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
     print "$StrViewFailHelp";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
    }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
   print "<br /><br /></center>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
   print "</td>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
  print "</tr>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
 print "</table>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
 print "<input type='hidden' name='path' value=\"".htmlentities($wp_fileman_path)."\">";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
 print "<font color='#CC0000'>$StrAccessDenied</font>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
?>