예제 #1
0
 function SetList_Init_reCAPTCHA(&$SetList)
 {
     // Drop any leading '.' from the domain.
     $domain = preg_replace('/^\\./', '', $SetList->Context->Configuration['COOKIE_DOMAIN']);
     // Put a reCAPTCHA signup link in the settings form.
     $elements =& $SetList->DelegateParameters['Form']['elements'];
     $elements['PrivateKey']['description'] = str_replace('\\1', '"' . recaptcha_get_signup_url($domain, 'Vanilla') . '"', $elements['PrivateKey']['description']);
 }
 function recaptcha_error_html()
 {
     if (!function_exists('fsockopen')) {
         return 'To use reCAPTCHA, the fsockopen() PHP function must be enabled on your server. Please check with your system administrator.';
     } elseif (!strlen(trim(qa_opt('recaptcha_public_key'))) || !strlen(trim(qa_opt('recaptcha_private_key')))) {
         require_once $this->directory . 'recaptchalib.php';
         $url = recaptcha_get_signup_url(@$_SERVER['HTTP_HOST'], qa_opt('site_title'));
         return 'To use reCAPTCHA, you must <a href="' . qa_html($url) . '">sign up</a> to get these keys.';
     }
     return null;
 }
예제 #3
0
function qa_captcha_error()
{
    if (qa_captcha_possible()) {
        return null;
    } elseif (!function_exists('fsockopen')) {
        return qa_lang_html('admin/recaptcha_fsockopen');
    } else {
        require_once QA_INCLUDE_DIR . 'qa-recaptchalib.php';
        $url = recaptcha_get_signup_url(@$_SERVER['HTTP_HOST'], qa_opt('site_title'));
        return strtr(qa_lang_html('admin/recaptcha_get_keys'), array('^1' => '<A HREF="' . qa_html($url) . '">', '^2' => '</A>'));
    }
}
예제 #4
0
 /**
  * Add the reCAPTCHA messages
  * 
  */
 function efReCaptcha()
 {
     global $wgMessageCache;
     global $recaptcha_public_key, $recaptcha_private_key;
     global $wgServerName;
     require_once dirname(__FILE__) . '/ReCaptcha.i18n.php';
     foreach (efReCaptchaMessages() as $lang => $messages) {
         $wgMessageCache->addMessages($messages, $lang);
     }
     if ($recaptcha_private_key == '' || $recaptcha_public_key == '') {
         die('You need to set $recaptcha_private_key and $recaptcha_public_key in LocalSettings.php to ' . "use the reCAPTCHA plugin. You can sign up for a key <a href='" . htmlentities(recaptcha_get_signup_url($wgServerName, "mediawiki")) . "'>here</a>.");
     }
 }
예제 #5
0
function recaptcha_key_configure()
{
    include_once 'plugins/recaptcha/recaptchalib.php';
    $url = recaptcha_get_signup_url($_SERVER['HTTP_HOST'], 'Coppermine Photo Gallery');
    echo <<<EOT
\t<form name="cpgform" id="cpgform" action="{$_SERVER['REQUEST_URI']}" method="post">
\t    <table border="0" cellspacing="0" cellpadding="0" width="80%">
              <tr>
                <td colspan="2" align="center">
                  <h2><a href="{$url}" target="_blank"><br>1) Sign Up and Get Keys for your Domain at recaptcha.net - Click Here</a></h2>
                </td>
                </tr>
\t\t\t\t<tr>
\t\t\t\t<td><br><br><br></td></tr>
\t\t\t\t              <tr>
\t\t\t\t<td align="center" colspan="2"><h2>2) Copy & Paste your Public and Private Keys below - then  press <b>Go!</b></h2></td></tr>
\t\t\t\t              <tr>
\t\t\t\t<td><br><br></td></tr>
\t\t\t\t              <tr>
                <td class="tableb" align="right">
                  Public Key:
                </td>
                <td class="tableb">
                  <input type="text" name="key_pub" class="textinput" size="55"/>
                </td>
              </tr>
              <tr>
\t\t\t\t<td><br><br></td></tr>
\t\t\t\t              <tr>
                <td class="tableb tableb_alternate" align="right">
                  Private Key:
                </td>
                <td class="tableb tableb_alternate">
                  <input type="text" name="key_pri" class="textinput" size="55"/>
                </td>
              </tr>
\t\t\t\t<tr>
\t\t\t\t<td><br></td></tr>
\t\t\t\t              <tr>
                <td class="tablef" colspan="2" align="center">
                  <input type="submit" name="rc_submit" value="Go!" class="button" />
                </td>
              </tr>
\t\t\t\t
            </table>
\t\t\t</form>
EOT;
}
예제 #6
0
/**
 * Make sure the keys are defined.
 */
function efReCaptcha()
{
    global $wgReCaptchaPublicKey, $wgReCaptchaPrivateKey;
    global $recaptcha_public_key, $recaptcha_private_key;
    global $wgServerName;
    // Backwards compatibility
    if ($wgReCaptchaPublicKey == '') {
        $wgReCaptchaPublicKey = $recaptcha_public_key;
    }
    if ($wgReCaptchaPrivateKey == '') {
        $wgReCaptchaPrivateKey = $recaptcha_private_key;
    }
    if ($wgReCaptchaPublicKey == '' || $wgReCaptchaPrivateKey == '') {
        die('You need to set $wgReCaptchaPrivateKey and $wgReCaptchaPublicKey in LocalSettings.php to ' . "use the reCAPTCHA plugin. You can sign up for a key <a href='" . htmlentities(recaptcha_get_signup_url($wgServerName, "mediawiki")) . "'>here</a>.");
    }
}
예제 #7
0
function sawey_recaptcha_configure()
{
    global $CONFIG, $lang_common;
    // Create the super cage
    $superCage = Inspekt::makeSuperCage();
    //load language
    $file_lang = RECAPTCHAPATH . '/lang/' . $CONFIG['lang'] . '.php';
    include file_exists($file_lang) ? $file_lang : RECAPTCHAPATH . '/lang/english.php';
    include_once RECAPTCHAPATH . '/recaptchalib.php';
    $superCage = Inspekt::makeSuperCage();
    $url = recaptcha_get_signup_url($superCage->server->getRaw('HTTP_HOST'), 'Coppermine Photo Gallery');
    $action_uri = $superCage->server->getEscaped('REQUEST_URI');
    echo <<<EOT
    <form name="cpgform" id="cpgform" action="{$action_uri}" method="post">
            <table border="0" cellspacing="0" cellpadding="0" width="100%">
              <tr>
                <td class="tableh2" colspan="2">
                  <h2>{$recap_lang['install_explain']}</h2>
                  <br />
                  <a href="{$url}" rel="external">{$recap_lang['install_click']}</a>
                  <br />
                </td>
              </tr>
              <tr>
                <td class="tableb">
                <br />
                  {$recap_lang['recaptcha_key']}:
                </td>
              </tr>
              <tr>
                <td class="tableb">
                  <input type="text" name="rc_key" class="textinput" size="55"/>
                </td>
              </tr>
              <tr>
                <td class="tableb">
                <br />
                  {$recap_lang['recaptcha_privkey']}:
                </td>
              </tr>
              <tr>
                <td class="tableb">
                  <input type="text" name="rc_privkey" class="textinput" size="55"/>
                </td>
              </tr>
              <tr>
                <td class="tablef" colspan="2">
                  <input type="submit" name="rc_submit" value="{$lang_common['go']}" class="button" />
                </td>
              </tr>
            </table>
    </form>
EOT;
}
예제 #8
0
function recaptcha_wp_options_subpanel()
{
    global $wpmu;
    // Default values for the options array
    $optionarray_def = array('pubkey' => '', 'privkey' => '', 'use_mailhide_posts' => '', 'use_mailhide_comments' => '', 'use_mailhide_rss' => '', 'use_mailhide_rss_comments' => '', 're_bypasslevel' => '3', 'mh_bypasslevel' => '3', 'mailhide_pub' => '', 'mailhide_priv' => '', 're_theme' => 'red', 're_theme_reg' => 'red', 're_lang' => 'en', 're_tabindex' => '5', 're_comments' => '1', 're_registration' => '1', 're_xhtml' => '0', 'mh_replace_link' => '', 'mh_replace_title' => '', 'error_blank' => __('<strong>ERROR</strong>: Please fill in the reCAPTCHA form.', "wp-recaptcha"), 'error_incorrect' => __('<strong>ERROR</strong>: That reCAPTCHA response was incorrect.', "wp-recaptcha"));
    if ($wpmu != 1) {
        add_option('recaptcha', $optionarray_def, __('reCAPTCHA Options', "wp-recaptcha"));
    }
    /* Check form submission and update options if no error occurred */
    if (isset($_POST['submit'])) {
        $optionarray_update = array('pubkey' => trim($_POST['recaptcha_opt_pubkey']), 'privkey' => trim($_POST['recaptcha_opt_privkey']), 'use_mailhide_posts' => $_POST['use_mailhide_posts'], 'use_mailhide_comments' => $_POST['use_mailhide_comments'], 'use_mailhide_rss' => $_POST['use_mailhide_rss'], 'use_mailhide_rss_comments' => $_POST['use_mailhide_rss_comments'], 're_bypass' => $_POST['re_bypass'], 're_bypasslevel' => $_POST['re_bypasslevel'], 'mailhide_pub' => trim($_POST['mailhide_pub']), 'mailhide_priv' => trim($_POST['mailhide_priv']), 'mh_bypass' => $_POST['mh_bypass'], 'mh_bypasslevel' => $_POST['mh_bypasslevel'], 're_theme' => $_POST['re_theme'], 're_theme_reg' => $_POST['re_theme_reg'], 're_lang' => $_POST['re_lang'], 're_tabindex' => $_POST['re_tabindex'], 're_comments' => $_POST['re_comments'], 're_registration' => $_POST['re_registration'], 're_xhtml' => $_POST['re_xhtml'], 'mh_replace_link' => $_POST['mh_replace_link'], 'mh_replace_title' => $_POST['mh_replace_title'], 'error_blank' => $_POST['error_blank'], 'error_incorrect' => $_POST['error_incorrect']);
        // save updated options
        if ($wpmu == 1) {
            update_site_option('recaptcha', $optionarray_update);
        } else {
            update_option('recaptcha', $optionarray_update);
        }
    }
    /* Get options */
    if ($wpmu == 1) {
        $optionarray_def = get_site_option('recaptcha');
    } else {
        $optionarray_def = get_option('recaptcha');
    }
    /* =============================================================================
       reCAPTCHA Admin Page and Functions
       ============================================================================= */
    /*
     * Display an HTML <select> listing the capability options for disabling security 
     * for registered users. 
     * @param string $select_name slug to use in <select> id and name
     * @param string $checked_value selected value for dropdown, slug form.
     * @return NULL
     */
    function recaptcha_dropdown_capabilities($select_name, $checked_value = "")
    {
        // define choices: Display text => permission slug
        $capability_choices = array(__('All registered users', "wp-recaptcha") => 'read', __('Edit posts', "wp-recaptcha") => 'edit_posts', __('Publish Posts', "wp-recaptcha") => 'publish_posts', __('Moderate Comments', "wp-recaptcha") => 'moderate_comments', __('Administer site', "wp-recaptcha") => 'level_10');
        // print the <select> and loop through <options>
        echo '<select name="' . $select_name . '" id="' . $select_name . '">' . "\n";
        foreach ($capability_choices as $text => $capability) {
            if ($capability == $checked_value) {
                $checked = ' selected="selected" ';
            }
            echo '\\t <option value="' . $capability . '"' . $checked . ">{$text}</option> \n";
            $checked = NULL;
        }
        echo "</select> \n";
    }
    // end recaptcha_dropdown_capabilities()
    ?>

<!-- ############################## BEGIN: ADMIN OPTIONS ################### -->
<div class="wrap">
	<h2><?php 
    _e('reCAPTCHA Options', 'wp-recaptcha');
    ?>
</h2>
	<h3><?php 
    _e('About reCAPTCHA', 'wp-recaptcha');
    ?>
</h3>
	<p><?php 
    _e('reCAPTCHA is a free, accessible CAPTCHA service that helps to digitize books while blocking spam on your blog.', 'wp-recaptcha');
    ?>
</p>
	
	<p><?php 
    _e('reCAPTCHA asks commenters to retype two words scanned from a book to prove that they are a human. This verifies that they are not a spambot while also correcting the automatic scans of old books. So you get less spam, and the world gets accurately digitized books. Everybody wins! For details, visit the <a href="http://recaptcha.net/">reCAPTCHA website</a>.', 'wp-recaptcha');
    ?>
</p>
   <p><?php 
    _e('<strong>NOTE</strong>: If you are using some form of Cache plugin you will probably need to flush/clear your cache for changes to take effect.', 'wp-recaptcha');
    ?>
</p>
   
	<form name="form1" method="post" action="<?php 
    echo $_SERVER['REDIRECT_SCRIPT_URI'] . '?page=' . plugin_basename(__FILE__);
    ?>
&updated=true">
		<div class="submit">
			<input type="submit" name="submit" value="<?php 
    _e('Update Options', 'wp-recaptcha');
    ?>
 &raquo;" />
		</div>
	
	<!-- ****************** Operands ****************** -->
   <table class="form-table">
   <tr valign="top">
		<th scope="row"><?php 
    _e('reCAPTCHA Keys', 'wp-recaptcha');
    ?>
</th>
		<td>
			<?php 
    _e('reCAPTCHA requires an API key, consisting of a "public" and a "private" key.', 'wp-recaptcha');
    ?>
 <?php 
    _e('You can sign up for a', 'wp-recaptcha');
    ?>
 <a href="<?php 
    echo recaptcha_get_signup_url(recaptcha_wp_blog_domain(), 'wordpress');
    ?>
" target="0"><?php 
    _e('free reCAPTCHA key', 'wp-recaptcha');
    ?>
</a>.
			<br />
			<p class="re-keys">
				<!-- reCAPTCHA public key -->
				<label class="which-key" for="recaptcha_opt_pubkey"><?php 
    _e('Public Key:', 'wp-recaptcha');
    ?>
</label>
				<input name="recaptcha_opt_pubkey" id="recaptcha_opt_pubkey" size="40" value="<?php 
    echo $optionarray_def['pubkey'];
    ?>
" />
				<br />
				<!-- reCAPTCHA private key -->
				<label class="which-key" for="recaptcha_opt_privkey"><?php 
    _e('Private Key:', 'wp-recaptcha');
    ?>
</label>
				<input name="recaptcha_opt_privkey" id="recaptcha_opt_privkey" size="40" value="<?php 
    echo $optionarray_def['privkey'];
    ?>
" />
			</p>
	    </td>
    </tr>
  	<tr valign="top">
		<th scope="row"><?php 
    _e('Comment Options', 'wp-recaptcha');
    ?>
</th>
		<td>
			<!-- Show reCAPTCHA on the comment post -->
			<big><input type="checkbox" name="re_comments" id="re_comments" value="1" <?php 
    if ($optionarray_def['re_comments'] == true) {
        echo 'checked="checked"';
    }
    ?>
 /> <label for="re_comments"><?php 
    _e('Enable reCAPTCHA for comments.', 'wp-recaptcha');
    ?>
</label></big>
			<br />
			<!-- Don't show reCAPTCHA to admins -->
			<div class="theme-select">
			<input type="checkbox" id="re_bypass" name="re_bypass" <?php 
    if ($optionarray_def['re_bypass'] == true) {
        echo 'checked="checked"';
    }
    ?>
/>
			<label name="re_bypass" for="re_bypass"><?php 
    _e('Hide reCAPTCHA for <strong>registered</strong> users who can:', 'wp-recaptcha');
    ?>
</label>
			<?php 
    recaptcha_dropdown_capabilities('re_bypasslevel', $optionarray_def['re_bypasslevel']);
    // <select> of capabilities
    ?>
			</div>

			<!-- The theme selection -->
			<div class="theme-select">
			<label for="re_theme"><?php 
    _e('Theme:', 'wp-recaptcha');
    ?>
</label>
			<select name="re_theme" id="re_theme">
			<option value="red" <?php 
    if ($optionarray_def['re_theme'] == 'red') {
        echo 'selected="selected"';
    }
    ?>
><?php 
    _e('Red', 'wp-recaptcha');
    ?>
</option>
			<option value="white" <?php 
    if ($optionarray_def['re_theme'] == 'white') {
        echo 'selected="selected"';
    }
    ?>
><?php 
    _e('White', 'wp-recaptcha');
    ?>
</option>
			<option value="blackglass" <?php 
    if ($optionarray_def['re_theme'] == 'blackglass') {
        echo 'selected="selected"';
    }
    ?>
><?php 
    _e('Black Glass', 'wp-recaptcha');
    ?>
</option>
			<option value="clean" <?php 
    if ($optionarray_def['re_theme'] == 'clean') {
        echo 'selected="selected"';
    }
    ?>
><?php 
    _e('Clean', 'wp-recaptcha');
    ?>
</option>
			</select>
			</div>
			<!-- Tab Index -->
			<label for="re_tabindex"><?php 
    _e('Tab Index (<em>e.g. WP: <strong>5</strong>, WPMU: <strong>3</strong></em>):', 'wp-recaptcha');
    ?>
</label>
			<input name="re_tabindex" id="re_tabindex" size="5" value="<?php 
    echo $optionarray_def['re_tabindex'];
    ?>
" />
			<br />
			<?php 
    global $wpmu;
    if ($wpmu == 1 || $wpmu == 0) {
        ?>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row"><?php 
        _e('Registration Options', 'wp-recaptcha');
        ?>
</th>
		<td>
			<!-- Show reCAPTCHA on the registration page -->
			<big><input type="checkbox" name="re_registration" id="re_registration" value="1" <?php 
        if ($optionarray_def['re_registration'] == true) {
            echo 'checked="checked"';
        }
        ?>
 /> <label for="re_registration"><?php 
        _e('Enable reCAPTCHA on registration form.', 'wp-recaptcha');
        ?>
</label></big>
			<br />
			<!-- The theme selection -->
			<div class="theme-select">
				<label for="re_theme_reg"><?php 
        _e('Theme:', 'wp-recaptcha');
        ?>
</label>
				<select name="re_theme_reg" id="re_theme_reg">
				<option value="red" <?php 
        if ($optionarray_def['re_theme_reg'] == 'red') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('Red', 'wp-recaptcha');
        ?>
</option>
				<option value="white" <?php 
        if ($optionarray_def['re_theme_reg'] == 'white') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('White', 'wp-recaptcha');
        ?>
</option>
				<option value="blackglass" <?php 
        if ($optionarray_def['re_theme_reg'] == 'blackglass') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('Black Glass', 'wp-recaptcha');
        ?>
</option>
				<option value="clean" <?php 
        if ($optionarray_def['re_theme_reg'] == 'clean') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('Clean', 'wp-recaptcha');
        ?>
</option>
				</select>
			</div>
			<?php 
    }
    ?>
		</td>
	</tr>
   <tr valign="top">
      <th scope="row"><?php 
    _e('Error Messages', 'wp-recaptcha');
    ?>
</th>
         <td>
            <p><?php 
    _e('The following are the messages to display when the user does not enter a CAPTCHA response or enters the incorrect CAPTCHA response.', 'wp-recaptcha');
    ?>
</p>
            <!-- Error Messages -->
            <p class="re-keys">
               <!-- Blank -->
      			<label class="which-key" for="error_blank"><?php 
    _e('No response entered:', 'wp-recaptcha');
    ?>
</label>
      			<input name="error_blank" id="error_blank" size="80" value="<?php 
    echo $optionarray_def['error_blank'];
    ?>
" />
      			<br />
      			<!-- Incorrect -->
      			<label class="which-key" for="error_incorrect"><?php 
    _e('Incorrect response entered:', 'wp-recaptcha');
    ?>
</label>
      			<input name="error_incorrect" id="error_incorrect" size="80" value="<?php 
    echo $optionarray_def['error_incorrect'];
    ?>
" />
      		</p>
         </td>
      </th>
   </tr>
	 <tr valign="top">
			<th scope="row"><?php 
    _e('General Settings', 'wp-recaptcha');
    ?>
</th>
			<td>
				<!-- The language selection -->
				<div class="lang-select">
				<label for="re_lang"><?php 
    _e('Language:', 'wp-recaptcha');
    ?>
</label>
				<select name="re_lang" id="re_lang">
				<option value="en" <?php 
    if ($optionarray_def['re_lang'] == 'en') {
        echo 'selected="selected"';
    }
    ?>
><?php 
    _e('English', 'wp-recaptcha');
    ?>
</option>
				<option value="nl" <?php 
    if ($optionarray_def['re_lang'] == 'nl') {
        echo 'selected="selected"';
    }
    ?>
><?php 
    _e('Dutch', 'wp-recaptcha');
    ?>
</option>
				<option value="fr" <?php 
    if ($optionarray_def['re_lang'] == 'fr') {
        echo 'selected="selected"';
    }
    ?>
><?php 
    _e('French', 'wp-recaptcha');
    ?>
</option>
				<option value="de" <?php 
    if ($optionarray_def['re_lang'] == 'de') {
        echo 'selected="selected"';
    }
    ?>
><?php 
    _e('German', 'wp-recaptcha');
    ?>
</option>
				<option value="pt" <?php 
    if ($optionarray_def['re_lang'] == 'pt') {
        echo 'selected="selected"';
    }
    ?>
><?php 
    _e('Portuguese', 'wp-recaptcha');
    ?>
</option>
				<option value="ru" <?php 
    if ($optionarray_def['re_lang'] == 'ru') {
        echo 'selected="selected"';
    }
    ?>
><?php 
    _e('Russian', 'wp-recaptcha');
    ?>
</option>
				<option value="es" <?php 
    if ($optionarray_def['re_lang'] == 'es') {
        echo 'selected="selected"';
    }
    ?>
><?php 
    _e('Spanish', 'wp-recaptcha');
    ?>
</option>
				<option value="tr" <?php 
    if ($optionarray_def['re_lang'] == 'tr') {
        echo 'selected="selected"';
    }
    ?>
><?php 
    _e('Turkish', 'wp-recaptcha');
    ?>
</option>
				</select>
				</label>
		    	</div>
		    	<!-- Whether or not to be XHTML 1.0 Strict compliant -->
				<input type="checkbox" name="re_xhtml" id="re_xhtml" value="1" <?php 
    if ($optionarray_def['re_xhtml'] == true) {
        echo 'checked="checked"';
    }
    ?>
 /> <label for="re_xhtml"><?php 
    _e("Be XHTML 1.0 Strict compliant. <strong>Note</strong>: Bad for users who don't have Javascript enabled in their browser (Majority do).", "wp-recaptcha");
    ?>
</label>
				<br />
			</td>
		</tr>
	</table>
	
	<h3><?php 
    _e('About MailHide', 'wp-recaptcha');
    ?>
</h3>
	<p><a href="http://mailhide.recaptcha.net/" title="mailhide email obfuscation">MailHide</a> <?php 
    _e('uses reCAPTCHA to protect email adresses displayed on your blog from being harvested for spam.', 'wp-recaptcha');
    ?>
</p>
	<p><?php 
    _e('Activating MailHide will automatically hide all emails in posts and comments from spam bots. For example, support@recaptcha.net would become', 'wp-recaptcha');
    ?>
 supp<a href="http://mailhide.recaptcha.net/d?k=01a8k2oW96qNZ4JhiFx5zDRg==&amp;c=yifPREOOvfzA0o3dbnnwP8fy91UD8RL4SspHDIKHVRE=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01a8k2oW96qNZ4JhiFx5zDRg==&amp;c=yifPREOOvfzA0o3dbnnwP8fy91UD8RL4SspHDIKHVRE=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="<?php 
    _e('Reveal this e-mail address', 'wp-recaptcha');
    ?>
">...</a>@recaptcha.net. <?php 
    _e('There are also options below for choosing the text to show for hidden emails.', 'wp-recaptcha');
    ?>
</p>
	<p><?php 
    _e('MailHide also requires a public and private key which you can generate using the <a href="http://mailhide.recaptcha.net/apikey">key generation service</a>.', 'wp-recaptcha');
    ?>
</p>
	<table class="form-table">
	<tr valign="top">
	<th scope="row"><?php 
    _e('MailHide Keys', 'wp-recaptcha');
    ?>
</th>
	<td>
		<!-- MailHide Enabler -->
		<big><?php 
    _e('Enable MailHide email obfuscation for:', 'wp-recaptcha');
    ?>
</big><br />
		   <input type="checkbox" name="use_mailhide_posts" id="use_mailhide_posts" value="1" <?php 
    if ($optionarray_def['use_mailhide_posts'] == true) {
        echo 'checked="checked"';
    }
    ?>
 /><label for="use_mailhide_posts"><?php 
    _e('Posts/Pages', 'wp-recaptcha');
    ?>
</label><br />
		   <input type="checkbox" name="use_mailhide_comments" id="use_mailhide_comments" value="1" <?php 
    if ($optionarray_def['use_mailhide_comments'] == true) {
        echo 'checked="checked"';
    }
    ?>
 /><label for="use_mailhide_comments"><?php 
    _e('Comments', 'wp-recaptcha');
    ?>
</label><br />
		   <input type="checkbox" name="use_mailhide_rss" id="use_mailhide_rss" value="1" <?php 
    if ($optionarray_def['use_mailhide_rss'] == true) {
        echo 'checked="checked"';
    }
    ?>
 /><label for="use_mailhide_rss"><?php 
    _e('RSS Feed of Posts/Pages', 'wp-recaptcha');
    ?>
</label><br />
		   <input type="checkbox" name="use_mailhide_rss_comments" id="use_mailhide_rss_comments" value="1" <?php 
    if ($optionarray_def['use_mailhide_rss_comments'] == true) {
        echo 'checked="checked"';
    }
    ?>
 /><label for="use_mailhide_rss_comments"><?php 
    _e('RSS Feed of Comments', 'wp-recaptcha');
    ?>
</label><br />
		<!-- Public Key -->
		<p class="re-keys">
			<label class="which-key" for="mailhide_pub"><?php 
    _e('Public Key:', 'wp-recaptcha');
    ?>
</label>
			<input name="mailhide_pub" id="mailhide_pub" size="40" value="<?php 
    echo $optionarray_def['mailhide_pub'];
    ?>
" />
			<br />
			<!-- Private Key -->
			<label class="which-key" for="mailhide_priv"><?php 
    _e('Private Key:', 'wp-recaptcha');
    ?>
</label>
			<input name="mailhide_priv" id="mailhide_priv" size="40" value="<?php 
    echo $optionarray_def['mailhide_priv'];
    ?>
" />
		</p>
   </td>
   </tr>
   <tr valign="top">
   <th scope="row"><?php 
    _e('Visibility Options', 'wp-recaptcha');
    ?>
</th>
   <td>
		<!-- Don't show mailhide to users who can... -->
		<div class="theme-select">
			<input type="checkbox" id="mh_bypass" name="mh_bypass" <?php 
    if ($optionarray_def['mh_bypass'] == true) {
        echo 'checked="checked"';
    }
    ?>
/>
			<label for="mh_bypass"><?php 
    _e('Show full email adresses to <strong>registered</strong> users who can:', 'wp-recaptcha');
    ?>
</label>
			<?php 
    recaptcha_dropdown_capabilities('mh_bypasslevel', $optionarray_def['mh_bypasslevel']);
    // <select> of capabilities
    ?>
		</div>
      <!-- Email Replacement Text -->
      <p class="re-keys">
         <p><?php 
    _e('The following allows you to show the replaced links differently. Usually, you get something like this,', 'wp-recaptcha');
    ?>
 supp<a href="http://mailhide.recaptcha.net/d?k=01a8k2oW96qNZ4JhiFx5zDRg==&amp;c=yifPREOOvfzA0o3dbnnwP8fy91UD8RL4SspHDIKHVRE=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01a8k2oW96qNZ4JhiFx5zDRg==&amp;c=yifPREOOvfzA0o3dbnnwP8fy91UD8RL4SspHDIKHVRE=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address">...</a>@recaptcha.net , <?php 
    _e('where the email is broken up into two pieces and then a link with dots is placed in the middle. The <strong>Email Replacement Text</strong> value lets you choose what to name the link and then the <strong>Reveal Link Title</strong> value determines the text that is shown when the link is hovered over.', 'wp-recaptcha');
    ?>
</p>
         <p><?php 
    _e('For example, if the <strong>Email Replacement Text</strong> option is set to <strong>HIDDEN EMAIL</strong> and the <strong>Reveal Link Title</strong> option is set to <strong>Click here to reveal this address</strong>, then ALL emails will be hidden like this:', 'wp-recaptcha');
    ?>
 <a href="http://mailhide.recaptcha.net/d?k=01a8k2oW96qNZ4JhiFx5zDRg==&amp;c=yifPREOOvfzA0o3dbnnwP8fy91UD8RL4SspHDIKHVRE=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01a8k2oW96qNZ4JhiFx5zDRg==&amp;c=yifPREOOvfzA0o3dbnnwP8fy91UD8RL4SspHDIKHVRE=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Click here to reveal this address"><?php 
    _e('HIDDEN EMAIL', 'wp-recaptcha');
    ?>
</a></p>
         <p><?php 
    _e('If you want to maintain the default method of hiding emails then leave both boxes blank.', 'wp-recaptcha');
    ?>
</p>
         <label class="whch-key" for="mh_replace_link"><?php 
    _e('EMail Replacement Text:', 'wp-recaptcha');
    ?>
</label>
         <input name="mh_replace_link" id="mh_replace_link" size="40" value="<?php 
    echo $optionarray_def['mh_replace_link'];
    ?>
" />
         <br />
         <label class="which-key" for="mh_replace_title"><?php 
    _e('Reveal Link Title:', 'wp-recaptcha');
    ?>
</label>
         <input name="mh_replace_title" id="mh_replace_title" size="40" value="<?php 
    echo $optionarray_def['mh_replace_title'];
    ?>
" />
      </p>
   </td>
   </tr>
   <tr valign="top">
   <th scope="row"><?php 
    _e('Other Information', 'wp-recaptcha');
    ?>
</th>
   <td>
		<!-- MailHide CSS -->
		<p><?php 
    _e("CSS: You can style the hidden emails and much more in the <strong>recaptcha.css</strong> stylesheet in wp-recaptcha's plugin folder.", "wp-recaptcha");
    ?>
</p>
		<p><?php 
    _e("You can bypass email hiding for an address by enclosing it within <strong>[nohide][/nohide]</strong>, ex. [nohide]some@email.com[/nohide].", "wp-recaptcha");
    ?>
</p>
	</td>
	</tr>
	</table>
	<div class="submit">
		<input type="submit" name="submit" value="<?php 
    _e('Update Options', 'wp-recaptcha');
    ?>
 &raquo;" />
	</div>

	</form>
   <p class="copyright">&copy; Copyright 2008&nbsp;&nbsp;<a href="http://recaptcha.net">reCAPTCHA</a></p>
</div> <!-- [wrap] -->
<!-- ############################## END: ADMIN OPTIONS ##################### -->

<?php 
}
예제 #9
0
    function spam_filter()
    {
        if ($_POST['action'] == 'save') {
            $options = array();
            if ($_POST['options']['patternsToDieOn']) {
                $options['patternsToDieOn'] = explode("\n", stripslashes(trim($_POST['options']['patternsToDieOn'])));
            } else {
                $options['patternsToDieOn'] = $this->patternsToDieOn;
            }
            if ($_POST['options']['wordsToDieOn']) {
                $options['wordsToDieOn'] = preg_split("/[\\s,]+/", stripslashes(trim($_POST['options']['wordsToDieOn'])), -1, PREG_SPLIT_NO_EMPTY);
            } else {
                $options['wordsToDieOn'] = $this->wordsToDieOn;
            }
            if ($_POST['options']['limit']) {
                $options['limit'] = (int) $_POST['options']['limit'];
            } else {
                $options['limit'] = 5;
            }
            if ($_POST['options']['similar']) {
                $options['similar'] = true;
            } else {
                $options['similar'] = false;
            }
            update_option('tantan_spam_filter', $options);
        } elseif ($_POST['action'] == 'savecaptcha') {
            if (is_array($_POST['recaptcha'])) {
                foreach ($_POST['recaptcha'] as $k => $v) {
                    $_POST['recaptcha'][$k] = trim($v);
                }
                update_option('tantan_spam_filter_recaptcha', $_POST['recaptcha']);
            }
        }
        $this->options = get_option('tantan_spam_filter');
        $this->captcha = get_option('tantan_spam_filter_recaptcha');
        if ($_POST['processSpam']) {
            $numDeleted = $this->processSpam();
            echo '<div id="message" class="updated fade"><p>Deleted ' . $numDeleted . ' spams from your spams queue.</p></div>';
        }
        ?>
        <style type="text/css">
        .spam, .spam:visited { color:#aaa; border:0; padding:2px;}
        .spam:hover { color:black;}
        .selected, .selected:visited, .selected:link { color:white; background:#aaa;text-decoration:none;}
        textarea { width:100%; font-size:0.9em;border:1px solid #aaa;margin:0 auto 5px auto; }
        fieldset { clear:both; border:1px solid #ccc; padding:15px;}
        fieldset legend { font-family: Georgia,"Times New Roman",Times,serif; font-size: 22px; }
        </style>
        <script type="text/javascript">
        function addWord(obj, word) {
            var txt = document.getElementById('wordsToDieOn');
            if (obj.className.indexOf('selected') <= -1) {
                obj.className = 'spam selected';
                txt.value += (' ' + word)
            } else {
                obj.className = 'spam';
                txt.value += ' ';
                txt.value = txt.value.replace(' '+word+' ', ' ');
                txt.value = txt.value.replace('  ', ' ');
            }
            return false;
        }
        </script>
       <div class="wrap">
       <h2>TanTanNoodles Simple Spam Filter</h2>
       
       <table width="100%" border="0"><tr valign="top"><td style="width:75%;padding:0 20px 0 0">
       <p>So far, this spam filter has blocked and rejected <strong><?php 
        echo $this->getSpamCount();
        ?>
</strong> spam comments.</p>
       <p>New comments that match any of the filter rules specified below will be immediately rejected with an error message.</p>
		<p>Plugin Info Page: <a href="http://tantannoodles.com/toolkit/spam-filter/">tantannoodles.com/toolkit/spam-filter/</a>
       </td><td style="font-size:0.9em;width:25%;">
If you find this plugin helpful, please consider donating a few dollars to support this plugin. Thanks!
<br /><br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations" />
<input type="hidden" name="business" value="*****@*****.**" />
<input type="hidden" name="item_name" value="TanTanNoodles Plugin Donation" />
<input type="hidden" name="item_number" value="Spam Filter" />
<input type="hidden" name="page_style" value="Primary" />

<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="return" value="http://tantannoodles.com/donation-thankyou/" />
<input type="hidden" name="cancel_return" value="http://tantannoodles.com/" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="tax" value="0" />
<input type="hidden" name="cn" value="Message / Note" />
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="bn" value="PP-DonationsBF" />
<div style="float:left;width:150px;padding-top:10px">
Amount: $<input type="text" name="amount" value="" style="width:50px;" /> <br />
</div>
<div style="float:right;width:100px">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />
</div>
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" style="clear:both;" />
</form>



        </td></tr></table>
        <form method="post">
            <input type="hidden" name="action" value="savecaptcha" />
	   <fieldset>
	       <legend>Captcha Verification</legend>
			Utilize a captcha if a comment gets blocked by one of the filter rules below, or if it gets flagged as spam by the Akismet plugin (version 2.1.3 or later).
			This gives people a "second chance" to prove that they are indeed human and not a spam generating bot. Once they successfully complete the captcha, their comment will be posted normally. 
			Note that comments that don't pass the captcha will be immediately discarded.
			<br /><br />
			<input type="checkbox" value="1" name="recaptcha[enabled]" id="recaptcha-enabled" <?php 
        echo $this->captcha['enabled'] ? 'checked="checked"' : '';
        ?>
 onclick="if (this.checked) document.getElementById('recaptcha-setup').style.display='block';" />
			<label for="recaptcha-enabled">Enable reCAPTCHA module</label>
			<br /><br />
			<div id="recaptcha-setup" style="<?php 
        echo $this->captcha['enabled'] ? '' : 'display:none;';
        ?>
">
			<strong>Setup Instructions</strong><br />
			<blockquote>
			Step 1: <a href="<?php 
        echo recaptcha_get_signup_url(recaptcha_wp_blog_domain(), 'tantan-spam-filter');
        ?>
" target="_blank">Signup for a reCAPTCHA account.</a> 
			This is a free service, and takes less than 2 minutes to signup. 
			<a href="http://recaptcha.net/">Learn more ></a>
			<br />
			Step 2: Copy and paste both of your <em>public and private keys</em> into the fields below.<br />
			Step 3: Click save, and you're done! <br /><br />
			</blockquote>
			reCAPTCHA Keys:<br />
			Public: <input type="text" name="recaptcha[public]" value="<?php 
        echo $this->captcha['public'];
        ?>
" size="45" /><br />
			Private: <input type="text" name="recaptcha[private]" value="<?php 
        echo $this->captcha['private'];
        ?>
" size="45" /><br />
			<br />
			To test and make sure reCAPTCHA is working properly, try to posting a comment with a banned word.
	       <p class="submit">
	       <input type="submit" value="save settings" /><br />
	       </p>
			</div>
		</fieldset>
		</form>
		<br />
        <form method="post">
            <input type="hidden" name="action" value="save" />
	   <fieldset>
	       <legend>Filter Rules</legend>

       Block comments with <input type="text" name="options[limit]" value="<?php 
        echo $this->options['limit'];
        ?>
" size="3" /> or more links to external sites.
       <br /><br />
       
       <input type="checkbox" name="options[similar]" value="1" <?php 
        echo $this->options['similar'] ? "checked='checked'" : '';
        ?>
 id="options-similar" /> <label for="options-similar">Block any comment that is extremely similar to a previously submitted comment.</label>
       <br /><br />
       
	   <strong>Banned Patterns</strong>: <br />
	   <textarea name="options[patternsToDieOn]" id="patternsToDieOn" wrap="off" style="height:6em"><?php 
        echo implode("\n", $this->getSpamPatterns());
        ?>
</textarea>
		<br /><small>One <a href="http://www.php.net/manual/en/function.eregi.php">regex pattern</a> per line. <a href="http://code.google.com/p/tantan-toolkit/wiki/SpamFilterRules">List of useful patterns</a>.</small>
       <br /><br />
	   <strong>Banned Words List</strong>: <br />
	   <textarea name="options[wordsToDieOn]" id="wordsToDieOn"><?php 
        echo implode(' ', $this->getSpamWords());
        ?>
</textarea><br />
       <p class="submit">
       <input type="submit" value="save rules" /><br />
       Process the <a href="edit-comments.php?page=akismet-admin">spam queue</a> with these rules <input type="checkbox" name="processSpam" value="1" />
       </p>
       <?php 
        $words = $this->getPossibleSpamWords();
        ?>
	   <p>This plugin found <strong><?php 
        echo count($words);
        ?>
</strong> possible spam words from your existing spam queue.
	       You can use this list to help you tweak the plugin's banned words list. Just click on a word to add it to the list.</p>
       <?php 
        foreach ($words as $word => $count) {
            echo "<a href='#' class='spam' title='{$count} occurrences' onclick=\"return addWord(this, '{$word}')\">{$word}</a> ";
        }
        // (<a href="#" class="addword">+</a><a href="edit-comments.php?page=tantan/spam-filter.php&action=delete&word='.$word.'" class="delword" title="delete">x</a>)
        ?>
	   </fieldset>
	   </form>
	   </div>
	   <?php 
    }
    /**
     * Configuration panel for widget
     * 
     * @access public
     */
    function control($options, $form_id)
    {
        // Store settings for this widget
        //
        if ($_POST[$this->internalName . '-submit']) {
            $newoptions['publickey'] = $_POST['recaptcha-publickey'];
            $newoptions['privatekey'] = $_POST['recaptcha-privatekey'];
            $newoptions['theme'] = $_POST['recaptcha-themekey'];
            $newoptions['language'] = $_POST['recaptcha-language'];
            $newoptions['xhtml'] = isset($_POST['recaptcha-xhtml']);
            $newoptions['plugin'] = isset($_POST['recaptcha-plugin']);
            $options = wp_parse_args($newoptions, $options);
            $this->updateOptions($options, $form_id);
        }
        if (!function_exists('recaptcha_get_signup_url')) {
            @(require_once TDOMF_RECAPTCHALIB_PATH);
        }
        // get blog domain
        $uri = parse_url(get_settings('siteurl'));
        $blogdomain = $uri['host'];
        // Display control panel for this widget
        //
        extract($options);
        ?>
<div>          
          <?php 
        $this->controlCommon($options);
        ?>
          
          <small><?php 
        _e('If this option is enabled and the reCaptcha plugin is active, the settings for comments will overwrite any configuration below.', 'tdomf');
        ?>
</small><br/>
    <input type="checkbox" name="recaptcha-plugin" id="recaptcha-plugin" <?php 
        if ($options['plugin']) {
            echo "checked";
        }
        ?>
 >
    <label for="recaptcha-plugin" style="line-height:35px;"><?php 
        _e('Use comment settings from <a href="http://wordpress.org/extend/plugins/wp-recaptcha/">reCaptcha plugin</a> if active', "tdomf");
        ?>
</label>
    
    <br/><br/>
    
    <small><?php 
        printf(__('reCAPTCHA requires an API key, consisting of a "public" and a "private" key. You can sign up for a <a href="%s" target="0">free reCAPTCHA key</a>.', 'tdomf'), recaptcha_get_signup_url($blogdomain, 'wordpress'));
        ?>
</small>
    <br/><br/>

    <label class="which-key" for="recaptcha-publickey" style="line-height:35px;">Public Key:</label>
    <input name="recaptcha-publickey" id="recaptcha-publickey" size="40" value="<?php 
        echo $options['publickey'];
        ?>
" />
    
    <br />
    <label class="which-key" for="recaptcha-privatekey" style="line-height:35px;">Private Key:</label>
    <input name="recaptcha-privatekey" id="recaptcha-privatekey" size="40" value="<?php 
        echo $options['privatekey'];
        ?>
" />

    <br/>

    <div class="theme-select">
    <label for="recaptcha-themekey" style="line-height:35px;"><?php 
        _e('Theme:', 'tdomf');
        ?>
</label>
    <select name="recaptcha-themekey" id="recaptcha-themekey">
    <option value="red" <?php 
        if ($options['theme'] == 'red') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('Red', 'tdomf');
        ?>
</option>
    <option value="white" <?php 
        if ($options['theme'] == 'white') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('White', 'tdomf');
        ?>
</option>
    <option value="blackglass" <?php 
        if ($options['theme'] == 'blackglass') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('Black Glass', 'tdomf');
        ?>
</option>
    <option value="clean" <?php 
        if ($options['theme'] == 'clean') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('Clean', 'tdomf');
        ?>
</option>
    </select>
    </div>

    <br/>
    
    <div class="lang-select">
    <label for="recaptcha-language" style="line-height:35px;"><?php 
        _e('Language:', 'tdomf');
        ?>
</label>
    <select name="recaptcha-language" id="recaptcha-languageg">
    <option value="en" <?php 
        if ($options['language'] == 'en') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('English', 'tdomf');
        ?>
</option>
    <option value="nl" <?php 
        if ($options['language'] == 'nl') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('Dutch', 'tdomf');
        ?>
</option>
    <option value="fr" <?php 
        if ($options['language'] == 'fr') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('French', 'tdomf');
        ?>
</option>
    <option value="de" <?php 
        if ($options['language'] == 'de') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('German', 'tdomf');
        ?>
</option>
    <option value="pt" <?php 
        if ($options['language'] == 'pt') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('Portuguese', 'tdomf');
        ?>
</option>
    <option value="ru" <?php 
        if ($options['language'] == 'ru') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('Russian', 'tdomf');
        ?>
</option>
    <option value="es" <?php 
        if ($options['language'] == 'es') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('Spanish', 'tdomf');
        ?>
</option>
    <option value="tr" <?php 
        if ($options['language'] == 'tr') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('Turkish', 'tdomf');
        ?>
</option>
    </select>
    </label>
    </div>

    <br/>
    
    <input type="checkbox" name="recaptcha-xhtml" id="recaptcha-xhtml" <?php 
        if ($options['xhtml']) {
            echo "checked";
        }
        ?>
 >
    <label for="recaptcha-xhtml" style="line-height:35px;"><?php 
        _e("XHTML 1.0 Strict compliant.", "tdomf");
        ?>
</label><br/>
    <small><?php 
        _e('Bad for users who don\'t have Javascript enabled in their browser (Majority do).', 'tdomf');
        ?>
</small>
    
    </div>
    
<?php 
    }
예제 #11
0
function mf_display_captcha($element)
{
    if (!empty($element->error_message)) {
        $error_code = $element->error_message;
    } else {
        $error_code = '';
    }
    //check for error
    $error_class = '';
    $error_message = '';
    $span_required = '';
    $guidelines = '';
    global $mf_lang;
    if (!empty($element->is_error)) {
        if ($element->error_message == 'el-required') {
            $element->error_message = $mf_lang['captcha_required'];
            $error_code = '';
        } else {
            if ($element->error_message == 'el-text-required') {
                $element->error_message = $mf_lang['val_required'];
                $error_code = '';
            } elseif ($element->error_message == 'incorrect-captcha-sol') {
                $element->error_message = $mf_lang['captcha_mismatch'];
            } elseif ($element->error_message == 'incorrect-text-captcha-sol') {
                $element->error_message = $mf_lang['captcha_text_mismatch'];
            } else {
                $element->error_message = "{$mf_lang['captcha_error']} ({$element->error_message})";
            }
        }
        $error_class = 'class="error"';
        $error_message = "<p class=\"error\">{$element->error_message}</p>";
    }
    if (!empty($_SERVER['HTTPS'])) {
        $use_ssl = true;
    } else {
        $use_ssl = false;
    }
    if ($element->captcha_type == 'i') {
        //if this is internal captcha type
        $machform_path = '';
        if (!empty($element->machform_path)) {
            $machform_path = $element->machform_path;
        }
        $timestamp = time();
        //use this as paramater for captcha.php, to prevent caching
        $element->title = $mf_lang['captcha_simple_image_title'];
        $captcha_html = <<<EOT
<img id="captcha_image" src="{$machform_path}captcha.php?t={$timestamp}" width="200" height="60" alt="Please refresh your browser to see this image." /><br />
<input id="captcha_response_field" name="captcha_response_field" class="element text small" type="text" /><div id="dummy_captcha_internal"></div>
EOT;
    } else {
        if ($element->captcha_type == 'r') {
            //if this is recaptcha
            $captcha_html = recaptcha_get_html(RECAPTCHA_PUBLIC_KEY, $error_code, $use_ssl);
            if ($captcha_html === false) {
                $domain = str_replace('www.', '', $_SERVER['SERVER_NAME']);
                $captcha_html = "<b>Error!</b> You have enabled CAPTCHA but no API key available. <br /><br />To use CAPTCHA you must get an API key from <a href='" . recaptcha_get_signup_url($domain, 'MachForm') . "'>http://recaptcha.net/api/getkey</a><br /><br />After getting the API key, save them into your <b>config.php</b> file.";
                $error_class = 'class="error"';
            }
            $recaptcha_theme = RECAPTCHA_THEME;
            $recaptcha_language = RECAPTCHA_LANGUAGE;
            $recaptcha_theme_init = <<<EOT
\t\t\t\t<script type="text/javascript">
\t\t\t\t var RecaptchaOptions = {
\t\t\t\t    theme : '{$recaptcha_theme}',
\t\t\t\t    lang: '{$recaptcha_language}'
\t\t\t\t };
\t\t\t\t</script>
EOT;
        } else {
            if ($element->captcha_type == 't') {
                //if this is simple text captcha
                $element->title = $mf_lang['captcha_simple_text_title'];
                $text_captcha = mf_get_text_captcha();
                $_SESSION['MF_TEXT_CAPTCHA_ANSWER'] = $text_captcha['answer'];
                $text_captcha_question = htmlspecialchars($text_captcha['question'], ENT_QUOTES);
                $captcha_html = <<<EOT
<span class="text_captcha">{$text_captcha_question}</span>
<input id="captcha_response_field" name="captcha_response_field" class="element text small" type="text" />
EOT;
            }
        }
    }
    $element_markup = <<<EOT
\t\t<li id="li_captcha" {$error_class}> {$recaptcha_theme_init}
\t\t<label class="description" for="captcha_response_field">{$element->title} {$span_required}</label>
\t\t<div>
\t\t\t{$captcha_html}\t
\t\t</div>\t 
\t\t{$guidelines} {$error_message}
\t\t</li>
EOT;
    return $element_markup;
}
예제 #12
0
 public function onSetupBuilding(SetupBuildingEvent $event)
 {
     $themes = array();
     foreach (glob("themes/*") as $theme_dirname) {
         $name = str_replace("themes/", "", $theme_dirname);
         $human = str_replace("_", " ", $name);
         $human = ucwords($human);
         $themes[$human] = $name;
     }
     if (isset($_SERVER["HTTP_HOST"])) {
         $host = $_SERVER["HTTP_HOST"];
     } else {
         $host = $_SERVER["SERVER_NAME"];
         if ($_SERVER["SERVER_PORT"] != "80") {
             $host .= ":" . $_SERVER["SERVER_PORT"];
         }
     }
     $full = (@$_SERVER["HTTPS"] ? "https://" : "http://") . $host . $_SERVER["PHP_SELF"];
     $test_url = str_replace("/index.php", "/nicetest", $full);
     $nicescript = "<script language='javascript'>\n\t\t\tfunction getHTTPObject() {\n\t\t\t\tif (window.XMLHttpRequest){\n\t\t\t\t\treturn new XMLHttpRequest();\n\t\t\t\t}\n\t\t\t\telse if(window.ActiveXObject){\n\t\t\t\t\treturn new ActiveXObject('Microsoft.XMLHTTP');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcheckbox = document.getElementById('nice_urls');\n\t\t\tout_span = document.getElementById('nicetest');\n\n\t\t\tcheckbox.disabled = true;\n\t\t\tout_span.innerHTML = '(testing...)';\n\n\t\t\t\$(document).ready(function() {\n\t\t\t\tvar http_request = getHTTPObject();\n\t\t\t\thttp_request.open('GET', '{$test_url}', false);\n\t\t\t\thttp_request.send(null);\n\n\t\t\t\tif(http_request.status == 200 && http_request.responseText == 'ok') {\n\t\t\t\t\tcheckbox.disabled = false;\n\t\t\t\t\tout_span.innerHTML = '(tested ok)';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcheckbox.disabled = true;\n\t\t\t\t\tout_span.innerHTML = '(test failed)';\n\t\t\t\t}\n\t\t\t});\n\t\t</script>";
     $sb = new SetupBlock("General");
     $sb->position = 0;
     $sb->add_text_option("title", "Site title: ");
     $sb->add_text_option("front_page", "<br>Front page: ");
     $sb->add_text_option("main_page", "<br>Main page: ");
     $sb->add_text_option("contact_link", "<br>Contact URL: ");
     $sb->add_choice_option("theme", $themes, "<br>Theme: ");
     //$sb->add_multichoice_option("testarray", array("a" => "b", "c" => "d"), "<br>Test Array: ");
     $sb->add_bool_option("nice_urls", "<br>Nice URLs: ");
     $sb->add_label("<span id='nicetest'>(Javascript inactive, can't test!)</span>{$nicescript}");
     $event->panel->add_block($sb);
     $sb = new SetupBlock("Remote API Integration");
     $sb->add_label("<a href='http://akismet.com/'>Akismet</a>");
     $sb->add_text_option("comment_wordpress_key", "<br>API key: ");
     $sb->add_label("<br>&nbsp;<br><a href='" . recaptcha_get_signup_url($_SERVER["HTTP_HOST"], "Shimmie") . "'>ReCAPTCHA</a>");
     $sb->add_text_option("api_recaptcha_privkey", "<br>Private key: ");
     $sb->add_text_option("api_recaptcha_pubkey", "<br>Public key: ");
     $event->panel->add_block($sb);
 }
예제 #13
0
function recaptcha_wp_options_subpanel()
{
    $optionarray_def = array('pubkey' => '', 'privkey' => '');
    add_option('plugin_recaptcha', $optionarray_def, 'reCAPTCHA Options');
    /* Check form submission and update options if no error occurred */
    if (isset($_POST['submit'])) {
        $optionarray_update = array('pubkey' => $_POST['recaptcha_opt_pubkey'], 'privkey' => $_POST['recaptcha_opt_privkey']);
        update_option('plugin_recaptcha', $optionarray_update);
    }
    /* Get options */
    $optionarray_def = get_option('plugin_recaptcha');
    ?>

<!-- ############################## BEGIN: ADMIN OPTIONS ################### -->
<div class="wrap">


	<h2>reCAPTCHA Options</h2>
	<p>reCAPTCHA asks commenters to read two words from a book. One of these words proves
	   that they are a human, not a computer. The other word is a word that a computer couldn't read.
	   Because the user is known to be a human, the reading of that word is probably correct. So you don't
	   get comment spam, and the world gets books digitized. Everybody wins! For details, visit
	   the <a href="http://recaptcha.net/">reCAPTCHA website</a>.</p>

	<form name="form1" method="post" style="margin: auto; width: 25em;" action="<?php 
    echo $_SERVER['PHP_SELF'] . '?page=' . plugin_basename(__FILE__);
    ?>
&updated=true">


	<!-- ****************** Operands ****************** -->
	<fieldset class="options">
		<legend>reCAPTCHA Key</legend>
		<p>
			reCAPTCHA requires an API key, consisting of a "public" and a "private" key. You can sign up for a
			
			<a href="<?php 
    echo recaptcha_get_signup_url(recaptcha_wp_blog_domain(), 'wordpress');
    ?>
" target="0">free reCAPTCHA key</a>.
		</p>
		<label style="font-weight:bold" for="recaptcha_opt_pubkey">Public Key:</label>
		<br />
		<input name="recaptcha_opt_pubkey" id="recaptcha_opt_pubkey" size="40" value="<?php 
    echo $optionarray_def['pubkey'];
    ?>
" />
		<label style="font-weight:bold" for="recaptcha_opt_privkey">Private Key:</label>
		<br />
		<input name="recaptcha_opt_privkey" id="recaptcha_opt_privkey" size="40" value="<?php 
    echo $optionarray_def['privkey'];
    ?>
" />

	</fieldset>


	<div class="submit">
		<input type="submit" name="submit" value="<?php 
    _e('Update Options');
    ?>
 &raquo;" />
	</div>

	</form>

	<p style="text-align: center; font-size: .85em;">&copy; Copyright 2007&nbsp;&nbsp;<a href="http://recaptcha.net">reCAPTCHA</a></p>

</div> <!-- [wrap] -->
<!-- ############################## END: ADMIN OPTIONS ##################### -->


<?php 
}
예제 #14
0
<?php

/***********************************
  Coppermine reCAPTCHA plugin v2.0
  **********************************
  By: SaWey - Updated by Joe Carver
  Date: 2010-11-10
**********************************************/
if (!defined('IN_COPPERMINE')) {
    die('Not in Coppermine...');
}
include_once 'plugins/recaptcha/recaptchalib.php';
require_once 'plugins/recaptcha/init.inc.php';
$superCage = Inspekt::makeSuperCage();
$url = recaptcha_get_signup_url($superCage->server->getRaw('HTTP_HOST'), 'Coppermine Photo Gallery');
$recaptcha_info = <<<EOT
<a href="{$url}" class="admin_menu">{$recap_lang['link_recaptcha']}</a>
EOT;
$name = $recap_lang['display_name'];
$configuration_link = '<a href="index.php?file=recaptcha/admin" class="admin_menu">' . $recaptcha_icon_array['configure'] . sprintf($recap_lang['configure_plugin_x'], $recap_lang['display_name']) . '</a> ';
$documentation_link = '<a href="plugins/recaptcha/docs/' . $documentation_file . '.htm" class="admin_menu">' . $recaptcha_icon_array['documentation'] . $recap_lang['plugin_documentation'] . '</a> ';
$announcement_thread = '<a href="http://forum.coppermine-gallery.net/index.php/topic,57439.html" class="admin_menu">' . $recaptcha_icon_array['announcement'] . $recap_lang['announcement_thread'] . '</a>';
$extra_info = $configuration_link . $announcement_thread . $documentation_link;
$install_info = $documentation_link . $announcement_thread . $recaptcha_info;
$author = <<<EOT
    <a href="http://forum.coppermine-gallery.net/index.php?action=profile;u=40798">Sander Weyens aka SaWey.</a> Updated by <a href="http://forum.coppermine-gallery.net/index.php?action=profile;u=65237">Joe Carver aka i-imagine.</a>
EOT;
$version = '2.0';
$plugin_cpg_version = array('min' => '1.5');
$description = $recap_lang['description'];
예제 #15
0
      <?php 
settings_fields('recaptcha_options_group');
?>

      <h3><?php 
_e('Authentication', 'recaptcha');
?>
</h3>
      <p><?php 
_e('These keys are required before you are able to do anything else.', 'recaptcha');
?>
 <?php 
_e('You can get the keys', 'recaptcha');
?>
 <a href="<?php 
echo recaptcha_get_signup_url($this->blog_domain(), 'wordpress');
?>
" title="<?php 
_e('Get your reCAPTCHA API Keys', 'recaptcha');
?>
"><?php 
_e('here', 'recaptcha');
?>
</a>.</p>
      <p><?php 
_e('Be sure not to mix them up! The public and private keys are not interchangeable!');
?>
</p>
      
      <table class="form-table">
         <tr valign="top">
예제 #16
0
    <input type="hidden" name="dekoboko_action" value="update_options">
    <table border="0" cellspacing="3" cellpadding="3" class="form-table">
    <tr valign="top">
    <td nowrap="nowrap"><?php 
_e("reCAPTCHA public key:", DEKOBOKO_L10N_NAME);
?>
</td>
    <td nowrap="nowrap"><input type="text" name="recaptcha[pubkey]" value="<?php 
echo $recaptcha_options['pubkey'];
?>
" size="40" /></td>
    <td rowspan="2"><strong>&laquo;</strong> <?php 
_e("If you are already using the WP-reCAPTCHA plugin for comments, Deko Boko will use the API key you've already set. If you are not using the WP-reCAPTCHA plugin, then you need to get a", DEKOBOKO_L10N_NAME);
?>
    <a href="<?php 
echo recaptcha_get_signup_url($site_url['host'], 'wordpress');
?>
" target="_blank"><?php 
_e('free reCAPTCHA API key for your site', DEKOBOKO_L10N_NAME);
?>
</a> <?php 
_e('and enter the public and private keys here.', DEKOBOKO_L10N_NAME);
?>
</td>
    </tr>

    <tr valign="top">
    <td nowrap="nowrap"><?php 
_e("reCAPTCHA private key:", DEKOBOKO_L10N_NAME);
?>
</td>
예제 #17
0
 /**
  * Administrative Functions for ReCaptcha
  */
 public function get_apikey()
 {
     return recaptcha_get_signup_url();
 }