Example #1
0
 function callback()
 {
     $this->_Authentication();
     $email = $_data['email'] = $this->email;
     $userData = $this->User_model->getWhere(array('email' => $email), 1);
     //print"<pre>";var_dump($userData);print"</pre>";
     //if(empty($this->getUserId())){
     if (empty($this->user_id)) {
         if (empty($this->subdomain)) {
             $notRegisteredOwner = TRUE;
         } else {
             $notRegisteredMember = TRUE;
         }
         $_data['ask_name'] = TRUE;
     } else {
         if (empty($this->subdomain)) {
             //checking if user is the owner
             $siteData = $this->Site_model->getWhere(array('owner_id' => $this->getUserId()), 1);
             if (empty($siteData)) {
                 $notRegisteredOwner = TRUE;
             } else {
                 $registeredOwner = TRUE;
             }
         } else {
             //checking if user is the member of site
             $siteData = $this->Site_model->getWhere(array('subdomain' => $this->subdomain), 1);
             $_data['subdomain_id'] = $siteData[0]['id'];
             $isMember = $this->User_is_member_of_site_model->getWhere(array('user_id' => $this->getUserId(), 'site_id' => $siteData[0]['id']), 1);
             if (empty($isMember)) {
                 $notRegisteredMember = TRUE;
             }
         }
     }
     $_data['site_name'] = $this->site_name;
     $_data['firstname'] = '';
     $_data['lastname'] = '';
     if (!empty($notRegisteredOwner)) {
         //not registered owner
         $_data['captcha'] = recaptcha_get_html($this->recaptcha_publickey);
         $_data['site_url'] = '';
         $this->load->view('owner_registration', $_data);
     } elseif (!empty($notRegisteredMember)) {
         $this->load->view('member_registration', $_data);
     } elseif (!empty($this->subdomain)) {
         if ($isMember[0]['member_y_n']) {
             //member approved
             redirect('http://' . $_SERVER['HTTP_HOST'] . '/member/');
         } else {
             //member not approed
             //print "You have not been approved yet.";
             $this->load->view('member_not_approved');
         }
     } elseif (!empty($registeredOwner)) {
         // redirecting owner to his subdomain
         //redirect( 'http://' . $siteData[0]['subdomain'] . '.'.$this->conf['site_name'].'/member/');
         $_data['captcha'] = recaptcha_get_html($this->recaptcha_publickey);
         $_data['site_url'] = '';
         $this->load->view('owner_registration', $_data);
     }
 }
    /**
     * @return string
     */
    public function render()
    {
        global $Campsite;

        $publicKey = $this->getPublicKey();
        return recaptcha_get_html(htmlspecialchars($publicKey), NULL, $Campsite['SSL_SITE']);
    }
 /**
  * Displays the reCAPTCHA widget.
  * If $this->recaptcha_error is set, it will display an error in the widget.
  *
  */
 function getForm()
 {
     global $wgReCaptchaPublicKey, $wgReCaptchaTheme;
     $useHttps = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on';
     $js = 'var RecaptchaOptions = ' . Xml::encodeJsVar(array('theme' => $wgReCaptchaTheme, 'tabindex' => 1));
     return Html::inlineScript($js) . recaptcha_get_html($wgReCaptchaPublicKey, $this->recaptcha_error, $useHttps);
 }
 protected function action()
 {
     if (!TAKEDOWN_TOOL) {
         throw new Exception(__METHOD__ . ' TAKEDOWN TOOL is not enabled!');
     }
     $view_data = ['recaptcha' => recaptcha_get_html(RECAPTCHA_PUBLIC_KEY, null, true), 'links' => $this->request->getPostVar('links'), 'reporter_id' => $this->request->getPostVar('reporter_id')];
     if (!is_null($this->request->getPostVar('links'))) {
         if (recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, $this->request->getServerVar('REMOTE_ADDR'), $this->request->getPostVar('recaptcha_challenge_field'), $this->request->getPostVar('recaptcha_response_field'))->is_valid) {
             if ($reporter_data = $this->_isValidReporterId($this->request->getPostVar('reporter_id'))) {
                 $links_to_be_removed = $this->_genRemoveLinkList($this->request->getPostVar('links'));
                 if (!empty($links_to_be_removed)) {
                     $this->_removeLinks($links_to_be_removed, $reporter_data);
                     $view_data = ['recaptcha' => recaptcha_get_html(RECAPTCHA_PUBLIC_KEY, null, true), 'tot_removed_links' => count($links_to_be_removed)];
                 } else {
                     $view_data['error'] = 'No valid URLs to remove!';
                 }
             } else {
                 $view_data['error'] = 'Your reporter ID is not valid!';
             }
         } else {
             $view_data['error'] = 'Captcha code was not valid!';
         }
     }
     $this->setViewData($view_data);
 }
    /**
     * What to display in form
     * 
     * @access public
     * @return String
     */
    function form($args, $options)
    {
        extract($args);
        $output = "";
        if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
            $use_ssl = true;
        } else {
            $use_ssl = false;
        }
        if (!function_exists('recaptcha_get_html')) {
            @(require_once TDOMF_RECAPTCHALIB_PATH);
        }
        $output .= <<<END
\t\t<script type='text/javascript'>
\t\tvar RecaptchaOptions = { theme : '{$options['theme']}', lang : '{$options['language']}' , tabindex : 30 };
\t\t</script>
END;
        $form_data = tdomf_get_form_data($args['tdomf_form_id']);
        $error = null;
        if (isset($form_data['recaptcha_error'])) {
            $error = $form_data['recaptcha_error'];
        }
        $output .= recaptcha_get_html($options['publickey'], $error, $use_ssl, $options['xhtml']);
        return $output;
    }
Example #6
0
 /**
  * XoopsCaptchaRecaptcha::render()
  *
  * @return string
  */
 function render()
 {
     require_once dirname(__FILE__) . '/recaptcha/recaptchalib.php';
     $form = "<script type=\"text/javascript\">\n            var RecaptchaOptions = {\n            theme : '" . $this->config['theme'] . "',\n            lang : '" . $this->config['lang'] . "'\n            };\n            </script>";
     $form .= recaptcha_get_html($this->config['public_key']);
     return $form;
 }
Example #7
0
 /**
  * Load reCAPTCHA
  *
  * @access private
  * @param string $error
  * @param bool   $ssl
  * @param string $theme
  * @return string
  */
 function load($error, $ssl = FALSE)
 {
     $recaptcha_public_key = $this->CI->config->item('recaptcha_public_key');
     $captcha = '<script type="text/javascript">var RecaptchaOptions = { theme : "' . $this->CI->config->item('recaptcha_theme') . '" };</script>';
     $captcha .= recaptcha_get_html($recaptcha_public_key, $error, $ssl);
     return $captcha;
 }
Example #8
0
function signup_user_recaptcha($errors)
{
    require WPMU_PLUGIN_DIR . '/wpmu_recaptcha_signup/recaptchalib.php';
    $error = $errors->get_error_message('recaptcha');
    $publickey = "6LfsGAkAAAAAAAjzKmnvmCMaSlR1aIcQUtK9bA6w";
    echo recaptcha_get_html($publickey);
}
 public function customDisplay()
 {
     // themes : custom <----
     $display = "<script type='text/javascript'>\r\n\t\t\t\t\t\t\t\tvar RecaptchaOptions = {\r\n\t\t\t\t\t\t\t\t    theme : 'custom',\r\n\t\t\t\t\t\t\t\t\tcustom_theme_widget : 'recaptcha_widget'\r\n\t\t\t\t\t\t\t\t };\r\n\t\t\t\t\t\t\t </script>";
     $display .= recaptcha_get_html($this->_publicKey);
     return $display;
 }
Example #10
0
    /**
     * Affichage du captcha côté public
     *
     * @param object $okt
     * @param string $sCaptchaId
     */
    public static function publicTplFormBottom($okt, $sCaptchaId)
    {
        if ($sCaptchaId == 'recaptcha') {
            $aAcceptedLanguages = array('en', 'nl', 'fr', 'de', 'pt', 'ru', 'es', 'tr');
            if (in_array($okt->user->language, $aAcceptedLanguages)) {
                $sLanguage = $okt->user->language;
            } elseif (in_array($okt->config->language, $aAcceptedLanguages)) {
                $sLanguage = $okt->config->language;
            } else {
                $sLanguage = 'en';
            }
            echo '<script type="text/javascript">
			//<![CDATA[

			var RecaptchaOptions = {
				theme: "' . $okt->recaptcha->config->theme . '",
				lang: "' . $sLanguage . '"
			};

			//]]>
			</script>';
            require_once __DIR__ . '/recaptcha-php-1.11/recaptchalib.php';
            echo recaptcha_get_html(html::escapeHTML($okt->recaptcha->config->publickey));
        }
    }
 private function contact()
 {
     $isSent = Request::get(0, VAR_URI) == 'send';
     $options = array('name' => array(Validator::MESSAGE => 'Der Name muss mindestens 5 und darf maximal 150 Zeichen lang sein.', Validator::MIN_LENGTH => 5, Validator::MAX_LENGTH => 150), 'email' => array(Validator::MESSAGE => 'Die E-Mail-Adresse ist nicht korrekt.', Validator::CALLBACK => Validator::CB_MAIL), 'message' => array(Validator::MESSAGE => 'Die Nachricht entspricht nicht den Vorgaben (mindestens 10 Zeichen, maximal 1000 Zeichen).', Validator::MIN_LENGTH => 10, Validator::MAX_LENGTH => 1000), 'title' => array(Validator::MESSAGE => 'Der Titel entspricht nicht den Vorgaben (mindestens 5 Zeichen, maximal 100 Zeichen).', Validator::MIN_LENGTH => 5, Validator::MAX_LENGTH => 100));
     $this->enableClientFormValidation($options);
     // Don't validate the captcha via ajax as the session would end
     if (Config::get('captcha.enable')) {
         Core::loadClass('Core.Security.ReCaptcha');
         $options['recaptcha_response_field'] = array(Validator::MESSAGE => 'Der Sicherheitscode wurde nicht korrekt eingegeben.', Validator::CALLBACK => 'cb_captcha_check');
     }
     $data = array_fill_keys(array_keys($options), '');
     $data['name'] = iif(Me::get()->loggedIn(), Me::get()->getName());
     $data['email'] = iif(Me::get()->loggedIn(), Me::get()->getEmail());
     $this->breadcrumb->add('Kontakt');
     $this->header();
     if ($isSent) {
         extract(Validator::checkRequest($options));
         if (count($error) > 0) {
             CmsPage::error($error);
         } else {
             CmsTools::sendMail(Config::get('general.email'), $data['title'], $data['message'], $data['email'], $data['name']);
             CmsPage::ok('Die Anfrage wurde erfolgreich verschickt. Vielen Dank!');
             $data['title'] = '';
             $data['message'] = '';
         }
     }
     $tpl = Response::getObject()->appendTemplate('Cms/contact/contact');
     $tpl->assign('data', $data);
     if (Config::get('captcha.enable')) {
         $tpl->assign('captcha', recaptcha_get_html(Config::get('captcha.public_key')), false);
     }
     $tpl->output();
     $this->footer();
 }
    /**
     * Creates a reCAPTCHA to combat SPAM as well as the necessary post processing validation rules.
     * Additional parameters include "recaptcha_public_key", "recaptcha_private_key" and "<a href="https://developers.google.com/recaptcha/docs/customization" target="_blank">theme</a>":
     *
     * <a href="https://developers.google.com/recaptcha/" target="_blank">https://developers.google.com/recaptcha/</a>
     * 
     * @access	public
     * @param 	array  	An array of parameters to pass to the field type
     * @return	string
     */
    public function recaptcha($params = array())
    {
        $form_builder =& $params['instance'];
        if (empty($params['recaptcha_public_key'])) {
            $params['recaptcha_public_key'] = $this->fuel->forms->config('recaptcha_public_key');
        }
        if (empty($params['recaptcha_private_key'])) {
            $params['recaptcha_private_key'] = $this->fuel->forms->config('recaptcha_private_key');
        }
        $defaults = array('theme' => 'clean', 'error_message' => 'Please enter in a valid captcha value');
        $params = $this->set_defaults($defaults, $params);
        if (isset($_POST["recaptcha_response_field"])) {
            $_POST[$params['key']] = $_POST["recaptcha_response_field"];
        }
        $params['type'] = 'none';
        $func_str = '$CI =& get_instance();
        	$validator =& $CI->form_builder->get_validator();
        	$validator->add_rule("recaptcha_response_field", "required", "' . $params['error_message'] . '", array("' . $this->CI->input->post('recaptcha_response_field') . '"));
			$validator->add_rule("recaptcha_response_field", "validate_recaptcha", "' . $params['error_message'] . '", array("' . $params['recaptcha_private_key'] . '"));
			';
        $func = create_function('$value', $func_str);
        $form_builder->set_post_process($params['key'], $func);
        $str = '<script>
             var RecaptchaOptions = {
                theme : \'' . $params['theme'] . '\'
             };
        </script>
        ';
        $str .= recaptcha_get_html($params['recaptcha_public_key']);
        return $str;
    }
Example #13
0
function reCAPTCHA($title, $desc)
{
    global $key, $FROM1, $mail, $subject, $MESSAGE, $c_pass;
    require_once './recaptchalib.php';
    $publickey = "";
    // you got this from the signup page
    $privatekey = "";
    // (same as above)
    $error = '';
    if ($_POST["recaptcha_response_field"]) {
        $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
        if ($resp->is_valid) {
            return true;
        } else {
            $error = $resp->error;
        }
    }
    echo '<html><head><title>' . $title . '</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<body>' . $desc . '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="key" value="' . $key . '"><input type="hidden" name="nick" value="' . $FROM1 . '"><input type="hidden" name="mail" value="' . $mail . '"><br>
<input type="hidden" name="subject" value="' . $subject . '">
<input type="hidden" name="content" value="' . $MESSAGE . '"><input type="hidden" name="url" value="">
<input type="hidden" name="delk" value="' . $c_pass . '">';
    echo recaptcha_get_html($publickey, $error);
    echo '<input type="submit" value="確認">
</form>
</body></html>';
    return false;
}
Example #14
0
	public function GetRecaptchaHTML() {
		$this->iErrorMessage = "";

		require_once(TP_SOURCEPATH . '/recaptcha/recaptchalib.php');
		$publickey = RECAPTCHA_PUBLIC; // you got this from the signup page
		return recaptcha_get_html($publickey);
	}
Example #15
0
 public function view()
 {
     // global public key of ThinPHP subscription from reCAPTCHA. You can use this.
     $publickey = "6LfUVcISAAAAAKjd1Mf0XiDTGaa2cjd9DT3uur9X";
     $customScript = "<script type=\"text/javascript\">var RecaptchaOptions = { theme : 'clean' };</script>";
     echo $customScript . recaptcha_get_html($publickey);
 }
 /**
  * Display the submission form with the captcha injected into it
  */
 public function display_captcha()
 {
     global $wgOut;
     $publicKey = $this->gateway_adapter->getGlobal('RecaptchaPublicKey');
     $useSSL = $this->gateway_adapter->getGlobal('RecaptchaUseSSL');
     // log that a captcha's been triggered
     $this->log($this->gateway_adapter->getData_Unstaged_Escaped('contribution_tracking_id'), 'Captcha triggered');
     // construct the HTML used to display the captcha
     $captcha_html = Xml::openElement('div', array('id' => 'mw-donate-captcha'));
     $captcha_html .= recaptcha_get_html($publicKey, $this->recap_err, $useSSL);
     $captcha_html .= '<span class="creditcard-error-msg">' . wfMsg($this->gateway_adapter->getIdentifier() . '_gateway-error-msg-captcha-please') . '</span>';
     $captcha_html .= Xml::closeElement('div');
     // close div#mw-donate-captcha
     // load up the form class
     $form_class = $this->gateway_adapter->getFormClass();
     //TODO: use setValidationErrors and getValidationErrors everywhere, and
     //refactor all the form constructors one more time. Eventually.
     $data = $this->gateway_adapter->getData_Unstaged_Escaped();
     $errors = $this->gateway_adapter->getValidationErrors();
     $form_obj = new $form_class($this->gateway_adapter, $errors);
     // set the captcha HTML to use in the form
     $form_obj->setCaptchaHTML($captcha_html);
     // output the form
     $wgOut->addHTML($form_obj->getForm());
 }
 public function conta_click($url, $captcha)
 {
     global $db_host, $db_user, $db_pass, $db_name;
     $this->Open($db_host, $db_user, $db_pass, $db_name);
     if (@$_POST['send'] == 1) {
         //Anti Flood
         $privatekey = "6Lc7yMASAAAAANiJ4_F-BbnxvC3hUlxdAT85PCUE";
         $userip = $_SERVER["REMOTE_ADDR"];
         $reCAPTCHA_f = $_POST["recaptcha_challenge_field"];
         $reCAPTCHA_r = $_POST["recaptcha_response_field"];
         $resp = recaptcha_check_answer($privatekey, $userip, $reCAPTCHA_f, $reCAPTCHA_r);
         if (!$resp->is_valid) {
             die("<br /><br /><center>Errore! Captcha Inserito non corretto!\n<br />Errore reCaptcha: " . $resp->error . "<br />\n<a href=\"index.php?page=visita&go_url=" . @$_GET['go_url'] . "\">Riprova</a></center>");
         }
         //Hijacking control - Thanks gabry9191 for the bug
         $this->check_url($this->mysql_parse($url));
         $url = $this->mysql_parse($url);
         $num_click = $this->Query("SELECT `num_click` FROM page_rank_hack WHERE site = '{$url}'");
         $row = mysql_fetch_row($num_click);
         $app = $row[0] + 1;
         $sql = $this->Query("UPDATE `page_rank_hack` SET num_click = '{$app}' WHERE site = '{$url}'");
         die(header('Location: ' . $url));
     } else {
         $publickey = "6Lc7yMASAAAAAPYmegj3CxwkLJlg3demRNHEzsUd";
         print "\n<center>" . "\n<h2 align=\"center\">Captcha Security (Anti-Flood)</h2><br /><br />\n" . "\n<form method=\"POST\" action=\"index.php?page=visita&go_url=" . htmlspecialchars($_GET['go_url']) . "\" />" . "\n";
         print recaptcha_get_html($publickey);
         print "<br />" . "\n<input type=\"hidden\" name=\"send\" value=\"1\" />" . "\n<input type=\"submit\" value=\"Visita\" />" . "\n</form>" . "\n</center>" . "";
     }
 }
Example #18
0
    /**
     * A block that is inserted into the "before_submit_button" slot in QuickForms.
     * If the use is not logged in, this displays the recaptcha image just before the 
     * submit button.
     *
     * @return void
     */
    function block__before_submit_button()
    {
        if (class_exists('Dataface_AuthenticationTool')) {
            $auth =& Dataface_AuthenticationTool::getInstance();
            $user =& $auth->getLoggedInUser();
            if ($user) {
                return null;
            }
        }
        if ($this->fieldAdded) {
            return;
        }
        require_once dirname(__FILE__) . '/recaptcha-php/recaptchalib.php';
        $app =& Dataface_Application::getInstance();
        if (!isset($app->_conf['reCAPTCHA']) or !isset($app->_conf['reCAPTCHA']['public_key'])) {
            trigger_error('No public key set for reCAPTCHA.  You need to add a section to your conf.ini file as follows:<br/>
[reCAPTCHA]
    public_key=xxxxxx
    private_key=xxxxxx
    ', E_USER_ERROR);
        }
        $public_key = $app->_conf['reCAPTCHA']['public_key'];
        //echo $public_key; echo "here";exit;
        echo '<div>' . recaptcha_get_html($public_key) . '</div>';
        $this->fieldAdded = true;
    }
 /**
  * Display the form.
  * @param $request PKPRequest
  */
 function display($request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $site = $request->getSite();
     $templateMgr->assign('minPasswordLength', $site->getMinPasswordLength());
     $context = $request->getContext();
     if ($this->captchaEnabled) {
         import('lib.pkp.lib.recaptcha.recaptchalib');
         $publicKey = Config::getVar('captcha', 'recaptcha_public_key');
         $useSSL = Config::getVar('security', 'force_ssl') ? true : false;
         $reCaptchaHtml = recaptcha_get_html($publicKey, null, $useSSL);
         $templateMgr->assign('reCaptchaHtml', $reCaptchaHtml);
         $templateMgr->assign('captchaEnabled', true);
     }
     $templateMgr->assign('privacyStatement', $context->getLocalizedSetting('privacyStatement'));
     $countryDao = DAORegistry::getDAO('CountryDAO');
     $countries = $countryDao->getCountries();
     $templateMgr->assign('countries', $countries);
     $userDao = DAORegistry::getDAO('UserDAO');
     $templateMgr->assign('genderOptions', $userDao->getGenderOptions());
     $site = $request->getSite();
     $templateMgr->assign('availableLocales', $site->getSupportedLocaleNames());
     import('lib.pkp.classes.user.form.UserFormHelper');
     $userFormHelper = new UserFormHelper();
     $userFormHelper->assignRoleContent($templateMgr, $request);
     $templateMgr->assign('source', $request->getUserVar('source'));
     parent::display($request);
 }
function form()
{
    ?>
				<form method="post" action="faucet.php">
					<fieldset>
						<table style="float:center!improtant; text-align:center!important; margin-left:auto!important;margin-right:auto!important;">
							<tr><legend>Request Payment</legend></tr>
							<tr><td>					
							<?php 
    require_once 'recaptchalib.php';
    $publickey = RECAPTCHAPUBLICKEY;
    // you got this from the signup page
    echo recaptcha_get_html($publickey);
    ?>
</tr></td>
							<tr><td>
								<label for="email">Bitcoin address:</label>
								<input type="text" name="address" id="address" size="32" maxlength="128">
							</tr></td>
							<tr><td>
									<input type="submit" name="submit" id="submit" value="Submit" >
							</tr></td>
						</table>
					</fieldset>	
				 </form>
				<?php 
}
Example #21
0
function faucet_get_captcha($SETTINGS)
{
    if ($SETTINGS->get("use_captcha")) {
        //Settings to pass to captcha functions
        $captcha_config = array();
        //Load Captcha HTML
        if ($SETTINGS->get("captcha") == "simple-captcha") {
            //Load simple captcha library
            $simplecaptcha = './libraries/simple-captcha/simple-php-captcha.php';
            require_once $simplecaptcha;
            $captcha_config['session_name'] = $SETTINGS->config["captcha_config"]["simple_captcha_session_name"];
            @session_name($captcha_config['session_name']);
            @session_start();
            $_SESSION['captcha'] = simple_php_captcha($captcha_config);
            // set a new CAPTCHA
            return isset($_SESSION['captcha']) ? '<img src="' . $simplecaptcha . $_SESSION['captcha']["image_request"] . '" alt="[captcha]"/>' : '';
        } elseif ($SETTINGS->get("captcha") == "solvemedia") {
            //Load solvemedia library
            require_once './libraries/solvemedialib.php';
            $captcha_config['solvemedia_challenge_key'] = $SETTINGS->config["captcha_config"]["solvemedia_challenge_key"];
            return solvemedia_get_html($captcha_config["solvemedia_challenge_key"]);
        } elseif ($SETTINGS->get("captcha") == "recaptcha") {
            //Load re-captcha library
            require_once './libraries/recaptchalib.php';
            $captcha_config['recpatcha_public_key'] = $SETTINGS->config["captcha_config"]["recpatcha_public_key"];
            return recaptcha_get_html($captcha_config["recpatcha_public_key"]);
        }
    } else {
        return '';
        //Emtpy
    }
}
 public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '')
 {
     $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix);
     require_once 'vendor/koala-framework/recaptcha-php/recaptchalib.php';
     $ret['html'] = "<div data-fieldname=\"" . $this->getFieldName() . $fieldNamePostfix . "\">" . recaptcha_get_html(Kwf_Config::getValue('recaptcha.publicKey')) . "</div>";
     return $ret;
 }
Example #23
0
 private function showRecaptcha()
 {
     Log::Debug('CaptchaControl using Recaptcha');
     require_once ROOT_DIR . 'lib/external/recaptcha/recaptchalib.php';
     $response = recaptcha_get_html(Configuration::Instance()->GetSectionKey(ConfigSection::RECAPTCHA, ConfigKeys::RECAPTCHA_PUBLIC_KEY));
     echo $response;
 }
 /**
  * Display the form.
  */
 function display(&$request)
 {
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('new', true);
     if ($this->captchaEnabled && $this->recaptchaEnabled) {
         import('lib.pkp.lib.recaptcha.recaptchalib');
         $publicKey = Config::getVar('captcha', 'recaptcha_public_key');
         $useSSL = Config::getVar('security', 'force_ssl') ? true : false;
         $reCaptchaHtml = recaptcha_get_html($publicKey, null, $useSSL);
         $templateMgr->assign('reCaptchaHtml', $reCaptchaHtml);
         $templateMgr->assign('captchaEnabled', true);
     } elseif ($this->captchaEnabled) {
         import('lib.pkp.classes.captcha.CaptchaManager');
         $captchaManager = new CaptchaManager();
         $captcha =& $captchaManager->createCaptcha();
         if ($captcha) {
             $templateMgr->assign('captchaEnabled', $this->captchaEnabled);
             $this->setData('captchaId', $captcha->getId());
         }
     }
     $context =& $request->getContext();
     if ($context) {
         $templateMgr->assign('allowRegReviewer', $context->getSetting('allowRegReviewer'));
         $templateMgr->assign('allowRegAuthor', $context->getSetting('allowRegAuthor'));
     }
     return parent::display();
 }
 function modify(&$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     switch ($operatorName) {
         case 'recaptcha_get_html':
             include_once 'extension/recaptcha/classes/recaptchalib.php';
             // Retrieve the reCAPTCHA public key from the ini file
             $ini = eZINI::instance('recaptcha.ini');
             $key = $ini->variable('Keys', 'PublicKey');
             if (is_array($key)) {
                 $hostname = eZSys::hostname();
                 if (isset($key[$hostname])) {
                     $key = $key[$hostname];
                 } else {
                     // try our luck with the first entry
                     $key = array_shift($key);
                 }
             }
             // check if the current user is able to bypass filling in the captcha and
             // return nothing so that no captcha is displayed
             $currentUser = eZUser::currentUser();
             $accessAllowed = $currentUser->hasAccessTo('recaptcha', 'bypass_captcha');
             if ($accessAllowed["accessWord"] == 'yes') {
                 $operatorValue = 'User bypasses CAPTCHA';
             } else {
                 // Run the HTML generation code from the reCAPTCHA PHP library
                 $operatorValue = recaptcha_get_html($key);
             }
             break;
     }
 }
Example #26
0
    function GetCommentForm()
    {
        $reCAPTCHA = recaptcha_get_html(RECAPTCHA_PUBLIC_KEY);
        return <<<EOHTML
<form action="/comment.php" method="post" id="commentform">
<h1>Lausu oma mõtteid</h1>
<p class="input">Nimi: <input type="text" name="name" value="{$this->mForm[name]}" /></p>
<p class="input">Koduleht: <input type="text" name="homepage" value="{$this->mForm[homepage]}" /></p>
<p class="input">e-post: <input type="text" name="email" value="{$this->mForm[email]}" /></p>
<p>Lubatud HTML: <code>&lt;a href="" rel="" title=""&gt;, &lt;strong&gt;,
&lt;em&gt;, &lt;code&gt;, &lt;blockquote cite=""&gt;,
&lt;abbr title=""&gt; ja &lt;acronym title=""&gt;</code>.
Reavahetused ja lõigud lisatakse automaatselt.</p>
<p>Kindlasti tuleks määrata oma nimi.
Kodulehe ja e-posti
aadress on valikulised, kusjuures e-posti aadressi
lehele üles ei panda - see on vaid selleks, kui te
kohe mitte ilma selle lisamiseta ei saa.
</p>
<p><textarea rows="20" cols="50" name="comment">{$this->mForm[comment]}</textarea></p>
<p>Et võidelda spämmiga, tõesta, et oled inimene
  <span lang="en">(to fight spam, prove that you are human being)</span>:</p>
{$reCAPTCHA}
<p><input type="submit" name="submit" value="Ütle!" />
<input type="submit" name="submit" value="Eelvaade" />
<input type="hidden" name="id" value="{$this->mArticleId}" /></p>
</form>

EOHTML;
    }
Example #27
0
 public function showRecaptcha($key = null, $error = null, $check = false)
 {
     if ($this->config['reCAPTCHA_enabled']) {
         if ($key == null) {
             $key = $this->config['reCAPTCHA_publickey'];
         }
         if ($error == null) {
             $error = $this->captcha_error;
         }
         ## Initiate the reCaptcha ##
         require_once SYSTEM_PATH . '/recaptcha/recaptchalib.php';
         if (!$check) {
             return '<div id="recaptcha">' . recaptcha_get_html($key, $error) . '</div>';
         }
         if (isset($_POST['recaptcha_response_field'])) {
             $captcha_resp = recaptcha_check_answer($this->config['reCAPTCHA_privatekey'], $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
             if (!$captcha_resp->is_valid) {
                 //$captcha_error = $captcha_resp->error; //Just in case of debugging
                 $status = false;
             } else {
                 $status = true;
             }
             $this->captcha_success = $status;
         }
     } else {
         $this->captcha_success = true;
     }
 }
 /**
  * Method which handle action of displaying contact form
  */
 public function indexAction()
 {
     $this->loadLayout();
     $this->getLayout()->getBlock('contactForm')->setFormAction(Mage::getUrl('*/*/post'));
     if (Mage::getStoreConfigFlag(self::XML_PATH_CFC_ENABLED)) {
         //include reCaptcha library
         require_once Mage::getBaseDir('lib') . DS . 'reCaptcha' . DS . 'recaptchalib.php';
         //create captcha html-code
         $publickey = Mage::getStoreConfig(self::XML_PATH_CFC_PUBLIC_KEY);
         $captcha_code = recaptcha_get_html($publickey);
         //get reCaptcha theme name
         $theme = Mage::getStoreConfig(self::XML_PATH_CFC_THEME);
         if (strlen($theme) == 0 || !in_array($theme, array('red', 'white', 'blackglass', 'clean'))) {
             $theme = 'red';
         }
         //get reCaptcha lang name
         $lang = Mage::getStoreConfig(self::XML_PATH_CFC_LANG);
         if (strlen($lang) == 0 || !in_array($lang, array('en', 'nl', 'fr', 'de', 'pt', 'ru', 'es', 'tr'))) {
             $lang = 'en';
         }
         //small hack for language feature - because it's not working as described in documentation
         $captcha_code = str_replace('?k=', '?hl=' . $lang . '&amp;k=', $captcha_code);
         $this->getLayout()->getBlock('contactForm')->setCaptchaCode($captcha_code)->setCaptchaTheme($theme)->setCaptchaLang($lang);
     }
     $this->_initLayoutMessages('customer/session');
     $this->_initLayoutMessages('catalog/session');
     $this->renderLayout();
 }
Example #29
0
 /**
  * Return the html of a recaptcha area for use in a  <form>
  * @static
  * @return string
  */
 static function GetForm()
 {
     global $config, $dataDir;
     $html = '';
     if (gp_recaptcha::hasRecaptcha()) {
         includeFile('thirdparty/recaptchalib.php');
         $themes = array('red', 'white', 'blackglass', 'clean');
         $theme = 'clean';
         $lang = $config['recaptcha_language'];
         if ($lang == 'inherit') {
             $lang = $config['language'];
         }
         $recaptchaLangs['en'] = true;
         $recaptchaLangs['nl'] = true;
         $recaptchaLangs['fr'] = true;
         $recaptchaLangs['de'] = true;
         $recaptchaLangs['pt'] = true;
         $recaptchaLangs['ru'] = true;
         $recaptchaLangs['es'] = true;
         $recaptchaLangs['tr'] = true;
         if (isset($recaptchaLangs[$lang])) {
             $html .= '<script type="text/javascript">var RecaptchaOptions = { lang : "' . $lang . '", theme:"' . $theme . '" };</script>';
         }
         $html .= recaptcha_get_html($config['recaptcha_public']);
     }
     return gpPlugin::Filter('AntiSpam_Form', array($html));
 }
Example #30
0
 /**
  * Display the form.
  */
 function display()
 {
     $templateMgr =& TemplateManager::getManager();
     $site =& Request::getSite();
     $templateMgr->assign('minPasswordLength', $site->getMinPasswordLength());
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     if ($this->captchaEnabled) {
         import('lib.pkp.lib.recaptcha.recaptchalib');
         $publicKey = Config::getVar('captcha', 'recaptcha_public_key');
         $useSSL = Config::getVar('security', 'force_ssl') ? true : false;
         $reCaptchaHtml = recaptcha_get_html($publicKey, null, $useSSL);
         $templateMgr->assign('reCaptchaHtml', $reCaptchaHtml);
         $templateMgr->assign('captchaEnabled', true);
     }
     $countryDao = DAORegistry::getDAO('CountryDAO');
     $countries =& $countryDao->getCountries();
     $templateMgr->assign_by_ref('countries', $countries);
     import('classes.schedConf.SchedConfAction');
     $userDao = DAORegistry::getDAO('UserDAO');
     $templateMgr->assign('genderOptions', $userDao->getGenderOptions());
     $templateMgr->assign('privacyStatement', $conference->getLocalizedSetting('privacyStatement'));
     $templateMgr->assign('enableOpenAccessNotification', $schedConf->getSetting('enableOpenAccessNotification') == 1 ? 1 : 0);
     $templateMgr->assign('allowRegReader', SchedConfAction::allowRegReader($schedConf));
     $templateMgr->assign('allowRegAuthor', SchedConfAction::allowRegAuthor($schedConf));
     $templateMgr->assign('allowRegReviewer', SchedConfAction::allowRegReviewer($schedConf));
     $templateMgr->assign('source', Request::getUserVar('source'));
     $templateMgr->assign('pageHierarchy', array(array(Request::url(null, 'index', 'index'), $conference->getLocalizedName(), true), array(Request::url(null, null, 'index'), $schedConf->getLocalizedName(), true)));
     $site =& Request::getSite();
     $templateMgr->assign('availableLocales', $site->getSupportedLocaleNames());
     $templateMgr->assign('helpTopicId', 'conference.users.index');
     parent::display();
 }