function lib_vote(&$ctag, &$refObj) { global $dsql; $attlist = "id|0,lineheight|24,tablewidth|100%,titlebgcolor|#EDEDE2,titlebackgroup|,tablebg|#FFFFFF"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); if (empty($id)) { $id = 0; } if ($id == 0) { $row = $dsql->GetOne("SELECT aid FROM `#@__vote` ORDER BY aid DESC LIMIT 0,1"); if (!isset($row['aid'])) { return ''; } else { $id = $row['aid']; } } $vt = new DedeVote($id); return $vt->GetVoteForm($lineheight, $tablewidth, $titlebgcolor, $titlebackgroup, $tablebg); }
ShowMsg('成功删除一组投票!', $ENV_GOBACK_URL); exit; } } else { ShowMsg('指定删除投票不存在!', $ENV_GOBACK_URL); exit; } } else { if ($dopost == "saveedit") { $starttime = GetMkTime($starttime); $endtime = GetMkTime($endtime); $query = "UPDATE #@__vote SET votename='{$votename}',\r\n starttime='{$starttime}',\r\n endtime='{$endtime}',\r\n totalcount='{$totalcount}',\r\n ismore='{$ismore}',\r\n votenote='{$votenote}',\r\n isallow='{$isallow}',\r\n view='{$view}',\r\n spec='{$spec}',\r\n isenable='{$isenable}'\r\n WHERE aid='{$aid}'\r\n "; if ($dsql->ExecuteNoneQuery($query)) { $vt = new DedeVote($aid); $vote_file = DEDEDATA . "/vote/vote_" . $aid . ".js"; $vote_content = $vt->GetVoteForm(); $vote_content = preg_replace(array("#/#", "#([\r\n])[\\s]+#"), array("\\/", " "), $vote_content); //取出内容中的空白字符并进行转义 $vote_content = 'document.write("' . $vote_content . '");'; file_put_contents($vote_file, $vote_content); ShowMsg('成功更改一组投票!', $ENV_GOBACK_URL); } else { ShowMsg('更改一组投票失败!', $ENV_GOBACK_URL); } } else { $row = $dsql->GetOne("SELECT * FROM #@__vote WHERE aid='{$aid}'"); if (!is_array($row)) { ShowMsg('指定投票不存在!', '-1'); exit; } include DedeInclude('templets/vote_edit.htm');
<?php require_once(dirname(__FILE__)."/config.php"); require_once(dirname(__FILE__)."/../include/inc_vote.php"); $aid = ereg_replace("[^0-9]","",$aid); $vt = new DedeVote($aid); $vcode = $vt->GetVoteForm(); $vt->Close(); require_once(dirname(__FILE__)."/templets/vote_getcode.htm"); ClearAllLink(); ?>
function GetVote($id=0,$lineheight=24,$tablewidth="100%",$titlebgcolor="#EDEDE2",$titlebackgroup="",$tablebg="#FFFFFF"){ if($id=="") $id=0; if($id==0){ $row = $this->dsql->GetOne("select aid From #@__vote order by aid desc limit 0,1"); if(!isset($row['aid'])) return ""; else $id=$row['aid']; } include_once(dirname(__FILE__)."/inc_vote.php"); $vt = new DedeVote($id); //$vt->Close(); return $vt->GetVoteForm($lineheight,$tablewidth,$titlebgcolor,$titlebackgroup,$tablebg); }