public function contactUs()
    {
        //Checks if the "contact us" form is enabled
        if (!getConfig('default.contact_us')) {
            $this->Flash->error(I18N_DISABLED);

            return $this->redirect(['_name' => 'homepage']);
        }

        $contact = new ContactUsForm;

        if ($this->request->is('post')) {
            //Checks for reCAPTCHA, if requested
            if (!getConfig('security.recaptcha') || $this->Recaptcha->verify()) {
                //Sends the email
                if ($contact->execute($this->request->getData())) {
                    $this->Flash->success(I18N_OPERATION_OK);

                    return $this->redirect(['_name' => 'homepage']);
                }

                $this->Flash->error(I18N_OPERATION_NOT_OK);
            } else {
                $this->Flash->error(__d('me_cms', 'You must fill in the {0} control correctly', 'reCAPTCHA'));
            }
        }

        $this->set(compact('contact'));
    }
public function contactUs()
    {
        //Checks if the "contact us" form is enabled
        if (!getConfig('default.contact_us')) {
            $this->Flash->error(I18N_DISABLED);

            return $this->redirect(['_name' => 'homepage']);
        }

        $contact = new ContactUsForm;

        if ($this->request->is('post')) {
            //Checks for reCAPTCHA, if requested
            if (!getConfig('security.recaptcha') || $this->Recaptcha->verify()) {
                //Sends the email
                if ($contact->execute($this->request->getData())) {
                    $this->Flash->success(I18N_OPERATION_OK);

                    return $this->redirect(['_name' => 'homepage']);
                }

                $this->Flash->error(I18N_OPERATION_NOT_OK);
            } else {
                $this->Flash->error(__d('me_cms', 'You must fill in the {0} control correctly', 'reCAPTCHA'));
            }
        }

        $this->set(compact('contact'));
    }
public function contactUs ( ) { //Checks if the "contact us" form is enabled if ( ! getConfig ( 'default.contact_us' ) ) { $ this -> Flash -> error ( I18N_DISABLED ) ; return $ this -> redirect ( [ '_name' => 'homepage' ] ) ; } $ contact = new ContactUsForm ; if ( $ this -> request -> is ( 'post' ) ) { //Checks for reCAPTCHA, if requested if ( ! getConfig ( 'security.recaptcha' ) || $ this -> Recaptcha -> verify ( ) ) { //Sends the email if ( $ contact -> execute ( $ this -> request -> getData ( ) ) ) { $ this -> Flash -> success ( I18N_OPERATION_OK ) ; return $ this -> redirect ( [ '_name' => 'homepage' ] ) ; } $ this -> Flash -> error ( I18N_OPERATION_NOT_OK ) ; } else { $ this -> Flash -> error ( __d ( 'me_cms' , 'You must fill in the {0} control correctly' , 'reCAPTCHA' ) ) ; } } $ this -> set ( compact ( 'contact' ) ) ; }
"Contact us" form
@return \Cake\Network\Response|null|void
@see MeCms\Form\ContactUsForm
@see MeCms\Mailer\ContactUsMailer
Contact us form