public function form($id = NULL) { if ($this->input->post('btn_cancel')) { redirect('clients'); } // Set validation rule based on is_update if ($this->input->post('is_update') == 0 && $this->input->post('client_name') != '') { $check = $this->db->get_where('ip_clients', array('client_name' => $this->input->post('client_name')))->result(); if (!empty($check)) { $this->session->set_flashdata('alert_error', lang('client_already_exists')); redirect('clients/form'); } } if ($this->mdl_clients->run_validation()) { $id = $this->mdl_clients->save($id); redirect('clients/view/' . $id); } if ($id and !$this->input->post('btn_submit')) { if (!$this->mdl_clients->prep_form($id)) { show_404(); } $this->mdl_clients->set_form_value('is_update', true); } $this->load->helper('country'); $this->layout->set('countries', get_country_list(lang('cldr'))); $this->layout->set('selected_country', $this->mdl_clients->form_value('client_country') ?: $this->mdl_settings->setting('default_country')); $this->layout->buffer('content', 'clients/form'); $this->layout->render(); }
/** * Метод отображения настроек * */ function settingsShow() { global $AVE_Template; $date_formats = array('%d.%m.%Y', '%d %B %Y', '%A, %d.%m.%Y', '%A, %d %B %Y'); $time_formats = array('%d.%m.%Y, %H:%M', '%d %B %Y, %H:%M', '%A, %d.%m.%Y (%H:%M)', '%A, %d %B %Y (%H:%M)'); $AVE_Template->assign('date_formats', $date_formats); $AVE_Template->assign('time_formats', $time_formats); $AVE_Template->assign('row', get_settings()); $AVE_Template->assign('available_countries', get_country_list(1)); $AVE_Template->assign('content', $AVE_Template->fetch('settings/settings_main.tpl')); }
public function form($id = NULL) { if ($this->input->post('btn_cancel')) { redirect('clients'); } // Set validation rule based on is_update if ($this->input->post('is_update') == 0 && $this->input->post('client_name') != '') { $check = $this->db->get_where('ip_clients', array('client_name' => $this->input->post('client_name')))->result(); if (!empty($check)) { $this->session->set_flashdata('alert_error', lang('client_already_exists')); redirect('clients/form'); } } if ($this->mdl_clients->run_validation()) { $id = $this->mdl_clients->save($id); $this->load->model('custom_fields/mdl_client_custom'); $this->mdl_client_custom->save_custom($id, $this->input->post('custom')); redirect('clients/view/' . $id); } if ($id and !$this->input->post('btn_submit')) { if (!$this->mdl_clients->prep_form($id)) { show_404(); } $this->load->model('custom_fields/mdl_client_custom'); $this->mdl_clients->set_form_value('is_update', true); $client_custom = $this->mdl_client_custom->where('client_id', $id)->get(); if ($client_custom->num_rows()) { $client_custom = $client_custom->row(); unset($client_custom->client_id, $client_custom->client_custom_id); foreach ($client_custom as $key => $val) { $this->mdl_clients->set_form_value('custom[' . $key . ']', $val); } } } elseif ($this->input->post('btn_submit')) { if ($this->input->post('custom')) { foreach ($this->input->post('custom') as $key => $val) { $this->mdl_clients->set_form_value('custom[' . $key . ']', $val); } } } $this->load->model('custom_fields/mdl_custom_fields'); $this->load->helper('country'); $this->layout->set('custom_fields', $this->mdl_custom_fields->by_table('ip_client_custom')->get()->result()); $this->layout->set('countries', get_country_list(lang('cldr'))); $this->layout->set('selected_country', $this->mdl_clients->form_value('client_country') ?: $this->mdl_settings->setting('default_country')); $this->layout->buffer('content', 'clients/form'); $this->layout->render(); }
public function form($id = null) { if ($this->input->post('btn_cancel')) { redirect('users'); } if ($this->mdl_users->run_validation($id ? 'validation_rules_existing' : 'validation_rules')) { $id = $this->mdl_users->save($id); $this->load->model('custom_fields/mdl_user_custom'); $this->mdl_user_custom->save_custom($id, $this->input->post('custom')); redirect('users'); } if ($id and !$this->input->post('btn_submit')) { if (!$this->mdl_users->prep_form($id)) { show_404(); } $this->load->model('custom_fields/mdl_user_custom'); $user_custom = $this->mdl_user_custom->where('user_id', $id)->get(); if ($user_custom->num_rows()) { $user_custom = $user_custom->row(); unset($user_custom->user_id, $user_custom->user_custom_id); foreach ($user_custom as $key => $val) { $this->mdl_users->set_form_value('custom[' . $key . ']', $val); } } } elseif ($this->input->post('btn_submit')) { if ($this->input->post('custom')) { foreach ($this->input->post('custom') as $key => $val) { $this->mdl_users->set_form_value('custom[' . $key . ']', $val); } } } $this->load->model('users/mdl_user_clients'); $this->load->model('clients/mdl_clients'); $this->load->model('custom_fields/mdl_custom_fields'); $this->load->helper('country'); $this->layout->set(array('id' => $id, 'user_types' => $this->mdl_users->user_types(), 'user_clients' => $this->mdl_user_clients->where('ip_user_clients.user_id', $id)->get()->result(), 'custom_fields' => $this->mdl_custom_fields->by_table('ip_user_custom')->get()->result(), 'countries' => get_country_list(trans('cldr')), 'selected_country' => $this->mdl_users->form_value('user_country') ?: $this->mdl_settings->setting('default_country'))); $this->layout->buffer('user_client_table', 'users/partial_user_client_table'); $this->layout->buffer('modal_user_client', 'users/modal_user_client'); $this->layout->buffer('content', 'users/form'); $this->layout->render(); }
public function form($id = NULL) { if ($this->input->post('btn_cancel')) { redirect('users'); } if ($this->mdl_users->run_validation($id ? 'validation_rules_existing' : 'validation_rules')) { $id = $this->mdl_users->save($id); redirect('users'); } if ($id and !$this->input->post('btn_submit')) { if (!$this->mdl_users->prep_form($id)) { show_404(); } } $this->load->model('users/mdl_user_clients'); $this->load->model('clients/mdl_clients'); $this->load->helper('country'); $this->layout->set(array('id' => $id, 'user_types' => $this->mdl_users->user_types(), 'user_clients' => $this->mdl_user_clients->where('ip_user_clients.user_id', $id)->get()->result(), 'countries' => get_country_list(lang('cldr')), 'selected_country' => $this->mdl_users->form_value('user_country') ?: $this->mdl_settings->setting('default_country'))); $this->layout->buffer('user_client_table', 'users/partial_user_client_table'); $this->layout->buffer('modal_user_client', 'users/modal_user_client'); $this->layout->buffer('content', 'users/form'); $this->layout->render(); }
/** * Returns the countryname of a given $countrycode, , translated in the language $cldr * @param $cldr * @return mixed */ function get_country_name($cldr, $countrycode) { $countries = get_country_list($cldr); return isset($countries[$countrycode]) ? $countries[$countrycode] : $countrycode; }
<div class="add_bookfield"> <div class="loginfield "> <label>Zip/Postal Code</label> <input name="postcode" type="text" id="postcode" value="" class="logininput" style="width:98%;" /> </div> </div> <div class="add_bookfield" style="float:right;"> <div class="loginfield "> <label>Country</label> <span class="css4-metro-dropdown" style="width:100%;"> <select name="country"> <option class="" value="">Please Select Country</option> <?php foreach (get_country_list() as $key => $value) { ?> <option value="<?php echo $value['ctr_id']; ?> "><?php echo $value['ctr_country']; ?> </option> <?php } ?> </select> </span> </div> </div>
/** * Редактирование учетной записи пользователя * * @param int $user_id идентификатор учетной записи пользователя */ function userEdit($user_id) { global $AVE_DB, $AVE_Template; $user_id = (int) $user_id; switch ($_REQUEST['sub']) { case '': $row = $AVE_DB->Query("\r\n\t\t\t\t\tSELECT *\r\n\t\t\t\t\tFROM " . PREFIX . "_users\r\n\t\t\t\t\tWHERE Id = '" . $user_id . "'\r\n\t\t\t\t")->FetchRow(); if (!$row) { header('Location:index.php?do=user&cp=' . SESSION); exit; } $AVE_Template->assign('row', $row); $AVE_Template->assign('user_group_extra', explode(';', $row->user_group_extra)); if ($AVE_DB->Query("SHOW TABLES LIKE '" . PREFIX . "_modul_shop'")->GetCell()) { $AVE_Template->assign('is_shop', 1); } if ($AVE_DB->Query("SHOW TABLES LIKE '" . PREFIX . "_modul_forum_userprofile'")->GetCell()) { $row = $AVE_DB->Query("\r\n\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\tFROM " . PREFIX . "_modul_forum_userprofile\r\n\t\t\t\t\t\tWHERE uid = '" . $user_id . "'\r\n\t\t\t\t\t")->FetchRow(); if (is_object($row)) { $AVE_Template->assign('row_fp', $row); $AVE_Template->assign('is_forum', 1); } } $AVE_Template->assign('available_countries', get_country_list(1)); $AVE_Template->assign('ugroups', $this->userGroupListGet(2)); $AVE_Template->assign('formaction', 'index.php?do=user&action=edit&sub=save&cp=' . SESSION . '&Id=' . $user_id); $AVE_Template->assign('content', $AVE_Template->fetch('user/form.tpl')); break; case 'save': $errors = $this->_userFieldValidate(); if (!empty($errors)) { $AVE_Template->assign('errors', $errors); $AVE_Template->assign('available_countries', get_country_list(1)); $AVE_Template->assign('ugroups', $this->userGroupListGet(2)); $AVE_Template->assign('formaction', 'index.php?do=user&action=edit&sub=save&cp=' . SESSION . '&Id=' . $user_id); $AVE_Template->assign('content', $AVE_Template->fetch('user/form.tpl')); } else { if (!empty($_REQUEST['password'])) { $salt = make_random_string(); $password = md5(md5(trim($_POST['password']) . $salt)); $password_set = "password = '******', salt = '" . $salt . "',"; } else { $password_set = ''; } $user_group_set = $_SESSION['user_id'] != $user_id ? "user_group = '" . $_REQUEST['user_group'] . "'," : ''; $times = $_REQUEST['deleted'] == "1" ? time() : ''; $AVE_DB->Query("\r\n\t\t\t\t\t\tUPDATE " . PREFIX . "_users\r\n\t\t\t\t\t\tSET\r\n\t\t\t\t\t\t\t" . $password_set . "\r\n\t\t\t\t\t\t\t" . $user_group_set . "\r\n\t\t\t\t\t\t\temail = '" . $_REQUEST['email'] . "',\r\n\t\t\t\t\t\t\tstreet = '" . $_REQUEST['street'] . "',\r\n\t\t\t\t\t\t\tstreet_nr = '" . $_REQUEST['street_nr'] . "',\r\n\t\t\t\t\t\t\tzipcode = '" . $_REQUEST['zipcode'] . "',\r\n\t\t\t\t\t\t\tcity = '" . $_REQUEST['city'] . "',\r\n\t\t\t\t\t\t\tphone = '" . $_REQUEST['phone'] . "',\r\n\t\t\t\t\t\t\ttelefax = '" . $_REQUEST['telefax'] . "',\r\n\t\t\t\t\t\t\tdescription = '" . $_REQUEST['description'] . "',\r\n\t\t\t\t\t\t\tfirstname = '" . $_REQUEST['firstname'] . "',\r\n\t\t\t\t\t\t\tlastname = '" . $_REQUEST['lastname'] . "',\r\n\t\t\t\t\t\t\tuser_name = '" . $_REQUEST['user_name'] . "',\r\n\t\t\t\t\t\t\tstatus = '" . $_REQUEST['status'] . "',\r\n\t\t\t\t\t\t\tcountry = '" . $_REQUEST['country'] . "',\r\n\t\t\t\t\t\t\tbirthday = '" . $_REQUEST['birthday'] . "',\r\n\t\t\t\t\t\t\tdeleted = '" . $_REQUEST['deleted'] . "',\r\n\t\t\t\t\t\t\tdel_time = '" . $times . "',\r\n\t\t\t\t\t\t\ttaxpay = '" . $_REQUEST['taxpay'] . "',\r\n\t\t\t\t\t\t\tcompany = '" . $_REQUEST['company'] . "',\r\n\t\t\t\t\t\t\tuser_group_extra = '" . @implode(';', $_REQUEST['user_group_extra']) . "'\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\tId = '" . $user_id . "'\r\n\t\t\t\t\t"); if ($AVE_DB->Query("SHOW TABLES LIKE '" . PREFIX . "_modul_forum_userprofile'")->GetCell()) { $AVE_DB->Query("\r\n\t\t\t\t\t\t\tUPDATE " . PREFIX . "_modul_forum_userprofile\r\n\t\t\t\t\t\t\tSET\r\n\t\t\t\t\t\t\t\tgroup_id_misc = '" . @implode(';', $_REQUEST['user_group_extra']) . "',\r\n\t\t\t\t\t\t\t\tuname = '" . @$_REQUEST['uname_fp'] . "',\r\n\t\t\t\t\t\t\t\tsignature = '" . @$_REQUEST['signature_fp'] . "' ,\r\n\t\t\t\t\t\t\t\tavatar = '" . @$_REQUEST['avatar_fp'] . "'\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tuid = '" . $user_id . "'\r\n\t\t\t\t\t\t"); } if ($_REQUEST['status'] == 1 && @$_REQUEST['SendFreeMail'] == 1) { $host = HOST . ABS_PATH; $body_start = $AVE_Template->get_config_vars('USER_MAIL_BODY1'); $body_start = str_replace('%USER%', $_REQUEST['user_name'], $body_start); $body_start .= str_replace('%HOST%', $host, $AVE_Template->get_config_vars('USER_MAIL_BODY2')); $body_start .= str_replace('%HOMEPAGENAME%', get_settings('site_name'), $AVE_Template->get_config_vars('USER_MAIL_FOOTER')); $body_start = str_replace('%N%', "\n", $body_start); $body_start = str_replace('%HOST%', $host, $body_start); send_mail($_POST['email'], $body_start, $AVE_Template->get_config_vars('USER_MAIL_SUBJECT'), get_settings('mail_from'), get_settings('mail_from_name') . ' (' . get_settings('site_name') . ')', 'text'); } if (!empty($_REQUEST['password']) && $_REQUEST['PassChange'] == 1) { $host = HOST . ABS_PATH; $body_start = $AVE_Template->get_config_vars('USER_MAIL_BODY1'); $body_start = str_replace('%USER%', $_REQUEST['user_name'], $body_start); $body_start .= str_replace('%HOST%', $host, $AVE_Template->get_config_vars('USER_MAIL_PASSWORD2')); $body_start = str_replace('%NEWPASS%', $_REQUEST['password'], $body_start); $body_start .= str_replace('%HOMEPAGENAME%', get_settings('site_name'), $AVE_Template->get_config_vars('USER_MAIL_FOOTER')); $body_start = str_replace('%N%', "\n", $body_start); $body_start = str_replace('%HOST%', $host, $body_start); send_mail($_POST['email'], $body_start, $AVE_Template->get_config_vars('USER_MAIL_PASSWORD'), get_settings('mail_from'), get_settings('mail_from_name') . ' (' . get_settings('site_name') . ')', 'text'); } if ($_REQUEST['SimpleMessage'] != '') { send_mail($_POST['email'], stripslashes($_POST['SimpleMessage']), stripslashes($_POST['SubjectMessage']), $_SESSION['user_email'], $_SESSION['user_name'], 'text'); } if (!empty($_REQUEST['password']) && $_SESSION['user_id'] == $user_id) { $_SESSION['user_pass'] = $password; $_SESSION['user_email'] = $_POST['email']; } reportLog($_SESSION['user_name'] . ' - Отредактировал параметры пользователя (' . stripslashes($_POST['user_name']) . ')', 2, 2); header('Location:index.php?do=user&cp=' . SESSION); exit; } break; } }
public function index() { if ($this->input->post('settings')) { $settings = $this->input->post('settings'); // Only execute if the setting is different if ($settings['tax_rate_decimal_places'] != $this->mdl_settings->setting('tax_rate_decimal_places')) { $this->db->query("ALTER TABLE `ip_tax_rates` CHANGE `tax_rate_percent` `tax_rate_percent` DECIMAL( 5, {$settings['tax_rate_decimal_places']} ) NOT NULL"); } // Save the submitted settings foreach ($settings as $key => $value) { // Don't save empty passwords if ($key == 'smtp_password' or $key == 'merchant_password') { if ($value != '') { $this->load->library('encrypt'); $this->mdl_settings->save($key, $this->encrypt->encode($value)); } } else { $this->mdl_settings->save($key, $value); } } $upload_config = array('upload_path' => './uploads/', 'allowed_types' => 'gif|jpg|png|svg', 'max_size' => '9999', 'max_width' => '9999', 'max_height' => '9999'); // Check for invoice logo upload if ($_FILES['invoice_logo']['name']) { $this->load->library('upload', $upload_config); if (!$this->upload->do_upload('invoice_logo')) { $this->session->set_flashdata('alert_error', $this->upload->display_errors()); redirect('settings'); } $upload_data = $this->upload->data(); $this->mdl_settings->save('invoice_logo', $upload_data['file_name']); } // Check for login logo upload if ($_FILES['login_logo']['name']) { $this->load->library('upload', $upload_config); if (!$this->upload->do_upload('login_logo')) { $this->session->set_flashdata('alert_error', $this->upload->display_errors()); redirect('settings'); } $upload_data = $this->upload->data(); $this->mdl_settings->save('login_logo', $upload_data['file_name']); } $this->session->set_flashdata('alert_success', lang('settings_successfully_saved')); redirect('settings'); } // Load required resources $this->load->model('invoice_groups/mdl_invoice_groups'); $this->load->model('tax_rates/mdl_tax_rates'); $this->load->model('email_templates/mdl_email_templates'); $this->load->model('settings/mdl_versions'); $this->load->model('payment_methods/mdl_payment_methods'); $this->load->model('invoices/mdl_templates'); $this->load->helper('directory'); $this->load->helper('country'); $this->load->library('merchant'); // Collect the list of templates $pdf_invoice_templates = $this->mdl_templates->get_invoice_templates('pdf'); $public_invoice_templates = $this->mdl_templates->get_invoice_templates('public'); $pdf_quote_templates = $this->mdl_templates->get_quote_templates('pdf'); $public_quote_templates = $this->mdl_templates->get_quote_templates('public'); // Collect the list of languages $languages = directory_map(APPPATH . 'language', TRUE); sort($languages); // Get the current version $current_version = $this->mdl_versions->limit(1)->where('version_sql_errors', 0)->get()->row()->version_file; $current_version = str_replace('.sql', '', substr($current_version, strpos($current_version, '_') + 1)); // Set data in the layout $this->layout->set(array('invoice_groups' => $this->mdl_invoice_groups->get()->result(), 'tax_rates' => $this->mdl_tax_rates->get()->result(), 'payment_methods' => $this->mdl_payment_methods->get()->result(), 'public_invoice_templates' => $public_invoice_templates, 'pdf_invoice_templates' => $pdf_invoice_templates, 'public_quote_templates' => $public_quote_templates, 'pdf_quote_templates' => $pdf_quote_templates, 'languages' => $languages, 'countries' => get_country_list(lang('cldr')), 'date_formats' => date_formats(), 'current_date' => new DateTime(), 'email_templates_quote' => $this->mdl_email_templates->where('email_template_type', 'quote')->get()->result(), 'email_templates_invoice' => $this->mdl_email_templates->where('email_template_type', 'invoice')->get()->result(), 'merchant_drivers' => $this->merchant->valid_drivers(), 'merchant_currency_codes' => Merchant::$NUMERIC_CURRENCY_CODES, 'current_version' => $current_version, 'first_days_of_weeks' => array("0" => lang("sunday"), "1" => lang("monday")))); $this->layout->buffer('content', 'settings/index'); $this->layout->render(); }
</label> <input type="text" name="location" id="location"value="<?php echo htmlentities($user_data['location']); ?> " required> </div> <div class="pure-control-group"> <label for="country"><?php echo __('Country:'); ?> </label> <select name="country" required style="padding: 2px;"> <?php load_helper('country_list'); $countries = get_country_list(); foreach ($countries as $code => $name) { if ($user_data['country'] == $code) { $selected = 'selected'; } else { $selected = ''; } ?> <option value="<?php echo $code; ?> " <?php echo $selected; ?> ><?php echo $name;
/** * Управление учетной записью пользователя * */ function loginUserProfileEdit() { global $AVE_DB, $AVE_Template; if (!isset($_SESSION['user_id']) || !isset($_SESSION['user_pass'])) { header('Location:' . get_home_link()); exit; } $AVE_Template->config_load($this->_lang_file, 'myprofile'); define('MODULE_SITE', $AVE_Template->get_config_vars('LOGIN_CHANGE_DETAILS')); if (isset($_REQUEST['sub']) && $_REQUEST['sub'] == 'update') { $errors = array(); if ($this->_loginFieldIsRequired('login_require_firstname') && empty($_POST['firstname'])) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_FN_EMPTY'); } if (preg_match($this->_regex, $_POST['firstname'])) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_FIRSTNAME'); } if ($this->_loginFieldIsRequired('login_require_lastname') && empty($_POST['lastname'])) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_LN_EMPTY'); } if (preg_match($this->_regex, $_POST['lastname'])) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_LASTNAME'); } if (!empty($_POST['street']) && preg_match($this->_regex, $_POST['street'])) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_STREET'); } if (!empty($_POST['street_nr']) && preg_match($this->_regex, $_POST['street_nr'])) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_HOUSE'); } if (!empty($_POST['zipcode']) && preg_match($this->_regex, $_POST['zipcode'])) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_ZIP'); } if (!empty($_POST['city']) && preg_match($this->_regex, $_POST['city'])) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_TOWN'); } if (!empty($_POST['phone']) && preg_match($this->_regex, $_POST['phone'])) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_PHONE'); } if (!empty($_POST['telefax']) && preg_match($this->_regex, $_POST['telefax'])) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_FAX'); } if (!preg_match($this->_regex_email, $_POST['email'])) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_EMAIL'); } else { $exist = $AVE_DB->Query("\r\n\t\t\t\t\tSELECT 1\r\n\t\t\t\t\tFROM " . PREFIX . "_users\r\n\t\t\t\t\tWHERE Id != '" . (int) $_SESSION['user_id'] . "'\r\n\t\t\t\t\tAND email = '" . $_POST['email'] . "'\r\n\t\t\t\t")->NumRows(); if ($exist) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_INUSE'); } } if (!empty($_POST['birthday']) && !preg_match($this->_regex_geb, $_POST['birthday'])) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_BIRTHDAY'); } if (!empty($_POST['birthday'])) { $birthday = preg_split('/[[:punct:]| ]/', $_POST['birthday']); if (empty($birthday[0]) || $birthday[0] > 31) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_DATE'); } if (empty($birthday[1]) || $birthday[1] > 12) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_MONTH'); } if (empty($birthday[2]) || $birthday[2] > date("Y") || $birthday[2] < date("Y") - 100) { $errors[] = $AVE_Template->get_config_vars('LOGIN_WRONG_YEAR'); } if (empty($errors)) { $_POST['birthday'] = $birthday[0] . '.' . $birthday[1] . '.' . $birthday[2]; } } if (!empty($errors)) { $AVE_Template->assign('errors', $errors); } else { $AVE_DB->Query("\r\n\t\t\t\t\tUPDATE " . PREFIX . "_users\r\n\t\t\t\t\tSET\r\n\t\t\t\t\t\temail = '" . $_POST['email'] . "',\r\n\t\t\t\t\t\tstreet = '" . $_POST['street'] . "',\r\n\t\t\t\t\t\tstreet_nr = '" . $_POST['street_nr'] . "',\r\n\t\t\t\t\t\tzipcode = '" . $_POST['zipcode'] . "',\r\n\t\t\t\t\t\tcity = '" . $_POST['city'] . "',\r\n\t\t\t\t\t\tphone = '" . $_POST['phone'] . "',\r\n\t\t\t\t\t\ttelefax = '" . $_POST['telefax'] . "',\r\n\t\t\t\t\t\tfirstname = '" . $_POST['firstname'] . "',\r\n\t\t\t\t\t\tlastname = '" . $_POST['lastname'] . "',\r\n\t\t\t\t\t\tcountry = '" . $_POST['country'] . "',\r\n\t\t\t\t\t\tbirthday = '" . $_POST['birthday'] . "',\r\n\t\t\t\t\t\tcompany = '" . $_POST['company'] . "'\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tId = '" . (int) $_SESSION['user_id'] . "'\r\n\t\t\t\t\tAND\r\n\t\t\t\t\t\tpassword = '******'user_pass']) . "'\r\n\t\t\t\t"); $AVE_Template->assign('password_changed', 1); } } $row = $AVE_DB->Query("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . PREFIX . "_users\r\n\t\t\tWHERE Id = '" . (int) $_SESSION['user_id'] . "'\r\n\t\t\tLIMIT 1\r\n\t\t")->FetchAssocArray(); $AVE_Template->assign('available_countries', get_country_list(1)); $AVE_Template->assign('row', $row); $this->_loginRequiredFieldFetch(); define('MODULE_CONTENT', $AVE_Template->fetch($this->_tpl_dir . 'myprofile.tpl')); }
</td> </tr> <tr align="center"> <td> <table width="58%"> <tr> <td> Select Country </td> <td> <select name="country"> <?php echo get_country_list($_POST['country']); ?> </select> </td> </tr> <tr><td><br></td></tr> <tr> <td> Select Language </td> <td> <select name="language"> <?php echo get_language_list($_POST['language']);
function checkOut() { global $AVE_DB, $AVE_Template; if (!isset($_SESSION['Product']) || count($_SESSION['Product']) < 1) { header('Location:' . $this->_shopRewrite($this->_link_start)); exit; } $checkoutinfo = false; $orderok = false; // Formular auf fehlende Angaben ьberprьfen if (isset($_REQUEST['send']) && $_REQUEST['send'] == 1) { $errors = array(); if (empty($_POST['billing_firstname'])) { array_push($errors, $GLOBALS['mod']['config_vars']['Errors_NoFirstName']); } if (empty($_POST['billing_lastname'])) { array_push($errors, $GLOBALS['mod']['config_vars']['Errors_NoLastName']); } if (empty($_POST['billing_street'])) { array_push($errors, $GLOBALS['mod']['config_vars']['Errors_NoStreet']); } if (empty($_POST['billing_streetnumber'])) { array_push($errors, $GLOBALS['mod']['config_vars']['Errors_NoStreetNr']); } if (empty($_POST['billing_zip']) || !preg_match('/^[0-9]{5}$/', $_POST['billing_zip']) && $_POST['country'] == 'DE') { array_push($errors, $GLOBALS['mod']['config_vars']['Errors_NoZip']); } if (empty($_POST['billing_town'])) { array_push($errors, $GLOBALS['mod']['config_vars']['Errors_NoTown']); } $regex_email = '/^[\\w.-]+@[a-z0-9.-]+\\.(?:[a-z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)$/i'; if (empty($_POST['OrderEmail']) || !@preg_match($regex_email, chop($_POST['OrderEmail']))) { array_push($errors, $GLOBALS['mod']['config_vars']['Errors_NoEmail']); } // if (empty($_POST['OrderPhone'])) array_push($errors, $GLOBALS['mod']['config_vars']['Errors_NoOrderPhone']); // Formularwerte in Session schreiben if (isset($_POST['OrderEmail'])) { $_SESSION['OrderEmail'] = chop($_POST['OrderEmail']); } if (isset($_POST['OrderPhone'])) { $_SESSION['OrderPhone'] = $_POST['OrderPhone']; } if (isset($_POST['billing_company'])) { $_SESSION['billing_company'] = stripslashes($_POST['billing_company']); } if (isset($_POST['billing_company_reciever'])) { $_SESSION['billing_company_reciever'] = stripslashes($_POST['billing_company_reciever']); } if (isset($_POST['billing_firstname'])) { $_SESSION['billing_firstname'] = stripslashes($_POST['billing_firstname']); } if (isset($_POST['billing_lastname'])) { $_SESSION['billing_lastname'] = stripslashes($_POST['billing_lastname']); } if (isset($_POST['billing_street'])) { $_SESSION['billing_street'] = stripslashes($_POST['billing_street']); } if (isset($_POST['billing_streetnumber'])) { $_SESSION['billing_streetnumber'] = stripslashes($_POST['billing_streetnumber']); } if (isset($_POST['billing_zip'])) { $_SESSION['billing_zip'] = stripslashes($_POST['billing_zip']); } if (isset($_POST['billing_town'])) { $_SESSION['billing_town'] = stripslashes($_POST['billing_town']); } if (isset($_POST['country'])) { $_SESSION['billing_country'] = stripslashes($_POST['country']); } // Formularwerte (Rechnungsadresse) if (isset($_POST['shipping_company'])) { $_SESSION['shipping_company'] = stripslashes($_POST['shipping_company']); } if (isset($_POST['shipping_company_reciever'])) { $_SESSION['shipping_company_reciever'] = stripslashes($_POST['shipping_company_reciever']); } if (isset($_POST['shipping_firstname'])) { $_SESSION['shipping_firstname'] = stripslashes($_POST['shipping_firstname']); } if (isset($_POST['shipping_lastname'])) { $_SESSION['shipping_lastname'] = stripslashes($_POST['shipping_lastname']); } if (isset($_POST['shipping_street'])) { $_SESSION['shipping_street'] = stripslashes($_POST['shipping_street']); } if (isset($_POST['shipping_streetnumber'])) { $_SESSION['shipping_streetnumber'] = stripslashes($_POST['shipping_streetnumber']); } if (isset($_POST['shipping_zip'])) { $_SESSION['shipping_zip'] = stripslashes($_POST['shipping_zip']); } if (isset($_POST['shipping_city'])) { $_SESSION['shipping_city'] = stripslashes($_POST['shipping_city']); } // Es sind Fehler vorhanden. Benutzer wird zurьck geleitet! if (count($errors) > 0) { $errors = str_replace('+', '_', urlencode(base64_encode(serialize($errors)))); header('Location:' . $this->_link_create_account . $_REQUEST['create_account'] . '&errors=' . $errors); exit; } } // Wenn kein Artikel im Warenkorb liegt, zum Shop weiterleiten if (!isset($_SESSION['Product'])) { header('Location:' . $this->_shopRewrite($this->_link_start)); exit; } // Alles ausgefьllt... if (isset($_REQUEST['zusammenfassung']) && $_REQUEST['zusammenfassung'] == 1) { if (!empty($_SESSION['ShipperId']) && !empty($_SESSION['PaymentId'])) { // Bestellung zusammenfassen udn weiterleiten... $checkoutinfo = true; } else { header('Location:' . $this->_shopRewrite($this->_link_start)); exit; } } $this->_globalProductInfo(); $create_account = true; if (!empty($_REQUEST['ShipperId'])) { $_SESSION['ShipperId'] = $_REQUEST['ShipperId']; } if (isset($_REQUEST['create_account']) && $_REQUEST['create_account'] == 'no') { $create_account = false; } if (!isset($_SESSION['user_id']) && $create_account == true) { if (isset($_POST['do']) && $_POST['do'] == 'login') { $this->_loginProcess(); } $tpl_out = $AVE_Template->fetch($GLOBALS['mod']['tpl_dir'] . $this->_shop_checkout_tpl); $tpl_out = $this->_shopRewrite($tpl_out); define('MODULE_CONTENT', $tpl_out); define('MODULE_SITE', $GLOBALS['mod']['config_vars']['PageName'] . $GLOBALS['mod']['config_vars']['PageSep'] . $GLOBALS['mod']['config_vars']['ShopPaySite']); } else { //======================================================= // Liefer & Versandadresse //======================================================= if (!empty($_POST['country'])) { $AVE_Template->assign('showShipper', $this->_showShipper($_POST['country'])); $_SESSION['IsShipper'] = 1; } if (isset($_SESSION['ShipperId'])) { $_POST['ShipperId'] = $_SESSION['ShipperId']; } if (!empty($_POST['ShipperId'])) { $_SESSION['ShipperId'] = $_POST['ShipperId'][0]; $sql_su = $AVE_DB->Query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tKeineKosten,\r\n\t\t\t\t\t\tPauschalkosten\r\n\t\t\t\t\tFROM " . PREFIX . "_modul_shop_versandarten\r\n\t\t\t\t\tWHERE Id = '" . $_SESSION['ShipperId'] . "'\r\n\t\t\t\t"); $row_su = $sql_su->FetchRow(); $VersFrei = $this->_getShopSetting('VersFrei'); $VersFreiBetrag = $this->_getShopSetting('VersFreiBetrag'); //@$_SESSION['BasketSumm'] = ($VersFrei == 1 && $_SESSION['BasketSumm'] >= $VersFreiBetrag) ? '0.00' : ($row_su->KeineKosten != 1 && $row_su->Pauschalkosten > 0) ? $_SESSION['BasketSumm'] + $row_su->Pauschalkosten : $_SESSION['BasketSumm'] = $_SESSION['BasketSumm'] + $this->_shipperSumm(@$_POST['country'],$_SESSION['ShipperId']); // Endsumme if ($VersFrei == 1 && $_SESSION['BasketSumm'] >= $VersFreiBetrag) { // @$_SESSION['BasketSumm'] = @$_SESSION['BasketSumm']; } elseif ($row_su->KeineKosten != 1 && $row_su->Pauschalkosten > 0) { // Pauschale Versandkosten @($_SESSION['BasketSumm'] += $row_su->Pauschalkosten); } else { @($_SESSION['BasketSumm'] += $this->_shipperSumm(@$_POST['country'], $_SESSION['ShipperId'])); } if ($VersFrei == 1 && $_SESSION['BasketSumm'] >= $VersFreiBetrag) { @($_SESSION['ShippingSumm'] = 0); } elseif ($row_su->KeineKosten != 1 && $row_su->Pauschalkosten > 0) { @($_SESSION['ShippingSumm'] = $row_su->Pauschalkosten); } else { @($_SESSION['ShippingSumm'] = $this->_shipperSumm(@$_POST['country'], $_SESSION['ShipperId'])); } @($_SESSION['ShippingSummOut'] = @$_SESSION['ShippingSumm']); } // Preisberechnung if (!isset($_POST['PaymentId']) && isset($_SESSION['PaymentId'])) { $_POST['PaymentId'][0] = $_SESSION['PaymentId']; } if (!empty($_POST['PaymentId'])) { $_SESSION['PaymentId'] = $_POST['PaymentId'][0]; $row = $AVE_DB->Query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tKosten,\r\n\t\t\t\t\t\tKostenOperant\r\n\t\t\t\t\tFROM " . PREFIX . "_modul_shop_zahlungsmethoden\r\n\t\t\t\t\tWHERE Id = '" . $_SESSION['PaymentId'] . "'\r\n\t\t\t\t")->FetchRow(); $Kosten = $_SESSION['BasketSumm']; $PluMin = mb_substr($row->Kosten, 0, 1); switch ($PluMin) { case '-': $row->Kosten = str_replace('-', '', $row->Kosten); $Kosten = $row->KostenOperant == '%' ? $_SESSION['BasketSumm'] - $_SESSION['BasketSumm'] / 100 * $row->Kosten : $_SESSION['BasketSumm'] - $row->Kosten; $KostenZahlungOp = $row->KostenOperant == '%' ? '%' : $this->_getShopSetting('WaehrungSymbol'); $_SESSION['KostenZahlung'] = '- ' . $row->Kosten . ' ' . $KostenZahlungOp; $_SESSION['KostenZahlungOut'] = $row->KostenOperant == '%' ? $row->Kosten : $row->Kosten; $_SESSION['KostenZahlungPM'] = '-'; break; case '': case '+': default: $row->Kosten = str_replace('+', '', $row->Kosten); $Kosten = $row->KostenOperant == '%' ? $_SESSION['BasketSumm'] + $_SESSION['BasketSumm'] / 100 * $row->Kosten : $_SESSION['BasketSumm'] + $row->Kosten; $KostenZahlungOp = $row->KostenOperant == '%' ? '%' : $this->_getShopSetting('WaehrungSymbol'); $_SESSION['KostenZahlung'] = $row->Kosten . ' ' . $KostenZahlungOp; $_SESSION['KostenZahlungOut'] = $row->KostenOperant == '%' ? $row->Kosten : $row->Kosten; $_SESSION['KostenZahlungPM'] = '+'; break; } $_SESSION['BasketSumm'] = $Kosten; $_SESSION['KostenZahlungSymbol'] = $KostenZahlungOp; } if (!empty($_SESSION['user_id'])) { $row = $AVE_DB->Query("\r\n\t\t\t\t\tSELECT *\r\n\t\t\t\t\tFROM " . PREFIX . "_users\r\n\t\t\t\t\tWHERE Id = '" . $_SESSION['user_id'] . "'\r\n\t\t\t\t")->FetchRow(); $AVE_Template->assign('row', $row); } $AVE_Template->assign('shippingCountries', explode(',', $this->_getShopSetting('VersandLaender'))); $AVE_Template->assign('Endsumme', $_SESSION['BasketSumm']); $AVE_Template->assign('available_countries', get_country_list(1)); $AVE_Template->assign('PaymentMethods', $this->_showPaymentMethods()); if (!empty($_REQUEST['errors'])) { $AVE_Template->assign('errors', unserialize(base64_decode(str_replace('_', '+', $_REQUEST['errors'])))); } // Zusammenfassung if ($checkoutinfo == true) { // Проверка принятия лицензионного соглашения if (isset($_REQUEST['sendorder']) && $_REQUEST['sendorder'] == 1 && isset($_REQUEST['agb_accept']) && $_REQUEST['agb_accept'] == 1) { $orderok = true; } else { $AVE_Template->assign('NoAGB', 1); $orderok = false; } // Отказ от использования куппона на скидку if (isset($_POST['couponcode_del']) && $_POST['couponcode_del'] == 1 && $this->_getShopSetting('GutscheinCodes') == 1) { unset($_SESSION['CouponCode']); unset($_SESSION['CouponCodeId']); $AVE_Template->assign('NoAGB', 0); } // Обработка введённого номера куппона на скидку if (!empty($_REQUEST['couponcode']) && $this->_getShopSetting('GutscheinCodes') == 1) { $use_coupon = true; $row_cc = $AVE_DB->Query("\r\n\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\tFROM " . PREFIX . "_modul_shop_gutscheine\r\n\t\t\t\t\t\tWHERE Code = '" . chop($_POST['couponcode']) . "'\r\n\t\t\t\t\t")->FetchRow(); if (is_object($row_cc) && $row_cc->Prozent != '' && $row_cc->Prozent < 100) { $Benutzer = explode(',', $row_cc->Benutzer); if (!empty($_SESSION['user_id']) && in_array($_SESSION['user_id'], $Benutzer)) { $use_coupon = false; } if ($_SESSION['user_group'] == 2 && $row_cc->AlleBenutzer != 1) { $use_coupon = false; } if ($row_cc->GueltigVon > time()) { $use_coupon = false; } if ($row_cc->GueltigBis < time()) { $use_coupon = false; } if ($use_coupon == true) { $_SESSION['CouponCode'] = $row_cc->Prozent; $_SESSION['CouponCodeId'] = $row_cc->Id; $_SESSION['BasketSumm'] = $_SESSION['BasketSumm'] - $_SESSION['Zwisumm'] / 100 * $row_cc->Prozent; } } $AVE_Template->assign('NoAGB', 0); } $AVE_Template->assign('AGB', $this->_getShopSetting('Agb')); $AVE_Template->assign('step', 2); $AVE_Template->assign('ShipperName', $this->_fetchShipper($_SESSION['ShipperId'])); $AVE_Template->assign('PaymentMethod', $this->_showPaymentMethod($_SESSION['PaymentId'])); $AVE_Template->assign('PaymentOverall', $_SESSION['BasketSumm']); $AVE_Template->assign('PaymentOverall2', defined('Waehrung2Multi') ? $_SESSION['BasketSumm'] * @Waehrung2Multi : ''); if ($orderok == true) { $EmpEmail = $this->_getShopSetting('EmpEmail'); if ($EmpEmail == '') { $EmpEmail = get_settings('mail_from'); if ($EmpEmail == '') { reportLog($GLOBALS['mod']['config_vars']['EmpEmailNotSet']); } else { reportLog($GLOBALS['mod']['config_vars']['EmpEmailEmpty']); } } $AbsEmail = $this->_getShopSetting('AbsEmail'); if ($AbsEmail == '') { reportLog($GLOBALS['mod']['config_vars']['AbsEmailEmpty']); } $AbsName = $this->_getShopSetting('AbsName'); if ($AbsName == '') { reportLog($GLOBALS['mod']['config_vars']['FromNameEmpty']); } // $transId = 'CPE_' . $this->_transId(12) . '_' . date('dmy'); $transId = $this->_transId() . date('dmy'); $_SESSION['TransId'] = $transId; //echo $_REQUEST['create_account']; $AVE_DB->Query("\r\n\t\t\t\t\t\tINSERT INTO " . PREFIX . "_modul_shop_bestellungen\r\n\t\t\t\t\t\tSET\r\n\t\t\t\t\t\t\tBenutzer = '" . (isset($_SESSION['user_id']) ? $_SESSION['user_id'] : $_SESSION['OrderEmail']) . "',\r\n\t\t\t\t\t\t\tTransId = '" . $transId . "',\r\n\t\t\t\t\t\t\tDatum = '" . time() . "',\r\n\t\t\t\t\t\t\tGesamt = '" . str_replace(',', '.', $_SESSION['BasketSumm']) . "',\r\n\t\t\t\t\t\t\tUSt = '',\r\n\t\t\t\t\t\t\tArtikel = '" . (!empty($_SESSION['Product']) ? serialize($_SESSION['Product']) : '') . "',\r\n\t\t\t\t\t\t\tArtikel_Vars = '" . (!empty($_SESSION['ProductVar']) ? serialize($_SESSION['ProductVar']) : '') . "',\r\n\t\t\t\t\t\t\tRechnungText = '',\r\n\t\t\t\t\t\t\tRechnungHtml = '',\r\n\t\t\t\t\t\t\tNachrichtBenutzer = '" . nl2br($_POST['Msg']) . "',\r\n\t\t\t\t\t\t\tIp = '" . $_SERVER['REMOTE_ADDR'] . "',\r\n\t\t\t\t\t\t\tZahlungsId = '" . $_SESSION['PaymentId'] . "',\r\n\t\t\t\t\t\t\tVersandId = '" . $_SESSION['ShipperId'] . "',\r\n\t\t\t\t\t\t\tKamVon = '" . (isset($_SESSION['Referer']) ? $_SESSION['Referer'] : '') . "',\r\n\t\t\t\t\t\t\tGutscheincode = '" . (isset($_SESSION['CouponCodeId']) ? $_SESSION['CouponCodeId'] : '') . "',\r\n\t\t\t\t\t\t\tBestell_Email = '" . $_SESSION['OrderEmail'] . "',\r\n\t\t\t\t\t\t\tLiefer_Firma = '" . addslashes(isset($_SESSION['billing_company']) ? $_SESSION['billing_company'] : '') . "',\r\n\t\t\t\t\t\t\tLiefer_Abteilung = '" . addslashes(isset($_SESSION['billing_company_reciever']) ? $_SESSION['billing_company_reciever'] : '') . "',\r\n\t\t\t\t\t\t\tLiefer_Vorname = '" . addslashes($_SESSION['billing_firstname']) . "',\r\n\t\t\t\t\t\t\tLiefer_Nachname = '" . addslashes($_SESSION['billing_lastname']) . "',\r\n\t\t\t\t\t\t\tLiefer_Strasse = '" . addslashes($_SESSION['billing_street']) . "',\r\n\t\t\t\t\t\t\tLiefer_Hnr = '" . addslashes($_SESSION['billing_streetnumber']) . "',\r\n\t\t\t\t\t\t\tLiefer_PLZ = '" . addslashes($_SESSION['billing_zip']) . "',\r\n\t\t\t\t\t\t\tLiefer_Ort = '" . addslashes($_SESSION['billing_town']) . "',\r\n\t\t\t\t\t\t\tLiefer_Land = '" . (!empty($_POST['country']) ? $_POST['country'] : '') . "',\r\n\t\t\t\t\t\t\tRech_Firma = '" . addslashes(!empty($_SESSION['shipping_company']) ? $_SESSION['shipping_company'] : (!empty($_SESSION['billing_company']) ? $_SESSION['billing_company'] : '')) . "',\r\n\t\t\t\t\t\t\tRech_Abteilung = '" . addslashes(!empty($_SESSION['shipping_company_reciever']) ? $_SESSION['shipping_company_reciever'] : (!empty($_SESSION['billing_company_reciever']) ? $_SESSION['billing_company_reciever'] : '')) . "',\r\n\t\t\t\t\t\t\tRech_Vorname = '" . addslashes(!empty($_SESSION['shipping_firstname']) ? $_SESSION['shipping_firstname'] : $_SESSION['billing_firstname']) . "',\r\n\t\t\t\t\t\t\tRech_Nachname = '" . addslashes(!empty($_SESSION['shipping_lastname']) ? $_SESSION['shipping_lastname'] : $_SESSION['billing_lastname']) . "',\r\n\t\t\t\t\t\t\tRech_Strasse = '" . addslashes(!empty($_SESSION['shipping_street']) ? $_SESSION['shipping_street'] : $_SESSION['billing_street']) . "',\r\n\t\t\t\t\t\t\tRech_Hnr = '" . addslashes(!empty($_SESSION['shipping_streetnumber']) ? $_SESSION['shipping_streetnumber'] : $_SESSION['billing_streetnumber']) . "',\r\n\t\t\t\t\t\t\tRech_PLZ = '" . addslashes(!empty($_SESSION['shipping_zip']) ? $_SESSION['shipping_zip'] : $_SESSION['billing_zip']) . "',\r\n\t\t\t\t\t\t\tRech_Ort = '" . addslashes(!empty($_SESSION['shipping_city']) ? $_SESSION['shipping_city'] : $_SESSION['billing_town']) . "',\r\n\t\t\t\t\t\t\tRech_Land = '" . (!empty($_POST['RLand']) ? $_POST['RLand'] : '') . "'\r\n\t\t\t\t\t"); $OrderId = $AVE_DB->insertid(); // TransId in Gutscheine eintragen if (!empty($_SESSION['CouponCode'])) { $row_cc = $AVE_DB->Query("\r\n\t\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\t\tFROM " . PREFIX . "_modul_shop_gutscheine\r\n\t\t\t\t\t\t\tWHERE Id = '" . $_SESSION['CouponCodeId'] . "'\r\n\t\t\t\t\t\t")->FetchRow(); $AVE_DB->Query("\r\n\t\t\t\t\t\t\tUPDATE " . PREFIX . "_modul_shop_gutscheine\r\n\t\t\t\t\t\t\tSET BestellId = CONCAT(BestellId, ',', '" . $OrderId . "')\r\n\t\t\t\t\t\t\tWHERE Id = '" . $_SESSION['CouponCodeId'] . "'\r\n\t\t\t\t\t\t"); if (!empty($_SESSION['user_id'])) { $AVE_DB->Query("\r\n\t\t\t\t\t\t\t\tUPDATE " . PREFIX . "_modul_shop_gutscheine\r\n\t\t\t\t\t\t\t\tSET Benutzer = CONCAT(Benutzer, ',', '" . $_SESSION['user_id'] . "')\r\n\t\t\t\t\t\t\t\tWHERE Id = '" . $_SESSION['CouponCodeId'] . "'\r\n\t\t\t\t\t\t\t"); } if ($row_cc->Mehrfach != 1) { $AVE_DB->Query("\r\n\t\t\t\t\t\t\t\tUPDATE " . PREFIX . "_modul_shop_gutscheine\r\n\t\t\t\t\t\t\t\tSET Eingeloest = 1\r\n\t\t\t\t\t\t\t\tWHERE Id = '" . $_SESSION['CouponCodeId'] . "'\r\n\t\t\t\t\t\t\t"); } } // Anzahl der Kдufe im Artikel erhцhen $arr = $_SESSION['Product']; foreach ($arr as $key => $value) { $AVE_DB->Query("\r\n\t\t\t\t\t\t\tUPDATE " . PREFIX . "_modul_shop_artikel\r\n\t\t\t\t\t\t\tSET Bestellungen = Bestellungen+" . $value . "\r\n\t\t\t\t\t\t\tWHERE Id = '" . $key . "'\r\n\t\t\t\t\t\t"); } $AVE_Template->assign('PaymentText', $this->_getShopSetting('EmailFormat') == 'html' ? $this->_getPaymentText($_SESSION['PaymentId']) : strip_tags($this->_getPaymentText($_SESSION['PaymentId']))); $AVE_Template->assign('TransCode', $transId); $AVE_Template->assign('CompanyHeadText', $this->_getShopSetting('AdresseText')); $AVE_Template->assign('CompanyHeadHtml', $this->_getShopSetting('AdresseHTML')); $AVE_Template->assign('CompanyLogo', $this->_getShopSetting('Logo')); $AVE_Template->assign('OrderId', $OrderId); $AVE_Template->assign('OrderTime', time()); $AVE_Template->assign('VatZones', $this->_showVatZones()); // формируем тексты копии заказа в форматах HTML и Text $mail_html = $AVE_Template->fetch($GLOBALS['mod']['tpl_dir'] . $this->_shop_orderconfirm_html_tpl); $mail_text = $AVE_Template->fetch($GLOBALS['mod']['tpl_dir'] . $this->_shop_orderconfirm_text_tpl); $mail_text = $this->_textReplace($mail_text); $AVE_Template->assign('innerhtml', htmlspecialchars($mail_html)); $BetreffBest = $this->_getShopSetting('BetreffBest'); // Отправка копии заказа адинистратору и клиенту // в выбранном формате (Text или HTML) if ($this->_getShopSetting('EmailFormat') == 'html') { send_mail($EmpEmail, $mail_html, $BetreffBest, $AbsEmail, $AbsName, 'html'); send_mail($_SESSION['OrderEmail'], $mail_html, $BetreffBest, $AbsEmail, $AbsName, 'html'); } else { send_mail($EmpEmail, $mail_text, $BetreffBest, $AbsEmail, $AbsName, 'text'); send_mail($_SESSION['OrderEmail'], $mail_text, $BetreffBest, $AbsEmail, $AbsName, 'text'); } // Сохраняем текст копии заказа в форматах HTML и Text $AVE_DB->Query("\r\n\t\t\t\t\t\tUPDATE " . PREFIX . "_modul_shop_bestellungen\r\n\t\t\t\t\t\tSET\r\n\t\t\t\t\t\t\tRechnungHtml = '" . addslashes($mail_html) . "',\r\n\t\t\t\t\t\t\tRechnungText = '" . addslashes($mail_text) . "'\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\tId = '" . $OrderId . "'\r\n\t\t\t\t\t"); // Gibt es ein Zahlunsg - Gateway? $row_gw = $AVE_DB->Query("\r\n\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\tFROM " . PREFIX . "_modul_shop_zahlungsmethoden\r\n\t\t\t\t\t\tWHERE status = '1'\r\n\t\t\t\t\t\tAND Id = '" . $_SESSION['PaymentId'] . "'\r\n\t\t\t\t\t")->FetchRow(); if (is_object($row_gw) && $row_gw->Extern == 1) { $Waehrung = $this->_getShopSetting('Waehrung'); define('GATEWAY', BASE_DIR . '/modules/shop/gateways/' . $row_gw->Gateway . '.php'); if (file_exists(GATEWAY) && @(include GATEWAY)) { exit; } } // Wenn es keinen Zahlungs - Gateway gibt, Bestдtigungs - Seite anzeigen unset($_SESSION['Zwisumm']); unset($_SESSION['BasketSumm']); unset($_SESSION['BasketOverall']); unset($_SESSION['ShippingSummOut']); unset($_SESSION['ShippingSumm']); unset($_SESSION['ShipperId']); unset($_SESSION['IsShipper']); unset($_SESSION['Product']); unset($_SESSION['VatInc']); unset($_SESSION['GewichtSumm']); unset($_SESSION['PaymentId']); unset($_SESSION['CouponCode']); unset($_SESSION['CouponCodeId']); unset($_SESSION['KostenZahlung']); unset($_SESSION['KostenZahlungOut']); $AVE_Template->assign('step', 3); $tpl_out = $AVE_Template->fetch($GLOBALS['mod']['tpl_dir'] . $this->_shop_confirm_thankyou_tpl); $tpl_out = $this->_shopRewrite($tpl_out); define('MODULE_CONTENT', $tpl_out); define('MODULE_SITE', $GLOBALS['mod']['config_vars']['PageName'] . $GLOBALS['mod']['config_vars']['PageSep'] . $GLOBALS['mod']['config_vars']['ShopPaySite']); } else { if (empty($_SESSION['ShipperId'])) { header('Location:' . $this->_link_create_account . 'no'); exit; } if ($this->_getShopSetting('GutscheinCodes') == 1) { $AVE_Template->assign('couponcodes', 1); } $AVE_Template->assign('VatZones', $this->_showVatZones()); $tpl_out = $AVE_Template->fetch($GLOBALS['mod']['tpl_dir'] . $this->_shop_checkoutinfo_tpl); $tpl_out = $this->_shopRewrite($tpl_out); define('MODULE_CONTENT', $tpl_out); define('MODULE_SITE', $GLOBALS['mod']['config_vars']['PageName'] . $GLOBALS['mod']['config_vars']['PageSep'] . $GLOBALS['mod']['config_vars']['ShopPaySite']); } } else { if (!isset($_SESSION['user_id']) && GastBestellung != 1) { header('Location:' . $this->_shopRewrite($this->_link_checkout)); exit; } $AVE_Template->assign('step', 1); $tpl_out = $AVE_Template->fetch($GLOBALS['mod']['tpl_dir'] . $this->_shop_billing_tpl); $tpl_out = $this->_shopRewrite($tpl_out); define('MODULE_CONTENT', $tpl_out); define('MODULE_SITE', $GLOBALS['mod']['config_vars']['PageName'] . $GLOBALS['mod']['config_vars']['PageSep'] . $GLOBALS['mod']['config_vars']['ShopPaySite']); } } }
public function create_user() { if ($this->session->userdata('install_step') != 'create_user') { redirect('setup/prerequisites'); } $this->load_ci_database(); $this->load->model('users/mdl_users'); $this->load->helper('country'); if ($this->mdl_users->run_validation()) { $db_array = $this->mdl_users->db_array(); $db_array['user_type'] = 1; $this->mdl_users->save(NULL, $db_array); $this->session->set_userdata('install_step', 'complete'); redirect('setup/complete'); } $this->layout->set(array('countries' => get_country_list(lang('cldr')))); $this->layout->buffer('content', 'setup/create_user'); $this->layout->render('setup'); }
function get_country_name($code) { $countries = get_country_list(); if (isset($countries[$code])) { return $countries[$code]; } else { return false; } }
private function handle_user_update($action, $user) { if ($user === false) { return; } if ($action == "update_mail" && isset($_POST["mail"])) { $mail = $_POST["mail"]; $error = []; if (!$mail) { // TODO: email verification $error[] = __("Please enter a valid email address"); } elseif ($mail != $user["mail"]) { if (!$this->auth_model->is_good_email($mail)) { $error[] = __("The email id you gave is not valid"); } else { $already_registered = $this->auth_model->get_user_by_mail($mail); if ($already_registered && $already_registered["id"] != $user["id"]) { $error[] = __("The email id you gave is already registered"); } else { $updated = $this->auth_model->update_user($user["id"], ["mail" => $mail, "email_verified" => "0", "resitration_status" => "incomplete"]); if ($updated) { $sent = $this->send_verification_mail($mail, "verify_email"); if (!$sent) { $error[] = __("Could not send mail"); } } if (!$updated) { $error[] = __("Could not update email"); } } } } else { $updated = $this->auth_model->update_user($user["id"], ["resitration_status" => "incomplete"]); if (!$updated) { $error[] = __("Could not update email"); } } $this->session_lib->flash_set("auth_last_error", implode("\n", $error)); $this->http->redirect(locale_base_url() . "auth/register/"); } elseif ($action == "update_profile") { if ($user["resitration_status"] == "complete") { return; } $user_data = ["nick" => strtolower($_POST["nick"]), "name" => $_POST["name"], "gender" => $_POST["gender"], "location" => $_POST["location"], "country" => $_POST["country"], "dob" => $_POST["dob"], "organization" => $_POST["organization"]]; $complete = true; $error = []; foreach ($user_data as $key => $value) { if (empty($value)) { $error[] = __("Please fill all the required fields"); $complete = false; } } if (!preg_match('/^[a-z0-9_]+$/i', $user_data["nick"])) { unset($user_data["nick"]); $complete = false; $error[] = __("You can use only alphanumeric characters and underscore in nick"); } elseif (strlen($user_data["nick"]) < 6) { unset($user_data["nick"]); $complete = false; $error[] = __("Nick must be at least 6 characters long"); } elseif ($user["nick"] != $user_data["nick"] && $this->auth_model->get_user_by_nick($user_data["nick"])) { unset($user_data["nick"]); $complete = false; $error[] = __("Nick is already taken"); } if (!in_array($user_data["gender"], ["male", "female", "other"])) { $user_data["gender"] = ""; $error[] = __("Enter valid gender"); $complete = false; } if ($user_data["dob"]) { if (date_parse($user_data["dob"])["error_count"]) { $user_data["dob"] = ""; $error[] = __("Enter valid birthdate"); $complete = false; } } if ($user_data["country"]) { load_helper("country_list"); $country_list = get_country_list(); if (!in_array($user_data["country"], array_keys($country_list))) { $user_data["country"] = ""; $error[] = __("Enter valid country"); $complete = false; } } if ($complete) { $user_data["resitration_status"] = "complete"; } $updated = $this->auth_model->update_user($user["id"], $user_data); if (!$updated) { $error[] = __("Could not update profile"); } if (count($error)) { $this->session_lib->flash_set("auth_last_error", implode("\n", $error)); } $this->http->redirect(locale_base_url() . "auth/register"); } }