} else { $emessage->add(POLLAN_46, E_MESSAGE_SUCCESS); } $_GET['mode'] = 'list'; } if (isset($_POST['preview'])) { // Can't have everyone voting if tracking method is user ID if ($_POST['pollUserclass'] == e_UC_PUBLIC && $_POST['storageMethod'] == 2) { $_POST['pollUserclass'] = e_UC_MEMBER; } $poll->render_poll($_POST, "preview"); } if (varset($_POST['edit']) || varset($_GET['mode']) == 'create' && !varset($_POST['submit'])) { $_GET['mode'] = 'create'; if ($_POST['edit']) { edit_poll(); define("POLLACTION", 'edit'); } $poll_total = $sql->db_Select("polls"); $text = $poll->renderPollForm(); $ns->tablerender(POLLAN_MENU_CAPTION . " :: " . POLLAN_2, $text); } if (isset($message)) { $emessage->add($message, E_MESSAGE_SUCCESS); } if (!varset($_POST['edit']) && ($_GET['mode'] == "list" || !$_GET['mode'])) { poll_list(); } require_once e_ADMIN . "footer.php"; function edit_poll() {
/** * Standard aed_module edit actualiser. * * @param ID_TEXT The entry being edited */ function edit_actualisation($id) { $rows = $GLOBALS['SITE_DB']->query_select('poll', array('is_current', 'submitter', 'num_options'), array('id' => intval($id)), '', 1); if (!array_key_exists(0, $rows)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $is_current = $rows[0]['is_current']; $submitter = $rows[0]['submitter']; check_edit_permission($is_current == 1 ? 'high' : 'mid', $submitter); $question = post_param('question', STRING_MAGIC_NULL); $option1 = post_param('option1', STRING_MAGIC_NULL); $option2 = post_param('option2', STRING_MAGIC_NULL); $option3 = post_param('option3', STRING_MAGIC_NULL); $option4 = post_param('option4', STRING_MAGIC_NULL); $option5 = post_param('option5', STRING_MAGIC_NULL); $option6 = post_param('option6', STRING_MAGIC_NULL); $option7 = post_param('option7', STRING_MAGIC_NULL); $option8 = post_param('option8', STRING_MAGIC_NULL); $option9 = post_param('option9', STRING_MAGIC_NULL); $option10 = post_param('option10', STRING_MAGIC_NULL); $allow_rating = post_param_integer('allow_rating', fractional_edit() ? INTEGER_MAGIC_NULL : 0); $allow_comments = post_param_integer('allow_comments', fractional_edit() ? INTEGER_MAGIC_NULL : 0); $allow_trackbacks = post_param_integer('allow_trackbacks', fractional_edit() ? INTEGER_MAGIC_NULL : 0); $notes = post_param('notes', STRING_MAGIC_NULL); if (fractional_edit()) { $num_options = $rows[0]['num_options']; } else { $num_options = 10; if ($option10 == '') { $num_options = 9; } if ($option9 == '') { $num_options = 8; } if ($option8 == '') { $num_options = 7; } if ($option7 == '') { $num_options = 6; } if ($option6 == '') { $num_options = 5; } if ($option5 == '') { $num_options = 4; } if ($option4 == '') { $num_options = 3; } if ($option3 == '') { $num_options = 2; } if ($option2 == '') { $num_options = 1; } } $current = post_param_integer('validated', 0); if ($current == 1 && $GLOBALS['SITE_DB']->query_value('poll', 'is_current', array('id' => $id)) == 0) { $submitter = $GLOBALS['SITE_DB']->query_value('poll', 'submitter', array('id' => $id)); if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'polls')) { syndicate_described_activity('polls:ACTIVITY_ADD_POLL', $question, '', '', '_SEARCH:polls:view:' . strval($id), '', '', 'polls', 1, NULL); } } edit_poll(intval($id), $question, $option1, $option2, $option3, $option4, $option5, $option6, $option7, $option8, $option9, $option10, $num_options, $allow_rating, $allow_comments, $allow_trackbacks, $notes); if (!fractional_edit()) { if ($current == 1) { if ($is_current == 0) { if (!has_specific_permission(get_member(), 'choose_poll')) { log_hack_attack_and_exit('BYPASS_VALIDATION_HACK'); } set_poll(intval($id)); } } } }