示例#1
0
文件: bbsvote.php 项目: bianle/www2
}
$brdarr = array();
$brdnum = bbs_getboard($board, $brdarr);
if ($brdnum == 0) {
    html_error_quit("错误的讨论区");
}
if (bbs_checkreadperm($currentuser["index"], $brdnum) == 0) {
    html_error_quit("您没有权限");
}
$oldvote = array();
$votearr = array();
$uservotearr = array();
for ($i = 0; $i < 32; $i++) {
    $oldvote[$i] = 0;
}
$retnum = bbs_get_vote_from_num($board, $votearr, $num, $uservotearr);
if (isset($_POST["submit"])) {
    if (isset($_GET["type"])) {
        $votetype = $_GET["type"];
    } else {
        if (isset($_POST["type"])) {
            $votetype = $_POST["type"];
        } else {
            html_error_quit("参数错误2");
        }
    }
    if (isset($_POST["msg"])) {
        $msg = $_POST["msg"];
    } else {
        $msg = "";
    }
示例#2
0
文件: board.php 项目: tilitala/nForum
 /**
  * function getVote get vote of board via num
  * array(
  *     'USERID' => string
  *     'TITLE' => string
  *     'DATE' => int
  *     'TYPE' => string '是非' (length=4)
  *     'MAXDAY' => int
  *     'MAXTKT' => int 1
  *     'DESC' => int
  *     'TOTALITEMS' => int
  *     'ITEM1' => string
  *     'ITEM2' => string
  *     'ITEM3' => string
  *     'ITEM4' => string
  *     'ITEM5' => string
  *     'ITEM6' => string
  *     'ITEM7' => string
  *     'VOTED1' => int 1
  *     'VOTED2' => int 1
  *     'MSG1' => string
  *     'MSG2' => string
  *     'MSG3' => string
  * )
  *
  * @param int $num
  * @return mixed array|false
  * array(
  *     'owner' string
  *     'title' string
  *     'start' int
  *     'type' string
  *     'day' int
  *     'limit' int
  *     'desc' string
  *     'val' array
  * )
  * @access public
  */
 public function getVote($num)
 {
     $arr = array();
     $res = array();
     $num = bbs_get_vote_from_num($this->NAME, $arr, $num, $res);
     if ($num < 0) {
         return false;
     }
     $ret['owner'] = $arr[0]['USERID'];
     $ret['title'] = $arr[0]['TITLE'];
     $ret['start'] = $arr[0]['DATE'];
     $ret['type'] = $arr[0]['TYPE'];
     $ret['day'] = $arr[0]['MAXDAY'];
     $ret['limit'] = $arr[0]['MAXTKT'];
     $ret['desc'] = @bbs_printansifile("vote/" . $this->NAME . "/desc." . $arr[0]["DATE"]);
     $voted = isset($res[0]['VOTED1']);
     switch ($arr[0]['TYPE']) {
         case '数字':
             $ret['val'] = $voted ? $res[0]['VOTED1'] : "";
             break;
         case '问答':
             $ret['val'] = false;
             break;
         default:
             foreach (range(1, $arr[0]['TOTALITEMS']) as $i) {
                 $ret['val'][] = array($arr[0]['ITEM' . $i], $voted && ($res[0]['VOTED' . ($i <= 32 ? '1' : '2')] & 1 << ($i - 1) % 32) != 0);
             }
     }
     $ret['msg'] = $voted ? trim(join("\n", array($res[0]['MSG1'], $res[0]['MSG2'], $res[0]['MSG3']))) : "";
     return $ret;
 }