2013-01-20 23:10:47 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-03-26 10:44:34 +00:00
|
|
|
* @author Bart Visscher <bartv@thisnet.nl>
|
|
|
|
* @author Björn Schießle <schiessle@owncloud.com>
|
|
|
|
* @author Guillaume AMAT <guillaume.amat@informatique-libre.com>
|
|
|
|
* @author Joas Schilling <nickvergessen@owncloud.com>
|
|
|
|
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
|
|
|
|
* @author Lukas Reschke <lukas@owncloud.com>
|
|
|
|
* @author Matthias Rieber <matthias@zu-con.org>
|
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
|
|
|
* @author Owen Winkler <a_github@midnightcircus.com>
|
|
|
|
* @author Robin Appelman <icewind@owncloud.com>
|
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
|
|
|
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
|
|
|
* @author Vincent Petry <pvince81@owncloud.com>
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2015, ownCloud, Inc.
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
2013-01-20 23:10:47 +00:00
|
|
|
*/
|
2015-02-26 10:37:37 +00:00
|
|
|
|
2013-01-20 23:10:47 +00:00
|
|
|
// Set the content type to Javascript
|
|
|
|
header("Content-type: text/javascript");
|
|
|
|
|
|
|
|
// Disallow caching
|
2014-02-20 23:13:27 +00:00
|
|
|
header("Cache-Control: no-cache, must-revalidate");
|
|
|
|
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
2013-01-20 23:10:47 +00:00
|
|
|
|
|
|
|
// Enable l10n support
|
2014-08-31 08:05:59 +00:00
|
|
|
$l = \OC::$server->getL10N('core');
|
2013-01-20 23:10:47 +00:00
|
|
|
|
2014-02-13 09:47:03 +00:00
|
|
|
// Enable OC_Defaults support
|
|
|
|
$defaults = new OC_Defaults();
|
|
|
|
|
2013-01-20 23:10:47 +00:00
|
|
|
// Get the config
|
2013-01-26 12:46:00 +00:00
|
|
|
$apps_paths = array();
|
|
|
|
foreach(OC_App::getEnabledApps() as $app) {
|
|
|
|
$apps_paths[$app] = OC_App::getAppWebPath($app);
|
|
|
|
}
|
|
|
|
|
2014-06-03 13:15:04 +00:00
|
|
|
$value = \OCP\Config::getAppValue('core', 'shareapi_default_expire_date', 'no');
|
|
|
|
$defaultExpireDateEnabled = ($value === 'yes') ? true :false;
|
2014-05-09 14:36:20 +00:00
|
|
|
$defaultExpireDate = $enforceDefaultExpireDate = null;
|
2014-06-03 13:15:04 +00:00
|
|
|
if ($defaultExpireDateEnabled) {
|
|
|
|
$defaultExpireDate = (int)\OCP\Config::getAppValue('core', 'shareapi_expire_after_n_days', '7');
|
|
|
|
$value = \OCP\Config::getAppValue('core', 'shareapi_enforce_expire_date', 'no');
|
|
|
|
$enforceDefaultExpireDate = ($value === 'yes') ? true : false;
|
2014-05-09 14:36:20 +00:00
|
|
|
}
|
|
|
|
|
2013-01-20 23:10:47 +00:00
|
|
|
$array = array(
|
2013-01-26 12:46:00 +00:00
|
|
|
"oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false',
|
2014-02-20 11:51:15 +00:00
|
|
|
"oc_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false',
|
2013-01-20 23:10:47 +00:00
|
|
|
"oc_webroot" => "\"".OC::$WEBROOT."\"",
|
2013-01-26 12:46:00 +00:00
|
|
|
"oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution
|
2014-10-13 15:44:57 +00:00
|
|
|
"datepickerFormatDate" => json_encode($l->getDateFormat()),
|
2013-02-14 22:19:12 +00: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')
|
|
|
|
)
|
|
|
|
),
|
2014-10-13 15:44:57 +00:00
|
|
|
"firstDay" => json_encode($l->getFirstWeekDay()) ,
|
2014-02-04 12:56:10 +00:00
|
|
|
"oc_config" => json_encode(
|
|
|
|
array(
|
2014-07-15 20:04:31 +00:00
|
|
|
'session_lifetime' => min(\OCP\Config::getSystemValue('session_lifetime', ini_get('session.gc_maxlifetime')), ini_get('session.gc_maxlifetime')),
|
2014-02-26 10:40:41 +00:00
|
|
|
'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true),
|
|
|
|
'version' => implode('.', OC_Util::getVersion()),
|
|
|
|
'versionstring' => OC_Util::getVersionString(),
|
2015-02-13 11:08:14 +00:00
|
|
|
'enable_avatars' => \OC::$server->getConfig()->getSystemValue('enable_avatars', true),
|
2014-02-04 12:56:10 +00:00
|
|
|
)
|
2014-02-13 09:47:03 +00:00
|
|
|
),
|
2014-05-09 14:36:20 +00:00
|
|
|
"oc_appconfig" => json_encode(
|
|
|
|
array("core" => array(
|
|
|
|
'defaultExpireDateEnabled' => $defaultExpireDateEnabled,
|
|
|
|
'defaultExpireDate' => $defaultExpireDate,
|
|
|
|
'defaultExpireDateEnforced' => $enforceDefaultExpireDate,
|
2014-05-12 10:19:07 +00:00
|
|
|
'enforcePasswordForPublicLink' => \OCP\Util::isPublicLinkPasswordRequired(),
|
2014-05-13 13:22:18 +00:00
|
|
|
'sharingDisabledForUser' => \OCP\Util::isSharingDisabledForUser(),
|
2014-08-05 08:57:13 +00:00
|
|
|
'resharingAllowed' => \OCP\Share::isResharingAllowed(),
|
2014-05-09 14:36:20 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
2014-02-13 09:47:03 +00: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 12:56:10 +00:00
|
|
|
)
|
2014-02-20 23:13:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
// Allow hooks to modify the output values
|
|
|
|
OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array));
|
2013-01-20 23:10:47 +00:00
|
|
|
|
|
|
|
// Echo it
|
|
|
|
foreach ($array as $setting => $value) {
|
|
|
|
echo("var ". $setting ."=".$value.";\n");
|
2013-05-17 10:47:32 +00:00
|
|
|
}
|