$menuid = 0; include tpl('poll_edit', $module); } break; case 'edit': $itemid or msg(); $do->itemid = $itemid; if ($submit) { if ($do->pass($post)) { $do->edit($post); dmsg('修改成功', $forward); } else { msg($do->errmsg); } } else { extract($do->get_one()); $addtime = timetodate($addtime); $fromtime = $fromtime ? timetodate($fromtime, 3) : ''; $totime = $totime ? timetodate($totime, 3) : ''; $menuid = 1; include tpl('poll_edit', $module); } break; case 'html': $all = isset($all) && $all ? 1 : 0; $one = isset($one) && $one ? 1 : 0; if (!isset($num)) { $num = 50; } if (!isset($fid)) { $r = $db->get_one("SELECT min(itemid) AS fid FROM {$DT_PRE}vote");
require MD_ROOT . '/poll.class.php'; $do = new poll(); $typeid = isset($typeid) ? intval($typeid) : 0; if ($action == 'js') { $itemid or exit; echo 'document.write(\'<iframe src="' . $EXT['poll_url'] . 'index.php?action=show&itemid=' . $itemid . '" style="width:99%;height:0;" scrolling="no" frameborder="0" id="poll__' . $itemid . '"></iframe>\');'; } else { if ($action == 'ajax') { if (!check_group($_groupid, $MOD['poll_group'])) { exit($_userid ? $L['poll_error_1'] : $L['poll_error_2']); } $itemid or exit($L['poll_error_3']); $I = $db->get_one("SELECT * FROM {$DT_PRE}poll_item WHERE itemid={$itemid}"); $I or exit($L['poll_error_4']); $do->itemid = $pollid = $I['pollid']; $item = $do->get_one(); $item or exit($L['poll_error_5']); if ($item['fromtime'] && $item['fromtime'] > $DT_TIME) { exit($L['poll_error_6']); } if ($item['totime'] && $item['totime'] < $DT_TIME) { exit($L['poll_error_7']); } $condition = $_username ? "AND username='******'" : "AND ip='{$DT_IP}' AND polltime>" . ($DT_TIME - 86400); $t = $db->get_one("SELECT * FROM {$DT_PRE}poll_record WHERE itemid={$itemid} {$condition}"); if ($t) { exit($L['poll_error_8']); } if ($item['poll_max']) { $t = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}poll_record WHERE pollid={$pollid} {$condition}"); if ($t['num'] >= $item['poll_max']) {