diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2013-01-21 00:10:47 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2013-01-21 00:10:47 +0100 |
commit | 5fff57339f5fa6ca6206f41a36e291e9662fe6ef (patch) | |
tree | 5b3a57500456c52e4ed0836331f681828b1c40ce /core/js/config.php | |
parent | 68025ac43c8f439f58347121b3b7a86a44f1f80d (diff) | |
download | nextcloud-server-5fff57339f5fa6ca6206f41a36e291e9662fe6ef.tar.gz nextcloud-server-5fff57339f5fa6ca6206f41a36e291e9662fe6ef.zip |
Move config to core/js/config.php
Diffstat (limited to 'core/js/config.php')
-rw-r--r-- | core/js/config.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/core/js/config.php b/core/js/config.php new file mode 100644 index 00000000000..bab9e6fd7e6 --- /dev/null +++ b/core/js/config.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright (c) 2013 Lukas Reschke <lukas@statuscode.ch> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +// Set the content type to Javascript +header("Content-type: text/javascript"); + +// Disallow caching +header("Cache-Control: no-cache, must-revalidate"); +header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); + +// Enable l10n support +$l = OC_L10N::get('core'); + +// Get the config +$debug = (defined('DEBUG') && DEBUG) ? 'true' : 'false'; +$array = array( + "oc_debug" => $debug, + "oc_webroot" => "\"".OC::$WEBROOT."\"", + "oc_appswebroots" => "\"".$_['apps_paths']. "\"", + "oc_current_user" => "\"".OC_User::getUser(). "\"", + "oc_requesttoken" => "\"".$_['requesttoken']. "\"", + "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'))), + "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'))), + "firstDay" => json_encode($l->l('firstday', 'firstday')) , + ); + +// Echo it +foreach ($array as $setting => $value) { + echo("var ". $setting ."=".$value.";\n"); +} +?> +requesttoken = '<?php echo $_['requesttoken']; ?>'; +OC.EventSource.requesttoken=requesttoken; +$(document).bind('ajaxSend', function(elm, xhr, s) { + xhr.setRequestHeader('requesttoken', requesttoken); +});
\ No newline at end of file |