<?php
/*金沙江出品 客服QQ109588550 
 *近来发现很多站长朋友私自更改代码造成插件无法访问
 *所以敬告站长朋友：此页为核心代码，请勿私自修改！
 *多沟通，多提问，有问题就联系我们。
 */
if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}
loadcache('plugin');
$config=$_G['cache']['plugin']['jsjpay'];
$jfzl=$_G['setting']['extcredits'][$config['jifen']]['title'];
$jfye = getuserprofile('extcredits'.$config['jifen']);
$navtitle = $config['pname'];

if(!$_GET['action']){
	$currpage=intval($_GET['page'])?intval($_GET['page']):1;
	$perpage=10;
	$num = C::t('#jsjpay#jsjpay')->count_by_uid($_G['uid']);
	$start=($currpage-1)*$perpage;
	$list=C::t('#jsjpay#jsjpay')->fetch_all_by_uid($_G['uid'],$start,$perpage);
	$paging = helper_page :: multi($num, $perpage, $currpage, 'home.php?mod=spacecp&ac=plugin&op=credit&id=jsjpay:log', 0, 11, false, false);

}else if($_GET['action']=='admin' && !$_GET['type']){
	if($_G['adminid']!='1') showmessage(lang('plugin/jsjpay','not'));
	$currpage=intval($_GET['page'])?intval($_GET['page']):1;
	$perpage=30;
	$num = C::t('#jsjpay#jsjpay')->count();
	$start=($currpage-1)*$perpage;
	$list=C::t('#jsjpay#jsjpay')->range($start,$perpage,'desc');
	$paging = helper_page :: multi($num, $perpage, $currpage, 'home.php?mod=spacecp&ac=plugin&op=credit&id=jsjpay:log&action=admin', 0, 11, false, false);
}else if($_GET['action']=='admin' && $_GET['type']=='uid'){
	if($_G['adminid']!='1') showmessage(lang('plugin/jsjpay','not'));
	$uid = intval($_GET['uid']);
	$currpage=intval($_GET['page'])?intval($_GET['page']):1;
	$perpage=30;
	$num=C::t('#jsjpay#jsjpay')->count_by_uid($uid);
	$start=($currpage-1)*$perpage;
	$list=C::t('#jsjpay#jsjpay')->fetch_all_by_uid($uid,$start,$perpage);
	$paging = helper_page :: multi($num, $perpage, $currpage, 'home.php?mod=spacecp&ac=plugin&op=credit&id=jsjpay:log&action=admin&type=uid&uid='.$uid.'', 0, 11, false, false);
}else if($_GET['action']=='delete'){
	if(submitcheck('formhash')){
		if(empty($_POST['showid'])){  
			showmessage(lang('plugin/jsjpay','d0'),dreferer(),array(),array('alert' => 'error', 'showdialog' => 1, 'closetime' => 3));
		}else{ 
			foreach($_POST['showid'] as $k=>$id){
				C::t('#jsjpay#jsjpay')->delete(intval($id));
			}
			showmessage(lang('plugin/jsjpay','d1'),dreferer(),array(),array('alert' => 'right', 'showdialog' => 1, 'closetime' => 3));
		}

	}
}
?>