config.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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(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'))),
  28. "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'))),
  29. "firstDay" => json_encode($l->l('firstday', 'firstday')) ,
  30. );
  31. // Echo it
  32. foreach ($array as $setting => $value) {
  33. echo("var ". $setting ."=".$value.";\n");
  34. }
  35. ?>