1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
16:
17: if (!$contenido) {
18:
19: $session = cRegistry::getSession();
20:
21: if (array_key_exists('acceptCookie', $_GET)) {
22:
23: $allowCookie = $_GET['acceptCookie'] === '1'? 1 : 0;
24: setcookie('allowCookie', $allowCookie);
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: function script_cookie_directive_add_get_params($uri) {
51: foreach($_GET as $getKey => $getValue) {
52:
53: if (strpos($uri, '?' . $getKey . '=') !== false
54: || strpos($uri, '&' . $getKey . '=') !== false
55: || strpos($uri, '&' . $getKey . '=') !== false) {
56: continue;
57: }
58: if (strpos($uri, '?') === false) {
59: $uri .= '?';
60: } else {
61: $uri .= '&';
62: }
63: $uri .= htmlentities($getKey) . '=' . htmlentities($getValue);
64: }
65:
66: return $uri;
67: }
68:
69:
70: $acceptUrl = script_cookie_directive_add_get_params(cUri::getInstance()->build(array(
71: 'idart' => cRegistry::getArticleId(),
72: 'lang' => cRegistry::getLanguageId(),
73: 'acceptCookie' => 1
74: ), true));
75:
76: $tpl->assign('pageUrlAccept', $acceptUrl);
77:
78:
79: $denyUrl = script_cookie_directive_add_get_params(cUri::getInstance()->build(array(
80: 'idart' => cRegistry::getArticleId(),
81: 'lang' => cRegistry::getLanguageId(),
82: 'acceptCookie' => 0
83: ), true));
84: $tpl->assign('pageUrlDeny', $denyUrl);
85:
86: $tpl->display('get.tpl');
87:
88: }
89: }
90: ?>