<?php
/*
 * content/upload/Form.class.php
 * 
 * CopyRight(C) 2010 Shopformer Development Team. All Right Reserved
 * URL: http://sourceforge.jp/projects/shopformer/
 * 
 * 
 * Mail: m_nakashima@users.sourceforge.jp
 * Auther: Masanori Nakashima
 * Last Update: 2010-06-18
 */
require_once( dirname(dirname(dirname(__FILE__)))
	.DIRECTORY_SEPARATOR.'system'
	.DIRECTORY_SEPARATOR.'login'
	.DIRECTORY_SEPARATOR.'ModuleBase.class.php');
require_once( dirname(dirname(dirname(__FILE__)))
	.DIRECTORY_SEPARATOR.'system'
	.DIRECTORY_SEPARATOR.'DataFileWriter.class.php');
require_once( dirname(dirname(__FILE__))
	.DIRECTORY_SEPARATOR.'Uploader.class.php' );
require_once( dirname(dirname(__FILE__))
	. DIRECTORY_SEPARATOR.'package_define.inc.php' );
class content_upload_Form extends system_login_ModuleBase {
	
	function content_upload_Form() {
	}
	function execute( & $request ) {

		$sessionObjectName		= 'content.upload.uploader';
		$sessionConfirmName		= 'content.upload.confirm';
		$targetFolder			= stripslashes($_GET['folder']);
		$uploadName				= stripslashes($_GET['upname']);
		$folderSelect			= stripslashes($_GET['fs']);
		$contentUploader		= $request->getSession($sessionObjectName);
		$request->removeSession($sessionConfirmName);
		
		if( preg_match('/^[fF](|[aA][lL][sS][eE])$/',$folderSelect) > 0 ) {
			$folderSelect	= false;
		} else {
			$folderSelect	= true;
		}

		// 一時アップロードファイルを削除
		if( is_object($contentUploader) && 'content_uploader' == strtolower(get_class($contentUploader)) ) {
			$contentUploader->initialize( $request );
		}

		$request->setAttribute('content.upload.targetUri', $targetFolder);
		$request->setAttribute('content.upload.uploadName', $uploadName);
		$request->setAttribute('content.upload.folderSelect', $folderSelect);
		$request->setAttribute('content.upload.uploaderObject',$contentUploader);
	}
}
?>