From: Thomas Mueller Date: Wed, 26 Jun 2013 09:23:21 +0000 (+0200) Subject: move javascript variables 'oc_current_user' and 'oc_requesttoken' to js.js - fixes... X-Git-Tag: v6.0.0alpha2~587^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e6c1db7a3f6d7ec35a1d55e5575e3e09d24bbbf8;p=nextcloud-server.git move javascript variables 'oc_current_user' and 'oc_requesttoken' to js.js - fixes #3853 --- diff --git a/core/js/config.php b/core/js/config.php index 53a8fb96388..dd46f7889d1 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -26,8 +26,6 @@ $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', "oc_webroot" => "\"".OC::$WEBROOT."\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution - "oc_current_user" => "document.getElementsByTagName('head')[0].getAttribute('data-user')", - "oc_requesttoken" => "document.getElementsByTagName('head')[0].getAttribute('data-requesttoken')", "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), "dayNames" => json_encode( array( diff --git a/core/js/js.js b/core/js/js.js index 3cb4d3dd151..08b429a555b 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -7,7 +7,10 @@ */ var oc_debug; var oc_webroot; -var oc_requesttoken; + +var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('data-user'); +var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken'); + if (typeof oc_webroot === "undefined") { oc_webroot = location.pathname.substr(0, location.pathname.lastIndexOf('/')); }