From 51f1f6f80c9921a442cfec6168c96c9991f2d61a Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Fri, 27 Oct 2017 18:15:15 +0200 Subject: [PATCH] rename 'window._token_' to 'window._tree_token_' in api.js --- public_html/js/lib/api.js | 6 +++--- public_html/js/lib/min/api.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public_html/js/lib/api.js b/public_html/js/lib/api.js index 32b009f..0867df4 100755 --- a/public_html/js/lib/api.js +++ b/public_html/js/lib/api.js @@ -69,7 +69,7 @@ APIClass.prototype = { if( [0,200,417].indexOf(ptrAPI.xhr[i].status) > -1 ){ // si fichier existe et reçu // Récupération token TreeToken - window._token_ = ptrAPI.xhr[i].getResponseHeader('X-Tree-Token'); + window._tree_token_ = ptrAPI.xhr[i].getResponseHeader('X-Tree-Token'); var parsedResponse = {ModuleError:-1, ErrorDescription:'Erreur au niveau de api.js'}; @@ -115,10 +115,10 @@ APIClass.prototype = { this.xhr[i].setRequestHeader('Authorization', 'Digest '+pToken); // Gestion du token (TreeToken) - if( window._token_ == null ) + if( window._tree_token_ == null ) this.xhr[i].setRequestHeader('X-Tree-Token', JSON.parse('{"'+document.cookie.replace(/=/g,'":"').replace(/; /g,'","')+'"}')._PUBLIC_); else - this.xhr[i].setRequestHeader('X-Tree-Token', window._token_); + this.xhr[i].setRequestHeader('X-Tree-Token', window._tree_token_); // Header pour dire que c'est AJAX diff --git a/public_html/js/lib/min/api.js b/public_html/js/lib/min/api.js index 2036737..6d76cdf 100755 --- a/public_html/js/lib/min/api.js +++ b/public_html/js/lib/min/api.js @@ -1 +1 @@ -function APIClass(e){this.target=e}APIClass.prototype={xhr:[],buffer:null,optionalParams:[],send:function(e,r,t){e.hasOwnProperty("path")||r({ModuleError:4});for(var s=0;s3)for(var o=3;o-1){window._token_=n.xhr[s].getResponseHeader("X-Tree-Token");var t={ModuleError:-1,ErrorDescription:"Erreur au niveau de api.js"};try{t=JSON.parse(n.xhr[s].responseText)}catch(e){}console.log("api response",t),t.hasOwnProperty("ModuleError")&&0!=t.ModuleError&&console.error("ModuleError::"+t.ModuleError),r(t,n.optionalParams[s])}else r({ModuleError:-2,ModuleDescription:"Erreur au niveau d'AJAX."})};var a=new FormData;for(var i in e)"path"==i?a.append(i,e[i]):e[i]instanceof File?a.append(i,e[i]):a.append(i,JSON.stringify(e[i]));this.xhr[s].open("POST",this.target,!0),null!=t&&this.xhr[s].setRequestHeader("Authorization","Digest "+t),null==window._token_?this.xhr[s].setRequestHeader("X-Tree-Token",JSON.parse('{"'+document.cookie.replace(/=/g,'":"').replace(/; /g,'","')+'"}')._PUBLIC_):this.xhr[s].setRequestHeader("X-Tree-Token",window._token_),this.xhr[s].setRequestHeader("X-Requested-With","XMLHttpRequest"),this.xhr[s].send(a)}}; \ No newline at end of file +function APIClass(e){this.target=e}APIClass.prototype={xhr:[],buffer:null,optionalParams:[],send:function(e,r,t){e.hasOwnProperty("path")||r({ModuleError:4});for(var s=0;s3)for(var o=3;o-1){window._tree_token_=n.xhr[s].getResponseHeader("X-Tree-Token");var t={ModuleError:-1,ErrorDescription:"Erreur au niveau de api.js"};try{t=JSON.parse(n.xhr[s].responseText)}catch(e){}console.log("api response",t),t.hasOwnProperty("ModuleError")&&0!=t.ModuleError&&console.error("ModuleError::"+t.ModuleError),r(t,n.optionalParams[s])}else r({ModuleError:-2,ModuleDescription:"Erreur au niveau d'AJAX."})};var a=new FormData;for(var i in e)"path"==i?a.append(i,e[i]):e[i]instanceof File?a.append(i,e[i]):a.append(i,JSON.stringify(e[i]));this.xhr[s].open("POST",this.target,!0),null!=t&&this.xhr[s].setRequestHeader("Authorization","Digest "+t),null==window._tree_token_?this.xhr[s].setRequestHeader("X-Tree-Token",JSON.parse('{"'+document.cookie.replace(/=/g,'":"').replace(/; /g,'","')+'"}')._PUBLIC_):this.xhr[s].setRequestHeader("X-Tree-Token",window._tree_token_),this.xhr[s].setRequestHeader("X-Requested-With","XMLHttpRequest"),this.xhr[s].send(a)}}; \ No newline at end of file