filemanager.inc.php

来自「phpcms2007很好的cms内容管理系统,操作方便」· PHP 代码 · 共 78 行

PHP
78
字号
<?php
defined('IN_PHPCMS') or exit('Access Denied');
if($_grade>0) showmessage($LANG['you_have_no_permission']);
include_once PHPCMS_ROOT.'/images/ext/ext.php';
include PHPCMS_ROOT.'/admin/filemanager.func.php';
@set_time_limit(0);

$submenu = array
(
	array($LANG['return_main_dir'], '?mod='.$mod.'&file='.$file.'&action=main'),
	array('PHPINFO()', '?mod='.$mod.'&file='.$file.'&action=phpinfo'),
);
$menu = adminmenu($LANG['online_filemanager'], $submenu);
if(!isset($forward)) $forward = '?mod=phpcms&file=database&action=main';
$action = $action ? $action : 'main';

$rootpath = str_replace("\\","/",PHPCMS_ROOT);

if(isset($newchangedir) && !empty($newchangedir))
{
	$newchangedir= str_replace("\\","/",$newchangedir);
	if($newchangedir[0] == '/'|| $newchangedir[0] == '.')
	{
		$dir = $newchangedir;
	}	
	else if(strlen($newchangedir)<strlen($rootpath))
	{
		$newchangedir = './';
		echo "<font color=red>".$LANG['illegal_directory']."</font>";
	}
	if(strpos($newchangedir,$rootpath)!= -1)
	{
		$newchangedir = str_replace($rootpath,'./',$newchangedir);
	}
	$dir = $newchangedir;
}
if (!isset($dir) or empty($dir))
{
	$dir = "./";
	$currentdir = getRelativePath($rootpath, $dir);
}
else $currentdir = getRelativePath($rootpath, $dir);
if(strlen($currentdir) < strlen($rootpath))
{
	$currentdir = $rootpath;
	$dir = './';
}
switch($action)
{
	case 'main':
		$writeable = is_writeable($currentdir) ? $LANG['writeable'] : $LANG['cannot_write'];
		$dirhandle = @opendir($dir);
		$dirnum = '0';
		$dirs = array();
		while ($f = @readdir($dirhandle)) {
			$fpath = "$dir/$f";
			$a = @is_dir($fpath);
			$r = array();
			if($a=="1"){
				if($f!=".." && $f!=".")
					{
						if (filectime($fpath) < filemtime($fpath))
						{
							$createtime = date("Y-m-d H:i:s",filectime($fpath));
							$modifytime = "<font color=\"red\">".date("Y-m-d H:i:s",filemtime($fpath))."</font>";					
						}
						else
						{
							$createtime = date("Y-m-d H:i:s",@filectime($fpath));
							$modifytime = date("Y-m-d H:i:s",@filemtime($fpath));					
						}			
						
						$dirperm = substr(base_convert(fileperms($fpath),10,8),-4);
						
						$r['createtime'] = $createtime;
						$r['modifytime'] = $modifytime;
						$r['dirperm'] = $dirperm;
						$r['size'] = '<鐩

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?