bb_die(sprintf($lang['NEW_POLL_DAYS'], $bb_cfg['poll_max_days'])); } if (!IS_ADMIN && $t_data['topic_vote'] != POLL_FINISHED) { bb_die($lang['CANNOT_DELETE_POLL']); } } switch ($mode) { // голосование case 'poll_vote': if (!$t_data['topic_vote']) { bb_die($lang['POST_HAS_NO_POLL']); } if ($t_data['topic_status'] == TOPIC_LOCKED) { bb_die($lang['TOPIC_LOCKED_SHORT']); } if (!poll_is_active($t_data)) { bb_die($lang['NEW_POLL_ENDED']); } if (!$vote_id) { bb_die($lang['NO_VOTE_OPTION']); } if (DB()->fetch_row("SELECT 1 FROM " . BB_POLL_USERS . " WHERE topic_id = {$topic_id} AND user_id = {$userdata['user_id']} LIMIT 1")) { bb_die($lang['ALREADY_VOTED']); } DB()->query("\n\t\t\tUPDATE " . BB_POLL_VOTES . " SET\n\t\t\t\tvote_result = vote_result + 1\n\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\tAND vote_id = {$vote_id}\n\t\t\tLIMIT 1\n\t\t"); if (DB()->affected_rows() != 1) { bb_die($lang['NO_VOTE_OPTION']); } DB()->query("INSERT IGNORE INTO " . BB_POLL_USERS . " (topic_id, user_id, vote_ip, vote_dt) VALUES ({$topic_id}, {$userdata['user_id']}, '" . USER_IP . "', " . TIMENOW . ")"); CACHE('bb_poll_data')->rm("poll_{$topic_id}"); bb_die($lang['VOTE_CAST']);
// // Update the topic view counter // $sql = "INSERT INTO " . BUF_TOPIC_VIEW . " (topic_id, topic_views) VALUES ({$topic_id}, 1) ON DUPLICATE KEY UPDATE topic_views = topic_views + 1"; if (!DB()->sql_query($sql)) { bb_die('Could not update topic views'); } // // Does this topic contain a poll? // if ($topic_has_poll) { $poll_votes_js = get_poll_data_items_js($topic_id); if (!$poll_votes_js) { $template->assign_vars(array('TOPIC_HAS_POLL' => false)); } else { $template->assign_vars(array('SHOW_VOTE_BTN' => poll_is_active($t_data), 'POLL_VOTES_JS' => $poll_votes_js)); } } $prev_post_time = $max_post_time = 0; $this_date = bb_date(TIMENOW, 'md', false); for ($i = 0; $i < $total_posts; $i++) { $poster_id = $postrow[$i]['user_id']; $poster = $poster_id == GUEST_UID ? $lang['GUEST'] : $postrow[$i]['username']; $poster_birthday = $poster_id != GUEST_UID ? date('md', strtotime($postrow[$i]['user_birthday'])) : ''; $post_date = bb_date($postrow[$i]['post_time'], $bb_cfg['post_date_format']); $max_post_time = max($max_post_time, $postrow[$i]['post_time']); $poster_posts = $poster_id != GUEST_UID ? $postrow[$i]['user_posts'] : ''; $poster_from = $postrow[$i]['user_from'] && $poster_id != GUEST_UID ? $postrow[$i]['user_from'] : ''; $poster_joined = $poster_id != GUEST_UID ? $lang['JOINED'] . ': ' . bb_date($postrow[$i]['user_regdate'], $bb_cfg['date_format']) : ''; $poster_longevity = $poster_id != GUEST_UID ? delta_time($postrow[$i]['user_regdate']) : ''; $post_id = $postrow[$i]['post_id'];