<?php
/**
@file
@brief 投稿時の確認 & CSRF ガード
@author minahito
@version $Id: submit_confirm.php,v 1.4 2004/07/26 10:29:12 minahito Exp $
*/

$xoopsOption['nocommon']=true;
include_once "../../mainfile.php";
include_once XOOPS_ROOT_PATH."/modules/exFrame/frameloader.php";
include_once "./class/global.php";

// Form を読み込む
require_once "exComponent/Preview.php";
require_once "./include/PartyForm.php";
require_once "./include/PartyConfirm.php";

include_once "class/party.php";
require_once "include/OnetimeTicket.php";

// session_start
include_once XOOPS_ROOT_PATH."/include/common.php";
include_once XOOPS_ROOT_PATH."/header.php";

$compo = new exPreviewComponent(null,new exConrimComponentModelRender(new PartyConfirmRenderModel()),'edit_party');

switch($ret=$compo->init()) {
	case COMPONENT_INIT_FAIL:
		die;
		break;

	case ACTIONFORM_POST_SUCCESS:
		$handler=bxParty::getHandler("party");
		$editform=Session::get($compo->name_);
		$editform->data_->setDirty();
		if($handler->insert($editform->data_)) {
			redirect_header("./index.php", 1, "新しい宴会の登録を受け付けました");
		}
		else {
			print "Fatal::データーベースへの書き込みに失敗しました";
		}
		break;

	case ACTIONFORM_INIT_FAIL:
	case ACTIONFORM_INIT_SUCCESS:
	case COMPONENT_INIT_SUCCESS:
		$compo->display();
		break;
}

include_once XOOPS_ROOT_PATH."/footer.php";

?>