diff options
Diffstat (limited to 'core/js/config.php')
-rw-r--r-- | core/js/config.php | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/core/js/config.php b/core/js/config.php index 517ea1615a8..7e23f3e2e41 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -10,12 +10,15 @@ header("Content-type: text/javascript"); // Disallow caching -header("Cache-Control: no-cache, must-revalidate"); -header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); +header("Cache-Control: no-cache, must-revalidate"); +header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Enable l10n support $l = OC_L10N::get('core'); +// Enable OC_Defaults support +$defaults = new OC_Defaults(); + // Get the config $apps_paths = array(); foreach(OC_App::getEnabledApps() as $app) { @@ -24,6 +27,7 @@ foreach(OC_App::getEnabledApps() as $app) { $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', + "oc_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', "oc_webroot" => "\"".OC::$WEBROOT."\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), @@ -57,11 +61,30 @@ $array = array( "firstDay" => json_encode($l->l('firstday', 'firstday')) , "oc_config" => json_encode( array( - 'session_lifetime' => \OCP\Config::getSystemValue('session_lifetime', 60 * 60 * 24), - 'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true) + '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(), + ) + ), + "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() ) ) - ); +); + +// Allow hooks to modify the output values +OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array)); // Echo it foreach ($array as $setting => $value) { |