2013-01-21 03:10:47 +04:00
|
|
|
<?php
|
|
|
|
/**
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Bart Visscher <bartv@thisnet.nl>
|
|
|
|
* @author Björn Schießle <schiessle@owncloud.com>
|
2016-01-12 17:02:16 +03:00
|
|
|
* @author Clark Tomlinson <fallen013@gmail.com>
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Guillaume AMAT <guillaume.amat@informatique-libre.com>
|
2015-10-05 21:54:56 +03:00
|
|
|
* @author Hasso Tepper <hasso@zone.ee>
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Joas Schilling <nickvergessen@owncloud.com>
|
|
|
|
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
|
|
|
|
* @author Lukas Reschke <lukas@owncloud.com>
|
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
|
|
|
* @author Owen Winkler <a_github@midnightcircus.com>
|
|
|
|
* @author Robin Appelman <icewind@owncloud.com>
|
2015-10-26 15:54:55 +03:00
|
|
|
* @author Roeland Jago Douma <rullzer@owncloud.com>
|
2016-03-01 19:25:15 +03:00
|
|
|
* @author Vincent Chan <plus.vincchan@gmail.com>
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Vincent Petry <pvince81@owncloud.com>
|
|
|
|
*
|
2016-01-12 17:02:16 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
2015-03-26 13:44:34 +03:00
|
|
|
* @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-21 03:10:47 +04:00
|
|
|
*/
|
2015-02-26 13:37:37 +03:00
|
|
|
|
2013-01-21 03:10:47 +04:00
|
|
|
// 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
|
2014-08-31 12:05:59 +04:00
|
|
|
$l = \OC::$server->getL10N('core');
|
2013-01-21 03:10:47 +04:00
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2015-04-09 13:19:42 +03:00
|
|
|
$config = \OC::$server->getConfig();
|
|
|
|
$value = $config->getAppValue('core', 'shareapi_default_expire_date', 'no');
|
2014-06-03 17:15:04 +04:00
|
|
|
$defaultExpireDateEnabled = ($value === 'yes') ? true :false;
|
2014-05-09 18:36:20 +04:00
|
|
|
$defaultExpireDate = $enforceDefaultExpireDate = null;
|
2014-06-03 17:15:04 +04:00
|
|
|
if ($defaultExpireDateEnabled) {
|
2015-04-09 13:19:42 +03:00
|
|
|
$defaultExpireDate = (int) $config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
|
|
|
|
$value = $config->getAppValue('core', 'shareapi_enforce_expire_date', 'no');
|
2014-06-03 17:15:04 +04:00
|
|
|
$enforceDefaultExpireDate = ($value === 'yes') ? true : false;
|
2014-05-09 18:36:20 +04:00
|
|
|
}
|
2015-04-09 13:19:42 +03:00
|
|
|
$outgoingServer2serverShareEnabled = $config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes';
|
2014-05-09 18:36:20 +04:00
|
|
|
|
2016-02-02 12:32:50 +03:00
|
|
|
$countOfDataLocation = 0;
|
2016-02-01 20:14:10 +03:00
|
|
|
|
2016-02-02 12:32:50 +03:00
|
|
|
$dataLocation = str_replace(OC::$SERVERROOT .'/', '', $config->getSystemValue('datadirectory', ''), $countOfDataLocation);
|
|
|
|
if($countOfDataLocation !== 1 || !OC_User::isAdminUser(OC_User::getUser())){
|
|
|
|
$dataLocation = false;
|
2016-02-01 20:14:10 +03:00
|
|
|
}
|
|
|
|
|
2013-01-21 03:10:47 +04:00
|
|
|
$array = array(
|
2015-08-24 18:38:32 +03:00
|
|
|
"oc_debug" => $config->getSystemValue('debug', false) ? 'true' : 'false',
|
2014-02-20 15:51:15 +04:00
|
|
|
"oc_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false',
|
2016-02-02 12:32:50 +03:00
|
|
|
"oc_dataURL" => is_string($dataLocation) ? "\"".$dataLocation."\"" : '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
|
2016-01-15 14:57:50 +03:00
|
|
|
"datepickerFormatDate" => json_encode($l->l('jsdate', null)),
|
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')
|
|
|
|
)
|
|
|
|
),
|
2015-08-21 10:17:36 +03:00
|
|
|
"dayNamesShort" => json_encode(
|
|
|
|
array(
|
|
|
|
(string)$l->t('Sun.'),
|
|
|
|
(string)$l->t('Mon.'),
|
|
|
|
(string)$l->t('Tue.'),
|
|
|
|
(string)$l->t('Wed.'),
|
|
|
|
(string)$l->t('Thu.'),
|
|
|
|
(string)$l->t('Fri.'),
|
|
|
|
(string)$l->t('Sat.')
|
|
|
|
)
|
|
|
|
),
|
|
|
|
"dayNamesMin" => json_encode(
|
|
|
|
array(
|
|
|
|
(string)$l->t('Su'),
|
|
|
|
(string)$l->t('Mo'),
|
|
|
|
(string)$l->t('Tu'),
|
|
|
|
(string)$l->t('We'),
|
|
|
|
(string)$l->t('Th'),
|
|
|
|
(string)$l->t('Fr'),
|
|
|
|
(string)$l->t('Sa')
|
|
|
|
)
|
|
|
|
),
|
2013-02-15 02:19:12 +04:00
|
|
|
"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')
|
|
|
|
)
|
|
|
|
),
|
2015-08-21 10:17:36 +03:00
|
|
|
"monthNamesShort" => json_encode(
|
|
|
|
array(
|
|
|
|
(string)$l->t('Jan.'),
|
|
|
|
(string)$l->t('Feb.'),
|
|
|
|
(string)$l->t('Mar.'),
|
|
|
|
(string)$l->t('Apr.'),
|
|
|
|
(string)$l->t('May.'),
|
|
|
|
(string)$l->t('Jun.'),
|
|
|
|
(string)$l->t('Jul.'),
|
|
|
|
(string)$l->t('Aug.'),
|
|
|
|
(string)$l->t('Sep.'),
|
|
|
|
(string)$l->t('Oct.'),
|
|
|
|
(string)$l->t('Nov.'),
|
|
|
|
(string)$l->t('Dec.')
|
|
|
|
)
|
|
|
|
),
|
2016-01-15 14:57:50 +03:00
|
|
|
"firstDay" => json_encode($l->l('firstday', null)) ,
|
2014-02-04 16:56:10 +04:00
|
|
|
"oc_config" => json_encode(
|
|
|
|
array(
|
2014-09-17 18:07:32 +04:00
|
|
|
'session_lifetime' => min(\OCP\Config::getSystemValue('session_lifetime', OC::$server->getIniWrapper()->getNumeric('session.gc_maxlifetime')), OC::$server->getIniWrapper()->getNumeric('session.gc_maxlifetime')),
|
2014-02-26 14:40:41 +04:00
|
|
|
'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true),
|
2015-12-18 17:26:54 +03:00
|
|
|
'version' => implode('.', \OCP\Util::getVersion()),
|
2014-02-26 14:40:41 +04:00
|
|
|
'versionstring' => OC_Util::getVersionString(),
|
2016-01-27 17:17:25 +03:00
|
|
|
'enable_avatars' => \OC::$server->getConfig()->getSystemValue('enable_avatars', true) === true,
|
2015-12-07 17:37:26 +03:00
|
|
|
'lost_password_link'=> \OC::$server->getConfig()->getSystemValue('lost_password_link', null),
|
2015-02-11 03:10:03 +03:00
|
|
|
'modRewriteWorking' => (getenv('front_controller_active') === 'true'),
|
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-08-05 12:57:13 +04:00
|
|
|
'resharingAllowed' => \OCP\Share::isResharingAllowed(),
|
2015-04-09 13:30:18 +03:00
|
|
|
'remoteShareAllowed' => $outgoingServer2serverShareEnabled,
|
2016-03-21 21:47:10 +03:00
|
|
|
'federatedCloudShareDoc' => \OC::$server->getURLGenerator()->linkToDocs('user-sharing-federated'),
|
|
|
|
'allowGroupSharing' => \OC::$server->getShareManager()->allowGroupSharing()
|
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(),
|
2016-01-09 00:32:11 +03:00
|
|
|
'docPlaceholderUrl' => $defaults->buildDocLinkToKey('PLACEHOLDER'),
|
2014-02-13 13:47:03 +04:00
|
|
|
'slogan' => $defaults->getSlogan(),
|
|
|
|
'logoClaim' => $defaults->getLogoClaim(),
|
|
|
|
'shortFooter' => $defaults->getShortFooter(),
|
2015-06-03 15:52:00 +03:00
|
|
|
'longFooter' => $defaults->getLongFooter(),
|
|
|
|
'folder' => OC_Util::getTheme(),
|
2014-02-13 13:47:03 +04:00
|
|
|
)
|
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
|
|
|
}
|