/** * checks spam fields availability * * @return bool */ function zbs_spamCheck() { $spamTraps = array('surname', 'lastname', 'seenoevil', 'mobile'); $result = true; if (!empty($spamTraps)) { foreach ($spamTraps as $eachTrap) { if (la_CheckPost(array($eachTrap))) { return false; } } } return $result; }
/** * sets some custom template fields from post request * * @return void */ public function setCustomFields() { $pdvPercent = $this->altcfg['DOCX_NDS']; if (la_CheckPost(array('customfields'))) { $morph = new UBMorph(); @($this->customFields['CUSTDATE'] = $_POST['customdate']); @($this->customFields['CUSTREALNAME'] = $_POST['customrealname']); @($this->customFields['CUSTPHONE'] = $_POST['customphone']); @($this->customFields['CUSTSERVICE'] = $_POST['customservice']); @($this->customFields['CUSTNOTES'] = $_POST['customnotes']); @($this->customFields['CUSTSUM'] = $_POST['customsum']); @($this->customFields['CUSTPHONE'] = $_POST['customphone']); @($pdv = $this->customFields['CUSTSUM'] / 100 * $pdvPercent); @($this->customFields['PDV'] = $pdv); @($this->customFields['CUSTSUMPDV'] = $this->customFields['CUSTSUM'] + $pdv); @($this->customFields['CUSTSUMLIT'] = $morph->sum2str($this->customFields['CUSTSUM'])); @($this->customFields['CUSTSUMPDVLIT'] = $morph->sum2str($this->customFields['CUSTSUMPDV'])); } }
// Send main headers header('Last-Modified: ' . date('r')); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache"); // Page gentime start $starttime = explode(' ', microtime()); $starttime = $starttime[1] + $starttime[0]; // Load libs include 'modules/engine/api.mysql.php'; include 'modules/engine/api.lightastral.php'; include 'modules/engine/api.compat.php'; include 'modules/engine/api.signup.php'; $dbConnect = new MySQLDB(); $signup = new SignupService($snConfig['confcache'], $snConfig['cachetimeout']); //show form by default if (!la_CheckPost(array('createrequest'))) { if (!la_CheckGet(array('success'))) { show_window('', $signup->renderForm()); } else { show_window(__('Thank you'), __('Your inquiry will be dealt with in the shortest possible time, and you will be contacted by our representative for details of connection.')); } } else { //or create request $request = $signup->createRequest(); if ($request) { rcms_redirect("?success=yeah"); } else { show_window(__('Error'), __('All fields marked with an asterisk (*) are required') . '. ' . la_Link('index.php', __('Try again'))); } } if ($snConfig['debug']) {
/** * creates signup request in database * * @return bool */ public function createRequest() { $date = date("Y-m-d H:i:s"); $ip = $_SERVER['REMOTE_ADDR']; $state = 0; $result = true; if (la_CheckPost($this->required)) { //all of required fields filled $street = ''; if (la_CheckPost(array('city'))) { $street .= $this->filter($_POST['city']) . ' '; } $street .= $this->filter($_POST['street']); $build = $this->filter($_POST['build']); if (la_CheckPost(array('apt'))) { $apt = $this->filter($_POST['apt']); } else { $apt = 0; } $realname = $this->filter($_POST['realname']); $phone = $this->filter($_POST['phone']); if (la_CheckPost(array('email'))) { $email = 'Email: ' . $this->filter($_POST['email']) . "\n"; } else { $email = ''; } if (la_CheckPost(array('service'))) { $service = $this->filter($_POST['service']); } else { $service = 'No'; } if (la_CheckPost(array('tariff'))) { $tariff = 'Tariff: ' . $this->filter($_POST['tariff']) . "\n"; } else { $tariff = ''; } $notes = ''; if (la_CheckPost(array('notes'))) { $notes .= $this->filter($_POST['notes']) . "\n"; } $notes .= $tariff; $notes .= $email; $query = "INSERT INTO `sigreq` (\n `id` ,\n `date` ,\n `state` ,\n `ip` ,\n `street` ,\n `build` ,\n `apt` ,\n `realname` ,\n `phone` ,\n `service` ,\n `notes`\n )\n VALUES (\n NULL ,\n '" . $date . "',\n '" . $state . "',\n '" . $ip . "',\n '" . $street . "',\n '" . $build . "',\n '" . $apt . "',\n '" . $realname . "',\n '" . $phone . "',\n '" . $service . "',\n '" . $notes . "'\n );\n "; //silent spam check if ($this->spamCheck()) { nr_query($query); } } else { $result = false; } return $result; }
$documents = new UsProfileDocuments(); $documents->setLogin($user_login); $documents->loadAllUserData(); $documents->loadUserDocuments($user_login); show_window(__('Available document templates'), $documents->renderTemplatesList()); if (la_CheckGet(array('print'))) { $templateId = vf($_GET['print'], 3); if (!empty($templateId)) { $ctemplateData = $documents->getTemplates(); if (isset($ctemplateData[$templateId])) { $templatePublicType = $ctemplateData[$templateId]['public']; if ($templatePublicType) { //template is ok show_window(__('Document creation'), $documents->customDocumentFieldsForm()); //try to parse template if (la_CheckPost(array('customfields'))) { $templatePath = $documents->tEMPLATES_PATH; $documentsSavePath = $documents->dOCUMENTS_PATH; $templateFile = $ctemplateData[$templateId]['path']; $templateName = $ctemplateData[$templateId]['name']; $fullPath = $templatePath . $templateFile; $saveFileName = $documents->getLogin() . '_' . $templateId . '_' . zbs_rand_string(8) . '.docx'; $saveFullPath = $documentsSavePath . $saveFileName; $templateData = $documents->getUserData(); if (isset($us_config['AGENTS_ASSIGN'])) { $userAgentData = $documents->getUserAgentData(); } else { $userAgentData = array(); } $documents->setCustomFields(); $templateData = array_merge($templateData, $documents->getCustomFields(), $userAgentData);