<?php
    include('header.html');
?>
<script type='text/javascript'>
function doAjax(url, param, callback, type) {
	function createAjax() {
		var xhr;
		if (window.XMLHttpRequest) {
			xhr = new XMLHttpRequest();
			if(xhr.overrideMimeType){
				xhr.overrideMimeType("text/html");
			}
		} else if (window.ActiveXObject) {
			try {
				xhr = new ActiveXObject("Xsxml2.XMLHTTP");
			} catch(e) {
				try {
					xhr = new ActiveXObject("Microsoft.XMLHTTP");
				} catch(e) {}
			}
		}
		return xhr; //返回XMLHTTP对象实例
	}

	var dl_xhr = createAjax();
	dl_xhr.onreadystatechange = function(){
		if (dl_xhr.readyState == 4) {
			if (dl_xhr.status == 200) {
				var data = dl_xhr.responseText;
				if (callback && typeof callback == "function") {
					callback(data);
				}
				dl_xhr = null;
			}
		}
	};
	var pstr = "_t=" + new Date().getTime();
	for (var i = 0; i < param.length; i++) {
		var pitem = param[i];
		pstr += "&" + pitem.name + "=" + encodeURI(pitem.value);
	}
	dl_xhr.open("POST", url, type ? type : true);
	dl_xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
	dl_xhr.send(pstr);
}

function ID(id) {
    return document.getElementById(id);
}
function auto_install(){
	$auto = confirm('灯鹭插件自动安装');
	if($auto){
		var install_method = 'auto_install';
		window.location.href="?action=four&install_method="+install_method;
	}
	return false;
	
}
function hand_install(){
	$hand = confirm('灯鹭插件手动安装');
	if($hand){
		var install_method = 'hand_install';
		window.location.href="?action=four&install_method="+install_method;
	}
	return false;
}

</script>
<div class="setup step4">
<h2>4.安装完成</h2>
</div>
<div class="stepstat">
<ul>
<li class="unactivated">1</li>
<li class="unactivated">2</li>
<li class="unactivated">3</li>
<li class="current last">4</li>
</ul>
<div class="stepstatbg stepstat4"></div>
</div>
</div> 
<div class="main">

<?php
if($_GET['install_method']=='auto_install'){
include $denglu_p_root.'/auto_install.php';

?>
<div class="installs">
<h1>安装完成</h1>
<ul>
<?php
foreach($warming as $v){
?>
<li><?php echo $v[0] ?><font title="struct" class="process wait">安装成功</font></li>
<?php
}
?>
</ul>
</div>
<div style="color:red; padding-left:70px">完成安装，请及时删除denglu/install.php文件</div>
<div class="btnbox marginbot">
<font id="final_result">

<input type="button" value="进入网站" onclick="javascript:window.parent.location.href='../../../admin.php?action=plugins'" />
</font>
</div>
<?php
}else if($_GET['install_method']=='hand_install'){
?>

<div style="height: 466px; overflow: hidden; width: 809px; margin-bottom:
20px;">
    <div style="margin:-120px 0px -296px -209px;">
        <iframe height="850" frameborder="0" width="1016" vspace="0" hspace="0"
marginheight="0" marginwidth="0" src="http://developer.denglu.cc/index.php?title=Discuz20"></iframe>
    </div>
</div>
<div class="btnbox marginbot">
<font id="final_result">

<input type="button" value="进入网站" onclick="javascript:window.parent.location.href='../../../admin.php?action=plugins'" />
</font>
</div>
<?php
}else{
?>
<div class="installs">
<h1>如果你网站未修改过模板请选择自动安装，否则选择手动安装</h1>
<input type="button" onclick="javascript:hand_install()" value="手动安装" />
<input type="button" value="自动安装" onclick="javascript:auto_install()"/>
</div>
<?php
}
?>

</div>

<?php
    include('footer.html');
?>