hpdl
|
477
|
1
|
<?php
|
|
2
|
/*
|
hpdl
|
1739
|
3
|
$Id: account_notifications.php 1843 2008-12-12 13:32:10Z hpdl $
|
hpdl
|
477
|
4
|
|
|
5
|
osCommerce, Open Source E-Commerce Solutions
|
|
6
|
http://www.oscommerce.com
|
|
7
|
|
hpdl
|
1843
|
8
|
Copyright (c) 2008 osCommerce
|
hpdl
|
477
|
9
|
|
|
10
|
Released under the GNU General Public License
|
|
11
|
*/
|
|
12
|
|
|
13
|
require('includes/application_top.php');
|
|
14
|
|
|
15
|
if (!tep_session_is_registered('customer_id')) {
|
|
16
|
$navigation->set_snapshot();
|
|
17
|
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
|
|
18
|
}
|
|
19
|
|
|
20
|
// needs to be included earlier to set the success message in the messageStack
|
|
21
|
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_NOTIFICATIONS);
|
|
22
|
|
|
23
|
$global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "'");
|
|
24
|
$global = tep_db_fetch_array($global_query);
|
|
25
|
|
hpdl
|
1843
|
26
|
if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') && isset($HTTP_POST_VARS['formid']) && ($HTTP_POST_VARS['formid'] == $sessiontoken)) {
|
hpdl
|
477
|
27
|
if (isset($HTTP_POST_VARS['product_global']) && is_numeric($HTTP_POST_VARS['product_global'])) {
|
|
28
|
$product_global = tep_db_prepare_input($HTTP_POST_VARS['product_global']);
|
|
29
|
} else {
|
|
30
|
$product_global = '0';
|
|
31
|
}
|
|
32
|
|
|
33
|
(array)$products = $HTTP_POST_VARS['products'];
|
|
34
|
|
|
35
|
if ($product_global != $global['global_product_notifications']) {
|
|
36
|
$product_global = (($global['global_product_notifications'] == '1') ? '0' : '1');
|
|
37
|
|
|
38
|
tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set global_product_notifications = '" . (int)$product_global . "' where customers_info_id = '" . (int)$customer_id . "'");
|
|
39
|
} elseif (sizeof($products) > 0) {
|
|
40
|
$products_parsed = array();
|
hpdl
|
1703
|
41
|
reset($products);
|
|
42
|
while (list(, $value) = each($products)) {
|
|
43
|
if (is_numeric($value)) {
|
|
44
|
$products_parsed[] = $value;
|
hpdl
|
477
|
45
|
}
|
|
46
|
}
|
|
47
|
|
|
48
|
if (sizeof($products_parsed) > 0) {
|
|
49
|
$check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "' and products_id not in (" . implode(',', $products_parsed) . ")");
|
|
50
|
$check = tep_db_fetch_array($check_query);
|
|
51
|
|
|
52
|
if ($check['total'] > 0) {
|
|
53
|
tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "' and products_id not in (" . implode(',', $products_parsed) . ")");
|
|
54
|
}
|
|
55
|
}
|
|
56
|
} else {
|
|
57
|
$check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "'");
|
|
58
|
$check = tep_db_fetch_array($check_query);
|
|
59
|
|
|
60
|
if ($check['total'] > 0) {
|
|
61
|
tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "'");
|
|
62
|
}
|
|
63
|
}
|
|
64
|
|
|
65
|
$messageStack->add_session('account', SUCCESS_NOTIFICATIONS_UPDATED, 'success');
|
|
66
|
|
|
67
|
tep_redirect(tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
|
|
68
|
}
|
|
69
|
|
|
70
|
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
|
|
71
|
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL'));
|
|
72
|
?>
|
|
73
|
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
74
|
<html <?php echo HTML_PARAMS; ?>>
|
|
75
|
<head>
|
|
76
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
|
|
77
|
<title><?php echo TITLE; ?></title>
|
|
78
|
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
|
|
79
|
<link rel="stylesheet" type="text/css" href="stylesheet.css">
|
|
80
|
<script language="javascript">
|
|
81
|
|
|
82
|
|
|
83
|
|
|
84
|
|
|
85
|
|
|
86
|
|
|
87
|
|
|
88
|
|
|
89
|
|
|
90
|
|
|
91
|
|
|
92
|
</script>
|
|
93
|
</head>
|
|
94
|
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
|
|
95
|
|
|
96
|
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
|
|
97
|
|
|
98
|
|
|
99
|
|
|
100
|
<table border="0" width="100%" cellspacing="3" cellpadding="3">
|
|
101
|
<tr>
|
|
102
|
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
|
|
103
|
|
|
104
|
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
|
|
105
|
|
|
106
|
</table></td>
|
|
107
|
|
hpdl
|
1843
|
108
|
<td width="100%" valign="top"><?php echo tep_draw_form('account_notifications', tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL'), 'post', '', true) . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
hpdl
|
477
|
109
|
<tr>
|
|
110
|
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
|
|
111
|
<tr>
|
|
112
|
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
|
|
113
|
<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_account.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
|
|
114
|
</tr>
|
|
115
|
</table></td>
|
|
116
|
</tr>
|
|
117
|
<tr>
|
|
118
|
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
|
119
|
</tr>
|
|
120
|
<tr>
|
|
121
|
<td class="main"><b><?php echo MY_NOTIFICATIONS_TITLE; ?></b></td>
|
|
122
|
</tr>
|
|
123
|
<tr>
|
|
124
|
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
|
125
|
<tr class="infoBoxContents">
|
|
126
|
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
|
127
|
<tr>
|
|
128
|
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
|
129
|
<td class="main"><?php echo MY_NOTIFICATIONS_DESCRIPTION; ?></td>
|
|
130
|
<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
|
131
|
</tr>
|
|
132
|
</table></td>
|
|
133
|
</tr>
|
|
134
|
</table></td>
|
|
135
|
</tr>
|
|
136
|
<tr>
|
|
137
|
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
|
138
|
</tr>
|
|
139
|
<tr>
|
|
140
|
<td class="main"><b><?php echo GLOBAL_NOTIFICATIONS_TITLE; ?></b></td>
|
|
141
|
</tr>
|
|
142
|
<tr>
|
|
143
|
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
|
144
|
<tr class="infoBoxContents">
|
|
145
|
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
|
146
|
<tr>
|
|
147
|
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
|
148
|
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
|
149
|
<tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="checkBox('product_global')">
|
|
150
|
<td class="main" width="30"><?php echo tep_draw_checkbox_field('product_global', '1', (($global['global_product_notifications'] == '1') ? true : false), 'onclick="checkBox(\'product_global\')"'); ?></td>
|
|
151
|
<td class="main"><b><?php echo GLOBAL_NOTIFICATIONS_TITLE; ?></b></td>
|
|
152
|
</tr>
|
|
153
|
<tr>
|
|
154
|
<td width="30"> </td>
|
|
155
|
<td class="main"><?php echo GLOBAL_NOTIFICATIONS_DESCRIPTION; ?></td>
|
|
156
|
</tr>
|
|
157
|
</table></td>
|
|
158
|
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
|
159
|
</tr>
|
|
160
|
</table></td>
|
|
161
|
</tr>
|
|
162
|
</table></td>
|
|
163
|
</tr>
|
|
164
|
<tr>
|
|
165
|
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
|
166
|
</tr>
|
|
167
|
<?php
|
|
168
|
if ($global['global_product_notifications'] != '1') {
|
|
169
|
?>
|
|
170
|
<tr>
|
|
171
|
<td class="main"><b><?php echo NOTIFICATIONS_TITLE; ?></b></td>
|
|
172
|
</tr>
|
|
173
|
<tr>
|
|
174
|
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
|
175
|
<tr class="infoBoxContents">
|
|
176
|
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
|
177
|
<tr>
|
|
178
|
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
|
179
|
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
|
180
|
<?php
|
|
181
|
$products_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "'");
|
|
182
|
$products_check = tep_db_fetch_array($products_check_query);
|
|
183
|
if ($products_check['total'] > 0) {
|
|
184
|
?>
|
|
185
|
<tr>
|
|
186
|
<td class="main" colspan="2"><?php echo NOTIFICATIONS_DESCRIPTION; ?></td>
|
|
187
|
</tr>
|
|
188
|
<?php
|
|
189
|
$counter = 0;
|
|
190
|
$products_query = tep_db_query("select pd.products_id, pd.products_name from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where pn.customers_id = '" . (int)$customer_id . "' and pn.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name");
|
|
191
|
while ($products = tep_db_fetch_array($products_query)) {
|
|
192
|
?>
|
|
193
|
<tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="checkBox('products[<?php echo $counter; ?>]')">
|
|
194
|
<td class="main" width="30"><?php echo tep_draw_checkbox_field('products[' . $counter . ']', $products['products_id'], true, 'onclick="checkBox(\'products[' . $counter . ']\')"'); ?></td>
|
|
195
|
<td class="main"><b><?php echo $products['products_name']; ?></b></td>
|
|
196
|
</tr>
|
|
197
|
<?php
|
|
198
|
$counter++;
|
|
199
|
}
|
|
200
|
} else {
|
|
201
|
?>
|
|
202
|
<tr>
|
|
203
|
<td class="main"><?php echo NOTIFICATIONS_NON_EXISTING; ?></td>
|
|
204
|
</tr>
|
|
205
|
<?php
|
|
206
|
}
|
|
207
|
?>
|
|
208
|
</table></td>
|
|
209
|
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
|
210
|
</tr>
|
|
211
|
</table></td>
|
|
212
|
</tr>
|
|
213
|
</table></td>
|
|
214
|
</tr>
|
|
215
|
<tr>
|
|
216
|
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
|
|
217
|
</tr>
|
|
218
|
<?php
|
|
219
|
}
|
|
220
|
?>
|
|
221
|
<tr>
|
|
222
|
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
|
|
223
|
<tr class="infoBoxContents">
|
|
224
|
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
|
|
225
|
<tr>
|
|
226
|
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
|
227
|
<td><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
|
|
228
|
<td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
|
|
229
|
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
|
|
230
|
</tr>
|
|
231
|
</table></td>
|
|
232
|
</tr>
|
|
233
|
</table></td>
|
|
234
|
</tr>
|
|
235
|
</table></form></td>
|
|
236
|
|
|
237
|
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
|
|
238
|
|
|
239
|
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
|
|
240
|
|
|
241
|
</table></td>
|
|
242
|
</tr>
|
|
243
|
</table>
|
|
244
|
|
|
245
|
|
|
246
|
|
|
247
|
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
|
|
248
|
|
|
249
|
<br>
|
|
250
|
</body>
|
|
251
|
</html>
|
|
252
|
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
|