<?php
include_once($_SERVER['DOCUMENT_ROOT'].'/products/recon/inc/simple_html_dom.php');
$error_file = './error-text.html';
$efh = fopen($error_file,'r');
$error_content = fread($efh,filesize($error_file));
fclose($efh);
if (isset($_GET['id'])) {
	$id = $_GET['id'];
}
else {
	$content = $error_content;
}

$url = 'https://www.novell.com/surveyutil/survey.jsp?id='.$id;

if (strpos($_SERVER['SERVER_NAME'], 'test')) {
	$server = 'secure-wwwtest.provo.novell.com';
}
elseif (strpos($_SERVER['SERVER_NAME'], 'stage')) {
	$server = 'secure-wwwstage.provo.novell.com';
}
else {
	$server = 'www.novell.com';
}

$html = file_get_html($url);
$plain_text = $html->plaintext;
if (!stripos($plain_text,'invalid id')) {

	$title_arr = $html->find('title');
	foreach($title_arr as $temp) {
		$title = $temp;
		break;
	}

	$content = $html->getElementById('contentcontainer');
	$content = str_replace("//]]>", '', $content);
	$content = str_replace("//<![CDATA[", '', $content);
	$content = str_replace('src="/','src="/common/',$content);
	$content = str_replace('Novell','NetIQ', $content);
	$content = str_replace('/common/inc/util/survey/', '/common/util/survey/',$content);
	$privacy_img = '<img src="/common/common/img/privacy_icon.gif" width="65" height="65" alt="privacy" style="float:right" />';

	$content = str_replace($privacy_img, '', $content);
	$content = str_replace('/company/policies/privacy/', '/ja-jp/company/legal/privacy/', $content);
	$content = str_replace('/surveyutil/survey_save.jsp', 'https://'.$server.'/surveyutil/survey_save.jsp', $content);
	$content = str_replace('/common/util/survey/custom/survey_', 'https://'.$server.'/common/util/survey/custom/survey_', $content);
	$ja_privacy = 'このフォームの必要事項を記入することにより、ネットアイキューおよびネットアイキューパートナーから、ネットアイキューの製品/サービスに関して連絡を受け取ることに同意します。';
	$content = str_replace("By completing this form, I am giving NetIQ and/or NetIQ's partners permission to contact me regarding NetIQ products and services.",$ja_privacy,$content);
	$ja_feedback = '弊社のプライバシーポリシーについてご質問やコメントがある場合、このページの一番下にある［フィードバック］をクリックしてください。';
	$content = str_replace('To submit questions or comments about our privacy policy, click on feedback at the bottom of this page.',$ja_feedback,$content);
	$ja_required = '<b>注:</b> <span class="redAst">*</span> マークの付いている項目は必須です。';
	$content = str_replace('<b>Note:</b> Items marked with an  <span class="redAst">*</span> are required.',$ja_required,$content);

}
else {
	$title = strip_tags($error_content);
	$title = '<title>'.$title.'</title>';
	$content = '<div id="contentcontainer">'.$error_content.'</div>';
}
//echo $content;

?>
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
	<?php echo $title; ?>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

	<?php virtual('/common/inc/header/hdr_head.html'); ?>
	<link href="/common/inc/css/surveys.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<?php virtual('/ja-jp/common/inc/header/hdr.html');?>
	<div role="main" id="main" class="product_main">
		<div class="wrap_alt">
			<?php echo $content;?>
			<!-- <?=$url?> -->
		</div>
	</div>
	<?php virtual('/ja-jp/common/inc/footer/footer.html');?>
	<?php virtual('/common/inc/footer/ftr_js.html');?>
</body>
</html>
