1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: if (!cRegistry::getBackendSessionId()) {
17:
18: $session = cRegistry::getSession();
19: $params = session_get_cookie_params();
20:
21: if (array_key_exists('acceptCookie', $_GET)) {
22:
23: $allowCookie = $_GET['acceptCookie'] === '1'? 1 : 0;
24: setcookie('allowCookie', $allowCookie, 0, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
25:
26:
27: $session->register('allowCookie');
28: } elseif (array_key_exists('allowCookie', $_COOKIE)) {
29:
30: $allowCookie = $_COOKIE['allowCookie'] === '1'? 1 : 0;
31:
32:
33: $session->register('allowCookie');
34: }
35:
36:
37: if (!isset($allowCookie)) {
38:
39: $tpl = cSmartyFrontend::getInstance();
40:
41:
42: $tpl->assign('trans', array(
43: 'title' => mi18n("TITLE"),
44: 'infoText' => mi18n("INFOTEXT"),
45: 'userInput' => mi18n("USERINPUT"),
46: 'accept' => mi18n("ACCEPT"),
47: 'decline' => mi18n("DECLINE")
48: ));
49:
50: 51: 52: 53: 54:
55: if (!function_exists('script_cookie_directive_add_get_params')) {
56: function script_cookie_directive_add_get_params($uri) {
57: foreach ($_GET as $getKey => $getValue) {
58:
59: if (cString::findFirstPos($uri, '?' . $getKey . '=') !== false
60: || cString::findFirstPos($uri, '&' . $getKey . '=') !== false
61: ) {
62: continue;
63: }
64: if (cString::findFirstPos($uri, '?') === false) {
65: $uri .= '?';
66: } else {
67: $uri .= '&';
68: }
69: $uri .= htmlentities($getKey) . '=' . htmlentities($getValue);
70: }
71:
72: return $uri;
73: }
74: }
75:
76:
77: $acceptUrl = script_cookie_directive_add_get_params(cUri::getInstance()->build(array(
78: 'idart' => cRegistry::getArticleId(),
79: 'lang' => cRegistry::getLanguageId(),
80: 'acceptCookie' => 1
81: ), true));
82:
83: $tpl->assign('pageUrlAccept', $acceptUrl);
84:
85:
86: $denyUrl = script_cookie_directive_add_get_params(cUri::getInstance()->build(array(
87: 'idart' => cRegistry::getArticleId(),
88: 'lang' => cRegistry::getLanguageId(),
89: 'acceptCookie' => 0
90: ), true));
91: $tpl->assign('pageUrlDeny', $denyUrl);
92:
93: $tpl->display('get.tpl');
94:
95: }
96: }
97:
98: ?>