-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathaccount.php
68 lines (56 loc) · 2.1 KB
/
account.php
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
<?php
// part of qEngine
require_once "./includes/user_init.php";
// close site?
if (!$isLogin) {
redir($config['site_url'].'/profile.php?mode=login');
}
$cmd = get_param('cmd');
$item_id = get_param('item_id');
switch ($cmd) {
case 'fave_del':
// verify item_id
$row = sql_qquery("SELECT idx FROM ".$db_prefix."listing WHERE idx='$item_id' LIMIT 1");
if (!$row) {
msg_die($lang['msg']['item_not_found']);
}
$current_f = explode(',', $current_user_info['user_fave']);
// array_unshift ($current_f, 'foo');
$j = array_search($item_id, $current_f);
if ($j !== false) {
unset($current_f[$j]);
}
$current_f = array_clean(array_unique($current_f));
$current = implode(',', $current_f);
sql_query("UPDATE ".$db_prefix."user SET user_fave='$current' WHERE user_id='$current_user_id' LIMIT 1");
redir();
break;
case 'fave_add':
// verify item_id
$row = sql_qquery("SELECT idx FROM ".$db_prefix."listing WHERE idx='$item_id' LIMIT 1");
if (!$row) {
msg_die($lang['msg']['item_not_found']);
}
$current_f = explode(',', $current_user_info['user_fave']);
$current_f[] = $item_id;
$current_f = array_clean(array_unique($current_f));
$current = implode(',', $current_f);
sql_query("UPDATE ".$db_prefix."user SET user_fave='$current' WHERE user_id='$current_user_id' LIMIT 1");
redir();
break;
case 'fave':
$txt['main_body'] = quick_tpl(load_tpl('fave.tpl'), $txt);
generate_html_header("$config[site_name] $config[cat_separator] My Favorites");
flush_tpl();
break;
case 'listing':
$txt['main_body'] = quick_tpl(load_tpl('listing_my.tpl'), $txt);
generate_html_header("$config[site_name] $config[cat_separator] My Listing");
flush_tpl();
break;
default:
$txt['main_body'] = quick_tpl(load_tpl('account.tpl'), $txt);
generate_html_header("$config[site_name] $config[cat_separator] My Account");
flush_tpl();
break;
}