b2da07fe95
Conflicts: apps/files/l10n/bn_BD.php apps/files/l10n/da.php apps/files/l10n/de.php apps/files/l10n/de_DE.php apps/files/l10n/fa.php apps/files/l10n/fi_FI.php apps/files/l10n/hr.php apps/files/l10n/ms_MY.php apps/files/l10n/ro.php apps/files/l10n/si_LK.php apps/files/l10n/sl.php apps/files/l10n/ta_LK.php apps/files_external/l10n/de_DE.php apps/files_external/l10n/et_EE.php apps/user_ldap/l10n/tr.php core/l10n/bg_BG.php l10n/af_ZA/files.po l10n/af_ZA/files_external.po l10n/ar/core.po l10n/ar/files.po l10n/ar/files_external.po l10n/be/files.po l10n/be/files_external.po l10n/bg_BG/core.po l10n/bg_BG/files.po l10n/bg_BG/files_external.po l10n/bg_BG/files_trashbin.po l10n/bg_BG/files_versions.po l10n/bg_BG/settings.po l10n/bn_BD/core.po l10n/bn_BD/files.po l10n/bn_BD/files_external.po l10n/ca/core.po l10n/ca/files.po l10n/ca/files_external.po l10n/cs_CZ/core.po l10n/cs_CZ/files.po l10n/cs_CZ/files_external.po l10n/cs_CZ/lib.po l10n/cy_GB/core.po l10n/cy_GB/files.po l10n/cy_GB/files_external.po l10n/cy_GB/settings.po l10n/da/core.po l10n/da/files.po l10n/da/files_external.po l10n/de/core.po l10n/de/files.po l10n/de/files_external.po l10n/de_DE/core.po l10n/de_DE/files.po l10n/de_DE/files_external.po l10n/el/core.po l10n/el/files.po l10n/el/files_external.po l10n/eo/core.po l10n/eo/files.po l10n/eo/files_external.po l10n/es/core.po l10n/es/files.po l10n/es/files_external.po l10n/es_AR/core.po l10n/es_AR/files.po l10n/es_AR/files_external.po l10n/et_EE/core.po l10n/et_EE/files.po l10n/et_EE/files_external.po l10n/eu/core.po l10n/eu/files.po l10n/eu/files_external.po l10n/fa/core.po l10n/fa/files.po l10n/fa/files_external.po l10n/fi/files.po l10n/fi_FI/core.po l10n/fi_FI/files.po l10n/fi_FI/files_external.po l10n/fr/core.po l10n/fr/files.po l10n/fr/files_external.po l10n/gl/core.po l10n/gl/files.po l10n/gl/files_external.po l10n/he/core.po l10n/he/files.po l10n/he/files_external.po l10n/hi/files.po l10n/hi/files_external.po l10n/hr/core.po l10n/hr/files.po l10n/hr/files_external.po l10n/hu_HU/core.po l10n/hu_HU/files.po l10n/hu_HU/files_external.po l10n/hy/files.po l10n/hy/files_external.po l10n/ia/core.po l10n/ia/files.po l10n/ia/files_external.po l10n/id/core.po l10n/id/files.po l10n/id/files_external.po l10n/is/core.po l10n/is/files.po l10n/is/files_external.po l10n/it/core.po l10n/it/files.po l10n/it/files_external.po l10n/ja_JP/core.po l10n/ja_JP/files.po l10n/ja_JP/files_external.po l10n/ka/files.po l10n/ka/files_external.po l10n/ka_GE/core.po l10n/ka_GE/files.po l10n/ka_GE/files_external.po l10n/kn/files.po l10n/kn/files_external.po l10n/ko/core.po l10n/ko/files.po l10n/ko/files_external.po l10n/ku_IQ/files.po l10n/ku_IQ/files_external.po l10n/lb/core.po l10n/lb/files.po l10n/lb/files_external.po l10n/lt_LT/core.po l10n/lt_LT/files.po l10n/lt_LT/files_external.po l10n/lv/core.po l10n/lv/files.po l10n/lv/files_external.po l10n/mk/core.po l10n/mk/files.po l10n/mk/files_external.po l10n/ms_MY/core.po l10n/ms_MY/files.po l10n/ms_MY/files_external.po l10n/my_MM/files.po l10n/my_MM/files_external.po l10n/nb_NO/core.po l10n/nb_NO/files.po l10n/nb_NO/files_external.po l10n/ne/files.po l10n/ne/files_external.po l10n/nl/core.po l10n/nl/files.po l10n/nl/files_external.po l10n/nn_NO/files.po l10n/nn_NO/files_external.po l10n/oc/core.po l10n/oc/files.po l10n/oc/files_external.po l10n/pl/core.po l10n/pl/files.po l10n/pl/files_external.po l10n/pl_PL/files.po l10n/pt_BR/core.po l10n/pt_BR/files.po l10n/pt_BR/files_external.po l10n/pt_PT/core.po l10n/pt_PT/files.po l10n/pt_PT/files_external.po l10n/ro/core.po l10n/ro/files.po l10n/ro/files_external.po l10n/ru/core.po l10n/ru/files.po l10n/ru/files_external.po l10n/ru_RU/core.po l10n/ru_RU/files.po l10n/si_LK/core.po l10n/si_LK/files.po l10n/si_LK/files_external.po l10n/sk/files.po l10n/sk/files_external.po l10n/sk_SK/core.po l10n/sk_SK/files.po l10n/sk_SK/files_external.po l10n/sl/core.po l10n/sl/files.po l10n/sl/files_external.po l10n/sq/core.po l10n/sq/files.po l10n/sq/files_external.po l10n/sr/core.po l10n/sr/files.po l10n/sr/files_external.po l10n/sr@latin/files.po l10n/sr@latin/files_external.po l10n/sv/core.po l10n/sv/files.po l10n/sv/files_external.po l10n/sw_KE/files.po l10n/sw_KE/files_external.po l10n/ta_LK/core.po l10n/ta_LK/files.po l10n/ta_LK/files_external.po l10n/te/files.po l10n/te/files_external.po l10n/templates/core.pot l10n/templates/files.pot l10n/templates/files_encryption.pot l10n/templates/files_external.pot l10n/templates/files_sharing.pot l10n/templates/files_trashbin.pot l10n/templates/files_versions.pot l10n/templates/lib.pot l10n/templates/settings.pot l10n/templates/user_ldap.pot l10n/templates/user_webdavauth.pot l10n/th_TH/core.po l10n/th_TH/files.po l10n/th_TH/files_external.po l10n/tr/core.po l10n/tr/files.po l10n/tr/files_external.po l10n/tr/user_ldap.po l10n/uk/core.po l10n/uk/files.po l10n/uk/files_external.po l10n/ur_PK/files.po l10n/ur_PK/files_external.po l10n/vi/core.po l10n/vi/files.po l10n/vi/files_external.po l10n/zh_CN.GB2312/core.po l10n/zh_CN.GB2312/files.po l10n/zh_CN.GB2312/files_external.po l10n/zh_CN/core.po l10n/zh_CN/files.po l10n/zh_CN/files_external.po l10n/zh_HK/core.po l10n/zh_HK/files.po l10n/zh_HK/files_external.po l10n/zh_TW/core.po l10n/zh_TW/files.po l10n/zh_TW/files_external.po lib/base.php lib/files/mount/mount.php
207 lines
7.7 KiB
PHP
207 lines
7.7 KiB
PHP
<?php
|
|
/**
|
|
* Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
* later.
|
|
* See the COPYING-README file.
|
|
*/
|
|
|
|
class OC_TemplateLayout extends OC_Template {
|
|
public function __construct( $renderas ) {
|
|
// Decide which page we show
|
|
|
|
if( $renderas == 'user' ) {
|
|
parent::__construct( 'core', 'layout.user' );
|
|
if(in_array(OC_APP::getCurrentApp(), array('settings','admin', 'help'))!==false) {
|
|
$this->assign('bodyid', 'body-settings');
|
|
}else{
|
|
$this->assign('bodyid', 'body-user');
|
|
}
|
|
|
|
// Update notification
|
|
if(OC_Config::getValue('updatechecker', true) === true) {
|
|
$data=OC_Updater::check();
|
|
if(isset($data['version']) && $data['version'] != '' and $data['version'] !== Array() && OC_User::isAdminUser(OC_User::getUser())) {
|
|
$this->assign('updateAvailable', true);
|
|
$this->assign('updateVersion', $data['versionstring']);
|
|
$this->assign('updateLink', $data['web']);
|
|
} else {
|
|
$this->assign('updateAvailable', false); // No update available or not an admin user
|
|
}
|
|
} else {
|
|
$this->assign('updateAvailable', false); // Update check is disabled
|
|
}
|
|
|
|
// Add navigation entry
|
|
$this->assign( 'application', '', false );
|
|
$navigation = OC_App::getNavigation();
|
|
$this->assign( 'navigation', $navigation);
|
|
$this->assign( 'settingsnavigation', OC_App::getSettingsNavigation());
|
|
foreach($navigation as $entry) {
|
|
if ($entry['active']) {
|
|
$this->assign( 'application', $entry['name'] );
|
|
break;
|
|
}
|
|
}
|
|
$user_displayname = OC_User::getDisplayName();
|
|
$this->assign( 'user_displayname', $user_displayname );
|
|
$this->assign( 'user_uid', OC_User::getUser() );
|
|
} else if ($renderas == 'guest' || $renderas == 'error') {
|
|
parent::__construct('core', 'layout.guest');
|
|
} else {
|
|
parent::__construct('core', 'layout.base');
|
|
}
|
|
$versionParameter = '?v=' . md5(implode(OC_Util::getVersion()));
|
|
// Add the js files
|
|
$jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
|
|
$this->assign('jsfiles', array(), false);
|
|
if (OC_Config::getValue('installed', false) && $renderas!='error') {
|
|
$this->append( 'jsfiles', OC_Helper::linkToRoute('js_config'));
|
|
}
|
|
if (!empty(OC_Util::$core_scripts)) {
|
|
$this->append( 'jsfiles', OC_Helper::linkToRemoteBase('core.js', false) . $versionParameter);
|
|
}
|
|
foreach($jsfiles as $info) {
|
|
$root = $info[0];
|
|
$web = $info[1];
|
|
$file = $info[2];
|
|
$this->append( 'jsfiles', $web.'/'.$file . $versionParameter);
|
|
}
|
|
|
|
// Add the css files
|
|
$cssfiles = self::findStylesheetFiles(OC_Util::$styles);
|
|
$this->assign('cssfiles', array());
|
|
if (!empty(OC_Util::$core_styles)) {
|
|
$this->append( 'cssfiles', OC_Helper::linkToRemoteBase('core.css', false) . $versionParameter);
|
|
}
|
|
foreach($cssfiles as $info) {
|
|
$root = $info[0];
|
|
$web = $info[1];
|
|
$file = $info[2];
|
|
|
|
$this->append( 'cssfiles', $web.'/'.$file . $versionParameter);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* @brief append the $file-url if exist at $root
|
|
* @param $files array to append file info to
|
|
* @param $root path to check
|
|
* @param $web base for path
|
|
* @param $file the filename
|
|
*/
|
|
static public function appendIfExist(&$files, $root, $webroot, $file) {
|
|
if (is_file($root.'/'.$file)) {
|
|
$files[] = array($root, $webroot, $file);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
static public function findStylesheetFiles($styles) {
|
|
// Read the selected theme from the config file
|
|
$theme=OC_Config::getValue( 'theme' );
|
|
|
|
// Read the detected formfactor and use the right file name.
|
|
$fext = self::getFormFactorExtension();
|
|
|
|
$files = array();
|
|
foreach($styles as $style) {
|
|
// is it in 3rdparty?
|
|
if(strpos($style, '3rdparty') === 0 &&
|
|
self::appendIfExist($files, OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style.'.css')) {
|
|
|
|
// or in the owncloud root?
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "$style$fext.css" )) {
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "$style.css" )) {
|
|
|
|
// or in core ?
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$style$fext.css" )) {
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$style.css" )) {
|
|
|
|
}else{
|
|
$app = substr($style, 0, strpos($style, '/'));
|
|
$style = substr($style, strpos($style, '/')+1);
|
|
$app_path = OC_App::getAppPath($app);
|
|
$app_url = OC::$WEBROOT . '/index.php/apps/' . $app;
|
|
if(self::appendIfExist($files, $app_path, $app_url, "$style$fext.css")) {
|
|
}
|
|
elseif(self::appendIfExist($files, $app_path, $app_url, "$style.css")) {
|
|
}
|
|
else {
|
|
echo('css file not found: style:'.$style.' formfactor:'.$fext
|
|
.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
|
|
die();
|
|
}
|
|
}
|
|
}
|
|
// Add the theme css files. you can override the default values here
|
|
if(!empty($theme)) {
|
|
foreach($styles as $style) {
|
|
if(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style$fext.css" )) {
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style.css" )) {
|
|
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style$fext.css" )) {
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style.css" )) {
|
|
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style$fext.css" )) {
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style.css" )) {
|
|
}
|
|
}
|
|
}
|
|
return $files;
|
|
}
|
|
|
|
static public function findJavascriptFiles($scripts) {
|
|
// Read the selected theme from the config file
|
|
$theme=OC_Config::getValue( 'theme' );
|
|
|
|
// Read the detected formfactor and use the right file name.
|
|
$fext = self::getFormFactorExtension();
|
|
|
|
$files = array();
|
|
foreach($scripts as $script) {
|
|
// Is it in 3rd party?
|
|
if(strpos($script, '3rdparty') === 0 &&
|
|
self::appendIfExist($files, OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $script.'.js')) {
|
|
|
|
// Is it in apps and overwritten by the theme?
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script$fext.js" )) {
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script.js" )) {
|
|
|
|
// Is it in the owncloud root but overwritten by the theme?
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script$fext.js" )) {
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script.js" )) {
|
|
|
|
// Is it in the owncloud root ?
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "$script$fext.js" )) {
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "$script.js" )) {
|
|
|
|
// Is in core but overwritten by a theme?
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$script$fext.js" )) {
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$script.js" )) {
|
|
|
|
// Is it in core?
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$script$fext.js" )) {
|
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$script.js" )) {
|
|
|
|
}else{
|
|
// Is it part of an app?
|
|
$app = substr($script, 0, strpos($script, '/'));
|
|
$script = substr($script, strpos($script, '/')+1);
|
|
$app_path = OC_App::getAppPath($app);
|
|
$app_url = OC_App::getAppWebPath($app);
|
|
if(self::appendIfExist($files, $app_path, $app_url, "$script$fext.js")) {
|
|
}
|
|
elseif(self::appendIfExist($files, $app_path, $app_url, "$script.js")) {
|
|
}
|
|
else {
|
|
echo('js file not found: script:'.$script.' formfactor:'.$fext
|
|
.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
|
|
die();
|
|
}
|
|
}
|
|
}
|
|
return $files;
|
|
}
|
|
}
|