function EditVoteMod($voteid, $ysvotename, $title, $votename, $votenum, $delvid, $vid, $voteclass, $doip, $dotime, $width, $height, $tempid, $userid, $username) { global $empire, $dbtbpre; $voteid = (int) $voteid; if (!$voteid || !$ysvotename || !$tempid) { printerror("EmptyVoteTitle", "history.go(-1)"); } //返回组合 $votetext = ReturnVote($votename, $votenum, $delvid, $vid, 1); //统计总票数 for ($i = 0; $i < count($votename); $i++) { $t_votenum += $votenum[$i]; } //处理变量 $t_votenum = (int) $t_votenum; $voteclass = (int) $voteclass; $width = (int) $width; $height = (int) $height; $doip = (int) $doip; $tempid = (int) $tempid; $sql = $empire->query("update {$dbtbpre}enewsvotemod set title='{$title}',votetext='{$votetext}',voteclass={$voteclass},doip={$doip},dotime='{$dotime}',tempid={$tempid},width={$width},height={$height},votenum={$t_votenum},ysvotename='{$ysvotename}' where voteid='{$voteid}'"); if ($sql) { //操作日志 insert_dolog("voteid=" . $voteid . "<br>title=" . $title); printerror("EditVoteSuccess", "ListVoteMod.php"); } else { printerror("DbError", "history.go(-1)"); } }
function AddInfoVote($classid, $id, $add) { global $empire, $dbtbpre, $class_r; $pubid = ReturnInfoPubid($classid, $id); $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewsinfovote where pubid='{$pubid}' limit 1"); $votename = $add['vote_name']; $votenum = $add['vote_num']; //统计总票数 for ($i = 0; $i < count($votename); $i++) { $t_votenum += $votenum[$i]; } $t_votenum = (int) $t_votenum; $voteclass = (int) $add['vote_class']; $width = (int) $add['vote_width']; $height = (int) $add['vote_height']; $doip = (int) $add['dovote_ip']; $tempid = (int) $add['vote_tempid']; $add['vote_title'] = hRepPostStr($add['vote_title'], 1); $add['vote_dotime'] = hRepPostStr($add['vote_dotime'], 1); //附加字段 $diyotherlink = (int) $add['info_diyotherlink']; $infouptime = 0; if ($add['info_infouptime']) { $infouptime = to_time($add['info_infouptime']); } $infodowntime = 0; if ($add['info_infodowntime']) { $infodowntime = to_time($add['info_infodowntime']); } if ($num) { $votetext = ReturnVote($add['vote_name'], $add['vote_num'], $add['delvote_id'], $add['vote_id'], 1); //返回组合 $votetext = hRepPostStr($votetext, 1); $sql = $empire->query("update {$dbtbpre}enewsinfovote set title='{$add['vote_title']}',votenum='{$t_votenum}',votetext='{$votetext}',voteclass='{$voteclass}',doip='{$doip}',dotime='{$add['vote_dotime']}',tempid='{$tempid}',width='{$width}',height='{$height}',diyotherlink='{$diyotherlink}',infouptime='{$infouptime}',infodowntime='{$infodowntime}' where pubid='{$pubid}' limit 1"); } else { $votetext = ReturnVote($add['vote_name'], $add['vote_num'], $add['delvote_id'], $add['vote_id'], 0); //返回组合 if (!($votetext || $diyotherlink || $infouptime || $infodowntime)) { return ''; } $votetext = hRepPostStr($votetext, 1); $sql = $empire->query("insert into {$dbtbpre}enewsinfovote(pubid,id,classid,title,votenum,voteip,votetext,voteclass,doip,dotime,tempid,width,height,diyotherlink,infouptime,infodowntime,copyids) values('{$pubid}','{$id}','{$classid}','{$add['vote_title']}','{$t_votenum}','','{$votetext}','{$voteclass}','{$doip}','{$add['vote_dotime']}','{$tempid}','{$width}','{$height}','{$diyotherlink}','{$infouptime}','{$infodowntime}','');"); } }
function EditVote($voteid, $title, $votename, $votenum, $delvid, $vid, $voteclass, $doip, $dotime, $width, $height, $tempid, $userid, $username) { global $empire, $dbtbpre; $voteid = (int) $voteid; if (!$voteid || !$title || !$tempid) { printerror("EmptyVoteTitle", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "vote"); //返回组合 $votetext = ReturnVote($votename, $votenum, $delvid, $vid, 1); //统计总票数 for ($i = 0; $i < count($votename); $i++) { $t_votenum += $votenum[$i]; } $r = $empire->fetch1("select dotime,votetime from {$dbtbpre}enewsvote where voteid='{$voteid}'"); $votetime = to_date($dotime); //处理变量 $t_votenum = (int) $t_votenum; $voteclass = (int) $voteclass; $votetime = (int) $votetime; $width = (int) $width; $height = (int) $height; $doip = (int) $doip; $tempid = (int) $tempid; $sql = $empire->query("update {$dbtbpre}enewsvote set title='{$title}',votetext='{$votetext}',votenum={$t_votenum},voteclass={$voteclass},doip={$doip},dotime='{$dotime}',votetime={$votetime},width={$width},height={$height},tempid={$tempid} where voteid='{$voteid}'"); //生成投票js GetVoteJs($voteid); if ($sql) { //操作日志 insert_dolog("voteid=" . $voteid . "<br>title=" . $title); printerror("EditVoteSuccess", "ListVote.php" . hReturnEcmsHashStrHref2(1)); } else { printerror("DbError", "history.go(-1)"); } }