hf/kindEditor/file_manager_json.ashx

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<%@ webhandler Language="C#" class="FileManager" %>

/**
 * KindEditor ASP.NET
 *
 * 本ASP.NET程序是演示程序,建议不要直接在实际项目中使用。
 * 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
 *
 */

using System;
using System.Collections;
using System.Web;
using System.IO;
using System.Text.RegularExpressions;
using LitJson;
using System.Collections.Generic;

public class FileManager : IHttpHandler
{
	public void ProcessRequest(HttpContext context)
	{
		String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1);

		//根目录路径,相对路径
		String rootPath = "../attached/";
		//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
		String rootUrl = aspxUrl + "../attached/";
		//图片扩展名
		String fileTypes = "gif,jpg,jpeg,png,bmp";

		String currentPath = "";
		String currentUrl = "";
		String currentDirPath = "";
		String moveupDirPath = "";

		//根据path参数,设置各路径和URL
		String path = context.Request.QueryString["path"];
		path = String.IsNullOrEmpty(path) ? "" : path;
		if (path == "")
		{
			currentPath = context.Server.MapPath(rootPath);
			currentUrl = rootUrl;
			currentDirPath = "";
			moveupDirPath = "";
		}
		else
		{
			currentPath = context.Server.MapPath(rootPath) + path;
			currentUrl = rootUrl + path;
			currentDirPath = path;
			moveupDirPath = Regex.Replace(currentDirPath, @"(.*?)[^\/]+\/$", "$1");
		}

		//排序形式,name or size or type
		String order = context.Request.QueryString["order"];
		order = String.IsNullOrEmpty(order) ? "" : order.ToLower();

		//不允许使用..移动到上一级目录
		if (Regex.IsMatch(path, @"\.\."))
后面还有 153 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。