www.gusucode.com > ShopEx481 & PHPWind 整合版码程序 > bbs/require/postnew.php
<?php !function_exists('readover') && exit('Forbidden'); ##主题分类 $t_typedb = array(); $t_per = 0;$t_exits = 0; $t_db = $foruminfo['t_type']; if ($t_db) { $t_typedb = explode("\t",$t_db); $t_typedb = array_unique ($t_typedb); $t_per = $t_typedb[0];unset($t_typedb[0]); foreach ($t_typedb as $value) { if ($value) $t_exits = 1; } } $db_forcetype = $t_exits && $t_per=='2' && !$admincheck ? 1 : 0; // 是否需要强制主题分类 if ($foruminfo['allowpost'] && !$admincheck && !allowcheck($foruminfo['allowpost'],$groupid,$winddb['groups'],$fid,$winddb['post'])) { Showmsg('postnew_forum_right'); } if ($special=='1' && !$foruminfo['allowpost'] && !$admincheck && $gp_allownewvote==0) { Showmsg('postnew_group_vote'); } elseif ($special=='2') { !$gp_allowactive && Showmsg('postnew_group_active'); $sel_0 = 'checked';$sel_1 = $sel_2 = ''; } if (!$foruminfo['allowpost'] && !$admincheck && $gp_allowpost==0) { Showmsg('postnew_group_right'); } $icon = (int)$icon; if (!$_POST['step']) { if ($special == 3 && $_G['allowreward']) { $cbselect = ''; list(,$rw_b_val,$rw_a_val,$rw_credit) = explode("\t",$forumset['rewarddb']); foreach (explode(',',$rw_credit) as $key => $val) { $cbselect .= "<option value=\"$val\">".(is_numeric($val) ? $_CREDITDB[$val][0] : ${'db_'.$val.'name'})."</option>"; } $caselect = $cbselect; } list($guidename,$forumtitle) = getforumtitle(forumindex($foruminfo['fup'])); $db_metakeyword = str_replace(array('|',' - '),',',$forumtitle).'phpwind'; require_once(R_P.'require/header.php'); list($msg_guide,$forumlist) = headguide($guidename); if ($winddb['payemail']) { list(,$payemail) = explode("\t",$winddb['payemail']); $winddb['email'] = $payemail; } require_once PrintEot('post');footer(); } elseif ($_POST['step']==2) { ##主题分类 //强制分类 if (!$p_type || empty($t_typedb[$p_type]) || ($t_per==0 && !$admincheck)) { $w_type = 0; } else { $w_type = $p_type; } $db_forcetype && $w_type=='0' && Showmsg('force_tid_select'); InitGP(array('atc_anonymous','atc_iconid','atc_email','atc_newrp','digest','atc_tags','atc_hideatt','magicid','magicname'),'P'); $atc_tags = ($db_iftag && $atc_tags) ? check_tag($atc_tags) : ''; list($atc_title,$atc_content,$ifconvert,$ifwordsfb) = check_data($action); $db_tcheck && $winddb['postcheck'] == tcheck($atc_content) && Showmsg('content_same'); //内容验证 require_once(R_P.'require/postupload.php'); $magic = ''; if ($special=="1") { !$_POST['vt_select'] && Showmsg('postfunc_noempty'); InitGP(array('vt_select','timelimit','multiplevote','modifiable','mostvotes','previewable'),'P'); $votearray = array(); $vt_select = Char_cv($vt_select); $vt_select = explode("\n",$vt_select); foreach ($vt_select as $voteoption) { $voteoption = trim($voteoption); if ($voteoption) { $votearray['options'][] = array($voteoption,0,array()); } } if (count($vt_select) > $db_selcount) { Showmsg('vote_num_limit'); } if ($mostvotes && is_numeric($mostvotes)) { $mostvotes>count($vt_select) && $mostvotes=count($vt_select); } else { $mostvotes=count($vt_select); } $timelimit < 0 && $timelimit = 0; $votearray['multiple'] = array($multiplevote,$mostvotes); $voteopts = addslashes(serialize($votearray)); } elseif ($special=='2') { InitGP(array('act_subject','act_location'),'P',1); InitGP(array('act_starttime','act_deadline','act_endtime','act_num','act_costs','act_sex'),'P'); !($act_subject && $act_starttime && $act_deadline) && Showmsg('active_data_empty'); $act_starttime= PwStrtoTime($act_starttime); $act_endtime = PwStrtoTime($act_endtime); $act_deadline = PwStrtoTime($act_deadline); $act_deadline < $timestamp && Showmsg('deadline_limit'); $act_deadline > $act_starttime && Showmsg('starttime_limit'); $act_endtime && $act_starttime>$act_endtime && Showmsg('endtime_limit'); (!is_numeric($act_num) || $act_num<0) && $act_num=0; (!is_numeric($act_costs) || $act_costs<0) && $act_costs=0; } elseif ($special=='3' && $_G['allowreward']) { require_once(R_P.'require/postreward.php'); } elseif($special=='4' && $_POST['seller'] && $_POST['subject']){ InitGP(array('seller','subject','contact','demo'),'P',1); InitGP(array('price','ordinary_fee','express_fee','method'),'p'); $price = (int)$price; $ordinary_fee = (int)$ordinary_fee; $express_fee = (int)$express_fee; if (!ereg("^[-a-zA-Z0-9_\.]+\@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{2,5}$",$seller)) { Showmsg('seller_error'); } $ifconvert = 2; $atc_content = "[payto] (seller)$seller(/seller) (subject)$subject(/subject) (body)$atc_content(/body) (price)$price(/price) (ordinary_fee)$ordinary_fee(/ordinary_fee) (express_fee)$express_fee(/express_fee) (contact)$contact(/contact) (demo)$demo(/demo) (method)$method(/method) [/payto]"; } elseif (strpos($atc_content,"[payto]")!==false && strpos($atc_content,"[/payto]")!==false) { $special = 4; } else { $special = 0; } if (!$SYSTEM['typeadmin']) { $digest=0; } if (($foruminfo['f_check'] == 1 || $foruminfo['f_check'] == 3) && $_G['atccheck'] && !$admincheck) { $ifcheck = 0; } else { $ifcheck = alarm($atc_title,$atc_content); } $anonymous = ($forumset['anonymous'] && $_G['anonymous'] && $atc_anonymous) ? 1 : 0; $ifhide = ($foruminfo['allowhide'] && $gp_allowhidden && $atc_hideatt) ? 1 : 0; $lastposter = $anonymous ? $db_anonymousname : $windid; $atc_iconid = (int)$atc_iconid; $atc_email = $db_replysendmail ? (int)$atc_email : 0; $db_replysitemail && $atc_newrp && $atc_email +=2; $ifmagic = 0; if ($db_windmagic && $magicid) { $magicid = Char_cv($magicid); $magicname = Char_cv($magicname); $ifmagic = 1; $magic = $magicid."\t".$magicname; } $top_post = 1; $t_date = $timestamp;//主题发表时间 bbspostguide 中用到 bbspostguide(); $db->update("INSERT INTO pw_threads (fid,icon,author,authorid,subject,ifcheck,type,postdate,lastpost,lastposter,hits,replies,topped,digest,special ,state,ifupload,ifmail,anonymous,ptable,ifmagic,ifhide) VALUES ('$fid','$atc_iconid','".addslashes($windid)."','$winddb[uid]','$atc_title','$ifcheck','$w_type','$timestamp','$timestamp','".addslashes($lastposter)."','1','0','0','".(int)$digest."','$special','0','$ifupload','$atc_email','$anonymous','$db_ptable','$ifmagic','$ifhide')"); $tid = $db->insert_id(); $pw_tmsgs = GetTtable($tid); if ($db_iftag) { if ($atc_tags) { insert_tag($tid,$atc_tags); } $atc_tags .= "\t".relate_tag($atc_title,$atc_content); } $db->update("INSERT INTO $pw_tmsgs(tid,aid,userip,ifsign,buy,ipfrom,tags,ifconvert,ifwordsfb,content,magic) VALUES('$tid','$attachs','$onlineip','$atc_usesign','','$ipfrom','$atc_tags','$ifconvert','$ifwordsfb','$atc_content','$magic')"); $digest && $db->update("UPDATE pw_memberdata SET digests=digests+1 WHERE uid='$winduid'"); if ($aids) { $db->update("UPDATE pw_attachs SET tid='$tid' WHERE aid IN($aids)"); } switch ($special) { case 1: $db->update("INSERT INTO pw_polls (tid,voteopts,modifiable,previewable,timelimit) VALUES ('$tid','$voteopts','$modifiable','$previewable','$timelimit')"); break; case 2: $db->update("INSERT INTO pw_activity (tid,subject,admin,starttime,endtime,location,num,sexneed,costs,deadline) VALUES ('$tid','$act_subject','$winduid','$act_starttime','$act_endtime','$act_location','$act_num','$act_sex','$act_costs','$act_deadline')"); break; case 3: $db->update("INSERT INTO pw_reward (tid,cbtype,catype,cbval,caval,timelimit) VALUES ('$tid','$ctype[best]','$ctype[active]','$bonus[best]','$bonus[active]','$timelimit')"); break; } unset($j_p); if ($ifcheck==1) { if ($foruminfo['allowhtm'] && !$foruminfo['cms']) { include_once(R_P.'require/template.php'); } lastinfo($fid,$foruminfo['allowhtm'],'new',$foruminfo['cms'].'B'); //Start Here新帖排行榜 if($db_ifsort&12 && !$foruminfo['allowvisit'] && $foruminfo['f_type']!='hidden' && !$foruminfo['password'] && !$forumset['forumsell']){ if ($newpic && $db_ifsort&4) { require_once(R_P.'require/sort.php'); sort_newpic($tid,$atc_title,$newpic); } elseif ($db_ifsort&8) { require_once(R_P.'require/sort.php'); sort_newpost($tid,$atc_title); } } //End Here } if(empty($j_p) || $foruminfo['cms']) $j_p = "read.php?tid=$tid"; refreshto($j_p,$ifcheck ? 'enter_thread' : 'post_check'); } ?>