function sys_GetInfoVote($classid, $id) { global $empire, $public_r, $dbtbpre; $r = $empire->fetch1("select * from {$dbtbpre}enewsinfovote where id='{$id}' and classid='{$classid}' limit 1"); if (empty($r[votetext])) { return ''; } //模板 $votetemp = ReturnVoteTemp($r[tempid], 0); $votetemp = RepVoteTempAllvar($votetemp, $r); $listexp = "[!--empirenews.listtemp--]"; $listtemp_r = explode($listexp, $votetemp); $r_exp = "\r\n"; $f_exp = "::::::"; //项目数 $r_r = explode($r_exp, $r[votetext]); $checked = 0; for ($i = 0; $i < count($r_r); $i++) { $checked++; $f_r = explode($f_exp, $r_r[$i]); //投票类型 if ($r[voteclass]) { $vote = "<input type=checkbox name=vote[] value=" . $checked . ">"; } else { $vote = "<input type=radio name=vote value=" . $checked . ">"; } $votetext .= RepVoteTempListvar($listtemp_r[1], $vote, $f_r[0]); } $votetext = $listtemp_r[0] . $votetext . $listtemp_r[2]; return $votetext; }
function GetVoteJs($voteid) { global $empire, $public_r, $fun_r, $dbtbpre; $r = $empire->fetch1("select * from {$dbtbpre}enewsvote where voteid='{$voteid}'"); //模板 $votetemp = ReturnVoteTemp($r[tempid], 1); $votetemp = RepVoteTempAllvar($votetemp, $r); $listexp = "[!--empirenews.listtemp--]"; $listtemp_r = explode($listexp, $votetemp); $file = "../../../d/js/vote/vote" . $voteid . ".js"; $r_exp = "\r\n"; $f_exp = "::::::"; //项目数 $r_r = explode($r_exp, $r[votetext]); $checked = 0; for ($i = 0; $i < count($r_r); $i++) { $checked++; $f_r = explode($f_exp, $r_r[$i]); //投票类型 if ($r[voteclass]) { $vote = "<input type=checkbox name=vote[] value=" . $checked . ">"; } else { $vote = "<input type=radio name=vote value=" . $checked . ">"; } $votetext .= RepVoteTempListvar($listtemp_r[1], $vote, $f_r[0]); } $votetext = "document.write(\"" . addslashes(stripSlashes($listtemp_r[0] . $votetext . $listtemp_r[2])) . "\");"; WriteFiletext_n($file, $votetext); }