static function captcha_settings_callback() { $captcha_url_cf = FSCF_Util::get_captcha_url_cf(); ?> <div class="clear"></div> <fieldset class="fscf_settings_group"> <p class="submit"> <input id="submit" class="button-primary" type="submit" value="<?php esc_attr_e('Save Changes', 'si-contact-form'); ?> " onclick="document.pressed=this.value" name="submit" /> </p> <?php self::display_ads(); ?> <input name="<?php echo self::$form_option_name; ?> [captcha_enable]" id="si_contact_captcha_enable" type="checkbox" <?php if (self::$form_options['captcha_enable'] == 'true') { echo ' checked="checked" '; } ?> value="true" /> <label for="<?php echo self::$form_option_name; ?> [captcha_enable]"><?php _e('Enable CAPTCHA.', 'si-contact-form'); ?> </label> <a style="cursor:pointer;" title="<?php esc_attr_e('Click for Help!', 'si-contact-form'); ?> " onclick="toggleVisibility('si_contact_captcha_enable_tip');"><?php _e('help', 'si-contact-form'); ?> </a> <div class="fscf_tip" id="si_contact_captcha_enable_tip"> <?php _e('Prevents automated spam bots by requiring that the user pass a CAPTCHA test before posting. You can disable CAPTCHA if you prefer, because the form also uses Akismet to prevent spam when Akismet plugin is installed with the key activated.', 'si-contact-form'); ?> </div> <br /> <input name="<?php echo self::$form_option_name; ?> [captcha_small]" id="si_contact_captcha_small" type="checkbox" <?php if (self::$form_options['captcha_small'] == 'true') { echo ' checked="checked" '; } ?> value="true" /> <label for="<?php echo self::$form_option_name; ?> [captcha_small]"><?php _e('Enable smaller size CAPTCHA image.', 'si-contact-form'); ?> </label> <a style="cursor:pointer;" title="<?php esc_attr_e('Click for Help!', 'si-contact-form'); ?> " onclick="toggleVisibility('si_contact_captcha_small_tip');"><?php _e('help', 'si-contact-form'); ?> </a> <div class="fscf_tip" id="si_contact_captcha_small_tip"> <?php _e('Makes the CAPTCHA image smaller.', 'si-contact-form'); ?> </div> <br /> <input name="<?php echo self::$form_option_name; ?> [captcha_perm]" id="si_contact_captcha_perm" type="checkbox" <?php if (self::$form_options['captcha_perm'] == 'true') { echo 'checked="checked"'; } ?> value="true" /> <label for="<?php echo self::$form_option_name; ?> [captcha_perm]"><?php _e('Hide CAPTCHA for', 'si-contact-form'); ?> <strong><?php _e('registered', 'si-contact-form'); ?> </strong> <?php __('users who can', 'si-contact-form'); ?> :</label> <?php self::si_contact_captcha_perm_dropdown(self::$form_option_name . '[captcha_perm_level]', self::$form_options['captcha_perm_level']); ?> <br /> <input name="<?php echo self::$form_option_name; ?> [honeypot_enable]" id="si_contact_honeypot_enable" type="checkbox" <?php if (self::$form_options['honeypot_enable'] == 'true') { echo ' checked="checked" '; } ?> value="true" /> <label for="<?php echo self::$form_option_name; ?> [honeypot_enable]"><?php _e('Enable honeypot spambot trap.', 'si-contact-form'); ?> </label> <a style="cursor:pointer;" title="<?php esc_attr_e('Click for Help!', 'si-contact-form'); ?> " onclick="toggleVisibility('si_contact_honeypot_enable_tip');"><?php _e('help', 'si-contact-form'); ?> </a> <div class="fscf_tip" id="si_contact_honeypot_enable_tip"> <?php _e('Enables hidden empty field honyepot trap for spam bots. For best results, do not enable unless you have a spam problem.', 'si-contact-form'); ?> </div> <br /> </fieldset> <?php }
static function display_captcha() { // this function adds the captcha to the contact form $captchaRequiresError = ''; $enable_php_sessions = 0; if (self::$global_options['enable_php_sessions'] == 'true') { $enable_php_sessions = 1; } $string = ''; // Test for some required things, print error message right here if not OK. // Code moved in from function captchaCheckRequires() -- only called once $captcha_ok = true; // Test for some required things, print error message if not OK. if (!extension_loaded('gd') || !function_exists('gd_info')) { $captchaRequiresError .= '<p ' . self::get_this_css('error_style') . '>' . __('ERROR: si-contact-form.php plugin says GD image support not detected in PHP!', 'si-contact-form') . '</p>'; $captchaRequiresError .= '<p>' . __('Contact your web host and ask them why GD image support is not enabled for PHP.', 'si-contact-form') . '</p>'; $captcha_ok = false; } if (!function_exists('imagepng')) { $captchaRequiresError .= '<p ' . self::get_this_css('error_style') . '>' . __('ERROR: si-contact-form.php plugin says imagepng function not detected in PHP!', 'si-contact-form') . '</p>'; $captchaRequiresError .= '<p>' . __('Contact your web host and ask them why imagepng function is not enabled for PHP.', 'si-contact-form') . '</p>'; $captcha_ok = false; } if (!@strtolower(ini_get('safe_mode')) == 'on' && !file_exists(FSCF_CAPTCHA_PATH . '/securimage.php')) { $captchaRequiresError .= '<p ' . self::get_this_css('error_style') . '>' . __('ERROR: si-contact-form.php plugin says captcha_library not found.', 'si-contact-form') . '</p>'; $captcha_ok = false; } if ($captcha_ok) { // the captch html $string = "\n<div " . self::get_this_css('title_style') . ">\n</div>\n" . '<div id="fscf_captcha_image_div' . self::$form_id_num . '" '; // url for captcha image $captcha_url_cf = FSCF_Util::get_captcha_url_cf(); $securimage_show_url = $captcha_url_cf . '/securimage_show.php?'; $securimage_size = 'width="175" height="60"'; if (self::$form_options['captcha_small'] == 'true') { $securimage_show_url .= 'ctf_sm_captcha=1&'; $securimage_size = 'width="132" height="45"'; } $parseUrl = parse_url($captcha_url_cf); $securimage_url = $parseUrl['path']; if (!$enable_php_sessions) { // no sessions self::init_temp_dir(FSCF_CAPTCHA_PATH . '/cache/'); // clean out old captcha cache files self::clean_temp_dir(FSCF_CAPTCHA_PATH . '/cache/'); // pick new prefix token $prefix_length = 16; $prefix_characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'; $prefix = ''; $prefix_count = strlen($prefix_characters); while ($prefix_length--) { $prefix .= $prefix_characters[mt_rand(0, $prefix_count - 1)]; } $securimage_show_rf_url = $securimage_show_url . 'prefix='; $securimage_show_url .= 'prefix=' . $prefix; } else { // no session $securimage_show_rf_url = $securimage_show_url . 'ctf_form_num=' . self::$form_id_num; $securimage_show_url .= 'ctf_form_num=' . self::$form_id_num; } $string .= self::$form_options['captcha_small'] == 'true' ? self::get_this_css('captcha_div_style_sm') : self::get_this_css('captcha_div_style_m'); $string .= ">\n" . ' <img id="fscf_captcha_image' . self::$form_id_num . '" '; $string .= self::get_this_css('captcha_image_style'); $string .= ' src="' . $securimage_show_url . '" ' . $securimage_size . ' alt="'; $string .= self::$form_options['tooltip_captcha'] != '' ? esc_html(self::$form_options['tooltip_captcha']) : esc_html(__('CAPTCHA Image', 'si-contact-form')); $string .= '" title="'; $string .= self::$form_options['tooltip_captcha'] != '' ? esc_html(self::$form_options['tooltip_captcha']) : esc_html(__('CAPTCHA Image', 'si-contact-form')); $string .= '" />' . "\n"; if (!$enable_php_sessions) { // no sessions $string .= ' <input id="fscf_captcha_prefix' . self::$form_id_num . '" type="hidden" name="fscf_captcha_prefix' . self::$form_id_num . '" value="' . esc_attr($prefix) . '" />' . "\n"; } $string .= ' <div id="fscf_captcha_refresh' . self::$form_id_num . '">' . "\n"; $string .= ' <a href="#" rel="nofollow" title="'; $string .= self::$form_options['tooltip_refresh'] != '' ? esc_html(self::$form_options['tooltip_refresh']) : esc_html(__('Refresh Image', 'si-contact-form')); if (!$enable_php_sessions) { // no sessions $string .= '" onclick="fscf_captcha_refresh(\'' . self::$form_id_num . '\',\'' . $securimage_url . '\',\'' . $securimage_show_rf_url . '\'); return false;">' . "\n"; } else { $string .= '" onclick="document.getElementById(\'fscf_captcha_image' . self::$form_id_num . '\').src = \'' . $securimage_show_url . '&sid=\'' . ' + Math.random(); return false;">' . "\n"; } $string .= ' <img src="' . $captcha_url_cf . '/images/refresh.png" width="22" height="20" alt="'; $string .= self::$form_options['tooltip_refresh'] != '' ? esc_html(self::$form_options['tooltip_refresh']) : esc_html(__('Refresh Image', 'si-contact-form')); $string .= '" '; $string .= self::get_this_css('captcha_reload_image_style'); $string .= ' onclick="this.blur();" /></a> </div> </div> <div id="fscf_captcha_field' . self::$form_id_num . '" ' . self::get_this_css('title_style') . '> <label ' . self::get_this_css('label_style') . ' for="fscf_captcha_code' . self::$form_id_num . '">'; $string .= self::$form_options['title_capt'] != '' ? self::$form_options['title_capt'] : __('CAPTCHA Code:', 'si-contact-form'); $string .= self::$req_field_ind . '</label> </div> <div ' . self::get_this_css('field_div_style') . '>' . self::echo_if_error('captcha') . "\n <input " . self::get_this_css('captcha_input_style') . ' type="text" value="" id="fscf_captcha_code' . self::$form_id_num . '" name="captcha_code" ' . self::$aria_required . ' />'; $string .= "\n</div>"; } else { $string .= $captchaRequiresError; } return $string; }