menu via data in the POST array. * If Form Validation is active it retrieves the info from the validation class * * @param string * @param string * @param bool * @return string */ function set_select($field, $value = '', $default = FALSE) { $CI =& get_instance(); if (isset($CI->form_validation) && is_object($CI->form_validation) && $CI->form_validation->has_rule($field)) { return $CI->form_validation->set_select($field, $value, $default); } else if (($input = $CI->input->post($field, FALSE)) === NULL) { return ($default === TRUE) ? ' selected="selected"' : ''; } $value = (string) $value; if (is_array($input)) { // Note: in_array('', array(0)) returns TRUE, do not use it foreach ($input as &$v) { if ($value === $v) { return ' selected="selected"'; } } return ''; } return ($input === $value) ? ' selected="selected"' : ''; } } // ------------------------------------------------------------------------ if ( ! function_exists('set_checkbox')) { /** * Set Checkbox * * Let's you set the selected value of a checkbox via the value in the POST array. * If Form Validation is active it retrieves the info from the validation class * * @param string * @param string * @param bool * @return string */ function set_checkbox($field, $value = '', $default = FALSE) { $CI =& get_instance(); if (isset($CI->form_validation) && is_object($CI->form_validation) && $CI->form_validation->has_rule($field)) { return $CI->form_validation->set_checkbox($field, $value, $default); } else if (($input = $CI->input->post($field, FALSE)) === NULL) { return ($default === TRUE) ? ' checked="checked"' : ''; } $value = (string) $value; if (is_array($input)) { // Note: in_array('', array(0)) returns TRUE, do not use it foreach ($input as &$v) { if ($value === $v) { return ' checked="checked"'; } } return ''; } return ($input === $value) ? ' checked="checked"' : ''; } } // ------------------------------------------------------------------------ if ( ! function_exists('set_radio')) { /** * Set Radio * * Let's you set the selected value of a radio field via info in the POST array. * If Form Validation is active it retrieves the info from the validation class * * @param string $field * @param string $value * @param bool $default * @return string */ function set_radio($field, $value = '', $default = FALSE) { $CI =& get_instance(); if (isset($CI->form_validation) && is_object($CI->form_validation) && $CI->form_validation->has_rule($field)) { return $CI->form_validation->set_radio($field, $value, $default); } else if (($input = $CI->input->post($field, FALSE)) === NULL) { return ($default === TRUE) ? ' checked="checked"' : ''; } return ($input === (string) $value) ? ' checked="checked"' : ''; } } if ( ! function_exists('check_use_captcha')) { function check_use_captcha($member, $board=array(), $mode=''){ $use_captcha = false; if( $member->is_admin() !== false ){ //관리자면 캡챠 사용 안함 return false; } if( $member->is_member() === false ){ //비회원은 캡챠 사용 $use_captcha = true; } if( element('board_use_captcha', $board) && $mode !== 'cu' ){ //글쓰기일때만 $use_captcha = true; } return $use_captcha; } }