forked from cunaedy/Cart-Engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
126 lines (109 loc) · 4.67 KB
/
profile.php
File metadata and controls
126 lines (109 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
// part of qEngine
require "./includes/user_init.php";
$mode = get_param('mode');
$xpress = get_param('xpress');
// shipping mode
$ship_area = $config['cart']['ship_area'];
switch ($mode) {
case 'logout':
kick_user();
break;
case 'lost':
qvc_init(3);
$tpl_mode = 'lost';
$txt['main_body'] = quick_tpl(load_tpl('lost.tpl'), $txt);
generate_html_header("$config[site_name] $config[cat_separator] Lost Password");
break;
case 'reset':
qvc_init(3);
$tpl_mode = 'reset';
$row['user_id'] = get_param('user_id');
$row['reset'] = get_param('reset');
$txt['main_body'] = quick_tpl(load_tpl('lost.tpl'), $row);
generate_html_header("$config[site_name] $config[cat_separator] Reset Password");
break;
case 'register':
case 'xpress':
case 'address':
qvc_init(3);
if (($mode != 'address') && ($isLogin)) {
redir($config['site_url'].'/profile.php');
}
if (($mode == 'address') && (!$isLogin)) {
redir($config['site_url'].'/profile.php');
}
if (!$row = load_form('register')) {
if ($mode == 'address') {
$row = sql_qquery("SELECT * FROM ".$db_prefix."user WHERE user_id='$current_user_id' LIMIT 1");
} else {
$row = create_blank_tbl($db_prefix.'user');
}
}
// area
$allow_city = $allow_state = $allow_country = true;
if ($config['cart']['ship_area'] == 'local') {
$allow_city = $allow_state = $allow_country = false;
$row['bill_city'] = $row['ship_city'] = $config['site_city'];
$row['bill_state'] = $row['ship_state'] = $config['site_state'];
$row['bill_country'] = $row['ship_country'] = $config['site_country'];
} elseif ($config['cart']['ship_area'] == 'state') {
$allow_state = $allow_country = false;
$row['bill_state'] = $row['ship_state'] = $config['site_state'];
$row['bill_country'] = $row['ship_country'] = $config['site_country'];
} elseif ($config['cart']['ship_area'] == 'nation') {
$allow_country = false;
$row['bill_country'] = $row['ship_country'] = $config['site_country'];
} else {
$country_def = get_country_list();
$row['bill_country_select'] = create_select_form('bill_country', $country_def, $row['bill_country'] ? $row['bill_country'] : $config['site_country']);
$row['ship_country_select'] = create_select_form('ship_country', $country_def, $row['ship_country'] ? $row['ship_country'] : $config['site_country']);
}
$txt = array_merge($txt, $row);
if ($mode == 'register') {
$tpl_mode = 'register';
$txt['main_body'] = quick_tpl(load_tpl('register.tpl'), $txt);
} elseif ($mode == 'address') {
$tpl_mode = 'address';
$txt['main_body'] = quick_tpl(load_tpl('register.tpl'), $txt);
} else { // xpress c.o
$tpl_mode = 'xpress';
sql_query("DELETE FROM ".$db_prefix."user WHERE user_id='$current_user_id' LIMIT 1");
if (!$config['cart']['allow_xpress']) {
msg_die('Express checkout is not enabled.');
}
$txt['main_body'] = quick_tpl(load_tpl('register.tpl'), $txt);
}
if ($mode == 'address') {
generate_html_header("$config[site_name] $config[cat_separator] My Addresses");
} else {
generate_html_header("$config[site_name] $config[cat_separator] Registration");
}
break;
case 'act':
$row['user_id'] = get_param('user_id');
$row['act'] = get_param('act');
$txt['main_body'] = quick_tpl(load_tpl('act.tpl'), $row);
generate_html_header("$config[site_name] $config[cat_separator] Account Activation");
break;
default:
if (!$isLogin) {
// login form
qvc_init(3);
$profile_mode = 'login';
if (!$config['cart']['allow_xpress']) {
$xpress = false;
}
$txt['url'] = get_param('url');
$txt['main_body'] = quick_tpl(load_tpl('login.tpl'), $txt);
generate_html_header("$config[site_name] $config[cat_separator] Login");
} else {
// get ID
$res = sql_query("SELECT * FROM ".$db_prefix."user WHERE user_id = '$current_user_id' LIMIT 1");
$row = sql_fetch_array($res);
$txt['main_body'] = quick_tpl(load_tpl('profile.tpl'), $row);
generate_html_header("$config[site_name] $config[cat_separator] My Profile");
}
break;
}
flush_tpl();