public function contactFormAction() { $success = false; if ($this->getParam("provider")) { $adapter = Tool\HybridAuth::authenticate($this->getParam("provider")); if ($adapter) { $user_data = $adapter->getUserProfile(); if ($user_data) { $this->setParam("firstname", $user_data->firstName); $this->setParam("lastname", $user_data->lastName); $this->setParam("email", $user_data->email); $this->setParam("gender", $user_data->gender); } } } // getting parameters is very easy ... just call $this->getParam("yorParamKey"); regardless if's POST or GET if ($this->getParam("firstname") && $this->getParam("lastname") && $this->getParam("email") && $this->getParam("message")) { $success = true; $mail = new Mail(); $mail->setIgnoreDebugMode(true); // To is used from the email document, but can also be set manually here (same for subject, CC, BCC, ...) //$mail->addTo("*****@*****.**"); $emailDocument = $this->document->getProperty("email"); if (!$emailDocument) { $emailDocument = Document::getById(38); } $mail->setDocument($emailDocument); $mail->setParams($this->getAllParams()); $mail->send(); } // do some validation & assign the parameters to the view foreach (["firstname", "lastname", "email", "message", "gender"] as $key) { if ($this->getParam($key)) { $this->view->{$key} = htmlentities(strip_tags($this->getParam($key))); } } // assign the status to the view $this->view->success = $success; }
/** * @param \Zend_Controller_Request_Abstract $request */ public function routeStartup(\Zend_Controller_Request_Abstract $request) { if (preg_match("@^/hybridauth/endpoint@", $request->getPathInfo(), $matches)) { \Pimcore\Tool\HybridAuth::process(); } }