[BUGFIX] dataTables: Avoid sending cookie-data too often 42/25342/2 42/25342/3
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 22:33:24 +0000 (23: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/25342
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
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 f76c207..23f5b52 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 5dfba2c..0437404 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";
+               }
        },
 
        /**