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: function script_cookie_directive_add_get_params($uri) {
56: foreach ($_GET as $getKey => $getValue) {
57:
58: if (strpos($uri, '?' . $getKey . '=') !== false
59: || strpos($uri, '&' . $getKey . '=') !== false) {
60: continue;
61: }
62: if (strpos($uri, '?') === false) {
63: $uri .= '?';
64: } else {
65: $uri .= '&';
66: }
67: $uri .= htmlentities($getKey) . '=' . htmlentities($getValue);
68: }
69:
70: return $uri;
71: }
72:
73:
74: $acceptUrl = script_cookie_directive_add_get_params(cUri::getInstance()->build(array(
75: 'idart' => cRegistry::getArticleId(),
76: 'lang' => cRegistry::getLanguageId(),
77: 'acceptCookie' => 1
78: ), true));
79:
80: $tpl->assign('pageUrlAccept', $acceptUrl);
81:
82:
83: $denyUrl = script_cookie_directive_add_get_params(cUri::getInstance()->build(array(
84: 'idart' => cRegistry::getArticleId(),
85: 'lang' => cRegistry::getLanguageId(),
86: 'acceptCookie' => 0
87: ), true));
88: $tpl->assign('pageUrlDeny', $denyUrl);
89:
90: $tpl->display('get.tpl');
91:
92: }
93: }
94:
95: ?>