/** * Create table and populate with data on module initialization */ public function onInit() { global $db; // create tables $sql = "CREATE TABLE IF NOT EXISTS `countries` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`name` varchar(35) NOT NULL,\n\t\t\t\t`short` char(2) NOT NULL,\n\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;"; $db->query($sql); $sql = "CREATE TABLE IF NOT EXISTS `country_states` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`country` char(2) NOT NULL,\n\t\t\t\t`name` varchar(30) NOT NULL,\n\t\t\t\t`short` char(5) NOT NULL,\n\t\t\t\tPRIMARY KEY (`id`),\n\t\t\t\tKEY `country` (`country`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;"; $db->query($sql); // populate table with data if (is_null($this->country_list)) { $this->_loadCountryList(); } if (is_null($this->state_list)) { $this->_loadStateList(); } // get managers $country_manager = CountryManager::getInstance(); $state_manager = CountryStateManager::getInstance(); $country_list = $this->country_list->document->tagChildren; $state_list = $this->state_list->document->tagChildren; foreach ($country_list as $country) { $country_manager->insertData(array('name' => escape_chars($country->tagData), 'short' => $country->tagAttrs['short'])); } foreach ($state_list as $country) { $country_code = $country->tagAttrs['short']; foreach ($country->tagChildren as $state) { $state_manager->insertData(array('country' => $country_code, 'name' => $state->tagData, 'short' => $state->tagAttrs['short'])); } } }
/** * Strip tags and escape the rest of the string * * @param mixed $string * @return mixed */ function escape_chars($string) { global $db; if (!is_array($string)) { // get rid of slashes if (get_magic_quotes_gpc()) { $string = stripcslashes($string); } // remove tags $string = strip_tags($string); if ($db != null) { $string = $db->escape_string($string); } } else { foreach ($string as $key => $value) { $string[$key] = escape_chars($value); } } return $string; }
/** * Get language constants for specified array */ private function json_GetTextArray() { // check if we were asked to get languages from specific module if (isset($_REQUEST['from_module']) && class_exists($_REQUEST['from_module'])) { $module = call_user_func(array(escape_chars($_REQUEST['from_module']), 'getInstance')); $language_handler = $module->language; } else { $language_handler = MainLanguageHandler::getInstance(); } // prepare variables $constants = fix_chars($_REQUEST['constants']); $result = array('text' => array()); // get constants if (count($constants) > 0) { foreach ($constants as $constant) { $result['text'][$constant] = $language_handler->getText($constant); } } print json_encode($result); }
/** * Save new or changed field data. */ private function saveField() { $id = isset($_REQUEST['id']) ? fix_id($_REQUEST['id']) : null; $form_id = fix_id($_REQUEST['form']); $data = array('form' => $form_id, 'name' => fix_chars($_REQUEST['name']), 'type' => fix_chars($_REQUEST['type']), 'label' => $this->getMultilanguageField('label'), 'placeholder' => $this->getMultilanguageField('placeholder'), 'min' => fix_id($_REQUEST['min']), 'max' => fix_id($_REQUEST['max']), 'maxlength' => fix_id($_REQUEST['maxlength']), 'value' => escape_chars($_REQUEST['value']), 'pattern' => escape_chars($_REQUEST['pattern']), 'disabled' => isset($_REQUEST['disabled']) && ($_REQUEST['disabled'] == 'on' || $_REQUEST['disabled'] == '1') ? 1 : 0, 'required' => isset($_REQUEST['required']) && ($_REQUEST['required'] == 'on' || $_REQUEST['required'] == '1') ? 1 : 0, 'autocomplete' => isset($_REQUEST['autocomplete']) && ($_REQUEST['autocomplete'] == 'on' || $_REQUEST['autocomplete'] == '1') ? 1 : 0); $manager = ContactForm_FormFieldManager::getInstance(); // insert or update data in database if (is_null($id)) { $window = 'contact_form_fields_add'; $manager->insertData($data); } else { $window = 'contact_form_fields_edit'; $manager->updateData($data, array('id' => $id)); } // show message $template = new TemplateHandler('message.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array('message' => $this->getLanguageConstant('message_field_saved'), 'button' => $this->getLanguageConstant('close'), 'action' => window_Close($window) . ";" . window_ReloadContent('contact_form_fields_' . $form_id)); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * News list tag handler * * @param array $tag_params * @param array $children */ public function tag_NewsList($tag_params, $children) { $limit = isset($tag_params['limit']) ? fix_id($tag_params['limit']) : null; $group = isset($tag_params['group']) ? escape_chars($tag_params['group']) : null; $conditions = array(); if (!isset($tag_params['show_invisible'])) { $conditions['visible'] = 1; } $manager = NewsManager::getInstance(); $membership_manager = NewsMembershipManager::getInstance(); $group_manager = NewsGroupManager::getInstance(); $admin_manager = UserManager::getInstance(); if (!is_null($group)) { // group is set, get item ids and feed them to conditions list if (!is_numeric($group)) { $group_id = $group_manager->getItemValue('id', array('text_id' => $group)); } else { $group_id = $group; } $item_list = $membership_manager->getItems(array('news'), array('group' => $group_id)); if (count($item_list) > 0) { $conditions['id'] = array(); foreach ($item_list as $item) { $conditions['id'][] = $item->news; } } else { $conditions['id'] = '-1'; } } // get items from database $items = $manager->getItems($manager->getFieldNames(), $conditions, array('timestamp'), false, $limit); // create template $template = $this->loadTemplate($tag_params, 'news_list_item.xml'); // parse items if (count($items) > 0) { foreach ($items as $item) { $timestamp = strtotime($item->timestamp); $date = date($this->getLanguageConstant('format_date_short'), $timestamp); $time = date($this->getLanguageConstant('format_time_short'), $timestamp); $params = array('id' => $item->id, 'time' => $time, 'date' => $date, 'timestamp' => $timestamp, 'author' => $admin_manager->getItemValue('fullname', array('id' => $item->author)), 'title' => $item->title, 'content' => $item->content, 'visible' => $item->visible, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('news_change', 490, $this->getLanguageConstant('title_news_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'news_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('news_delete', 390, $this->getLanguageConstant('title_news_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'news_delete'), array('id', $item->id))))); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } } }
/** * Save new or changed affiliate data. */ private function saveAffiliate() { if ($_SESSION['level'] < 10) { die('Access denied!'); } $manager = AffiliatesManager::getInstance(); $id = isset($_REQUEST['id']) ? fix_id($_REQUEST['id']) : null; $uid = escape_chars($_REQUEST['uid']); $user = fix_id($_REQUEST['user']); $name = fix_chars($_REQUEST['name']); $active = isset($_REQUEST['active']) && ($_REQUEST['active'] == 'on' || $_REQUEST['active'] == '1') ? 1 : 0; $default = isset($_REQUEST['default']) && ($_REQUEST['default'] == 'on' || $_REQUEST['default'] == '1') ? 1 : 0; $data = array('name' => $name, 'user' => $user, 'active' => $active, 'default' => $default); $existing_items = $manager->getItems(array('id'), array('uid' => $uid)); if (is_null($id)) { if (count($existing_items) > 0 || empty($uid)) { // there are items with existing UID, show error $message = 'message_affiliate_not_unique'; } else { // affiliate ID is unique, proceed $message = 'message_affiliate_saved'; $data['uid'] = $uid; $manager->insertData($data); } $window = 'affiliates_new'; } else { // update existing record $window = 'affiliates_change'; $message = 'message_affiliate_saved'; $manager->updateData($data, array('id' => $id)); } // show message $template = new TemplateHandler('message.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array('message' => $this->getLanguageConstant($message), 'button' => $this->getLanguageConstant('close'), 'action' => window_Close($window) . ";" . window_ReloadContent('affiliates')); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Tag handler for article group * * @param array $tag_params * @param array $children */ public function tag_Group($tag_params, $children) { $id = isset($tag_params['id']) ? fix_id($tag_params['id']) : null; $text_id = isset($tag_params['text_id']) ? escape_chars($tag_params['text_id']) : null; // we need at least one of IDs in order to display article if (is_null($id) && is_null($text_id)) { return; } $manager = ArticleGroupManager::getInstance(); // load template $template = $this->loadTemplate($tag_params, 'group.xml'); $template->setMappedModule($this->name); $template->registerTagHandler('_article_list', $this, 'tag_ArticleList'); if (!is_null($id)) { $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id)); } else { $item = $manager->getSingleItem($manager->getFieldNames(), array('text_id' => $text_id)); } if (is_object($item)) { $params = array('id' => $item->id, 'text_id' => $item->text_id, 'title' => $item->title, 'desciption' => $item->description); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } }
/** * Tag handler for showing days selection. * * @param array $tag_params * @param array $children */ public function tag_Days($tag_params, $children) { $value = '0000000'; // check if value is set if (isset($tag_params['value'])) { $value = escape_chars($tag_params['value']); } // load template $template = $this->loadTemplate($tag_params, 'day.xml'); // parse template for ($i = 1; $i <= 7; $i++) { $params = array('name' => 'day_' . $i, 'label' => $this->getLanguageConstant('label_' . $i), 'checked' => $value[$i - 1] == '1'); $template->setLocalParams($params); $template->restoreXML(); $template->parse(); } }
$mail_message .= "Цена: " . $price . "\n"; } if ($uslugi) { $mail_message .= "Доп. услуги: \n" . $uslugi . "\n"; } mail($contactsemail, 'Заявка', $mail_message, $headers); $errormessage = "Заявка успешно отправлена." . $mail_message . $contactsemail; } } elseif ($action == 'calcformzakaz_2') { //заказ $name = escape_chars($_POST['zakaz_name']); $tel = escape_chars($_POST['zakaz_tel']); $email = escape_chars($_POST['zakaz_email']); $uslugi = escape_chars($_POST['zakaz_uslugi']); $price = escape_chars($_POST['zakaz_price']); $sitetype = escape_chars($_POST['zakaz_sitetype']); if ($uslugi) { $uslugi_ar = split(';', $uslugi); $uslugi = ''; foreach ($uslugi_ar as $u) { if ($u != '') { $uslugi .= ' • ' . $u . "\n"; } } } if ($name == '' || $tel == '' || checknumber($tel) == 0 || $email == '' || check_length($name, 2, 50) == 0 || check_length($tel, 2, 20) == 0) { $errormessage = 'Неверные данные.'; } else { $mail_message = "Заявка "; $mail_message .= "от " . $name . "\n"; $mail_message .= "тел. " . $tel . "\n";
/** * Save changes existing (or new) to `link` object and display result */ private function saveLink() { $id = isset($_REQUEST['id']) ? fix_id(fix_chars($_REQUEST['id'])) : null; $data = array('text' => fix_chars($_REQUEST['text']), 'description' => escape_chars($_REQUEST['description']), 'url' => fix_chars($_REQUEST['url']), 'external' => isset($_REQUEST['external']) && ($_REQUEST['external'] == 'on' || $_REQUEST['external'] == '1') ? 1 : 0, 'sponsored' => isset($_REQUEST['sponsored']) && ($_REQUEST['sponsored'] == 'on' || $_REQUEST['sponsored'] == '1') ? 1 : 0, 'display_limit' => fix_id(fix_chars($_REQUEST['display_limit']))); $gallery_addon = ''; // if images are in use and specified if (class_exists('gallery') && isset($_FILES['image'])) { $gallery = gallery::getInstance(); $gallery_manager = GalleryManager::getInstance(); $result = $gallery->createImage('image'); if (!$result['error']) { $image_data = array('title' => $data['text'], 'visible' => 0, 'protected' => 1); $gallery_manager->updateData($image_data, array('id' => $result['id'])); $data['image'] = $result['id']; $gallery_addon = ";" . window_ReloadContent('gallery_images'); } } $manager = LinksManager::getInstance(); if (!is_null($id)) { $manager->updateData($data, array('id' => $id)); $window_name = 'links_change'; } else { $manager->insertData($data); $window_name = 'links_add'; } $template = new TemplateHandler('message.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array('message' => $this->getLanguageConstant('message_link_saved'), 'button' => $this->getLanguageConstant('close'), 'action' => window_Close($window_name) . ";" . window_ReloadContent('links_list') . ";" . window_ReloadContent('links_overview') . $gallery_addon); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Tag handler for admin lists * * @param array $tag_params * @param array $children */ public function tag_AdminList($tag_params, $children) { $manager = ChatAdminManager::getInstance(); $user_manager = ChatUserManager::getInstance(); $room_manager = ChatRoomManager::getInstance(); $conditions = array(); // if room was specified, print only admins for that room if (isset($tag_params['room']) && !empty($tag_params['room'])) { $room = escape_chars($tag_params['room']); if (is_numeric($room)) { $room_id = $room; } else { $room_id = $room_manger->getItemValue('id', array('text_id' => $room)); } $conditions['room'] = $room_id; } $items = $manager->getItems($manager->getFieldNames(), $conditions, array('user', 'room')); if (isset($tag_params['template'])) { if (isset($tag_params['local']) && $tag_params['local'] == 1) { $template = new TemplateHandler($tag_params['template'], $this->path . 'templates/'); } else { $template = new TemplateHandler($tag_params['template']); } } else { $template = new TemplateHandler('admins_list_item.xml', $this->path . 'templates/'); } if (count($items) > 0) { foreach ($items as $item) { $user = $user_manager->getSingleItem(array('display_name'), array('id' => $item->user)); $room = $room_manager->getSingleItem(array('name'), array('id' => $item->room)); $params = array('id' => $item->id, 'user' => $item->user, 'room' => $item->room, 'display_name' => $user->display_name, 'room_name' => $room->name, 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('chat_admins_delete', 400, $this->getLanguageConstant('title_chat_admins_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'admins_delete'), array('id', $item->id))))); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } } }
$mail_message .= "E-Mail: " . $order_form_email . "\n"; mail($email, 'Заявка на допуск', $mail_message, $headers); $errormessage = "Заявка успешно отправлена."; } //форма калькулятора } else { if ($action == 'calc_form') { //получаем данные с формы $calc_name = escape_chars($_POST['calc_name']); $calc_tel = escape_chars($_POST['calc_tel']); $calc_email = escape_chars($_POST['calc_email']); $calc_price_result = escape_chars($_POST['calc_price_result']); $calc_select_1 = escape_chars($_POST['calc_select_1']); $calc_select_2 = escape_chars($_POST['calc_select_2']); $calc_select_3 = escape_chars($_POST['calc_select_3']); $calc_select_4 = escape_chars($_POST['calc_select_4']); //проверка данных if ($calc_select_1 == 'Тип деятельности' || $calc_select_2 == 'Сумма ген. подряда') { $calc_price_result = 'Неизвестно'; } if ($calc_select_1 == 'Тип деятельности') { $calc_select_1 = 'Не указано'; } if ($calc_select_2 == 'Сумма ген. подряда') { $calc_select_2 = 'Не указано'; } if ($calc_select_3 == 'Опасность работ') { $calc_select_3 = 'Не указано'; } if ($calc_select_4 == 'Тип организации') { $calc_select_4 = 'Не указано';
/** * Handle IPN. */ private function handleIPN() { if (!PayPal_Helper::validate_notification()) { trigger_error('PayPal: Invalid notification received. ' . json_encode($_POST), E_USER_WARNING); return; } // get objects $transaction_manager = ShopTransactionsManager::getInstance(); // get data $handled = false; $type = escape_chars($_POST['txn_type']); $amount = escape_chars($_POST['amount']); // handle different notification types switch ($type) { case 'recurring_payment': case 'recurring_payment_expired': case 'recurring_payment_failed': case 'recurring_payment_profile_created': case 'recurring_payment_profile_cancel': case 'recurring_payment_skipped': case 'recurring_payment_suspended': case 'recurring_payment_suspended_due_to_max_failed_payment': $profile_id = escape_chars($_REQUEST['recurring_payment_id']); $transaction = $transaction_manager->getSingleItem($transaction_manager->getFieldNames(), array('token' => $profile_id)); if (is_object($transaction)) { $handled = $this->handleRecurringIPN($transaction, $type, $amount); } else { trigger_error("PayPal: Unable to handle IPN, unknown transaction {$profile_id}.", E_USER_WARNING); } break; } // record unhandled notifications if (!$handled) { trigger_error("PayPal: Unhandled notification '{$type}'.", E_USER_NOTICE); } }
/** * Complete checkout and charge money. */ public function completeCheckout() { global $language; // prepare data for new recurring profile $shop = shop::getInstance(); $token = escape_chars($_REQUEST['token']); $payer_id = escape_chars($_REQUEST['payer_id']); $return_url = fix_chars($_REQUEST['return_url']); $recurring = isset($_REQUEST['type']) && $_REQUEST['type'] == 'recurring'; $transaction_uid = $_SESSION['transaction']['uid']; // get buyer information $fields = array('TOKEN' => $token); $response = PayPal_Helper::callAPI(PayPal_Helper::METHOD_GetExpressCheckoutDetails, $fields); // update transaction status and buyer if ($response['ACK'] == 'Success' || $response['ACK'] == 'SuccessWithWarning') { $buyer = array('first_name' => $response['FIRSTNAME'], 'last_name' => $response['LASTNAME'], 'email' => $response['EMAIL'], 'uid' => $response['PAYERID']); $shop->updateBuyerInformation($transaction_uid, $buyer); } else { // report error $error_code = urldecode($response['L_ERRORCODE0']); $error_long = urldecode($response['L_LONGMESSAGE0']); trigger_error("PayPal_Express: ({$error_code}) - {$error_long}", E_USER_ERROR); } // create recurring profile if ($recurring) { $request_id = 0; $plan_name = $_SESSION['recurring_plan']; $manager = PayPal_PlansManager::getInstance(); $plan = $manager->getSingleItem($manager->getFieldNames(), array('text_id' => $plan_name)); $current_plan = $shop->getRecurringPlan(); // cancel existing recurring payment if exists if (!is_null($current_plan)) { $plans = $this->get_recurring_plans(); $current_group = null; // get plan data if (isset($plans[$current_plan->plan_name])) { $current_group = $plans[$current_plan->plan_name]['group']; } // cancel current plan if (!is_null($current_group) && $current_group == $plan->group_name) { $shop->cancelTransaction($current_plan->transaction); } } // generate params for description $plan_params = array('price' => $plan->price, 'period' => $plan->interval_count, 'unit' => $plan->interval, 'setup' => $plan->setup_price, 'trial_period' => $plan->trial_count, 'trial_unit' => $plan->trial); // charge one time setup fee if (is_object($plan) && $plan->setup_price > 0) { $setup_fields = $fields; $setup_fields["PAYMENTREQUEST_{$request_id}_AMT"] = $plan->setup_price; $setup_fields["PAYMENTREQUEST_{$request_id}_CURRENCYCODE"] = $shop->getDefaultCurrency(); $setup_fields["PAYMENTREQUEST_{$request_id}_DESC"] = $this->parent->getLanguageConstant('api_setup_fee'); $setup_fields["PAYMENTREQUEST_{$request_id}_INVNUM"] = $_SESSION['transaction']['uid']; $setup_fields["PAYMENTREQUEST_{$request_id}_PAYMENTACTION"] = 'Sale'; $response = PayPal_Helper::callAPI(PayPal_Helper::METHOD_DoExpressCheckoutPayment, $setup_fields); } // create recurring payments profile $recurring_fields = $fields; // set starting date of the profile $start_timestamp = strtotime($plan->start_time); if ($start_timestamp < time()) { $start_timestamp = time(); } $recurring_fields['PROFILESTARTDATE'] = strftime('%Y-%m-%dT%T%z', $start_timestamp); $recurring_fields['PAYERID'] = $payer_id; // set description $recurring_fields['DESC'] = $shop->formatRecurring($plan_params); // set currency $recurring_fields['AMT'] = $plan->price; $recurring_fields['CURRENCYCODE'] = $shop->getDefaultCurrency(); // billing period $recurring_fields['BILLINGPERIOD'] = $this->units[$plan->interval]; $recurring_fields['BILLINGFREQUENCY'] = $plan->interval_count; // trial period if ($plan->trial_count > 0) { $recurring_fields['TRIALBILLINGPERIOD'] = $this->units[$plan->trial]; $recurring_fields['TRIALBILLINGFREQUENCY'] = $plan->trial_count; $recurring_fields['TRIALTOTALBILLINGCYCLES'] = 1; } // make api call $response = PayPal_Helper::callAPI(PayPal_Helper::METHOD_CreateRecurringPaymentsProfile, $recurring_fields); if ($response['ACK'] == 'Success' || $response['ACK'] == 'SuccessWithWarning') { // update transaction token $shop->setTransactionToken($transaction_uid, fix_chars($response['PROFILEID'])); // update transaction status if ($response['PROFILESTATUS'] == 'ActiveProfile') { $shop->setTransactionStatus($transaction_uid, TransactionStatus::COMPLETED); } } else { // report error $error_code = urldecode($response['L_ERRORCODE0']); $error_long = urldecode($response['L_LONGMESSAGE0']); trigger_error("PayPal_Express: ({$error_code}) - {$error_long}", E_USER_ERROR); } // redirect user header('Location: ' . $return_url, true, 302); } }
/** * Save new or changed manufacturer data */ private function saveManufacturer() { $id = null; $manager = ShopManufacturerManager::getInstance(); $gallery_addon = ''; if (isset($_REQUEST['id'])) { $id = fix_id($_REQUEST['id']); } // get data from request $data = array('name' => $this->_parent->getMultilanguageField('name'), 'web_site' => escape_chars($_REQUEST['web_site'])); // store or update data in database if (is_null($id)) { // get new image inserted if (class_exists('gallery') && isset($_FILES['logo'])) { $gallery = gallery::getInstance(); $gallery_manager = GalleryManager::getInstance(); $result = $gallery->createImage('logo'); if (!$result['error']) { $image_data = array('title' => $data['name'], 'visible' => 0, 'protected' => 1); $gallery_manager->updateData($image_data, array('id' => $result['id'])); $data['logo'] = $result['id']; $gallery_addon = ';' . window_ReloadContent('gallery_images'); } } // insert new manufacturer data $manager->insertData($data); $window = 'shop_manufacturer_add'; } else { // get the logo $data['logo'] = isset($_REQUEST['logo']) && !empty($_REQUEST['logo']) ? fix_id($_REQUEST['logo']) : 0; // update existing data $manager->updateData($data, array('id' => $id)); $window = 'shop_manufacturer_change'; } // show message $template = new TemplateHandler('message.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array('message' => $this->_parent->getLanguageConstant('message_manufacturer_saved'), 'button' => $this->_parent->getLanguageConstant('close'), 'action' => window_Close($window) . ";" . window_ReloadContent('shop_manufacturers') . $gallery_addon); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
$mail_message .= "Имя: " . $consultation_name . "\n"; $mail_message .= "Телефон: " . $consultation_tel . "\n"; $mail_message .= "E-Mail: " . $consultation_email . "\n"; mail($email, 'Заявка', $mail_message, $headers); $errormessage = "Заявка успешно отправлена."; } else { $errormessage = 'Введены некорректные данные.'; } } else { $errormessage = 'Введены некорректные данные.'; } } else { if ($action == 'call') { //получаем данные с формы $call_name = escape_chars($_POST['call_name']); $call_tel = escape_chars($_POST['call_tel']); //проверка данных if (!empty($call_name) && !empty($call_tel)) { if (checknumber($call_tel) == 1 && check_length($call_name, 2, 25) && check_length($call_tel, 5, 25)) { //формирование емейла $mail_message = "Заявка от лица:\n"; $mail_message .= "Имя: " . $call_name . "\n"; $mail_message .= "Телефон: " . $call_tel . "\n"; mail($email, 'Заявка', $mail_message, $headers); $errormessage = "Заявка успешно отправлена."; } else { $errormessage = 'Введены некорректные данные.'; } } else { $errormessage = 'Введены некорректные данные.'; }
/** * Transfers control to preconfigured template * * @param string $section * @param string $action * @param string $language */ public function transferControl($section, $action, $language = '') { $file = $this->getFile($section, $action, $language); if (empty($file)) { // if no section is defined, check for module with the same name if (class_exists($section)) { $module = call_user_func(array(escape_chars($section), 'getInstance')); $params = array('action' => $action); // transfer control to module $module->transferControl($params, array()); } } else { // section file is defined, load and parse it $template = new TemplateHandler($file); $template->parse(); } }
/** * Get license for specified domain */ private function json_GetLicense() { $result = ''; $domain = $this->getDomain(); $local_server = !empty($domain) && $domain == $_SERVER['SERVER_NAME']; if (isset($_REQUEST['domain']) && $local_server) { $domain = escape_chars($_REQUEST['domain']); $result = $this->generateLicense($domain); } print json_encode($result); }