[geeklog-cvs] Geeklog-1.x/public_html/fckeditor/editor/filemanager/connectors/py config.py, 1.1, 1.2 connector.py, 1.1, 1.2 fckcommands.py, 1.1, 1.2 fckconnector.py, 1.1, 1.2 fckoutput.py, 1.1, 1.2 fckutil.py, 1.1, 1.2 htaccess.txt, 1.1, 1.2 upload.py, 1.1, 1.2 wsgi.py, 1.1, 1.2 zope.py, 1.1, 1.2

Blaine Lang blaine at qs1489.pair.com
Sun May 4 20:35:29 EDT 2008


Update of /cvsroot/geeklog/Geeklog-1.x/public_html/fckeditor/editor/filemanager/connectors/py
In directory qs1489.pair.com:/tmp/cvs-serv85146/editor/filemanager/connectors/py

Modified Files:
	config.py connector.py fckcommands.py fckconnector.py 
	fckoutput.py fckutil.py htaccess.txt upload.py wsgi.py zope.py 
Log Message:
Upgraded the FCKeditor to version 2.6 Final - latest release April 7/08

Index: config.py
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/fckeditor/editor/filemanager/connectors/py/config.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** config.py	9 Feb 2008 12:53:59 -0000	1.1
--- config.py	5 May 2008 00:35:25 -0000	1.2
***************
*** 2,6 ****
  """
   * FCKeditor - The text editor for Internet - http://www.fckeditor.net
!  * Copyright (C) 2003-2007 Frederico Caldeira Knabben
   *
   * == BEGIN LICENSE ==
--- 2,6 ----
  """
   * FCKeditor - The text editor for Internet - http://www.fckeditor.net
!  * Copyright (C) 2003-2008 Frederico Caldeira Knabben
   *
   * == BEGIN LICENSE ==
***************
*** 20,31 ****
   * == END LICENSE ==
   *
!  * Configuration file for the File Manager Connector for Python 
  """
  
! # INSTALLATION NOTE: You must set up your server environment accordingly to run 
  # python scripts. This connector requires Python 2.4 or greater.
! # 
! # Supported operation modes: 
! #  * WSGI (recommended): You'll need apache + mod_python + modpython_gateway 
  #                        or any web server capable of the WSGI python standard
  #  * Plain Old CGI:      Any server capable of running standard python scripts
--- 20,31 ----
   * == END LICENSE ==
   *
!  * Configuration file for the File Manager Connector for Python
  """
  
! # INSTALLATION NOTE: You must set up your server environment accordingly to run
  # python scripts. This connector requires Python 2.4 or greater.
! #
! # Supported operation modes:
! #  * WSGI (recommended): You'll need apache + mod_python + modpython_gateway
  #                        or any web server capable of the WSGI python standard
  #  * Plain Old CGI:      Any server capable of running standard python scripts
***************
*** 33,50 ****
  #                        This was the previous connector version operation mode
  #
! # If you're using Apache web server, replace the htaccess.txt to to .htaccess, 
  # and set the proper options and paths.
  # For WSGI and mod_python, you may need to download modpython_gateway from:
! # http://projects.amor.org/misc/svn/modpython_gateway.py and copy it in this 
  # directory.
  
!    
  # SECURITY: You must explicitly enable this "connector". (Set it to "True").
! # WARNING: don't just set "ConfigIsEnabled = True", you must be sure that only 
  #		authenticated users can access this file or use some kind of session checking.
  Enabled = False
  
  # Path to user files relative to the document root.
! UserFilesPath = '/userfiles/' 
  
  # Fill the following value it you prefer to specify the absolute path for the
--- 33,50 ----
  #                        This was the previous connector version operation mode
  #
! # If you're using Apache web server, replace the htaccess.txt to to .htaccess,
  # and set the proper options and paths.
  # For WSGI and mod_python, you may need to download modpython_gateway from:
! # http://projects.amor.org/misc/svn/modpython_gateway.py and copy it in this
  # directory.
  
! 
  # SECURITY: You must explicitly enable this "connector". (Set it to "True").
! # WARNING: don't just set "ConfigIsEnabled = True", you must be sure that only
  #		authenticated users can access this file or use some kind of session checking.
  Enabled = False
  
  # Path to user files relative to the document root.
! UserFilesPath = '/userfiles/'
  
  # Fill the following value it you prefer to specify the absolute path for the
***************
*** 54,68 ****
  # WARNING: GetRootPath may not work in virtual or mod_python configurations, and
  # may not be thread safe. Use this configuration parameter instead.
! UserFilesAbsolutePath = '' 
  
  # Due to security issues with Apache modules, it is recommended to leave the
  # following setting enabled.
! ForceSingleExtension = True 
  
  # What the user can do with this connector
! ConfigAllowedCommands = [ 'QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder' ] 
  
  # Allowed Resource Types
! ConfigAllowedTypes = ['File', 'Image', 'Flash', 'Media'] 
  
  # Do not touch this 3 lines, see "Configuration settings for each Resource Type"
--- 54,79 ----
  # WARNING: GetRootPath may not work in virtual or mod_python configurations, and
  # may not be thread safe. Use this configuration parameter instead.
! UserFilesAbsolutePath = ''
  
  # Due to security issues with Apache modules, it is recommended to leave the
  # following setting enabled.
! ForceSingleExtension = True
  
  # What the user can do with this connector
! ConfigAllowedCommands = [ 'QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder' ]
  
  # Allowed Resource Types
! ConfigAllowedTypes = ['File', 'Image', 'Flash', 'Media']
! 
! # After file is uploaded, sometimes it is required to change its permissions
! # so that it was possible to access it at the later time.
! # If possible, it is recommended to set more restrictive permissions, like 0755.
! # Set to 0 to disable this feature.
! # Note: not needed on Windows-based servers.
! ChmodOnUpload = 0755
! 
! # See comments above.
! # Used when creating folders that does not exist.
! ChmodOnFolderCreate = 0755
  
  # Do not touch this 3 lines, see "Configuration settings for each Resource Type"
***************
*** 73,79 ****
  #	Configuration settings for each Resource Type
  #
! #	- AllowedExtensions: the possible extensions that can be allowed. 
  #		If it is empty then any file type can be uploaded.
! #	- DeniedExtensions: The extensions that won't be allowed. 
  #		If it is empty then no restrictions are done here.
  #
--- 84,90 ----
  #	Configuration settings for each Resource Type
  #
! #	- AllowedExtensions: the possible extensions that can be allowed.
  #		If it is empty then any file type can be uploaded.
! #	- DeniedExtensions: The extensions that won't be allowed.
  #		If it is empty then no restrictions are done here.
  #
***************
*** 82,92 ****
  #
  #	- FileTypesPath: the virtual folder relative to the document root where
! #		these resources will be located. 
  #		Attention: It must start and end with a slash: '/'
  #
  #	- FileTypesAbsolutePath: the physical path to the above folder. It must be
! #		an absolute path. 
  #		If it's an empty string then it will be autocalculated.
! #		Useful if you are using a virtual directory, symbolic link or alias. 
  #		Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
  #		Attention: The above 'FileTypesPath' must point to the same directory.
--- 93,103 ----
  #
  #	- FileTypesPath: the virtual folder relative to the document root where
! #		these resources will be located.
  #		Attention: It must start and end with a slash: '/'
  #
  #	- FileTypesAbsolutePath: the physical path to the above folder. It must be
! #		an absolute path.
  #		If it's an empty string then it will be autocalculated.
! #		Useful if you are using a virtual directory, symbolic link or alias.
  #		Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
  #		Attention: The above 'FileTypesPath' must point to the same directory.
***************
*** 95,106 ****
  #
  #	- QuickUploadPath: the virtual folder relative to the document root where
! #		these resources will be uploaded using the Upload tab in the resources 
  #		dialogs.
  #		Attention: It must start and end with a slash: '/'
  #
  #	- QuickUploadAbsolutePath: the physical path to the above folder. It must be
! #		an absolute path. 
  #		If it's an empty string then it will be autocalculated.
! #		Useful if you are using a virtual directory, symbolic link or alias. 
  #		Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
  #		Attention: The above 'QuickUploadPath' must point to the same directory.
--- 106,117 ----
  #
  #	- QuickUploadPath: the virtual folder relative to the document root where
! #		these resources will be uploaded using the Upload tab in the resources
  #		dialogs.
  #		Attention: It must start and end with a slash: '/'
  #
  #	- QuickUploadAbsolutePath: the physical path to the above folder. It must be
! #		an absolute path.
  #		If it's an empty string then it will be autocalculated.
! #		Useful if you are using a virtual directory, symbolic link or alias.
  #		Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
  #		Attention: The above 'QuickUploadPath' must point to the same directory.
***************
*** 109,113 ****
  AllowedExtensions['File'] 		= ['7z','aiff','asf','avi','bmp','csv','doc','fla','flv','gif','gz','gzip','jpeg','jpg','mid','mov','mp3','mp4','mpc','mpeg','mpg','ods','odt','pdf','png','ppt','pxd','qt','ram','rar','rm','rmi','rmvb','rtf','sdc','sitd','swf','sxc','sxw','tar','tgz','tif','tiff','txt','vsd','wav','wma','wmv','xls','xml','zip']
  DeniedExtensions['File'] 		= []
! FileTypesPath['File'] 			= UserFilesPath + 'file/' 
  FileTypesAbsolutePath['File'] 	= (not UserFilesAbsolutePath == '') and (UserFilesAbsolutePath + 'file/') or ''
  QuickUploadPath['File']			= FileTypesPath['File']
--- 120,124 ----
  AllowedExtensions['File'] 		= ['7z','aiff','asf','avi','bmp','csv','doc','fla','flv','gif','gz','gzip','jpeg','jpg','mid','mov','mp3','mp4','mpc','mpeg','mpg','ods','odt','pdf','png','ppt','pxd','qt','ram','rar','rm','rmi','rmvb','rtf','sdc','sitd','swf','sxc','sxw','tar','tgz','tif','tiff','txt','vsd','wav','wma','wmv','xls','xml','zip']
  DeniedExtensions['File'] 		= []
! FileTypesPath['File'] 			= UserFilesPath + 'file/'
  FileTypesAbsolutePath['File'] 	= (not UserFilesAbsolutePath == '') and (UserFilesAbsolutePath + 'file/') or ''
  QuickUploadPath['File']			= FileTypesPath['File']
***************
*** 116,120 ****
  AllowedExtensions['Image']		= ['bmp','gif','jpeg','jpg','png']
  DeniedExtensions['Image']		= []
! FileTypesPath['Image']			= UserFilesPath + 'image/' 
  FileTypesAbsolutePath['Image']	= (not UserFilesAbsolutePath == '') and UserFilesAbsolutePath + 'image/' or ''
  QuickUploadPath['Image']		= FileTypesPath['Image']
--- 127,131 ----
  AllowedExtensions['Image']		= ['bmp','gif','jpeg','jpg','png']
  DeniedExtensions['Image']		= []
! FileTypesPath['Image']			= UserFilesPath + 'image/'
  FileTypesAbsolutePath['Image']	= (not UserFilesAbsolutePath == '') and UserFilesAbsolutePath + 'image/' or ''
  QuickUploadPath['Image']		= FileTypesPath['Image']

Index: zope.py
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/fckeditor/editor/filemanager/connectors/py/zope.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** zope.py	9 Feb 2008 12:53:59 -0000	1.1
--- zope.py	5 May 2008 00:35:25 -0000	1.2
***************
*** 3,7 ****
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2007 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
--- 3,7 ----
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2008 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
***************
*** 24,29 ****
  
  This code was not tested at all.
! It just was ported from pre 2.5 release, so for further reference see 
! \editor\filemanager\browser\default\connectors\py\connector.py in previous 
  releases.
  
--- 24,29 ----
  
  This code was not tested at all.
! It just was ported from pre 2.5 release, so for further reference see
! \editor\filemanager\browser\default\connectors\py\connector.py in previous
  releases.
  
***************
*** 49,53 ****
  		self.context = context
  		self.request = FCKeditorRequest(context)
! 	
  	def getZopeRootContext(self):
  		if self.zopeRootContext is None:
--- 49,53 ----
  		self.context = context
  		self.request = FCKeditorRequest(context)
! 
  	def getZopeRootContext(self):
  		if self.zopeRootContext is None:
***************
*** 187,189 ****
  return connector.FCKeditorConnectorZope(context=context).doResponse()
  """
- 
--- 187,188 ----

Index: upload.py
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/fckeditor/editor/filemanager/connectors/py/upload.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** upload.py	9 Feb 2008 12:53:59 -0000	1.1
--- upload.py	5 May 2008 00:35:25 -0000	1.2
***************
*** 3,7 ****
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2007 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
--- 3,7 ----
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2008 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
***************
*** 32,37 ****
  
  class FCKeditorQuickUpload(	FCKeditorConnectorBase,
! 							UploadFileCommandMixin, 
! 							BaseHttpMixin, BaseHtmlMixin):	
  	def doResponse(self):
  		"Main function. Process the request, set headers and return a string as response."
--- 32,37 ----
  
  class FCKeditorQuickUpload(	FCKeditorConnectorBase,
! 							UploadFileCommandMixin,
! 							BaseHttpMixin, BaseHtmlMixin):
  	def doResponse(self):
  		"Main function. Process the request, set headers and return a string as response."
***************
*** 49,70 ****
  		# Check if it is an allowed command
  		if ( not command in Config.ConfigAllowedCommands ):
! 			return self.sendUploadResults( 1, '', '', 'The %s command isn\'t allowed' % command ) 
! 		
  		if ( not resourceType in Config.ConfigAllowedTypes  ):
! 			return self.sendUploadResults( 1, '', '', 'Invalid type specified' ) 
  
  		# Setup paths
! 		self.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType] 
! 		self.webUserFilesFolder =  Config.QuickUploadPath[resourceType]	
  		if not self.userFilesFolder: # no absolute path given (dangerous...)
! 			self.userFilesFolder = mapServerPath(self.environ, 
  									self.webUserFilesFolder)
! 		
  		# Ensure that the directory exists.
  		if not os.path.exists(self.userFilesFolder):
  			try:
! 				self.createServerFoldercreateServerFolder( self.userFilesFolder ) 
  			except:
! 				return self.sendError(1, "This connector couldn\'t access to local user\'s files directories.  Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ")			
  
  		# File upload doesn't have to return XML, so intercept here
--- 49,70 ----
  		# Check if it is an allowed command
  		if ( not command in Config.ConfigAllowedCommands ):
! 			return self.sendUploadResults( 1, '', '', 'The %s command isn\'t allowed' % command )
! 
  		if ( not resourceType in Config.ConfigAllowedTypes  ):
! 			return self.sendUploadResults( 1, '', '', 'Invalid type specified' )
  
  		# Setup paths
! 		self.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType]
! 		self.webUserFilesFolder =  Config.QuickUploadPath[resourceType]
  		if not self.userFilesFolder: # no absolute path given (dangerous...)
! 			self.userFilesFolder = mapServerPath(self.environ,
  									self.webUserFilesFolder)
! 
  		# Ensure that the directory exists.
  		if not os.path.exists(self.userFilesFolder):
  			try:
! 				self.createServerFoldercreateServerFolder( self.userFilesFolder )
  			except:
! 				return self.sendError(1, "This connector couldn\'t access to local user\'s files directories.  Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ")
  
  		# File upload doesn't have to return XML, so intercept here
***************
*** 80,84 ****
  			if not header is None:
  				print '%s: %s' % header
! 		print 
  		print data
  	except:
--- 80,84 ----
  			if not header is None:
  				print '%s: %s' % header
! 		print
  		print data
  	except:

Index: connector.py
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/fckeditor/editor/filemanager/connectors/py/connector.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** connector.py	9 Feb 2008 12:53:59 -0000	1.1
--- connector.py	5 May 2008 00:35:25 -0000	1.2
***************
*** 3,7 ****
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2007 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
--- 3,7 ----
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2008 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
***************
*** 38,42 ****
  							GetFoldersAndFilesCommandMixin,
  							CreateFolderCommandMixin,
! 							UploadFileCommandMixin, 
  							BaseHttpMixin, BaseXmlMixin, BaseHtmlMixin  ):
  	"The Standard connector class."
--- 38,42 ----
  							GetFoldersAndFilesCommandMixin,
  							CreateFolderCommandMixin,
! 							UploadFileCommandMixin,
  							BaseHttpMixin, BaseXmlMixin, BaseHtmlMixin  ):
  	"The Standard connector class."
***************
*** 58,84 ****
  		if currentFolder is None:
  			return self.sendError(102, "")
! 		
  		# Check if it is an allowed command
  		if ( not command in Config.ConfigAllowedCommands ):
! 			return self.sendError( 1, 'The %s command isn\'t allowed' % command ) 
! 		
  		if ( not resourceType in Config.ConfigAllowedTypes  ):
! 			return self.sendError( 1, 'Invalid type specified' ) 
  
  		# Setup paths
  		if command == "QuickUpload":
! 			self.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType] 
  			self.webUserFilesFolder =  Config.QuickUploadPath[resourceType]
  		else:
  			self.userFilesFolder = Config.FileTypesAbsolutePath[resourceType]
! 			self.webUserFilesFolder = Config.FileTypesPath[resourceType]	
! 		
  		if not self.userFilesFolder: # no absolute path given (dangerous...)
! 			self.userFilesFolder = mapServerPath(self.environ, 
  									self.webUserFilesFolder)
  		# Ensure that the directory exists.
  		if not os.path.exists(self.userFilesFolder):
  			try:
! 				self.createServerFoldercreateServerFolder( self.userFilesFolder ) 
  			except:
  				return self.sendError(1, "This connector couldn\'t access to local user\'s files directories.  Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ")
--- 58,84 ----
  		if currentFolder is None:
  			return self.sendError(102, "")
! 
  		# Check if it is an allowed command
  		if ( not command in Config.ConfigAllowedCommands ):
! 			return self.sendError( 1, 'The %s command isn\'t allowed' % command )
! 
  		if ( not resourceType in Config.ConfigAllowedTypes  ):
! 			return self.sendError( 1, 'Invalid type specified' )
  
  		# Setup paths
  		if command == "QuickUpload":
! 			self.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType]
  			self.webUserFilesFolder =  Config.QuickUploadPath[resourceType]
  		else:
  			self.userFilesFolder = Config.FileTypesAbsolutePath[resourceType]
! 			self.webUserFilesFolder = Config.FileTypesPath[resourceType]
! 
  		if not self.userFilesFolder: # no absolute path given (dangerous...)
! 			self.userFilesFolder = mapServerPath(self.environ,
  									self.webUserFilesFolder)
  		# Ensure that the directory exists.
  		if not os.path.exists(self.userFilesFolder):
  			try:
! 				self.createServerFoldercreateServerFolder( self.userFilesFolder )
  			except:
  				return self.sendError(1, "This connector couldn\'t access to local user\'s files directories.  Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ")
***************
*** 87,94 ****
  		if (command == "FileUpload"):
  			return self.uploadFile(resourceType, currentFolder)
! 		
  		# Create Url
  		url = combinePaths( self.webUserFilesFolder, currentFolder )
! 		
  		# Begin XML
  		s += self.createXmlHeader(command, resourceType, currentFolder, url)
--- 87,94 ----
  		if (command == "FileUpload"):
  			return self.uploadFile(resourceType, currentFolder)
! 
  		# Create Url
  		url = combinePaths( self.webUserFilesFolder, currentFolder )
! 
  		# Begin XML
  		s += self.createXmlHeader(command, resourceType, currentFolder, url)
***************
*** 100,105 ****
  		s += selector[command](resourceType, currentFolder)
  		s += self.createXmlFooter()
! 		return s	
! 	
  # Running from command line (plain old CGI)
  if __name__ == '__main__':
--- 100,105 ----
  		s += selector[command](resourceType, currentFolder)
  		s += self.createXmlFooter()
! 		return s
! 
  # Running from command line (plain old CGI)
  if __name__ == '__main__':
***************
*** 110,114 ****
  		for header in conn.headers:
  			print '%s: %s' % header
! 		print 
  		print data
  	except:
--- 110,114 ----
  		for header in conn.headers:
  			print '%s: %s' % header
! 		print
  		print data
  	except:

Index: fckcommands.py
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/fckeditor/editor/filemanager/connectors/py/fckcommands.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** fckcommands.py	9 Feb 2008 12:53:59 -0000	1.1
--- fckcommands.py	5 May 2008 00:35:25 -0000	1.2
***************
*** 3,7 ****
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2007 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
--- 3,7 ----
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2008 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
***************
*** 101,105 ****
  						errorNo = 103
  					elif e.errno==36 or e.errno==2 or e.errno==22: # filename too long / no such file / invalid name
! 						errorNo = 102 
  				else:
  					errorNo = 110
--- 101,105 ----
  						errorNo = 103
  					elif e.errno==36 or e.errno==2 or e.errno==22: # filename too long / no such file / invalid name
! 						errorNo = 102
  				else:
  					errorNo = 110
***************
*** 111,117 ****
  		"Purpose: physically creates a folder on the server"
  		# No need to check if the parent exists, just create all hierachy
! 		oldumask = os.umask(0)
! 		os.makedirs(folderPath,mode=0755)
! 		os.umask( oldumask ) 
  
  class UploadFileCommandMixin (object):
--- 111,126 ----
  		"Purpose: physically creates a folder on the server"
  		# No need to check if the parent exists, just create all hierachy
! 
! 		try:
! 			permissions = Config.ChmodOnFolderCreate
! 			if not permissions:
! 				os.makedirs(folderPath)
! 		except AttributeError: #ChmodOnFolderCreate undefined
! 			permissions = 0755
! 
! 		if permissions:
! 			oldumask = os.umask(0)
! 			os.makedirs(folderPath,mode=0755)
! 			os.umask( oldumask )
  
  class UploadFileCommandMixin (object):
***************
*** 126,130 ****
  			# Get the file name
  			newFileName = newFile.filename
! 			newFileName = sanitizeFileName( newFileName ) 
  			newFileNameOnly = removeExtension(newFileName)
  			newFileExtension = getExtension(newFileName).lower()
--- 135,139 ----
  			# Get the file name
  			newFileName = newFile.filename
! 			newFileName = sanitizeFileName( newFileName )
  			newFileNameOnly = removeExtension(newFileName)
  			newFileExtension = getExtension(newFileName).lower()
***************
*** 169,175 ****
  
  						if os.path.exists ( newFilePath ):
! 							oldumask = os.umask(0) 
! 							os.chmod( newFilePath, 0755 ) 
! 							os.umask( oldumask ) 
  
  						newFileUrl = self.webUserFilesFolder + currentFolder + newFileName
--- 178,192 ----
  
  						if os.path.exists ( newFilePath ):
! 							doChmod = False
! 							try:
! 								doChmod = Config.ChmodOnUpload
! 								permissions = Config.ChmodOnUpload
! 							except AttributeError: #ChmodOnUpload undefined
! 								doChmod = True
! 								permissions = 0755
! 							if ( doChmod ):
! 								oldumask = os.umask(0)
! 								os.chmod( newFilePath, permissions )
! 								os.umask( oldumask )
  
  						newFileUrl = self.webUserFilesFolder + currentFolder + newFileName

Index: wsgi.py
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/fckeditor/editor/filemanager/connectors/py/wsgi.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** wsgi.py	9 Feb 2008 12:53:59 -0000	1.1
--- wsgi.py	5 May 2008 00:35:25 -0000	1.2
***************
*** 3,7 ****
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2007 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
--- 3,7 ----
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2008 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
***************
*** 34,38 ****
  
  # Running from WSGI capable server (recomended)
! def App(environ, start_response): 
  	"WSGI entry point. Run the connector"
  	if environ['SCRIPT_NAME'].endswith("connector.py"):
--- 34,38 ----
  
  # Running from WSGI capable server (recomended)
! def App(environ, start_response):
  	"WSGI entry point. Run the connector"
  	if environ['SCRIPT_NAME'].endswith("connector.py"):
***************
*** 55,58 ****
  		start_response("500 Internal Server Error",[("Content-type","text/html")])
  		file = StringIO()
! 		cgitb.Hook(file = file).handle()    
  		yield file.getvalue()
--- 55,58 ----
  		start_response("500 Internal Server Error",[("Content-type","text/html")])
  		file = StringIO()
! 		cgitb.Hook(file = file).handle()
  		yield file.getvalue()

Index: fckconnector.py
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/fckeditor/editor/filemanager/connectors/py/fckconnector.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** fckconnector.py	9 Feb 2008 12:53:59 -0000	1.1
--- fckconnector.py	5 May 2008 00:35:25 -0000	1.2
***************
*** 3,7 ****
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2007 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
--- 3,7 ----
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2008 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
***************
*** 39,43 ****
  		"Constructor: Here you should parse request fields, initialize variables, etc."
  		self.request = FCKeditorRequest(environ) # Parse request
! 		self.headers = []						# Clean Headers 
  		if environ:
  			self.environ = environ
--- 39,43 ----
  		"Constructor: Here you should parse request fields, initialize variables, etc."
  		self.request = FCKeditorRequest(environ) # Parse request
! 		self.headers = []						# Clean Headers
  		if environ:
  			self.environ = environ

Index: htaccess.txt
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/fckeditor/editor/filemanager/connectors/py/htaccess.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** htaccess.txt	9 Feb 2008 12:53:59 -0000	1.1
--- htaccess.txt	5 May 2008 00:35:25 -0000	1.2
***************
*** 1,3 ****
! # replace the name of this file to .htaccess (if using apache), 
  # and set the proper options and paths according your enviroment
  
--- 1,3 ----
! # replace the name of this file to .htaccess (if using apache),
  # and set the proper options and paths according your enviroment
  
***************
*** 20,23 ****
  
  # Plain old CGI
! #Options +ExecCGI 
  #AddHandler cgi-script py
--- 20,23 ----
  
  # Plain old CGI
! #Options +ExecCGI
  #AddHandler cgi-script py

Index: fckoutput.py
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/fckeditor/editor/filemanager/connectors/py/fckoutput.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** fckoutput.py	9 Feb 2008 12:53:59 -0000	1.1
--- fckoutput.py	5 May 2008 00:35:25 -0000	1.2
***************
*** 3,7 ****
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2007 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
--- 3,7 ----
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2008 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
***************
*** 54,63 ****
  		self.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT')
  		# always modified
! 		self.setHeader('Last-Modified',strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime())) 
  		# HTTP/1.1
! 		self.setHeader('Cache-Control','no-store, no-cache, must-revalidate') 
! 		self.setHeader('Cache-Control','post-check=0, pre-check=0') 
  		# HTTP/1.0
! 		self.setHeader('Pragma','no-cache') 
  
  		# Set the response format.
--- 54,63 ----
  		self.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT')
  		# always modified
! 		self.setHeader('Last-Modified',strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime()))
  		# HTTP/1.1
! 		self.setHeader('Cache-Control','no-store, no-cache, must-revalidate')
! 		self.setHeader('Cache-Control','post-check=0, pre-check=0')
  		# HTTP/1.0
! 		self.setHeader('Pragma','no-cache')
  
  		# Set the response format.
***************
*** 94,98 ****
  				self.sendErrorNode (number, text) +
  				"""</Connector>""" )
! 		
  	def sendErrorNode(self, number, text):
  		return """<Error number="%s" text="%s" />""" % (number, convertToXmlAttribute(text))
--- 94,98 ----
  				self.sendErrorNode (number, text) +
  				"""</Connector>""" )
! 
  	def sendErrorNode(self, number, text):
  		return """<Error number="%s" text="%s" />""" % (number, convertToXmlAttribute(text))
***************
*** 103,111 ****
  		"This is the function that sends the results of the uploading process"
  		return """<script type="text/javascript">
! 			window.parent.OnUploadCompleted(%(errorNumber)s,"%(fileUrl)s","%(fileName)s","%(customMsg)s"); 
  			</script>""" % {
  			'errorNumber': errorNo,
  			'fileUrl': fileUrl.replace ('"', '\\"'),
! 			'fileName': fileName.replace ( '"', '\\"' ) , 
  			'customMsg': customMsg.replace ( '"', '\\"' ),
! 			}
\ No newline at end of file
--- 103,142 ----
  		"This is the function that sends the results of the uploading process"
  		return """<script type="text/javascript">
! 			(function()
! 			{
! 				var d = document.domain ;
! 
! 				while ( true )
! 				{
! 					// Test if we can access a parent property.
! 					try
! 					{
! 						var test = window.top.opener.document.domain ;
! 						break ;
! 					}
! 					catch( e ) {}
! 
! 					// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
! 					d = d.replace( /.*?(?:\.|$)/, '' ) ;
! 
! 					if ( d.length == 0 )
! 						break ;		// It was not able to detect the domain.
! 
! 					try
! 					{
! 						document.domain = d ;
! 					}
! 					catch (e)
! 					{
! 						break ;
! 					}
! 				}
! 			})() ;
! 
! 			window.parent.OnUploadCompleted(%(errorNumber)s,"%(fileUrl)s","%(fileName)s","%(customMsg)s");
  			</script>""" % {
  			'errorNumber': errorNo,
  			'fileUrl': fileUrl.replace ('"', '\\"'),
! 			'fileName': fileName.replace ( '"', '\\"' ) ,
  			'customMsg': customMsg.replace ( '"', '\\"' ),
! 			}

Index: fckutil.py
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/fckeditor/editor/filemanager/connectors/py/fckutil.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** fckutil.py	9 Feb 2008 12:53:59 -0000	1.1
--- fckutil.py	5 May 2008 00:35:25 -0000	1.2
***************
*** 3,7 ****
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2007 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
--- 3,7 ----
  """
  FCKeditor - The text editor for Internet - http://www.fckeditor.net
! Copyright (C) 2003-2008 Frederico Caldeira Knabben
  
  == BEGIN LICENSE ==
***************
*** 21,25 ****
  == END LICENSE ==
  
! Utility functions for the File Manager Connector for Python 
  
  """
--- 21,25 ----
  == END LICENSE ==
  
! Utility functions for the File Manager Connector for Python
  
  """
***************
*** 50,57 ****
  
  def combinePaths( basePath, folder ):
! 	return removeFromEnd( basePath, '/' ) + '/' + removeFromStart( folder, '/' ) 
  
  def getFileName(filename):
! 	" Purpose: helper function to extrapolate the filename " 
  	for splitChar in ["/", "\\"]:
  		array = filename.split(splitChar)
--- 50,57 ----
  
  def combinePaths( basePath, folder ):
! 	return removeFromEnd( basePath, '/' ) + '/' + removeFromStart( folder, '/' )
  
  def getFileName(filename):
! 	" Purpose: helper function to extrapolate the filename "
  	for splitChar in ["/", "\\"]:
  		array = filename.split(splitChar)
***************
*** 62,67 ****
  def sanitizeFolderName( newFolderName ):
  	"Do a cleanup of the folder name to avoid possible problems"
! 	# Remove . \ / | : ? *
! 	return re.sub( '\\.|\\\\|\\/|\\||\\:|\\?|\\*', '_', newFolderName )
  
  def sanitizeFileName( newFileName ):
--- 62,67 ----
  def sanitizeFolderName( newFolderName ):
  	"Do a cleanup of the folder name to avoid possible problems"
! 	# Remove . \ / | : ? * " < > and control characters
! 	return re.sub( '(?u)\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[^\u0000-\u001f\u007f-\u009f]', '_', newFolderName )
  
  def sanitizeFileName( newFileName ):
***************
*** 73,81 ****
  	newFileName = os.path.basename (newFileName)	# strip directories
  	# Remove \ / | : ? *
! 	return re.sub ( '/\\\\|\\/|\\||\\:|\\?|\\*/', '_', newFileName )
  
  def getCurrentFolder(currentFolder):
! 	if not currentFolder: 
! 		currentFolder = '/' 
  
  	# Check the current folder syntax (must begin and end with a slash).
--- 73,81 ----
  	newFileName = os.path.basename (newFileName)	# strip directories
  	# Remove \ / | : ? *
! 	return re.sub ( '(?u)/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[^\u0000-\u001f\u007f-\u009f]/', '_', newFileName )
  
  def getCurrentFolder(currentFolder):
! 	if not currentFolder:
! 		currentFolder = '/'
  
  	# Check the current folder syntax (must begin and end with a slash).
***************
*** 84,97 ****
  	if (currentFolder[0] <> "/"):
  		currentFolder = "/" + currentFolder
! 				
  	# Ensure the folder path has no double-slashes
  	while '//' in currentFolder:
! 		currentFolder = currentFolder.replace('//','/') 
  
  	# Check for invalid folder paths (..)
! 	if '..' in currentFolder:
  		return None
  
! 	return currentFolder 
  
  def mapServerPath( environ, url):
--- 84,97 ----
  	if (currentFolder[0] <> "/"):
  		currentFolder = "/" + currentFolder
! 
  	# Ensure the folder path has no double-slashes
  	while '//' in currentFolder:
! 		currentFolder = currentFolder.replace('//','/')
  
  	# Check for invalid folder paths (..)
! 	if '..' in currentFolder or '\\' in currentFolder:
  		return None
  
! 	return currentFolder
  
  def mapServerPath( environ, url):
***************
*** 102,106 ****
  
  def mapServerFolder(resourceTypePath, folderPath):
! 	return combinePaths ( resourceTypePath  , folderPath ) 
  
  def getRootPath(environ):
--- 102,106 ----
  
  def mapServerFolder(resourceTypePath, folderPath):
! 	return combinePaths ( resourceTypePath  , folderPath )
  
  def getRootPath(environ):
***************
*** 112,127 ****
  		return environ['DOCUMENT_ROOT']
  	else:
! 		realPath = os.path.realpath( './' ) 
  		selfPath = environ['SCRIPT_FILENAME']
! 		selfPath = selfPath [ :  selfPath.rfind( '/'  ) ] 		
! 		selfPath = selfPath.replace( '/', os.path.sep) 
! 		
! 		position = realPath.find(selfPath) 
  
  		# This can check only that this script isn't run from a virtual dir
  		# But it avoids the problems that arise if it isn't checked
! 		raise realPath 
  		if ( position < 0 or position <> len(realPath) - len(selfPath) or realPath[ : position ]==''):
  			raise Exception('Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/py/config.py".')
  		return realPath[ : position ]
- 
--- 112,126 ----
  		return environ['DOCUMENT_ROOT']
  	else:
! 		realPath = os.path.realpath( './' )
  		selfPath = environ['SCRIPT_FILENAME']
! 		selfPath = selfPath [ :  selfPath.rfind( '/'  ) ]
! 		selfPath = selfPath.replace( '/', os.path.sep)
! 
! 		position = realPath.find(selfPath)
  
  		# This can check only that this script isn't run from a virtual dir
  		# But it avoids the problems that arise if it isn't checked
! 		raise realPath
  		if ( position < 0 or position <> len(realPath) - len(selfPath) or realPath[ : position ]==''):
  			raise Exception('Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/py/config.py".')
  		return realPath[ : position ]




More information about the geeklog-cvs mailing list