<?php
/*
 * content/page/html/Load.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(dirname(__FILE__))))
	.DIRECTORY_SEPARATOR.'system'
	.DIRECTORY_SEPARATOR.'login'
	.DIRECTORY_SEPARATOR.'ModuleBase.class.php');
require_once( dirname(dirname(dirname(__FILE__)))
	.DIRECTORY_SEPARATOR.'DaoPage.class.php');
require_once( dirname(dirname(dirname(__FILE__)))
	.DIRECTORY_SEPARATOR.'Variable.class.php');
class content_page_html_Load extends system_login_ModuleBase {
	function content_page_html_Load() {
		array_push($this->require_module_array,'content.page.setting.Load');
	}
	function execute( & $request ) {
		if( !$request->isError() ) {
			$agent			= strtolower(trim(stripslashes($_GET['agent'])));
			$pageObject		= $request->getAttribute('content.page.pageObject' );
			$isExistAgent	= false;
			$bodyStrings	= '';
			foreach( $GLOBALS['SPIDER_USER_AGENT_CLASS_HASH'] as $agentType => $agentName ) {
				if( $agentType == $agent ) {
					$bodyStrings	= $pageObject->getBody( $request, $agent );
					$isExistAgent	= true;
					break;
				}
			}
			if( !$isExistAgent ) {
				$agent			= 'default';
				$bodyStrings	= $pageObject->getBody( $request, $agent );
			}
			$request->setAttribute('content.page.html.agent',$agent);
			$request->setAttribute('content.page.html.body', $bodyStrings );
		}
	}
}
?>