Move requesttoken to oc-requesttoken.js

This commit is contained in:
Lukas Reschke 2013-01-21 20:24:18 +01:00
parent 5fff57339f
commit 8ca78fcf3f
3 changed files with 6 additions and 7 deletions

View File

@ -23,7 +23,7 @@ $array = array(
"oc_webroot" => "\"".OC::$WEBROOT."\"", "oc_webroot" => "\"".OC::$WEBROOT."\"",
"oc_appswebroots" => "\"".$_['apps_paths']. "\"", "oc_appswebroots" => "\"".$_['apps_paths']. "\"",
"oc_current_user" => "\"".OC_User::getUser(). "\"", "oc_current_user" => "\"".OC_User::getUser(). "\"",
"oc_requesttoken" => "\"".$_['requesttoken']. "\"", "oc_requesttoken" => "\"".OC_Util::callRegister(). "\"",
"datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')),
"dayNames" => json_encode(array((string)$l->t('Sunday'), (string)$l->t('Monday'), (string)$l->t('Tuesday'), (string)$l->t('Wednesday'), (string)$l->t('Thursday'), (string)$l->t('Friday'), (string)$l->t('Saturday'))), "dayNames" => json_encode(array((string)$l->t('Sunday'), (string)$l->t('Monday'), (string)$l->t('Tuesday'), (string)$l->t('Wednesday'), (string)$l->t('Thursday'), (string)$l->t('Friday'), (string)$l->t('Saturday'))),
"monthNames" => json_encode(array((string)$l->t('January'), (string)$l->t('February'), (string)$l->t('March'), (string)$l->t('April'), (string)$l->t('May'), (string)$l->t('June'), (string)$l->t('July'), (string)$l->t('August'), (string)$l->t('September'), (string)$l->t('October'), (string)$l->t('November'), (string)$l->t('December'))), "monthNames" => json_encode(array((string)$l->t('January'), (string)$l->t('February'), (string)$l->t('March'), (string)$l->t('April'), (string)$l->t('May'), (string)$l->t('June'), (string)$l->t('July'), (string)$l->t('August'), (string)$l->t('September'), (string)$l->t('October'), (string)$l->t('November'), (string)$l->t('December'))),
@ -35,8 +35,3 @@ foreach ($array as $setting => $value) {
echo("var ". $setting ."=".$value.";\n"); echo("var ". $setting ."=".$value.";\n");
} }
?> ?>
requesttoken = '<?php echo $_['requesttoken']; ?>';
OC.EventSource.requesttoken=requesttoken;
$(document).bind('ajaxSend', function(elm, xhr, s) {
xhr.setRequestHeader('requesttoken', requesttoken);
});

View File

@ -0,0 +1,3 @@
$(document).bind('ajaxSend', function(elm, xhr, s) {
xhr.setRequestHeader('requesttoken', oc_requesttoken);
});

View File

@ -284,6 +284,7 @@ class OC
OC_Util::addStyle("multiselect"); OC_Util::addStyle("multiselect");
OC_Util::addStyle("jquery-ui-1.8.16.custom"); OC_Util::addStyle("jquery-ui-1.8.16.custom");
OC_Util::addStyle("jquery-tipsy"); OC_Util::addStyle("jquery-tipsy");
OC_Util::addScript("oc-requesttoken");
} }
public static function initSession() public static function initSession()