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