From 8a7334ef128f24024deeff32eed532ba92799f8c Mon Sep 17 00:00:00 2001 From: SMaker Date: Mon, 30 Dec 2013 17:57:15 +0900 Subject: [PATCH] =?UTF-8?q?pollController:procInsert=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/poll/poll.controller.php | 48 ++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/modules/poll/poll.controller.php b/modules/poll/poll.controller.php index 4397394c6..44c0b5938 100644 --- a/modules/poll/poll.controller.php +++ b/modules/poll/poll.controller.php @@ -20,9 +20,9 @@ class pollController extends poll function procInsert() { $stop_date = Context::get('stop_date'); - if($stop_date < date("Ymd")) + if($stop_date < date('Ymd')) { - $stop_date = date("YmdHis", $_SERVER['REQUEST_TIME']+60*60*24*365); + $stop_date = date('YmdHis', $_SERVER['REQUEST_TIME']+60*60*24*365); } $logged_info = Context::get('logged_info'); @@ -30,48 +30,59 @@ class pollController extends poll $args = new stdClass; $tmp_args = array(); + unset($vars->_filter); + unset($vars->error_return_url); + unset($vars->stop_date); + foreach($vars as $key => $val) { - if(strpos($key,'tidx')) + if(stripos($key, 'tidx')) { continue; } - if(!preg_match("/^(title|checkcount|item)_/i", $key)) + + $tmp_arr = explode('_', $key); + + $poll_index = $tmp_arr[1]; + if(!$poll_index) { continue; } + if(!trim($val)) { continue; } - $tmp_arr = explode('_',$key); - - $poll_index = $tmp_arr[1]; - - if($logged_info->is_admin != 'Y') - { - $val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); - } - if($tmp_args[$poll_index] == NULL) { $tmp_args[$poll_index] = new stdClass; } - if($tmp_arr[0]=='title') + if(!is_array($tmp_args[$poll_index]->item)) + { + $tmp_args[$poll_index]->item = array(); + } + + if($logged_info->is_admin != 'Y') + { + $val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); + } + + if($tmp_arr[0] == 'title') { $tmp_args[$poll_index]->title = $val; } - else if($tmp_arr[0]=='checkcount') + elseif($tmp_arr[0] == 'checkcount') { $tmp_args[$poll_index]->checkcount = $val; } - else if($tmp_arr[0]=='item') + elseif($tmp_arr[0] == 'item') { - $tmp_args[$poll_index]->item[] = $val; + $tmp_args[$poll_index]->item[] = $val; } } + return new Object(-1, print_r($tmp_args, true)); foreach($tmp_args as $key => $val) { @@ -79,6 +90,7 @@ class pollController extends poll { $val->checkcount = 1; } + if($val->title && count($val->item)) { $args->poll[] = $val; @@ -406,4 +418,4 @@ class pollController extends poll } } /* End of file poll.controller.php */ -/* Location: ./modules/poll/poll.controller.php */ +/* Location: ./modules/poll/poll.controller.php */ \ No newline at end of file