##############################################################################
#
# Files (WEB File share PHP script)
#
# Software Development GUSUKU
#
# Written by  : Takashi Miyagi
#
# Copyright (c) 2004-2014 GUSUKU All rights reserved.
#
# Last Update : 2014/05/23
#
##############################################################################

Software Name:
	Files (WEB File share PHP scripts)

Version:
	Ver.2.6.2

Filename:
	filesVVV-YYYYMMDD.tgz

		VVV      : Version No. 
		YYYYMMDD : The update date

Copyright holder:
	Software Development GUSUKU
	http://www.gusuku.org

Outline:
	This program is PHP script to offer file-sharing capabilities on by the
	WEB server that can use PHP4.

Feature:
	Up-loading and the download of the file can be done by making the shared
	folder for the WEB server, and using a browser from the client.

	The subfolder of two or more hierarchies can be able to be made in the 
	shared folder of the server, to delete the file, and to do the comment 
	edit of the file. 

	Functions such as the cutout of the file, the copies, and putting are 
	offered by using the cutting buffer. 

	Two or more shared folders according to the user can be managed. 
	Each shared folder can have an independent first folder, and neither the 
	reference nor the file copy, etc. be done between folders each other.
	The user's registration is separately done. 

	It is assumed that the size uses it in having appended it to mail when
	the file is handed over in the environment for which the FTP and SSH, 
	etc. cannot be used in the case of largeness.

	The MD5 hush is used for the attestation when logging it in. 
	MD5 hushes of session ID and the password of PHP are combined, and it 
	encrypts it by the method of putting it on the MD5 hush function further. 

System requirements:
	It verifies it only by combining Linux+Apache+PHP5. 
	(If it is HTTP server that can use PHP4 or more, it is likely to be able
	to use it.)

	JavaScript's operating becomes the condition of the client because it uses
	JavaScript for the login processing and the switch processing on the page. 

	The operation verification is done in the following environments. 

	Server:
		CentOS6.5 + Apache 2.2.15 + php 5.3.3
		Fedora Core 8 + Apache 2.2.8 + php 5.2.6
		Ubuntu 8.10 + Apache 2.2.9 + php 5.2.6

	Client:
		Windows7 + Firefox 29.0.1
		WindowsXP Pro + Firefox 3.0.4
		WindowsXP Pro + InternetExplorer7
		WindowsVista Ultimate + Firefox 3.0.4
		WindowsVista Ultimate + InternetExplorer7

Preparation:
	PHP can be used by the WEB server.

	It should be set that the place where the shared folder is made finishes
	writing it from the WEB server. 
	(It makes it to can write it by HTTP Server User.)

	The file can be up-loaded in PHP.

	Example of set item of /etc/php.ini

	  file_uploads = On		--> Indispensability
	  upload_max_filesize = 10M	--> Size of the maximum up-loading file
	  post_max_size = 10M 	--> It influences the size of the up-loading file. 


Install:

	Arcaiv is developed with the directory that the HTTP server is accessible,
	and the PHP script is executable.
	The directory named filesXXX (XXX is a version number) is made, and the 
	script file is progressed in that.

	ex:
		tar zxvf filesXXX.tgz	(XXX is a version number)

Upgrade:

	The method of the version's improving overwrites existing script files
	other than the configuration file and the password file.
	The configuration file must add only the addition item to an existing 
	configuration file or use the change in the content of an existing 
	configuration file set for a new configuration file in addition. 
	The content of the folder for data need not change.

	In default, the character-code used is us-ascii.
	To environment to use, please change it by the setting of the language to 
	mention later.

	(In that case, please reflect the content of existing installation file 
	files.conf for remembrance' sake.)

File composition: (XXX of filesXXX is a version number.)

	filesXXX/			Script storage directory
		README.txt		This file
		confmenu.php	Shared folder setting menu
		cut.php			Cutting and copy processing of file or folder
		delconf.php		Shared folder deletion processing
		delete.php		Deletion processing of file or folder
		dirlist.php		Shared folder list screen
		download.php	Download processing of file
		edit.php		Name, comment, and attribute edit of file or folder
		files.php		List screen of file and folder in shared folder
		files_com.php	Common subroutine file
		group.php		User and group setting processing
		icon_img.php	File of definition of icon image of file
						When add the icon of the file, edit this file.
		index.php		Page for entrance to shared folder
						(It jumps to login.php.)
		locale.php		CConfiguration file of character string according to
						character-code
						(The character-code of default is UTF-8.)
		login.php		Login processing
		md5hash.js		MD5 hush function JavaScript
		mkdir.php		Folder making processing in shared folder
		modconf.php		Set update processing of made shared folder
		newconf.php		Making processing of shared folder
		passwd.php		Password setting processing
		paste.php		Paste processing of file or folder
		session.php		Subroutine for session establishment and continuance
		setconf.php		Arrangement setting processing of configuration file
		setlang.php		The setting of the indication language
		upload.php		Up-loading processing of file

	filesXXX/config/	Default directory for storage of shared folder configuration 
						file. (It is revokable in the setting.)
						Entry page (index.php) of the shared folder is made for here. 
		files.conf		Configuration file for management
		passwd			Password file for management

	filesXXX/data/		Default directory for shared folder and data storage.
						(It is revokable in the setting.)

	filesXXX/images/	Image file storage directory
		back.png		Background image
		bmp.png			Icon of bit map file
		copy.png		Copy icon
		cut.png			Cut icon
		delete.png		Delete icon
		edit.png		Edit icon
		excel.png		Icon of Excel data file
		folder.png		Folder icon
		gif.png			Icon of GIF image file
		html.png		Icon of HTML file
		iso.png			Icon of iso image file
		lzh.png			Icon of LZH compression file
		mail.png		Icon of OutlookExpress data (.eml) file
		movie.png		Icon of movie file
		paste.png		Paste icon
		pdf.png			Icon of PDF file
		sound.png		Icon of MIDI file
		text.png		Icon of text file
		title.png		Title image (Default is an image of GUSUKU.)
		unknown.png		Icon of uncertain kind file
		up.png			Upper folder icon
		wav.png			Icon of sound file
		word.png		Icon of word document file
		wordpad.png		Icon of word pad document file

	filesXXX/locale/	Directory that stores file according to character-code

		euc-jp/			Directory where character-code stored file of EUC-JP.
						When the character-code used with the system is EUC-JP,
						the file in this is copied onto the filesXXX right under
						in the superscription. 

			locale.php	Configuration file of character string according to 
						character-code (EUC-JP version)
						(Overwrite onto filesXXX/locale.php.)
			files.conf	Configuration file for management (EUC-JP version)
						(Overwrite onto filesXXX/files.conf.)
			manual/		Manual storage directory (EUC-JP version)
						(Overwrite onto filesXXX/manual.)
				folder_manual.html	Operation explanation of shared folder.
				index.html			Help menu
				kanri_manual.html	Operation explanation of management screen.
				readme.html			Outline and setup
				image/				An image file directory for manuals.
					*/png			An image file for manuals.

		utf-8/			Directory where character-code stored file of UTF-8.
						When the character-code used with the system is UTF-8,
						the file in this is copied onto the filesXXX right under
						in the superscription.

			locale.php	Configuration file of character string according to 
						character-code (UTF-8 version)
						(Overwrite onto filesXXX/locale.php.)
			files.conf	Configuration file for management (UTF-8 version)
						(Overwrite onto filesXXX/files.conf.)
			manual/		Manual storage directory (UTF-8 version)
						(Overwrite onto filesXXX/manual.)
				folder_manual.html	Operation explanation of shared folder.
				index.html			Help menu
				kanri_manual.html	Operation explanation of management screen.
				readme.html			Outline and setup
				image/				An image file directory for manuals.
					*/png			An image file for manuals.

		shift-jis/		Directory where character-code stored file of ShiftJIS.
						When the character-code used with the system is Shift-
						JIS, the file in this is copied onto the filesXXX right 
						under in the superscription.

			locale.php	Configuration file of character string according to 
						character-code (Shift-JIS version)
						(Overwrite onto filesXXX/locale.php.)
			files.conf	Configuration file for management (Shift-JIS version)
						(Overwrite onto filesXXX/files.conf.)
			manual/		Manual storage directory (Shift-JIS version)
						(Overwrite onto filesXXX/manual.)
				folder_manual.html	Operation explanation of shared folder.
				index.html			Help menu
				kanri_manual.html	Operation explanation of management screen.
				readme.html			Outline and setup
				image/				An image file directory for manuals.
					*/png			An image file for manuals.

		us-ascii/		Directory where character-code stored file of US-ASCII.
						When the character-code used with the system is US-
						ASCII, the file in this is copied onto the filesXXX 
						right under in the superscription.

			locale.php	Configuration file of character string according to 
						character-code (US-ASCII version)
						(Overwrite onto filesXXX/locale.php.)
			files.conf	Configuration file for management (US-ASCII version)
						(Overwrite onto filesXXX/files.conf.)
			manual/		Manual storage directory (US-ASCII version)
						(Overwrite onto filesXXX/manual.)
				folder_manual.html	Operation explanation of shared folder.
				index.html			Help menu
				kanri_manual.html	Operation explanation of management screen.
				readme.html			Outline and setup.
				image/				An image file directory for manuals.
					*/png			An image file for manuals.

	filesXXX/manual/	Manual storage directory(Default is the UTF-8 edition.)
		folder_manual.html	Operation explanation of shared folder.
		index.html			Help menu
		kanri_manual.html	Operation explanation of management screen.
		readme.html			Outline and setup.
		image/				An image file directory for manuals.
			*/png			An image file for manuals.

Initialization:

	files.conf in the developing folder is a basic configuration file. 

	The configuration file sets the item of one a line by the composition like 
	key word <TAB> value. 

	The point needing a change in particular is 2 of the following

		CONFIG_TOP_DIR	./config
		TOPDIR	./data

	Because CONFIG_TOP_DIR is appointment of the directories that a pass Word
	file and the preference of the folder are stored, I recommend what I change
	to the place that I cannot refer to directly by the browser.

	But it must be the place that the practice user of the WEB server can read 
	and write.

	TOPDIR wins likewise at the place that the practice user of the WEB server 
	can read and write 	You had better set it by the browser in the place that 
	you cannot refer to.

	But I can use others as initial setting, but TOP_DIR and CONFIG_TOP_DIR
	recommend what they change in total to the environment of the server to use.

	The link URL is right, and it is transcribed when I do this item value for 
	absolute notation not relative notation because it is used for link URL 
	displayed by a file list screen.

	In default, the character-code used is us-ascii.
	To environment to use, please change it by the setting of the language to 
	mention later.

	It came to be able to set the directory that stored the configuration file 
	and the password from Ver.2.1 on the management screen.

	It is revokable on the screen where the directory that stores entry page 
	(index.php) of the shared folder is also the same.

	In addition, from Ver.2.5, the choice of the indication language came to be
	possible with a management screen.

How to use:

	In the setting when developing, a set directory of the shared folder is 
	made in the config directory in the directory that can have been done by 
	developing.

	The first folder is made below the data directory right under the directory
	to which the shared folder that puts actual data progresses, too.

	URL and passing under the explanation are described assuming that the 
	script is progressed right under DocumentRoot of the WEB server. 

  1) Change in basic setting

	First of all, it connects it with http://Server-Address/filesXXX/index.php 
	by using a browser from the client. 

	Because the login screen is displayed, admin is input in user ID, nimda is 
	input to the password, and it logs it in. 

	(The manager of default gets to nimda the setting of the admin password.)

	A management screen is displayed when I log in. 
	At first please set the language.

	Please change the placement of the constitution file of it next.

	In the setting of default, if URL of the file name is specified directly, 
	the password file and the configuration file can be inspected by a browser. 

	There is no change in a dangerous thing though it is not because the
	password can be seen directly because the password part filing the password
	has passed the hash function. 

	Therefore, it is necessary to move it to the place where the password file 
	and the configuration file cannot be inspected by a browser.

	The change does the place of the configuration file from "Configuration file
	arrangement setting" menu of the management menu. 

	The file is actually moved when the setting is executed on the configuration
	file arrangement setting screen, and set it carefully, please. 

	Next, please do "Password setting" when you can do the configuration file 
	arrangement setting. 

  2) Making of shared folder

	In the shared folder list, the list of the made shared folder is displayed.
	The folder list is a link to the folder that becomes an object. 
	It changes in the setting and the deletion also is linked with the screen 
	here. 

	In the shared folder making, the shared folder is newly made. 
	A set name of the shared folder becomes the storage directory name of the 
	configuration file.
	The first directory of the folder actually shared is specified for the 
	first folder.
	The first directory is done by the relative path from the directory in the 
	script in specification or the full path.

	From version 2.4, I got possible to appoint even the directory which 
	I cannot refer to in URL directly.
	You had better appoint the directory which did not have the management of
	the WEB server below in top folder when you considered security.

	From version 2.5, I was able to use a link to the direct file without
	using a download script.

	When size was more than 2GByte, this established it for evasion for what
	I cannot download in the cases that wanted to show a big file of the size.

	In that case, a WEB server must set the top folder in access possibility, 
	the writable place.

	When the folder under the management of the WEB server is specified, the 
	following content in the directory for data. You will put the htaccess 
	file, and do measures of the acceptance only of the access from the link 
	on the page after specification URL etc.

		SetEnvIf REFERER "^http://www\.example\.com" ref_ok
		Order deny,allow
		deny from all
		allow from env=ref_ok

	(The above-mentioned is a description for Apache.)

	Additionally, please set it suitably.

	The directory of the name same as setting name is made under the directory 
	which I appointed in CONFIG_TOP_DIR of preference (files.conf) when I make 
	a shared folder, and a preference and a pass Word file are begun to write 
	in that.

	The configuration file name becomes <folder name>.conf.

	The content that can be edited on a set screen is only a part of very item
	of the configuration file.
	Because the configuration file can be edited in the editor, other detailed
	items are edited in the editor.

	I temporarily think that it can use it only by setting the above-mentioned.

	When the shared folder is made, the shared folder list screen is opened.

	A set name of the shared folder list screen or URL is a link of the shared
	folder to the login screen.

  3) Operation of shared folder:

	The name or URL of the made folder is selected from the list screen. 

	It logs it in here with user ID = admin and password = nimda because it 
	jumps to the login screen to the made shared folder. 
	(Please change the password of admin after it logs it in.)

	The screen of the file list that is basic of the operation of the shared 
	folder is displayed. 

	The link of "Make Folder", "Upload", and "Password Setting" to each
	function is displayed in the upper part of this screen. 

	The subfolder is made by "Make Folder", and the file is up-loaded from 
	the client by "Upload".

	The movement to the made folder selects the icon of the folder name or the
	destination head. 

	The movement from the lower folder to a upper folder selects the name of a
	upper folder of the first line or the arrow icon. 

	The name of the up-loaded file is displayed as a link in the list.
	This link is selected and it downloads it to the client when downloading it. 
	The comment is edited, is deleted, and copied, and it cuts out and the icon
	on the side of file name is selected.

  4) Edit of configuration file:

	The character-code of the configuration file is described by the character-
	code used with the system, and changing line uses only LF. 

	A set item is describes one item a line, and the following forms. 

		keyword<TAB>value1<TAB>value2<TAB>value3<LF>

	TThe key word begins from the head of line, and the delimitation with the
	value is delimited with Tab. 

	Do not put two or more Tab in the delimitation.
	Set value2 and set value3 are by the kind of the key word and there is a 
	no potato, too.

	The line where "#" is at the head is a comment. 

	The item of the configuration file is written at the head of the 
	configuration file by the comment, and refer to that, please. 

Use regulations:

 1) Use conditions
	This software can be used by anyone free of charge.
	However, I prohibited the use and that violates the laws of the country of 
	the user, the use of applications unethical.

 2) About the distribution
	The re-distribution in the state that is edited and not remodeled is free.

 3) About the edit and remodeling
	The change and remodeling can do freely, and when the one to have made a 
	change is distributed again, should include the document that described
	the content of the change clearly in distributed material.

	However, the edit of the part concerning copyright information is assumed 
	to be no permission.

	An entire part of the source code of this software cannot be used for other
	software without permission. 

 4) Exemption matters
	Our company doesn't assume the responsibility for it at all even if it
	is assumed that the user received some disadvantages by having used this 
	software. 

	Please use it by the self-responsibility.

 5) About the bug and the demand
	I hope about the bug and the demand in E-mail.
	However, it is not a thing that the reflection of the bug correction and
	the demand is guaranteed. 

Copyright information:
	The GUSUKU has the copyright of this software. 
	This software is protected by a Japanese country Copyright Law and an
	international agreement. 

	Please note becoming the infringement of a copyright when it violates the
	use regulations and it uses, and it distributes it though it is permitted
	to use it within the range of the use regulations. 

Where to make contact:
	Software Development GUSUKU
	webmaster@gusuku.org

Update history:

Ver.1.0.0  2004/04/27 First edition

Ver.1.0.1  2004/05/12
	The size specification of Table is changed from fixed-size (pixel) 
	specification to relative size (percent) specification. 
	Help is added.

Ver.1.0.2  2004/05/18
	Get_post_get_val() of files_com.php is corrected and it deals with the
	escape by the backing slash. 

Ver.1.0.3  2004/05/23
	Because JavaScript of the MD5 hush making doesn't operate correctly by
	a browser on MacOS.
	It is corrected that use conditions and MD5_PASSWD_USE of MD5 can be 
	added to the configuration file, and three kinds (YES, NO, and NO_MAC)
	be set as a value.

Ver.1.0.4  2005/08/02
	The icon definition file of the file is cut out to another file, and 
	the edit method is added by the comment. (Because the icon addition 
	was demanded. )

	The description of the download method was added to help. 

	It is corrected that the superscription is confirmed when file 
	up-loading it.

	It is corrected that it makes it to the one that manager's default 
	password was specified by not the blank but the configuration file.
	In default, it is the following settings.
		Manager user ID : admin
		Manager password: nimda

Ver.2.0	2007/09/05
	To change by correcting only locale.php in the displayed character 
	string, the display character string was separated to locale.php as 
	an array. 
	The displayed character string acquisition is corrected to do by using
	get_txt().

	Add the permission setting function to use the group and the user.

	To use not the link but the download script, the method of downloading
	the file was changed. 
	(As a result, downloading it even if the data folder was not the under
	of the management of the WEB server became possible.)

	The script had in the configuration file and all users had reading and
	writing can enabled the permission of the made file.(PERMIT_ALL=YES)

	The configuration file was prepared according to the character-code.
	The directory for the file that depended on the character-code for the
	filesXXX/locale under was prepared, and the configuration file for four
	kinds of character-codes of euc-jp, utf-8, shift-jis, and us-ascii was
	prepared. 

Ver.2.1	2007/12/01
	The index.php filing in which a link to a login screen was written was
	done in order to make a setting file at the place different from a 
	password file.

	I deleted an unnecessary description of download script download.php.

	The configuration file arrangement setting was added to the management
	menu. 

Ver.2.1	2007/12/02
	Because URL of the script of index.php was absolute path specification,
	it corrected it to the relative path. 

Ver.2.2	2007/12/07
	The character-code in the script released with Ver.2.1 replaced it because
	there was something that 'BOM' mixes with the file of UTF-8.

Ver.2.3 2008/02/09
	It was corrected that ini_set() was executed in the session_start() 
	front because it had become an error by session_start() in the version 
	before PHP 4.3.3 occasionally. 

	Because function stripos() not supported with PHP4 had been used, 
	it changed to use stristr() instead. 

	When a pass of a folder for setting files was established by the same
	condition by composition file arrangement setting, the defect which 
	puts out an original setting file was corrected.

Ver.2.4 2008/03/25
	URL for the connection to the login screen was displayed. 

	The method of linking the download files was changed. 

	When the file of a Japanese name was downloaded, the file name was 
	converted in consideration of the kind of a browser.

	Because link ahead to the file of the cut buffer was wrong, I revised it

Ver.2.5 2008/12/11
	The character set used by HTTP header was specified in front of HTML.

	A part of function was moved from files_com.php to session.php.

	Because return destination URL had not been correctly set, it corrected it. 

	I changed it to treat file size with 32 bits unsigned integer.

	I added the setting screen of the indication language.

	Besides the use of the download script, I was able to use a direct link
	to the file.

	A value to set in a variable to save current directory was funny and 
	revised it because there was the case that a pass of a file cannot set 
	definitely.
	(BUG was able to be discovered by the favor that the point is gotten 
	on the bulletin board. Thank you so much.)

Ver.2.6 2009/03/25
	When an error occurred by upload, I was able to display a message and 
	return.

	When a config file name was not handed, I acquired it from a session 
	variable.

	Because warning was given by cf. variable that was not set, I checked 
	it earlier.

	I changed the check order of the global variable to take the file 
	names of an uploaded file.
	$_FILES >> $HTTP_POST_FILES >> $UploadFile

	It previously checked it because it opened and it deleted it without
	doing the existence check of the file and the directory.

	I revised the mistake of the variable(new_conf -> conf)

	I revised it there was it before deleting a file, and to check it. 
	iSo that warning is not output by logj

Ver.2.6.1 2009/11/08
	In Internet Explorer, without opening the file in the application, 
	so you get a save dialog.

Ver.2.6.2 2014/05/23
	The copyright owner has been changed.

	Add a string resource that was missing for the message.

	After returning from a shared folder, the modified configuration file
	is not specified as a shared folder.

-- End --
