亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? connector.py

?? 論壇程序可以實現多人同時交流,jsp + mysql實現的 請大家多多交流
?? PY
?? 第 1 頁 / 共 2 頁
字號:
#!/usr/bin/env python

"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2007 Frederico Caldeira Knabben

== BEGIN LICENSE ==

Licensed under the terms of any of the following licenses at your
choice:

 - GNU General Public License Version 2 or later (the "GPL")
   http://www.gnu.org/licenses/gpl.html

 - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
   http://www.gnu.org/licenses/lgpl.html

 - Mozilla Public License Version 1.1 or later (the "MPL")
   http://www.mozilla.org/MPL/MPL-1.1.html

== END LICENSE ==

Connector for Python.

Tested With:
Standard:
	Python 2.3.3
Zope:
	Zope Version: (Zope 2.8.1-final, python 2.3.5, linux2)
	Python Version: 2.3.5 (#4, Mar 10 2005, 01:40:25)
		[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)]
	System Platform: linux2
"""

"""
Author Notes (04 December 2005):
This module has gone through quite a few phases of change.  Obviously,
I am only supporting that part of the code that I use.  Initially
I had the upload directory as a part of zope (ie. uploading files
directly into Zope), before realising that there were too many
complex intricacies within Zope to deal with.  Zope is one ugly piece
of code.  So I decided to complement Zope by an Apache server (which
I had running anyway, and doing nothing).  So I mapped all uploads
from an arbitrary server directory to an arbitrary web directory.
All the FCKeditor uploading occurred this way, and I didn't have to
stuff around with fiddling with Zope objects and the like (which are
terribly complex and something you don't want to do - trust me).

Maybe a Zope expert can touch up the Zope components.  In the end,
I had FCKeditor loaded in Zope (probably a bad idea as well), and
I replaced the connector.py with an alias to a server module.
Right now, all Zope components will simple remain as is because
I've had enough of Zope.

See notes right at the end of this file for how I aliased out of Zope.

Anyway, most of you probably wont use Zope, so things are pretty
simple in that regard.

Typically, SERVER_DIR is the root of WEB_DIR (not necessarily).
Most definitely, SERVER_USERFILES_DIR points to WEB_USERFILES_DIR.
"""

import cgi
import re
import os
import string

"""
escape

Converts the special characters '<', '>', and '&'.

RFC 1866 specifies that these characters be represented
in HTML as &lt; &gt; and &amp; respectively. In Python
1.5 we use the new string.replace() function for speed.
"""
def escape(text, replace=string.replace):
    text = replace(text, '&', '&amp;') # must be done 1st
    text = replace(text, '<', '&lt;')
    text = replace(text, '>', '&gt;')
    text = replace(text, '"', '&quot;')
    return text

"""
getFCKeditorConnector

Creates a new instance of an FCKeditorConnector, and runs it
"""
def getFCKeditorConnector(context=None):
	# Called from Zope.  Passes the context through
	connector = FCKeditorConnector(context=context)
	return connector.run()


"""
FCKeditorRequest

A wrapper around the request object
Can handle normal CGI request, or a Zope request
Extend as required
"""
class FCKeditorRequest(object):
	def __init__(self, context=None):
		if (context is not None):
			r = context.REQUEST
		else:
			r = cgi.FieldStorage()
		self.context = context
		self.request = r

	def isZope(self):
		if (self.context is not None):
			return True
		return False

	def has_key(self, key):
		return self.request.has_key(key)

	def get(self, key, default=None):
		value = None
		if (self.isZope()):
			value = self.request.get(key, default)
		else:
			if key in self.request.keys():
				value = self.request[key].value
			else:
				value = default
		return value

"""
FCKeditorConnector

The connector class
"""
class FCKeditorConnector(object):
	# Configuration for FCKEditor
	# can point to another server here, if linked correctly
	#WEB_HOST = "http://127.0.0.1/"
	WEB_HOST = ""
	SERVER_DIR = "/var/www/html/"

	WEB_USERFILES_FOLDER = WEB_HOST + "upload/"
	SERVER_USERFILES_FOLDER = SERVER_DIR + "upload/"

	# Allow access (Zope)
	__allow_access_to_unprotected_subobjects__ = 1
	# Class Attributes
	parentFolderRe = re.compile("[\/][^\/]+[\/]?$")

	"""
	Constructor
	"""
	def __init__(self, context=None):
		# The given root path will NOT be shown to the user
		# Only the userFilesPath will be shown

		# Instance Attributes
		self.context = context
		self.request = FCKeditorRequest(context=context)
		self.rootPath = self.SERVER_DIR
		self.userFilesFolder = self.SERVER_USERFILES_FOLDER
		self.webUserFilesFolder = self.WEB_USERFILES_FOLDER

		# Enables / Disables the connector
		self.enabled = False # Set to True to enable this connector

		# These are instance variables
		self.zopeRootContext = None
		self.zopeUploadContext = None

		# Copied from php module =)
		self.allowedExtensions = {
				"File": None,
				"Image": None,
				"Flash": None,
				"Media": None
				}
		self.deniedExtensions = {
				"File": [ "html","htm","php","php2","php3","php4","php5","phtml","pwml","inc","asp","aspx","ascx","jsp","cfm","cfc","pl","bat","exe","com","dll","vbs","js","reg","cgi","htaccess","asis","sh","shtml","shtm","phtm" ],
				"Image": [ "html","htm","php","php2","php3","php4","php5","phtml","pwml","inc","asp","aspx","ascx","jsp","cfm","cfc","pl","bat","exe","com","dll","vbs","js","reg","cgi","htaccess","asis","sh","shtml","shtm","phtm" ],
				"Flash": [ "html","htm","php","php2","php3","php4","php5","phtml","pwml","inc","asp","aspx","ascx","jsp","cfm","cfc","pl","bat","exe","com","dll","vbs","js","reg","cgi","htaccess","asis","sh","shtml","shtm","phtm" ],
				"Media": [ "html","htm","php","php2","php3","php4","php5","phtml","pwml","inc","asp","aspx","ascx","jsp","cfm","cfc","pl","bat","exe","com","dll","vbs","js","reg","cgi","htaccess","asis","sh","shtml","shtm","phtm" ]
				}

	"""
	Zope specific functions
	"""
	def isZope(self):
		# The context object is the zope object
		if (self.context is not None):
			return True
		return False

	def getZopeRootContext(self):
		if self.zopeRootContext is None:
			self.zopeRootContext = self.context.getPhysicalRoot()
		return self.zopeRootContext

	def getZopeUploadContext(self):
		if self.zopeUploadContext is None:
			folderNames = self.userFilesFolder.split("/")
			c = self.getZopeRootContext()
			for folderName in folderNames:
				if (folderName <> ""):
					c = c[folderName]
			self.zopeUploadContext = c
		return self.zopeUploadContext

	"""
	Generic manipulation functions
	"""
	def getUserFilesFolder(self):
		return self.userFilesFolder

	def getWebUserFilesFolder(self):
		return self.webUserFilesFolder

	def getAllowedExtensions(self, resourceType):
		return self.allowedExtensions[resourceType]

	def getDeniedExtensions(self, resourceType):
		return self.deniedExtensions[resourceType]

	def removeFromStart(self, string, char):
		return string.lstrip(char)

	def removeFromEnd(self, string, char):
		return string.rstrip(char)

	def convertToXmlAttribute(self, value):
		if (value is None):
			value = ""
		return escape(value)

	def convertToPath(self, path):
		if (path[-1] <> "/"):
			return path + "/"
		else:
			return path

	def getUrlFromPath(self, resourceType, path):
		if (resourceType is None) or (resourceType == ''):
			url = "%s%s" % (
					self.removeFromEnd(self.getUserFilesFolder(), '/'),
					path
					)
		else:
			url = "%s%s%s" % (
					self.getUserFilesFolder(),
					resourceType,
					path
					)
		return url

	def getWebUrlFromPath(self, resourceType, path):
		if (resourceType is None) or (resourceType == ''):
			url = "%s%s" % (
					self.removeFromEnd(self.getWebUserFilesFolder(), '/'),
					path
					)
		else:
			url = "%s%s%s" % (
					self.getWebUserFilesFolder(),
					resourceType,
					path
					)
		return url

	def removeExtension(self, fileName):
		index = fileName.rindex(".")
		newFileName = fileName[0:index]
		return newFileName

	def getExtension(self, fileName):
		index = fileName.rindex(".") + 1
		fileExtension = fileName[index:]
		return fileExtension

	def getParentFolder(self, folderPath):
		parentFolderPath = self.parentFolderRe.sub('', folderPath)
		return parentFolderPath

	"""
	serverMapFolder

	Purpose: works out the folder map on the server
	"""
	def serverMapFolder(self, resourceType, folderPath):
		# Get the resource type directory
		resourceTypeFolder = "%s%s/" % (
				self.getUserFilesFolder(),
				resourceType
				)
		# Ensure that the directory exists
		self.createServerFolder(resourceTypeFolder)

		# Return the resource type directory combined with the
		# required path
		return "%s%s" % (
				resourceTypeFolder,
				self.removeFromStart(folderPath, '/')
				)

	"""
	createServerFolder

	Purpose: physically creates a folder on the server
	"""
	def createServerFolder(self, folderPath):
		# Check if the parent exists
		parentFolderPath = self.getParentFolder(folderPath)
		if not(os.path.exists(parentFolderPath)):
			errorMsg = self.createServerFolder(parentFolderPath)
			if errorMsg is not None:
				return errorMsg
		# Check if this exists
		if not(os.path.exists(folderPath)):
			os.mkdir(folderPath)
			os.chmod(folderPath, 0755)
			errorMsg = None
		else:
			if os.path.isdir(folderPath):
				errorMsg = None
			else:
				raise "createServerFolder: Non-folder of same name already exists"
		return errorMsg


	"""
	getRootPath

	Purpose: returns the root path on the server
	"""
	def getRootPath(self):
		return self.rootPath

	"""
	setXmlHeaders

	Purpose: to prepare the headers for the xml to return
	"""
	def setXmlHeaders(self):
		#now = self.context.BS_get_now()
		#yesterday = now - 1
		self.setHeader("Content-Type", "text/xml")
		#self.setHeader("Expires", yesterday)
		#self.setHeader("Last-Modified", now)
		#self.setHeader("Cache-Control", "no-store, no-cache, must-revalidate")
		self.printHeaders()
		return

	def setHeader(self, key, value):
		if (self.isZope()):
			self.context.REQUEST.RESPONSE.setHeader(key, value)
		else:
			print "%s: %s" % (key, value)
		return

	def printHeaders(self):
		# For non-Zope requests, we need to print an empty line
		# to denote the end of headers
		if (not(self.isZope())):
			print ""

	"""
	createXmlFooter

	Purpose: returns the xml header
	"""
	def createXmlHeader(self, command, resourceType, currentFolder):
		self.setXmlHeaders()
		s = ""
		# Create the XML document header
		s += """<?xml version="1.0" encoding="utf-8" ?>"""
		# Create the main connector node
		s += """<Connector command="%s" resourceType="%s">""" % (
				command,
				resourceType
				)
		# Add the current folder node
		s += """<CurrentFolder path="%s" url="%s" />""" % (
				self.convertToXmlAttribute(currentFolder),
				self.convertToXmlAttribute(
					self.getWebUrlFromPath(
						resourceType,
						currentFolder
						)
					),
				)
		return s

	"""

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品在线一区二区| 精品久久久久久久人人人人传媒| 亚洲国产精品麻豆| 国产农村妇女毛片精品久久麻豆| 欧美日韩精品三区| 成人高清视频免费观看| 麻豆精品一区二区三区| 亚洲一区二三区| 国产精品久久久久久久久久久免费看 | 在线亚洲高清视频| 国产盗摄女厕一区二区三区| 日韩av不卡在线观看| 亚洲精品免费播放| 亚洲国产精品ⅴa在线观看| 欧美一二三四区在线| 欧美三级电影在线观看| av电影在线观看一区| 国产成人精品亚洲777人妖 | 中文字幕巨乱亚洲| 欧美草草影院在线视频| 5月丁香婷婷综合| 91国在线观看| 色综合久久66| 99国产精品久久久久久久久久久 | 国产一区二区三区免费| 日本视频一区二区| 亚洲丰满少妇videoshd| 一区二区三区欧美久久| 亚洲欧美色综合| 国产精品福利一区二区三区| 久久精品人人做人人综合| 欧美主播一区二区三区美女| 色综合色综合色综合色综合色综合| 国产成人精品一区二| 国产经典欧美精品| 国内成+人亚洲+欧美+综合在线| 热久久国产精品| 免费视频一区二区| 久久国产麻豆精品| 日本不卡一区二区三区高清视频| 同产精品九九九| 日韩高清不卡一区| 蜜臀av性久久久久av蜜臀妖精 | 亚洲精品伦理在线| 亚洲特黄一级片| 亚洲精选在线视频| 一区二区三国产精华液| 亚洲va韩国va欧美va精品 | 丝袜脚交一区二区| 免费xxxx性欧美18vr| 美女爽到高潮91| 精品亚洲成a人| 国产精一品亚洲二区在线视频| 国产麻豆9l精品三级站| 国产成人精品免费在线| 99久久夜色精品国产网站| 99视频精品全部免费在线| 99久久久免费精品国产一区二区| 色婷婷精品久久二区二区蜜臀av| 在线观看亚洲精品视频| 欧美日韩的一区二区| 日韩午夜电影av| 国产欧美日韩视频在线观看| 亚洲欧美一区二区三区久本道91 | 欧美成人官网二区| 欧美精品一区男女天堂| 国产精品视频你懂的| 一区二区三区日韩精品| 免费av网站大全久久| 国产91清纯白嫩初高中在线观看| 91视频.com| 91精品国产综合久久精品app | 北条麻妃一区二区三区| 欧美亚洲国产一区二区三区va| 日韩午夜电影在线观看| 国产精品久久久久久久裸模| 丝袜美腿亚洲一区| 国产成人精品影视| 精品视频在线看| 久久精品欧美一区二区三区不卡 | 国产视频一区二区在线观看| 亚洲免费av在线| 精品亚洲porn| 91蜜桃网址入口| 精品日韩在线观看| 一区二区久久久| 精品亚洲免费视频| 欧美午夜精品久久久久久孕妇 | 久久色在线视频| 一区二区三区成人| 国产精品资源在线看| 欧美性色黄大片手机版| 久久久国产午夜精品| 亚洲电影在线播放| 风间由美一区二区av101| 7777精品久久久大香线蕉| 中文字幕欧美三区| 老司机午夜精品| 欧美在线不卡视频| 国产免费久久精品| 麻豆精品视频在线观看视频| 在线精品视频免费播放| 国产精品乱码妇女bbbb| 麻豆一区二区三| 欧美日韩免费高清一区色橹橹| 中国色在线观看另类| 美国毛片一区二区| 欧美日韩不卡在线| 亚洲精品高清在线观看| 成人午夜伦理影院| 亚洲精品一区在线观看| 视频一区二区国产| 日本丰满少妇一区二区三区| 国产精品每日更新在线播放网址| 激情综合色丁香一区二区| 欧美日韩精品福利| 亚洲精品国产无套在线观| 成人午夜大片免费观看| 精品国产一区二区国模嫣然| 首页综合国产亚洲丝袜| 欧美亚洲国产一卡| 亚洲综合色噜噜狠狠| 99视频一区二区| 国产精品色在线| 大白屁股一区二区视频| 久久久99久久| 国产精品一二三四五| 久久久国产综合精品女国产盗摄| 麻豆成人av在线| 日韩三级.com| 久久精品国产精品亚洲综合| 日韩你懂的在线播放| 日本不卡一区二区| 日韩欧美一级在线播放| 久久精品噜噜噜成人av农村| 日韩一区二区三区视频在线| 日本麻豆一区二区三区视频| 欧美一区二视频| 蜜桃一区二区三区四区| 欧美mv日韩mv亚洲| 国产自产高清不卡| 亚洲精品国产a久久久久久 | 欧美日韩免费观看一区二区三区| 夜夜嗨av一区二区三区| 在线观看不卡视频| 五月天国产精品| 日韩欧美在线综合网| 国产一区二区三区精品视频| 国产日韩一级二级三级| 97久久超碰国产精品| 一区二区三区91| 在线成人午夜影院| 极品瑜伽女神91| 国产免费成人在线视频| 91小宝寻花一区二区三区| 一区二区三区高清在线| 制服丝袜中文字幕一区| 久久精品国产99国产精品| 久久久不卡影院| 色呦呦一区二区三区| 五月天激情综合| 久久久精品免费网站| 91欧美激情一区二区三区成人| 亚洲成人免费av| 久久久影视传媒| 91美女福利视频| 免费精品视频在线| 国产人久久人人人人爽| 在线免费亚洲电影| 青青草国产成人av片免费| 久久综合狠狠综合久久综合88| 99麻豆久久久国产精品免费优播| 亚洲国产综合色| 精品国产凹凸成av人网站| 99久久综合狠狠综合久久| 香蕉影视欧美成人| 国产视频一区二区三区在线观看| 在线这里只有精品| 精品一区二区免费看| 亚洲精品少妇30p| 精品国产一区二区三区av性色 | 国产成人av一区二区| 亚洲美女精品一区| 精品剧情v国产在线观看在线| 99re这里只有精品首页| 麻豆国产精品一区二区三区| 亚洲图片另类小说| 日韩精品资源二区在线| 91亚洲国产成人精品一区二区三 | 成人网在线播放| 天天色 色综合| 亚洲欧洲美洲综合色网| 精品久久久久久无| 欧美日韩在线电影| 成人精品高清在线| 秋霞国产午夜精品免费视频| 亚洲免费av高清| 国产欧美一区二区三区在线老狼| 欧美精品高清视频| 97久久超碰国产精品|