tosql($user_id, INTEGER); $db->query($sql); if ($db->next_record()) { $type_id = $db->f("type_id"); } } else { $type = get_param("type"); if (strlen($type)) { $db->query("SELECT type_id,discount_type,discount_amount FROM " . $table_prefix . "user_types WHERE type_id=" . $db->tosql($type, INTEGER)); if($db->next_record()) { $type_id = $db->f("type_id"); $group_discount_type = $db->f("discount_type"); $group_discount_amount = $db->f("discount_amount"); } } else { $db->query("SELECT type_id,discount_type,discount_amount FROM " . $table_prefix . "user_types WHERE is_default=1"); if ($db->next_record()) { $type_id = $db->f("type_id"); $group_discount_type = $db->f("discount_type"); $group_discount_amount = $db->f("discount_amount"); } } } $setting_type = "user_profile_" . $type_id; $referer = get_session("session_referer"); $user_ip = get_ip(); $initial_ip = get_session("session_initial_ip"); $cookie_ip = get_session("session_cookie_ip"); $visit_number = get_session("session_visit_number"); $site_url = get_setting_value($settings, "site_url", ""); $secure_url = get_setting_value($settings, "secure_url", ""); $secure_user_profile = get_setting_value($settings, "secure_user_profile", 0); if ($secure_user_profile) { $user_profile_url = $secure_url . "user_profile.php"; } else { $user_profile_url = "user_profile.php"; } $t = new VA_Template("./js"); $t->set_file("profile_js","profile.js"); $t->set_var("user_upload_href", "user_upload.php"); $t->set_var("type", $type_id); $t->parse("profile_js", false); $t->templates_path = $settings["templates_dir"]; $t->set_file("main","user_profile.html"); $t->set_var("site_url", $settings["site_url"]); $t->set_var("user_profile_href", "user_profile.php"); $t->set_var("user_profile_url", $user_profile_url); $t->set_var("user_home_href", "user_home.php"); $t->set_var("referer", $referer); $t->set_var("referrer", $referer); $t->set_var("HTTP_REFERER", $referer); $t->set_var("initial_ip", $initial_ip); $t->set_var("cookie_ip", $cookie_ip); $t->set_var("visit_number", $visit_number); $t->set_var("PROFILE_TITLE", PROFILE_TITLE); $t->set_var("EDIT_PROFILE_MSG", EDIT_PROFILE_MSG); $t->set_var("MY_ACCOUNT_MSG", MY_ACCOUNT_MSG); $t->set_var("LOGIN_INFO_MSG", LOGIN_INFO_MSG); $t->set_var("PERSONAL_DETAILS_MSG", PERSONAL_DETAILS_MSG); $t->set_var("DELIVERY_DETAILS_MSG", DELIVERY_DETAILS_MSG); $t->set_var("SAME_DETAILS_MSG", SAME_DETAILS_MSG); $t->set_var("REGISTER_BUTTON", REGISTER_BUTTON); $t->set_var("UPDATE_BUTTON", UPDATE_BUTTON); $t->set_var("CANCEL_BUTTON", CANCEL_BUTTON); $t->set_var("LOGIN_FIELD", LOGIN_FIELD); $t->set_var("PASSWORD_FIELD", PASSWORD_FIELD); $t->set_var("CONFIRM_PASS_FIELD", CONFIRM_PASS_FIELD); $t->set_var("NAME_FIELD", NAME_FIELD); $t->set_var("FIRST_NAME_FIELD", FIRST_NAME_FIELD); $t->set_var("LAST_NAME_FIELD", LAST_NAME_FIELD); $t->set_var("PERSONAL_IMAGE_FIELD", PERSONAL_IMAGE_FIELD); $t->set_var("UPLOAD_IMAGE_MSG", UPLOAD_IMAGE_MSG); $t->set_var("COMPANY_SELECT_FIELD", COMPANY_SELECT_FIELD); $t->set_var("COMPANY_NAME_FIELD", COMPANY_NAME_FIELD); $t->set_var("EMAIL_FIELD", EMAIL_FIELD); $t->set_var("STREET_FIRST_FIELD", STREET_FIRST_FIELD); $t->set_var("STREET_SECOND_FIELD",STREET_SECOND_FIELD); $t->set_var("CITY_FIELD", CITY_FIELD); $t->set_var("PROVINCE_FIELD", PROVINCE_FIELD); $t->set_var("STATE_FIELD", STATE_FIELD); $t->set_var("ZIP_FIELD", ZIP_FIELD); $t->set_var("COUNTRY_FIELD", COUNTRY_FIELD); $t->set_var("PHONE_FIELD", PHONE_FIELD); $t->set_var("DAYTIME_PHONE_FIELD",DAYTIME_PHONE_FIELD); $t->set_var("EVENING_PHONE_FIELD",EVENING_PHONE_FIELD); $t->set_var("CELL_PHONE_FIELD", CELL_PHONE_FIELD); $t->set_var("FAX_FIELD", FAX_FIELD); $t->set_var("SUBSCRIBE_CHECKBOX_MSG",SUBSCRIBE_CHECKBOX_MSG); $t->set_var("VALIDATION_CODE_FIELD", VALIDATION_CODE_FIELD); $user_profile = array(); $sql = "SELECT setting_name,setting_value FROM " . $table_prefix . "global_settings WHERE setting_type=" . $db->tosql($setting_type, TEXT); $db->query($sql); while($db->next_record()) { $user_profile[$db->f("setting_name")] = $db->f("setting_value"); } $user_settings = array(); $sql = "SELECT setting_name,setting_value FROM " . $table_prefix . "user_types_settings WHERE type_id=" . $db->tosql($type_id, INTEGER); $db->query($sql); while($db->next_record()) { $user_settings[$db->f("setting_name")] = $db->f("setting_value"); } $subscribe = get_param("subscribe"); $r = new VA_Record($table_prefix . "users"); $r->add_where("user_id", INTEGER); $r->change_property("user_id", USE_IN_INSERT, true); $use_random_image = get_setting_value($user_profile, "use_random_image", 0); if ($use_random_image == 1 && !strlen($user_id)) { $use_validation = true; } else { $use_validation = false; } if(!$user_id) { $r->add_textbox("login", TEXT, LOGIN_FIELD); $r->parameters["login"][REQUIRED] = true; $r->parameters["login"][UNIQUE] = true; $r->parameters["login"][MIN_LENGTH] = 5; $r->add_textbox("password", TEXT, PASSWORD_FIELD); $r->parameters["password"][REQUIRED] = true; $r->parameters["password"][MIN_LENGTH] = 5; $r->add_textbox("confirm", TEXT, CONFIRM_PASS_FIELD); $r->change_property("confirm", USE_IN_SELECT, false); $r->change_property("confirm", USE_IN_INSERT, false); $r->change_property("confirm", USE_IN_UPDATE, false); $r->change_property("password", MATCHED, "confirm"); $r->add_textbox("security_question", TEXT, "Security Question"); $r->change_property("security_question", USE_SQL_NULL, false); $r->add_textbox("security_answer", TEXT, "Security Answer"); $r->change_property("security_answer", USE_SQL_NULL, false); } $companies = get_db_values("SELECT company_id,company_name FROM " . $table_prefix . "companies ", array(array("", SELECT_COMPANY_MSG))); $states = get_db_values("SELECT state_code,state_name FROM " . $table_prefix . "states ORDER BY state_name ", array(array("", SELECT_STATE_MSG))); $countries = get_db_values("SELECT country_code,country_name FROM " . $table_prefix . "countries ORDER BY country_order, country_name ", array(array("", SELECT_COUNTRY_MSG))); $r->add_hidden("type", INTEGER); $r->add_textbox("user_type_id", INTEGER, "User Type"); $r->change_property("user_type_id", REQUIRED, true); $r->change_property("user_type_id", USE_IN_UPDATE, false); $r->add_textbox("is_approved", INTEGER); $r->add_textbox("name", TEXT, NAME_FIELD); $r->change_property("name", USE_SQL_NULL, false); $r->add_textbox("first_name", TEXT, FIRST_NAME_FIELD); $r->change_property("first_name", USE_SQL_NULL, false); $r->add_textbox("last_name", TEXT, LAST_NAME_FIELD); $r->change_property("last_name", USE_SQL_NULL, false); $r->add_select("company_id", INTEGER, $companies, COMPANY_SELECT_FIELD); $r->add_textbox("company_name", TEXT, COMPANY_NAME_FIELD); $r->add_textbox("email", TEXT, EMAIL_FIELD); $r->change_property("email", USE_SQL_NULL, false); $r->change_property("email", REGEXP_MASK, EMAIL_REGEXP); $r->change_property("email", UNIQUE, true); $r->add_textbox("address1", TEXT, STREET_FIRST_FIELD); $r->add_textbox("address2", TEXT, STREET_SECOND_FIELD); $r->add_textbox("city", TEXT, CITY_FIELD); $r->add_textbox("province", TEXT, PROVINCE_FIELD); $r->add_select("state_code", TEXT, $states, STATE_FIELD); $r->add_textbox("zip", TEXT, ZIP_FIELD); $r->add_select("country_code", TEXT, $countries, COUNTRY_FIELD); $r->add_textbox("phone", TEXT, PHONE_FIELD); $r->add_textbox("daytime_phone", TEXT, DAYTIME_PHONE_FIELD); $r->add_textbox("evening_phone", TEXT, EVENING_PHONE_FIELD); $r->add_textbox("cell_phone", TEXT, CELL_PHONE_FIELD); $r->add_textbox("fax", TEXT, FAX_FIELD); $r->add_textbox("personal_image", TEXT, PERSONAL_IMAGE_FIELD); $r->change_property("personal_image", REGEXP_MASK, "/^\\.?\\/?images\\/users\\//i"); if(!$user_id || !isset($user_profile["show_personal_image"]) || $user_profile["show_personal_image"] != 1) { $r->parameters["personal_image"][SHOW] = false; } $r->add_textbox("delivery_name", TEXT, DELIVERY_MSG." ".NAME_FIELD); $r->add_textbox("delivery_first_name", TEXT, DELIVERY_MSG." ".FIRST_NAME_FIELD); $r->add_textbox("delivery_last_name", TEXT, DELIVERY_MSG." ".LAST_NAME_FIELD); $r->add_select("delivery_company_id", INTEGER, $companies, DELIVERY_MSG." ".COMPANY_SELECT_FIELD); $r->add_textbox("delivery_company_name", TEXT, DELIVERY_MSG." ".COMPANY_NAME_FIELD); $r->add_textbox("delivery_email", TEXT, DELIVERY_MSG." ".EMAIL_FIELD); $r->change_property("delivery_email", REGEXP_MASK, EMAIL_REGEXP); $r->add_textbox("delivery_address1", TEXT, DELIVERY_MSG." ".STREET_FIRST_FIELD); $r->add_textbox("delivery_address2", TEXT, DELIVERY_MSG." ".STREET_SECOND_FIELD); $r->add_textbox("delivery_city", TEXT, DELIVERY_MSG." ".CITY_FIELD); $r->add_textbox("delivery_province", TEXT, DELIVERY_MSG." ".PROVINCE_FIELD); $r->add_select("delivery_state_code", TEXT, $states, DELIVERY_MSG." ".STATE_FIELD); $r->add_textbox("delivery_zip", TEXT, DELIVERY_MSG." ".ZIP_FIELD); $r->add_select("delivery_country_code", TEXT, $countries, DELIVERY_MSG." ".COUNTRY_FIELD); $r->add_textbox("delivery_phone", TEXT, DELIVERY_MSG." ".PHONE_FIELD); $r->add_textbox("delivery_daytime_phone", TEXT, DELIVERY_MSG." ".DAYTIME_PHONE_FIELD); $r->add_textbox("delivery_evening_phone", TEXT, DELIVERY_MSG." ".EVENING_PHONE_FIELD); $r->add_textbox("delivery_cell_phone", TEXT, DELIVERY_MSG." ".CELL_PHONE_FIELD); $r->add_textbox("delivery_fax", TEXT, DELIVERY_MSG." ".FAX_FIELD); $r->add_textbox("validation_number", TEXT, VALIDATION_CODE_FIELD); $r->change_property("validation_number", USE_IN_INSERT, false); $r->change_property("validation_number", USE_IN_UPDATE, false); $r->change_property("validation_number", USE_IN_SELECT, false); if ($use_validation) { $r->change_property("validation_number", REQUIRED, true); $r->change_property("validation_number", SHOW, true); } else { $r->change_property("validation_number", REQUIRED, false); $r->change_property("validation_number", SHOW, false); } $personal_number = 0; $delivery_number = 0; for($i = 0; $i < sizeof($parameters); $i++) { $personal_param = "show_" . $parameters[$i]; $delivery_param = "show_delivery_" . $parameters[$i]; if(isset($user_profile[$personal_param]) && $user_profile[$personal_param] == 1) { $personal_number++; if($user_profile[$parameters[$i] . "_required"] == 1) { $r->parameters[$parameters[$i]][REQUIRED] = true; } } else { $r->parameters[$parameters[$i]][SHOW] = false; } if(isset($user_profile[$delivery_param]) && $user_profile[$delivery_param] == 1) { $delivery_number++; if($user_profile["delivery_" . $parameters[$i] . "_required"] == 1) { $r->parameters["delivery_" . $parameters[$i]][REQUIRED] = true; } } else { $r->parameters["delivery_" . $parameters[$i]][SHOW] = false; } } $r->add_textbox("registration_date", DATETIME); $r->change_property("registration_date", USE_IN_SELECT, false); $r->change_property("registration_date", USE_IN_UPDATE, false); $r->add_textbox("registration_ip", TEXT); $r->change_property("registration_ip", USE_IN_SELECT, false); $r->change_property("registration_ip", USE_IN_UPDATE, false); $r->add_textbox("modified_date", DATETIME); $r->change_property("modified_date", USE_IN_SELECT, false); $r->add_textbox("modified_ip", TEXT); $r->change_property("modified_ip", USE_IN_SELECT, false); $r->add_textbox("last_visit_date", DATETIME); $r->change_property("last_visit_date", USE_IN_SELECT, false); $r->change_property("last_visit_date", USE_IN_UPDATE, false); $r->add_textbox("last_visit_ip", TEXT); $r->change_property("last_visit_ip", USE_IN_SELECT, false); $r->change_property("last_visit_ip", USE_IN_UPDATE, false); $r->add_checkbox("same_as_personal", INTEGER); $r->change_property("same_as_personal", USE_IN_SELECT, false); $r->change_property("same_as_personal", USE_IN_INSERT, false); $r->change_property("same_as_personal", USE_IN_UPDATE, false); if($personal_number < 1 || $delivery_number < 1) { $r->parameters["same_as_personal"][SHOW] = false; } $r->add_checkbox("subscribe", INTEGER); $r->change_property("subscribe", USE_IN_SELECT, false); $r->change_property("subscribe", USE_IN_INSERT, false); $r->change_property("subscribe", USE_IN_UPDATE, false); $r->get_form_values(); $r->set_value("user_type_id", $type_id); $r->set_value("type", $type_id); //$r->add_textbox("is_approved", INTEGER); $operation = get_param("operation"); $return_page = get_param("return_page"); if (!strlen($return_page)) { if(strlen($user_id)) { $return_page = get_setting_value($user_profile, "update_redirect", "user_home.php"); } else { $return_page = get_setting_value($user_profile, "registration_redirect", "user_home.php"); } if ($secure_user_profile && !preg_match("/^http\:\/\//", $return_page) && !preg_match("/^https\:\/\//", $return_page)) { $return_page = $site_url . $return_page; } } if(strlen($operation)) { if($operation == "cancel") { header("Location: " . $return_page); exit; } else if($operation == "delete" && $user_id) { // delete operation disabled for users // $r->delete_record(); header("Location: " . $return_page); exit; } if($r->get_value("same_as_personal")) { for($i = 0; $i < sizeof($parameters); $i++) { $personal_param = "show_" . $parameters[$i]; $delivery_param = "show_delivery_" . $parameters[$i]; if(isset($user_profile[$delivery_param]) && isset($user_profile[$personal_param]) && $user_profile[$delivery_param] == 1 && $user_profile[$personal_param] == 1) { $r->set_value("delivery_" . $parameters[$i], $r->get_value($parameters[$i])); } } } if(strlen($user_id)) { $r->set_value("user_id", $user_id); $r->where_set = true; } $r->validate(); if ($use_validation && !$r->is_empty("validation_number")) { if(!check_image_validation($r->get_value("validation_number"))) { $r->errors .= str_replace("{field_name}", VALIDATION_CODE_FIELD, VALIDATION_MESSAGE); } } if(strlen($user_id)) { if(!isset($user_settings["edit_profile"]) || $user_settings["edit_profile"] != 1) { $r->errors = EDIT_PROFILE_ERROR; } } else { if(!isset($user_settings["new_profile"]) || $user_settings["new_profile"] != 1) { $r->errors = NEW_PROFILE_ERROR; } } if(!$r->errors && check_black_ip()) { $r->errors = BLACK_IP_MSG; } if(!strlen($r->errors)) { $subscribe_email = $r->get_value("email"); if(!$subscribe_email && $r->get_value("delivery_email")) { $subscribe_email = $r->get_value("delivery_email"); } // subscribe/unsubscribe user from newsletter if ($subscribe_email) { if($r->get_value("subscribe") == 1) { $sql = " SELECT COUNT(*) FROM " . $table_prefix . "newsletters_users "; $sql .= " WHERE email=" . $db->tosql($subscribe_email, TEXT); $db->query($sql); $db->next_record(); $email_count = $db->f(0); if ($email_count < 1) { $sql = " INSERT INTO " . $table_prefix . "newsletters_users (email, date_added) "; $sql .= " VALUES ("; $sql .= $db->tosql($subscribe_email, TEXT) . ", "; $sql .= $db->tosql(va_time(), DATETIME) . ") "; $db->query($sql); } } else { $sql = " DELETE FROM " . $table_prefix . "newsletters_users "; $sql .= " WHERE email=" . $db->tosql($subscribe_email, TEXT); $db->query($sql); } } if(isset($user_settings["approve_profile"]) && $user_settings["approve_profile"] == 1) { $r->set_value("is_approved", 1); } else { $r->set_value("is_approved", 0); } if(strlen($user_id)) { $r->set_value("modified_date", va_time()); $r->set_value("modified_ip", $user_ip); $r->update_record(); } else { $db->query("SELECT MAX(user_id) FROM " . $table_prefix . "users"); $db->next_record(); $user_id = $db->f(0) + 1; $r->set_value("user_id", $user_id); $registration_date = va_time(); $r->set_value("registration_date", $registration_date); $r->set_value("registration_ip", $user_ip); $r->set_value("modified_date", $registration_date); $r->set_value("modified_ip", $user_ip); $r->set_value("last_visit_date", $registration_date); $r->set_value("last_visit_ip", $user_ip); $password_encrypt = get_setting_value($settings, "password_encrypt", 0); $plain_password = $r->get_value("password"); if ($password_encrypt == 1) { $r->set_value("password", md5($plain_password)); } if($r->insert_record()) { $registration_date_string = va_date($datetime_show_format, $registration_date); if($r->get_value("is_approved") == 1) { set_session("session_user_id", $user_id); set_session("session_user_type_id", $type_id); set_session("session_user_login", $r->get_value("login")); if(!($r->is_empty("name"))) { $user_name = $r->get_value("name"); } else if (!($r->is_empty("first_name")) || !($r->is_empty("last_name"))) { $user_name = $r->get_value("first_name") . " " . $r->get_value("last_name"); } else { $user_name = $r->get_value("login"); } set_session("session_user_name", $user_name); $user_email = $r->is_empty("email") ? "" : $r->get_value("email"); set_session("session_user_email", $user_email); set_session("session_discount_type", $group_discount_type); set_session("session_discount_amount", $group_discount_amount); $country_code = $r->get_value("country_code"); if (strlen($country_code)) { $sql = "SELECT currency_code FROM " . $table_prefix . "countries WHERE country_code=" . $db->tosql($country_code, TEXT); $currency_code = get_db_value($sql); if (strlen($currency_code)) { get_currency($currency_code); } } } $admin_notification = get_setting_value($user_profile, "admin_notification", 0); $user_notification = get_setting_value($user_profile, "user_notification", 0); $admin_sms = get_setting_value($user_profile, "admin_sms_notification", 0); $user_sms = get_setting_value($user_profile, "user_sms_notification", 0); if ($admin_notification || $user_notification || $admin_sms || $user_sms) { $r->set_parameters(); $t->set_var("registration_date", $registration_date_string); $t->set_var("password", $plain_password); $company_select = $r->is_empty("company_id") ? "" : get_array_value($r->get_value("company_id"), $companies); $state = $r->is_empty("state_code") ? "" : get_array_value($r->get_value("state_code"), $states); $country = $r->is_empty("country_code") ? "" : get_array_value($r->get_value("country_code"), $countries); $delivery_company_select = $r->is_empty("delivery_company_id") ? "" : get_array_value($r->get_value("delivery_company_id"), $companies); $delivery_state = $r->is_empty("delivery_state_code") ? "" : get_array_value($r->get_value("delivery_state_code"), $states); $delivery_country = $r->is_empty("delivery_country_code") ? "" : get_array_value($r->get_value("delivery_country_code"), $countries); $t->set_var("company_select", $company_select); $t->set_var("state", $state); $t->set_var("country", $country); $t->set_var("state_code", $r->get_value("state_code")); $t->set_var("country_code", $r->get_value("country_code")); $t->set_var("delivery_company_select", $delivery_company_select); $t->set_var("delivery_state", $delivery_state); $t->set_var("country", $country); $t->set_var("delivery_country", $delivery_country); $t->set_var("delivery_state_code", $r->get_value("delivery_state_code")); $t->set_var("delivery_country_code", $r->get_value("delivery_country_code")); } if($admin_notification) { $t->set_block("admin_subject", $user_profile["admin_subject"]); $t->set_block("admin_message", $user_profile["admin_message"]); $t->parse("admin_subject", false); $t->parse("admin_message", false); $mail_to = get_setting_value($user_profile, "admin_email", $settings["admin_email"]); $mail_from = get_setting_value($user_profile, "admin_mail_from", $settings["admin_email"]); $mail_cc = get_setting_value($user_profile, "cc_emails"); $mail_bcc = get_setting_value($user_profile, "admin_mail_bcc"); $mail_reply_to = get_setting_value($user_profile, "admin_mail_reply_to"); $mail_return_path = get_setting_value($user_profile, "admin_mail_return_path"); $mail_type = get_setting_value($user_profile, "admin_message_type"); $email_headers = get_email_headers($mail_from, $mail_cc, $mail_bcc, $mail_reply_to, $mail_return_path, $mail_type); $admin_message = preg_replace("/\r\n|\r|\n/", CRLF, $t->get_var("admin_message")); mail($mail_to, $t->get_var("admin_subject"), $admin_message, $email_headers); } if($user_notification) { $t->set_block("user_subject", $user_profile["user_subject"]); $t->set_block("user_message", $user_profile["user_message"]); $t->parse("user_subject", false); $t->parse("user_message", false); $mail_from = get_setting_value($user_profile, "user_mail_from", $settings["admin_email"]); $mail_cc = get_setting_value($user_profile, "user_mail_cc"); $mail_bcc = get_setting_value($user_profile, "user_mail_bcc"); $mail_reply_to = get_setting_value($user_profile, "user_mail_reply_to"); $mail_return_path = get_setting_value($user_profile, "user_mail_return_path"); $mail_type = get_setting_value($user_profile, "user_message_type"); $email_headers = get_email_headers($mail_from, $mail_cc, $mail_bcc, $mail_reply_to, $mail_return_path, $mail_type); $user_message = preg_replace("/\r\n|\r|\n/", CRLF, $t->get_var("user_message")); mail($r->get_value("email"), $t->get_var("user_subject"), $user_message, $email_headers); } if ($admin_sms) { $admin_sms_recipient = get_setting_value($user_profile, "admin_sms_recipient", ""); $admin_sms_originator = get_setting_value($user_profile, "admin_sms_originator", ""); $admin_sms_message = get_setting_value($user_profile, "admin_sms_message", ""); $t->set_block("admin_sms_recipient", $admin_sms_recipient); $t->set_block("admin_sms_originator", $admin_sms_originator); $t->set_block("admin_sms_message", $admin_sms_message); $t->parse("admin_sms_recipient", false); $t->parse("admin_sms_originator", false); $t->parse("admin_sms_message", false); sms_send($t->get_var("admin_sms_recipient"), $t->get_var("admin_sms_message"), $t->get_var("admin_sms_originator")); } if ($user_sms) { $user_sms_recipient = get_setting_value($user_profile, "user_sms_recipient", $r->get_value("cell_phone")); $user_sms_originator = get_setting_value($user_profile, "user_sms_originator", ""); $user_sms_message = get_setting_value($user_profile, "user_sms_message", ""); $t->set_block("user_sms_recipient", $user_sms_recipient); $t->set_block("user_sms_originator", $user_sms_originator); $t->set_block("user_sms_message", $user_sms_message); $t->parse("user_sms_recipient", false); $t->parse("user_sms_originator", false); $t->parse("user_sms_message", false); sms_send($t->get_var("user_sms_recipient"), $t->get_var("user_sms_message"), $t->get_var("user_sms_originator")); } } } header("Location: " . $return_page); exit; } } else if(strlen($user_id)) { $r->set_value("user_id", $user_id); $r->get_db_values(); $subscribe_email = $r->get_value("email"); if (!$subscribe_email && $r->get_value("delivery_email")) { $subscribe_email = $r->get_value("delivery_email"); } if ($subscribe_email) { $sql = " SELECT email_id FROM " . $table_prefix . "newsletters_users "; $sql .= " WHERE email=" . $db->tosql($subscribe_email, TEXT); $db->query($sql); if ($db->next_record()) { $r->set_value("subscribe", 1); } } } else // new record (set default values) { } $t->set_var("return_page", htmlspecialchars($return_page)); $r->set_parameters(); if(!$user_id) $t->parse("login_block", false); else $t->set_var("login_block", ""); if($personal_number > 0) $t->parse("personal", false); else $t->set_var("personal", ""); if($delivery_number > 0) $t->parse("delivery", false); else $t->set_var("delivery", ""); $t->set_var("save_button", ""); $t->set_var("update_button", ""); $t->set_var("register_button", ""); if(strlen($user_id)) { if (isset($user_settings["edit_profile"]) && $user_settings["edit_profile"] == 1) { $t->set_var("save_button_title", UPDATE_BUTTON); $t->global_parse("save_button", false, false, true); $t->global_parse("update_button", false, false, true); } } else { if (isset($user_settings["new_profile"]) && $user_settings["new_profile"] == 1) { $t->set_var("save_button_title", REGISTER_BUTTON); $t->global_parse("save_button", false, false, true); $t->global_parse("register_button", false, false, true); } } if(strlen($user_id) && strlen(trim(get_setting_value($user_profile, "intro_text_registered")))) { $t->set_var("intro_text", get_translation($user_profile["intro_text_registered"])); $t->parse("intro_block", false); } else if (!strlen($user_id) && strlen(trim(get_setting_value($user_profile, "intro_text_new")))) { $t->set_var("intro_text", get_translation($user_profile["intro_text_new"])); $t->parse("intro_block", false); } if(strlen(get_session("session_user_id"))) { $t->sparse("user_links", false); } include("./header.php"); include("./footer.php"); $t->pparse("main"); ?>