<?php

#在线支付插件
RegisterPlugin("payment","ActivePlugin_payment");

function ActivePlugin_payment() {
	global $zbp;
	Add_Filter_Plugin('Filter_Plugin_Index_Begin','payment_Main');
}

function InstallPlugin_payment(){
	global $zbp;
		if(!$zbp->Config('payment')->title_text){
		$zbp->Config('payment')->title_text='在线支付';
		$zbp->Config('payment')->pay_account='13592589115';
		$zbp->Config('payment')->pay_amount='10';
		$zbp->SaveConfig('payment');
	}
}

function payment_Main(){
	global $zbp;

	if(isset($_GET['pay'])){
	payment_Page();
		die();
	}
	
}


function payment_Page(){

	global $zbp;

	$article = new Post;
	$article->Title=$zbp->Config('payment')->title_text;
	$article->IsLock=true;
	$article->Type=ZC_POST_TYPE_PAGE;
	$article->Content .=$zbp->Config('payment')->readme_text;
	$article->Content .='<form action="https://shenghuo.alipay.com/send/payment/fill.htm" method="POST" target="_blank" accept-charset="gb2312"><input name="optEmail" type="hidden" value="'.$zbp->Config('payment')->pay_account.'" /><input name="payAmount" type="hidden" value="'.$zbp->Config('payment')->pay_amount.'" /><input id="title" name="title" type="hidden" value="'.$zbp->Config('payment')->pay_show.'" /><input name="memo" type="hidden" value="'.$zbp->Config('payment')->pay_note.'" /><input name="pay" type="image" value="转账" src="https://img.alipay.com/sys/personalprod/style/mc/btn-index.png" /></form>';
	$mt=microtime();
	$s=	'';
	$article->Content .=$s;	
	$zbp->template->SetTags('title',$article->Title);
	$zbp->template->SetTags('article',$article);
	$zbp->template->SetTemplate($article->Template);
	$zbp->template->SetTags('comments',array());
	foreach ($GLOBALS['Filter_Plugin_ViewPost_Template'] as $fpname => &$fpsignal) {
		$fpreturn=$fpname($zbp->template);
	}
	$zbp->template->Display();
}

?>