mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
pollController:procInsert 코드 정리
This commit is contained in:
parent
b6b3a78826
commit
8a7334ef12
1 changed files with 30 additions and 18 deletions
|
|
@ -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 */
|
||||
Loading…
Add table
Add a link
Reference in a new issue