public function initializeModule($request_method, $request_data) { if (empty(PA::$login_uid)) { return 'skip'; } if (!empty($request_data['type'])) { $this->mode = htmlspecialchars($request_data['type']); } if (!empty($request_data['action']) && $request_data['action'] == "delete") { $obj = new poll(); $p_id = $request_data['id']; $c_id = $request_data['cid']; $obj->delete_poll($p_id, $c_id); $this->message = __('Poll has been deleted successfully.'); $this->queryString = '?page_id=' . PAGE_POLL . '&type=select'; if ($this->gid != 0) { $this->redirect2 = PA::$url . "/group_poll.php?gid=" . $this->gid . "&type=select"; $this->queryString .= "&gid=" . $this->gid; } else { $this->redirect2 = PA::$url . "/" . FILE_DYNAMIC; } $this->isError = FALSE; $this->setWebPageMessage(); } }
if (!empty($_GET['type'])) { $type = htmlspecialchars($_GET['type']); } if (!empty($_POST['submit'])) { $obj = new Poll(); $obj->poll_id = $_POST['poll']; $obj->prev_changed = $_POST['prev_poll_changed']; $obj->prev_poll_id = $_POST['prev_poll_id']; $obj->save_current(); header("Location: " . PA::$url . PA_ROUTE_HOME_PAGE); } if (!empty($_GET['action']) && $_GET['action'] == "delete") { $obj = new poll(); $p_id = $_GET['id']; $c_id = $_GET['cid']; $obj->delete_poll($p_id, $c_id); header("Location: " . PA::$url . "/poll.php?type=select"); } if (!empty($_POST['create'])) { $poll_topic = $_POST['topic']; $cnt = $_POST['num_option']; $poll_option = array(); for ($i = 1; $i <= $cnt; $i++) { $poll_option['option' . $i] = $_POST['option' . $i]; } $option = serialize($poll_option); $obj = new POll(); $obj->author_id = $login_uid; $obj->type = POLL; $obj->title = $poll_topic; $obj->body = $option;
require_once e_ADMIN . "auth.php"; require_once e_PLUGIN . "poll/poll_class.php"; require_once e_HANDLER . "form_handler.php"; require_once e_HANDLER . "userclass_class.php"; if (isset($_POST)) { $_POST = strip_if_magic($_POST); } $rs = new form(); $poll = new poll(); if (isset($_POST['reset'])) { unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['multipleChoice'], $_POST['showResults'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear']); define("RESET", TRUE); } $emessage = eMessage::getInstance(); if (varset($_POST['delete'])) { $message = $poll->delete_poll(key($_POST['delete'])); unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate']); $_GET['mode'] = 'list'; } if (isset($_POST['submit'])) { if ($_POST['poll_title']) { define("POLLID", $_POST['poll_id']); $emessage->add($poll->submit_poll(), E_MESSAGE_SUCCESS); unset($_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['poll_comment']); } 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
require_once e_HANDLER . "userclass_class.php"; require_once e_HANDLER . "form_handler.php"; // FIXME using 'form' instead of 'e_form' if (isset($_POST)) { $_POST = strip_if_magic($_POST); } $rs = new form(); $poll = new poll(); $frm = e107::getForm(); $mes = e107::getMessage(); if (isset($_POST['reset'])) { unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['multipleChoice'], $_POST['showResults'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear']); define("RESET", TRUE); } if (varset($_POST['delete'])) { $poll->delete_poll(key($_POST['delete'])); // TODO check security? $mes->addSuccess(LAN_DELETED); unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate']); $_GET['mode'] = 'list'; } if (isset($_POST['submit'])) { if ($_POST['poll_title']) { define("POLLID", $_POST['poll_id']); $poll->submit_poll(); $mes->addSuccess(LAN_CREATED); unset($_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['poll_comment']); } else { $mes->addError(LAN_REQUIRED_BLANK); } $_GET['mode'] = 'list';