config.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Lukas Reschke <lukas@statuscode.ch>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. // Set the content type to Javascript
  9. header("Content-type: text/javascript");
  10. // Disallow caching
  11. header("Cache-Control: no-cache, must-revalidate");
  12. header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
  13. // Enable l10n support
  14. $l = OC_L10N::get('core');
  15. // Get the config
  16. $apps_paths = array();
  17. foreach(OC_App::getEnabledApps() as $app) {
  18. $apps_paths[$app] = OC_App::getAppWebPath($app);
  19. }
  20. $array = array(
  21. "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false',
  22. "oc_webroot" => "\"".OC::$WEBROOT."\"",
  23. "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution
  24. "oc_current_user" => "\"".OC_User::getUser(). "\"",
  25. "oc_requesttoken" => "\"".OC_Util::callRegister(). "\"",
  26. "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')),
  27. "dayNames" => json_encode(
  28. array(
  29. (string)$l->t('Sunday'),
  30. (string)$l->t('Monday'),
  31. (string)$l->t('Tuesday'),
  32. (string)$l->t('Wednesday'),
  33. (string)$l->t('Thursday'),
  34. (string)$l->t('Friday'),
  35. (string)$l->t('Saturday')
  36. )
  37. ),
  38. "monthNames" => json_encode(
  39. array(
  40. (string)$l->t('January'),
  41. (string)$l->t('February'),
  42. (string)$l->t('March'),
  43. (string)$l->t('April'),
  44. (string)$l->t('May'),
  45. (string)$l->t('June'),
  46. (string)$l->t('July'),
  47. (string)$l->t('August'),
  48. (string)$l->t('September'),
  49. (string)$l->t('October'),
  50. (string)$l->t('November'),
  51. (string)$l->t('December')
  52. )
  53. ),
  54. "firstDay" => json_encode($l->l('firstday', 'firstday')) ,
  55. );
  56. // Echo it
  57. foreach ($array as $setting => $value) {
  58. echo("var ". $setting ."=".$value.";\n");
  59. }