2013-01-21 03:10:47 +04:00
|
|
|
<?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
|
2014-02-21 03:13:27 +04:00
|
|
|
header("Cache-Control: no-cache, must-revalidate");
|
|
|
|
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
2013-01-21 03:10:47 +04:00
|
|
|
|
|
|
|
// Enable l10n support
|
|
|
|
$l = OC_L10N::get('core');
|
|
|
|
|
2014-02-13 13:47:03 +04:00
|
|
|
// Enable OC_Defaults support
|
|
|
|
$defaults = new OC_Defaults();
|
|
|
|
|
2013-01-21 03:10:47 +04:00
|
|
|
// Get the config
|
2013-01-26 16:46:00 +04:00
|
|
|
$apps_paths = array();
|
|
|
|
foreach(OC_App::getEnabledApps() as $app) {
|
|
|
|
$apps_paths[$app] = OC_App::getAppWebPath($app);
|
|
|
|
}
|
|
|
|
|
2014-05-09 18:36:20 +04:00
|
|
|
$defaultExpireDateEnabled = \OCP\Config::getAppValue('core', 'shareapi_default_expire_date', 'no');
|
|
|
|
$defaultExpireDate = $enforceDefaultExpireDate = null;
|
|
|
|
if ($defaultExpireDateEnabled === 'yes') {
|
|
|
|
$defaultExpireDate = \OCP\Config::getAppValue('core', 'shareapi_expire_after_n_days', '7');
|
|
|
|
$enforceDefaultExpireDate = \OCP\Config::getAppValue('core', 'shareapi_enforce_expire_date', 'no');
|
|
|
|
}
|
|
|
|
|
2013-01-21 03:10:47 +04:00
|
|
|
$array = array(
|
2013-01-26 16:46:00 +04:00
|
|
|
"oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false',
|
2014-02-20 15:51:15 +04:00
|
|
|
"oc_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false',
|
2013-01-21 03:10:47 +04:00
|
|
|
"oc_webroot" => "\"".OC::$WEBROOT."\"",
|
2013-01-26 16:46:00 +04:00
|
|
|
"oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution
|
2013-01-21 03:10:47 +04:00
|
|
|
"datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')),
|
2013-02-15 02:19:12 +04:00
|
|
|
"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')
|
|
|
|
)
|
|
|
|
),
|
2013-01-21 03:10:47 +04:00
|
|
|
"firstDay" => json_encode($l->l('firstday', 'firstday')) ,
|
2014-02-04 16:56:10 +04:00
|
|
|
"oc_config" => json_encode(
|
|
|
|
array(
|
2014-02-26 14:40:41 +04:00
|
|
|
'session_lifetime' => \OCP\Config::getSystemValue('session_lifetime', ini_get('session.gc_maxlifetime')),
|
|
|
|
'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true),
|
|
|
|
'version' => implode('.', OC_Util::getVersion()),
|
|
|
|
'versionstring' => OC_Util::getVersionString(),
|
2014-02-04 16:56:10 +04:00
|
|
|
)
|
2014-02-13 13:47:03 +04:00
|
|
|
),
|
2014-05-09 18:36:20 +04:00
|
|
|
"oc_appconfig" => json_encode(
|
|
|
|
array("core" => array(
|
|
|
|
'defaultExpireDateEnabled' => $defaultExpireDateEnabled,
|
|
|
|
'defaultExpireDate' => $defaultExpireDate,
|
|
|
|
'defaultExpireDateEnforced' => $enforceDefaultExpireDate,
|
2014-05-12 14:19:07 +04:00
|
|
|
'enforcePasswordForPublicLink' => \OCP\Util::isPublicLinkPasswordRequired(),
|
2014-05-13 17:22:18 +04:00
|
|
|
'sharingDisabledForUser' => \OCP\Util::isSharingDisabledForUser(),
|
2014-05-09 18:36:20 +04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
2014-02-13 13:47:03 +04:00
|
|
|
"oc_defaults" => json_encode(
|
|
|
|
array(
|
|
|
|
'entity' => $defaults->getEntity(),
|
|
|
|
'name' => $defaults->getName(),
|
|
|
|
'title' => $defaults->getTitle(),
|
|
|
|
'baseUrl' => $defaults->getBaseUrl(),
|
|
|
|
'syncClientUrl' => $defaults->getSyncClientUrl(),
|
|
|
|
'docBaseUrl' => $defaults->getDocBaseUrl(),
|
|
|
|
'slogan' => $defaults->getSlogan(),
|
|
|
|
'logoClaim' => $defaults->getLogoClaim(),
|
|
|
|
'shortFooter' => $defaults->getShortFooter(),
|
|
|
|
'longFooter' => $defaults->getLongFooter()
|
|
|
|
)
|
2014-02-04 16:56:10 +04:00
|
|
|
)
|
2014-02-21 03:13:27 +04:00
|
|
|
);
|
|
|
|
|
|
|
|
// Allow hooks to modify the output values
|
|
|
|
OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array));
|
2013-01-21 03:10:47 +04:00
|
|
|
|
|
|
|
// Echo it
|
|
|
|
foreach ($array as $setting => $value) {
|
|
|
|
echo("var ". $setting ."=".$value.";\n");
|
2013-05-17 14:47:32 +04:00
|
|
|
}
|