public function handlePOST($request_data)
 {
     if (!empty($request_data['submit'])) {
         $obj = new Poll();
         $obj->poll_id = $request_data['poll'];
         $obj->prev_changed = $request_data['prev_poll_changed'];
         $obj->prev_poll_id = $request_data['prev_poll_id'];
         $obj->save_current();
         $this->message = __('Poll has been saved successfully.');
         if ($this->gid != 0) {
             $this->redirect2 = PA::$url . "/group_poll.php?gid=" . $this->gid . "&type=select";
         } else {
             $this->redirect2 = NULL;
         }
         $this->queryString = NULL;
         $this->isError = FALSE;
         $this->setWebPageMessage();
     }
     if (!empty($request_data['create'])) {
         $poll_topic = $request_data['topic'];
         $cnt = $request_data['num_option'];
         $poll_option = array();
         for ($i = 1; $i <= $cnt; $i++) {
             $poll_option['option' . $i] = $request_data['option' . $i];
         }
         $option = serialize($poll_option);
         $obj = new Poll();
         $obj->author_id = PA::$login_uid;
         $obj->type = POLL;
         $obj->title = $poll_topic;
         $obj->body = $option;
         $obj->parent_collection_id = 0;
         $obj->user_id = PA::$login_uid;
         $obj->group_id = $this->gid;
         $obj->options = $option;
         $obj->is_active = INACTIVE;
         $obj->save_poll();
         $this->message = __('Poll has been created successfully.');
         if ($obj->group_id != 0) {
             $this->redirect2 = PA::$url . "/group_poll.php?gid=" . $obj->group_id . "&type=select";
         } else {
             $this->redirect2 = PA::$url . PA_ROUTE_CONFIG_POLL . "?type=select";
         }
         $this->queryString = NULL;
         $this->isError = FALSE;
         $this->setWebPageMessage();
     }
 }
require_once "api/Validation/Validation.php";
require_once "api/Poll/Poll.php";
$error = FALSE;
$authorization_required = TRUE;
$message = @$_REQUEST['msg'];
global $flag, $type;
if (!$error) {
    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];