/** * kontrola validity * @param LBoxFormControl $control * @return bool */ protected function isValid(LBoxFormControl $control) { try { new recaptcha(); $dataPost = LBoxFront::getDataPost(); $this->resp = recaptcha_check_answer($this->getKeyPrivate(), LBOX_REQUEST_IP, $dataPost["recaptcha_challenge_field"], $dataPost["recaptcha_response_field"]); return $this->resp->is_valid; } catch (Exception $e) { throw $e; } }
<?php DEFINE("XT_GROUP", 1); require "../../../../lBox/lib/loader.php"; session_start(); LBoxCacheManagerFront::getInstance()->switchListeningOff(); // check xt session if (!LBoxXTDBFree::isLogged(XT_GROUP) && !LBoxXTProject::isLoggedAdmin(XT_GROUP)) { header("HTTP/1.1 404 Not Found"); die; } $post = LBoxFront::getDataPost(); $postFormData = current($post); // firePHP debug //LBoxFirePHP::table($post, 'POST data debug'); try { ////////////////////////////////////////////////////////////////////// // saving data ////////////////////////////////////////////////////////////////////// foreach ($post as $formID => $data) { $typeRecord = $data["type"]; $idColname = eval("return {$typeRecord}::\$idColName;"); $flagEdit = strlen($postFormData[$idColname]) > 0; $record = strlen($postFormData[$idColname]) < 1 ? new $typeRecord() : new $typeRecord($postFormData[$idColname]); $form = LBoxMetaRecordsManager::getMetaRecord($record)->getForm(); $form->setDoNotReload(true); $form->toString($forceThrow = true); $ret = new stdclass(); // PHP base class // check controls validations errors $exceptions = array();
/** * @return array */ public function getSentData() { try { $data = array(); switch (strtolower($this->method)) { case "get": $data = LBoxFront::getDataGet(); break; case "post": $data = LBoxFront::getDataPost(); break; } // pridame filesdata, pokud nejaka jsou if (count($this->getFilesData()) > 0) { $filesData = $this->getFilesData(); $data[$this->getName()] = array_merge($data[$this->getName()], $filesData[$this->getName()]); } return array_key_exists($this->name, $data) ? $data[$this->name] : NULL; } catch (Exception $e) { throw $e; } }
protected function process() { try { // zkontrolovat, jestli mame nastaven procesor if (count($this->processors) < 1) { throw new LBoxExceptionForm(LBoxExceptionForm::MSG_FORM_PROCESSOR_DOESNOT_EXISTS, LBoxExceptionForm::CODE_FORM_PROCESSOR_DOESNOT_EXISTS); } $dataPost = LBoxFront::getDataPost(); if (strlen($dataPost[$this->getName()]["previous"]) > 0) { $this->moveToPreviousStep(); } // zjistime, jestli nejsme na dalsim kroku pro zpracovani ve stavu do not reload $isLastStep = $this->subForms[$this->getStepCurrent() + 1] instanceof LBoxForm ? false : true; // pokud byl subform odeslan a uspesne zpracovan, posouvame se na dalsi krok $this->getCurrentForm()->__toString(); // v pripade ze plati $this->doNotReload a jsme na zprocessovanem poslednim kroku if ($this->doNotReload && $this->wasFinishedSuccess()) { foreach ($this->processors as $processor) { $processor->process(); } $this->reset(); return; } if ($this->getCurrentForm()->wasSentSucces()) { $this->moveToNextStep(); } if ($this->wasFinishedSuccess()) { foreach ($this->processors as $processor) { $processor->process(); } $this->reset(); $_SESSION["LBox"]["Forms"][$this->getName()]["succes"] = true; LBoxFront::reload(); } } catch (Exception $e) { throw $e; } }