config.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')),
  25. "dayNames" => json_encode(
  26. array(
  27. (string)$l->t('Sunday'),
  28. (string)$l->t('Monday'),
  29. (string)$l->t('Tuesday'),
  30. (string)$l->t('Wednesday'),
  31. (string)$l->t('Thursday'),
  32. (string)$l->t('Friday'),
  33. (string)$l->t('Saturday')
  34. )
  35. ),
  36. "monthNames" => json_encode(
  37. array(
  38. (string)$l->t('January'),
  39. (string)$l->t('February'),
  40. (string)$l->t('March'),
  41. (string)$l->t('April'),
  42. (string)$l->t('May'),
  43. (string)$l->t('June'),
  44. (string)$l->t('July'),
  45. (string)$l->t('August'),
  46. (string)$l->t('September'),
  47. (string)$l->t('October'),
  48. (string)$l->t('November'),
  49. (string)$l->t('December')
  50. )
  51. ),
  52. "firstDay" => json_encode($l->l('firstday', 'firstday')) ,
  53. "oc_config" => json_encode(
  54. array(
  55. 'session_lifetime' => \OCP\Config::getSystemValue('session_lifetime', ini_get('session.gc_maxlifetime')),
  56. 'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true)
  57. )
  58. )
  59. );
  60. // Echo it
  61. foreach ($array as $setting => $value) {
  62. echo("var ". $setting ."=".$value.";\n");
  63. }