コード例 #1
0
ファイル: vote.inc.php プロジェクト: hcd2008/destoon
<?php

defined('IN_DESTOON') or exit('Access Denied');
require DT_ROOT . '/module/' . $module . '/common.inc.php';
$MOD['vote_enable'] or dheader(DT_PATH);
$TYPE = get_type('vote', 1);
require MD_ROOT . '/vote.class.php';
$do = new vote();
$typeid = isset($typeid) ? intval($typeid) : 0;
if ($itemid) {
    $do->itemid = $itemid;
    $item = $do->get_one();
    $item or dheader(DT_PATH);
    extract($item);
    if ($submit) {
        $could_vote = true;
        $condition = $_username ? "AND username='******'" : "AND ip='{$DT_IP}'";
        $r = $db->get_one("SELECT rid FROM {$DT_PRE}vote_record WHERE itemid={$itemid} {$condition}");
        if ($r) {
            $could_vote = false;
        }
        if ($fromtime && $DT_TIME < $fromtime) {
            $could_vote = false;
        }
        if ($totime && $DT_TIME > $totime) {
            $could_vote = false;
        }
        if (!check_group($_groupid, $MOD['vote_group'])) {
            $could_vote = false;
        }
        if ($could_vote) {
コード例 #2
0
ファイル: vote.inc.php プロジェクト: hcd2008/destoon
         $menuid = 0;
         include tpl('vote_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('vote_edit', $module);
     }
     break;
 case 'update':
     $do->update();
     dmsg('更新成功', $forward);
     break;
 case 'html':
     $all = isset($all) && $all ? 1 : 0;
     $one = isset($one) && $one ? 1 : 0;
     if (!isset($num)) {