[BUGFIX] dataTables: Avoid sending cookie-data too often 85/24885/2
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Thu, 17 Oct 2013 23:05:25 +0000 (01:05 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 12 Nov 2013 21:33:15 +0000 (22:33 +0100)
All core-modules currently using jQuery-dataTables are
called through mod.php. So by adding that to the
cookie-path we can at least prevent sending those cookies
with requests like JS/CSS/images.

Change-Id: Ia9ea30e8967564572c7104600eb8dcc67647382d
Resolves: #52934
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/24885
Reviewed-by: Sebastian Fischer
Reviewed-by: Pascal Dürsteler
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/documentation/Resources/Public/JavaScript/main.js
typo3/sysext/extensionmanager/Resources/Public/JavaScript/main.js
typo3/sysext/extensionmanager/Resources/Public/JavaScript/ter.js
typo3/sysext/lang/Resources/Public/JavaScript/LangModule.js

index b31c738..3e94a8d 100644 (file)
@@ -29,7 +29,11 @@ TYPO3.DocumentationApplication = {
                        'bJQueryUI': true,
                        'bLengthChange': false,
                        'iDisplayLength': 15,
-                       'bStateSave': true
+                       'bStateSave': true,
+                       "fnCookieCallback": function (sNameFile, oData, sExpires, sPath) {
+                               // append mod.php to cookiePath to avoid sending cookie-data to images etc. without reason
+                               return sNameFile + "=" + encodeURIComponent($.fn.dataTableExt.oApi._fnJsonString(oData)) + "; expires=" + sExpires +"; path=" + sPath + "mod.php";
+                       }
                });
 
                // restore filter
@@ -45,7 +49,11 @@ TYPO3.DocumentationApplication = {
                        'bLengthChange': false,
                        'iDisplayLength': 15,
                        'bStateSave': true,
-                       'aaSorting': [[ 1, 'asc' ]]
+                       'aaSorting': [[ 1, 'asc' ]],
+                       "fnCookieCallback": function (sNameFile, oData, sExpires, sPath) {
+                               // append mod.php to cookiePath to avoid sending cookie-data to images etc. without reason
+                               return sNameFile + "=" + encodeURIComponent($.fn.dataTableExt.oApi._fnJsonString(oData)) + "; expires=" + sExpires +"; path=" + sPath + "mod.php";
+                       }
                });
 
                // restore filter
@@ -69,4 +77,4 @@ TYPO3.DocumentationApplication = {
                        }
                });
        });
-}(jQuery));
\ No newline at end of file
+}(jQuery));
index aab6619..8004666 100644 (file)
                        "oLanguage": {"sSearch": TYPO3.l10n.localize('extensionList.search')},
                        "bStateSave":true,
                        "fnDrawCallback": bindActions,
+                       "fnCookieCallback": function (sNameFile, oData, sExpires, sPath) {
+                               // append mod.php to cookiePath to avoid sending cookie-data to images etc. without reason
+                               return sNameFile + "=" + encodeURIComponent($.fn.dataTableExt.oApi._fnJsonString(oData)) + "; expires=" + sExpires +"; path=" + sPath + "mod.php";
+                       },
                        'aoColumns': [
                                null,
                                null,
index 6b88c69..23806ab 100644 (file)
                        "bPaginate": false,
                        "bFilter": false,
                        "bSort": false,
-                       "fnDrawCallback": bindDownload
+                       "fnDrawCallback": bindDownload,
+                       "fnCookieCallback": function (sNameFile, oData, sExpires, sPath) {
+                               // append mod.php to cookiePath to avoid sending cookie-data to images etc. without reason
+                               return sNameFile + "=" + encodeURIComponent($.fn.dataTableExt.oApi._fnJsonString(oData)) + "; expires=" + sExpires +"; path=" + sPath + "mod.php";
+                       }
                });
 
                $('#terVersionTable').dataTable({
                        "bPaginate":false,
                        "bFilter":false,
                        "fnDrawCallback":bindDownload,
+                       "fnCookieCallback": function (sNameFile, oData, sExpires, sPath) {
+                               // append mod.php to cookiePath to avoid sending cookie-data to images etc. without reason
+                               return sNameFile + "=" + encodeURIComponent($.fn.dataTableExt.oApi._fnJsonString(oData)) + "; expires=" + sExpires +"; path=" + sPath + "mod.php";
+                       },
                        "aaSorting": [
                                [2, 'asc']
                        ],
                                "sSearch": "Filter results:"
                        },
                        "bSort": false,
-                       "fnDrawCallback": bindDownload
+                       "fnDrawCallback": bindDownload,
+                       "fnCookieCallback": function (sNameFile, oData, sExpires, sPath) {
+                               // append mod.php to cookiePath to avoid sending cookie-data to images etc. without reason
+                               return sNameFile + "=" + encodeURIComponent($.fn.dataTableExt.oApi._fnJsonString(oData)) + "; expires=" + sExpires +"; path=" + sPath + "mod.php";
+                       }
                });
 
                bindDownload();
index 3f46229..73551f6 100644 (file)
@@ -35,7 +35,11 @@ var languageModule = {
                aoColumnDefs: [{
                        bSortable: false,
                        aTargets: ['notSortable']
-               }]
+               }],
+               "fnCookieCallback": function (sNameFile, oData, sExpires, sPath) {
+                       // append mod.php to cookiePath to avoid sending cookie-data to images etc. without reason
+                       return sNameFile + "=" + encodeURIComponent($.fn.dataTableExt.oApi._fnJsonString(oData)) + "; expires=" + sExpires +"; path=" + sPath + "mod.php";
+               }
        },
 
        /**