<?php
/**
* 开发团队:IT618资讯网
* it618_copyright 插件设计:<a href="http://www.cnit618.com" target="_blank" title="为站长提供学习资料">IT618资讯网</a>
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
global $_G,$it618_wike;
$it618_wike = $_G['cache']['plugin']['it618_wike'];
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pramga: no-cache");
if($_GET['formhash']!=FORMHASH)return;
if($_GET['ac']=="postwike"){
$uid = $_G['uid'];
$tid = intval($_GET['tid']);
$it618_mode = intval($_GET['it618_mode']);
$it618_mancount = intval($_GET['it618_mancount']);
$it618_moneycount1 = intval($_GET['it618_moneycount1']);
$it618_moneycount2 = intval($_GET['it618_moneycount2']);
$it618_getwikemoney = intval($_GET['it618_getwikemoney']);
$wike_groups=(array)unserialize($it618_wike['wike_groups']);
if($it618_mode==2){
$it618_wike['wike_ismoneyedit']=0;
$it618_wike['wike_jiangedit']=0;
$it618_wike['wike_isclockmoney']=1;
$wike_mode=lang('plugin/it618_wike', 'it618_wike_lang225');
}else{
$wike_mode=lang('plugin/it618_wike', 'it618_wike_lang226');
}
if($uid>0){
if(in_array($_G['groupid'], $wike_groups)){
$count=DB::result_first("select count(1) from ".DB::table('it618_wike_main')." where it618_tid=$tid");
$liii1il=array();for($i=0;$i<strlen($_GET['id']);$i++){if(substr($_GET['id'],$i,1)==':')break;$liii1il[]=substr($_GET['id'],$i,1);}
if($count==0){
$timeStr = str_replace("-","",$_GET['it618_time2']);
$timeStr = str_replace(" ","",$timeStr);
$timeStr = str_replace(":","",$timeStr);
$hour = substr($timeStr,8,2);
$minute = substr($timeStr,10,2);
$second= substr($timeStr,12,2);
$year= substr($timeStr,0,4);
$month= substr($timeStr,4,2);
$day = substr($timeStr,6,2);
$it618_time2=mktime($hour,$minute,$second,$month,$day,$year);
$setarr = array(
'it618_uid' => $uid,
'it618_tid' => $tid,
'it618_mode' => $it618_mode,
'it618_mancount' => $it618_mancount,
'it618_moneycount1' => $it618_moneycount1,
'it618_moneycount2' => $it618_moneycount2,
'it618_getwikemoney' => $it618_getwikemoney,
'it618_state' => 10,
'it618_time1' => $_G['timestamp'],
'it618_time2' => $it618_time2
);
if(count($liii1il)!=10)return;
if($it618_mancount<=0){
showmessage(lang('plugin/it618_wike', 'it618_wike_lang83'), '', array(), array('alert' => 'error'));
}
if($it618_moneycount1<0||$it618_moneycount2<0){
showmessage(lang('plugin/it618_wike', 'it618_wike_lang42'), '', array(), array('alert' => 'error'));
}elseif($it618_moneycount1>=$it618_moneycount2){
if($it618_wike['wike_ismoneyto']==1){
showmessage(lang('plugin/it618_wike', 'it618_wike_lang43'), '', array(), array('alert' => 'error'));
}else{
showmessage(lang('plugin/it618_wike', 'it618_wike_lang200'), '', array(), array('alert' => 'error'));
}
}
if($it618_time2<=$_G['timestamp']){
showmessage(lang('plugin/it618_wike', 'it618_wike_lang44'), '', array(), array('alert' => 'error'));
}
$creditnum=DB::result_first("select extcredits".$it618_wike['wike_credit']." from ".DB::table('common_member_count')." where uid=".$_G['uid']);
$liii1il=array();for($i=0;$i<strlen($_GET['id']);$i++){if(substr($_GET['id'],$i,1)==':')break;$liii1il[]=substr($_GET['id'],$i,1);}
if($creditnum>=$it618_wike['wike_mincount']){
$id = C::t('#it618_wike#it618_wike_main')->insert($setarr, true);
if($id>0){
$wike_credit=$it618_wike['wike_credit'];
$wike_creditname=$_G['setting']['extcredits'][$it618_wike['wike_credit']]['title'];
if($it618_wike['wike_isclockmoney']==1){
DB::query('update '.DB::table('common_member_count').' set extcredits'.$wike_credit.'=extcredits'.$wike_credit.'-'.$it618_moneycount2.' where uid='.$_G['uid']);
$liii1il=array();for($i=0;$i<strlen($_GET['id']);$i++){if(substr($_GET['id'],$i,1)==':')break;$liii1il[]=substr($_GET['id'],$i,1);}
showmessage(lang('plugin/it618_wike', 'it618_wike_lang45')."<font color=red>".$it618_moneycount2."</font>".$wike_creditname.lang('plugin/it618_wike', 'it618_wike_lang46').$wike_creditname.lang('plugin/it618_wike', 'it618_wike_lang47').$wike_creditname.lang('plugin/it618_wike', 'it618_wike_lang48').'<br>'.$wike_mode, '', array(), array('alert' => 'right'));
if(count($liii1il)!=10)return;
}else{
showmessage(lang('plugin/it618_wike', 'it618_wike_lang84').'<br>'.$wike_mode, '', array(), array('alert' => 'right'));
}
}else{
showmessage(lang('plugin/it618_wike', 'it618_wike_lang2'), '', array(), array('alert' => 'error'));
}
}else{
$wike_creditname=$_G['setting']['extcredits'][$it618_wike['wike_credit']]['title'];
showmessage(lang('plugin/it618_wike', 'it618_wike_lang3')." <font color=red>".$it618_wike['wike_mincount']."</font> ".$wike_creditname.",".lang('plugin/it618_wike', 'it618_wike_lang4')." <font color=red>".$creditnum."</font> ".$wike_creditname."!", '', array(), array('alert' => 'info'));
$liii1il=array();for($i=0;$i<strlen($_GET['id']);$i++){if(substr($_GET['id'],$i,1)==':')break;$liii1il[]=substr($_GET['id'],$i,1);}
}
}
}
}
}
if($_GET['ac']=="postwikecheck"){
$uid = $_G['uid'];
$it618_mancount = intval($_GET['it618_mancount']);
$it618_moneycount1 = intval($_GET['it618_moneycount1']);
$it618_moneycount2 = intval($_GET['it618_moneycount2']);
$it618_getwikemoney = intval($_GET['it618_getwikemoney']);
$wike_groups=(array)unserialize($it618_wike['wike_groups']);
if(in_array($_G['groupid'], $wike_groups)){
$liii1il=array();for($i=0;$i<strlen($_GET['id']);$i++){if(substr($_GET['id'],$i,1)==':')break;$liii1il[]=substr($_GET['id'],$i,1);}
$timeStr = str_replace("-","",$_GET['it618_time2']);
$timeStr = str_replace(" ","",$timeStr);
$timeStr = str_replace(":","",$timeStr);
$hour = substr($timeStr,8,2);
$minute = substr($timeStr,10,2);
$second= substr($timeStr,12,2);
$year= substr($timeStr,0,4);
$month= substr($timeStr,4,2);
$day = substr($timeStr,6,2);
$it618_time2=mktime($hour,$minute,$second,$month,$day,$year);
if(count($liii1il)!=10)return;
if($it618_mancount<=0){
echo lang('plugin/it618_wike', 'it618_wike_lang83');return;
}
if($it618_moneycount1<0||$it618_moneycount2<0){
echo lang('plugin/it618_wike', 'it618_wike_lang42');return;
}elseif($it618_moneycount1>=$it618_moneycount2){
if($it618_wike['wike_ismoneyto']==1){
echo lang('plugin/it618_wike', 'it618_wike_lang43');return;
}else{
echo lang('plugin/it618_wike', 'it618_wike_lang200');return;
}
}
$wike_credit=$it618_wike['wike_credit'];
$curcreditcount=DB::result_first("select extcredits".$wike_credit." from ".DB::table('common_member_count')." where uid=".$uid);
if($it618_moneycount2>$curcreditcount){
echo lang('plugin/it618_wike', 'it618_wike_lang67').$wike_creditname."(<font color=red>".$curcreditcount."</font>)".lang('plugin/it618_wike', 'it618_wike_lang68');return;
}
if($it618_time2<=$_G['timestamp']){
echo lang('plugin/it618_wike', 'it618_wike_lang44');return;
}
$creditnum=DB::result_first("select extcredits".$it618_wike['wike_credit']." from ".DB::table('common_member_count')." where uid=".$_G['uid']);
$liii1il=array();for($i=0;$i<strlen($_GET['id']);$i++){if(substr($_GET['id'],$i,1)==':')break;$liii1il[]=substr($_GET['id'],$i,1);}
if($creditnum<$it618_wike['wike_mincount']){
$wike_creditname=$_G['setting']['extcredits'][$it618_wike['wike_credit']]['title'];
echo lang('plugin/it618_wike', 'it618_wike_lang3')." <font color=red>".$it618_wike['wike_mincount']."</font> ".$wike_creditname.",".lang('plugin