public function addAction() { //require CORRECTIONS_DIR . '/forms/Correction.php'; $this->view->addHelperPath(CORRECTIONS_DIR . '/helpers', 'Corrections_View_Helper_'); $itemId = $this->getParam('item_id'); $item = $this->_helper->db->getTable('Item')->find($itemId); $this->view->item = $item; $elements = $this->getElements(); $this->view->elements = $elements; $user = current_user(); if (!$user) { $captcha = Omeka_Captcha::getCaptcha(); $this->captcha = $captcha; $this->view->captchaScript = $captcha->render(new Zend_View()); } if ($this->getRequest()->isPost()) { if ($user || $this->captcha->isValid(null, $_POST)) { $this->_helper->flashMessenger(__("Thank you for the correction. It is under review."), 'success'); parent::addAction(); } else { $this->_helper->flashMessenger(__('Your CAPTCHA submission was invalid, please try again.'), 'error'); $this->view->corrections_correction = new CorrectionsCorrection(); } } else { parent::addAction(); } }
public function testGetCaptcha() { $this->assertNull(Omeka_Captcha::getCaptcha()); $options = array(Omeka_Captcha::PUBLIC_KEY_OPTION => 'public_key', Omeka_Captcha::PRIVATE_KEY_OPTION => 'private_key'); $this->bootstrap->getContainer()->options = $options; $captcha = Omeka_Captcha::getCaptcha(); $this->assertNotNull($captcha); $this->assertInstanceOf('Zend_Captcha_Adapter', $captcha); }
* @package Contribution */ queue_css_file('contribution-browse'); queue_js_file('contribution-contributed-item'); queue_js_file('contribution-browse'); contribution_admin_header(array(__('Contributed Items (%d)', $total_results))); // To avoid to determine rights for each record. $allowToManage = is_allowed('Items', 'edit') || is_allowed('Items', 'update') || is_allowed('Items', 'delete'); echo $this->partial('contribution-navigation.php'); ?> <div id="primary"> <?php echo flash(); if (!Omeka_Captcha::isConfigured()) { ?> <p class="alert"><?php echo __("You have not entered your %s API keys under %s. We recommend adding these keys, or the contribution form will be vulnerable to spam.", '<a href="http://recaptcha.net/">reCAPTCHA</a>', "<a href='" . url('settings/edit-security#fieldset-captcha') . "'>" . __('security settings') . "</a>"); ?> </p> <?php } if ($total_results) { ?> <div class="pagination"><?php echo pagination_links(); ?> </div> <form action="<?php
protected function _getForm($options) { $form = new Omeka_Form_User($options); //need to remove submit so I can add in new elements $form->removeElement('submit'); $form->addElement('password', 'new_password', array('label' => __('Password'), 'required' => true, 'class' => 'textinput', 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array('isEmpty' => __("New password must be entered.")))), array('validator' => 'Confirmation', 'options' => array('field' => 'new_password_confirm', 'messages' => array(Omeka_Validate_Confirmation::NOT_MATCH => __('New password must be typed correctly twice.')))), array('validator' => 'StringLength', 'options' => array('min' => User::PASSWORD_MIN_LENGTH, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => __("New password must be at least %min% characters long."))))))); $form->addElement('password', 'new_password_confirm', array('label' => __('Password again for match'), 'required' => true, 'class' => 'textinput', 'errorMessages' => array(__('New password must be typed correctly twice.')))); if (Omeka_Captcha::isConfigured() && get_option('guest_user_recaptcha') == 1) { $form->addElement('captcha', 'captcha', array('class' => 'hidden', 'style' => 'display: none;', 'label' => __("Please verify you're a human"), 'type' => 'hidden', 'captcha' => Omeka_Captcha::getCaptcha())); } if (current_user()) { $submitLabel = __('Update'); } else { $submitLabel = get_option('guest_user_register_text') ? get_option('guest_user_register_text') : __('Register'); } $form->addElement('submit', 'submit', array('label' => $submitLabel)); return $form; }
protected function _getForm($options) { $form = new Omeka_Form_User($options); //need to remove submit so I can add in new elements $form->removeElement('submit'); $form->addElement('password', 'new_password', array('label' => __('Password'), 'placeholder' => "Mot de passe", 'required' => true, 'class' => 'textinput', 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array('isEmpty' => __("Mot de passe obligatoire.")))), array('validator' => 'Confirmation', 'options' => array('field' => 'new_password_confirm', 'messages' => array(Omeka_Validate_Confirmation::NOT_MATCH => __('Les mots de passe ne correspondent pas.')))), array('validator' => 'StringLength', 'options' => array('min' => User::PASSWORD_MIN_LENGTH, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => __("%min% caractères minimum."))))))); $form->addElement('password', 'new_password_confirm', array('label' => __('Password again for match'), 'placeholder' => "Mot de passe (confirmation)", 'required' => true, 'class' => 'textinput', 'errorMessages' => array(__('Les mots de passe ne correspondent pas.')))); if (Omeka_Captcha::isConfigured() && get_option('guest_user_recaptcha') == 1) { $form->addElement('captcha', 'captcha', array('class' => 'hidden', 'style' => 'display: none;', 'label' => __("Merci de confirmer que vous êtes humain"), 'type' => 'hidden', 'captcha' => Omeka_Captcha::getCaptcha())); } if (current_user()) { $submitLabel = __('Mettre à jour'); } else { $submitLabel = __('Créer'); } $form->addElement('submit', 'submit', array('label' => $submitLabel)); return $form; }
protected function _setupCaptcha() { return Omeka_Captcha::getCaptcha(); }
/** * Creates the reCAPTCHA object and returns it. * * @return Zend_Captcha_Recaptcha|null */ protected function _setupCaptcha() { if (current_user()) { return false; } else { return Omeka_Captcha::getCaptcha(); } }