diff options
Diffstat (limited to 'lib/private/legacy')
-rw-r--r-- | lib/private/legacy/app.php | 6 | ||||
-rw-r--r-- | lib/private/legacy/defaults.php | 6 | ||||
-rw-r--r-- | lib/private/legacy/eventsource.php | 2 | ||||
-rw-r--r-- | lib/private/legacy/files.php | 19 | ||||
-rw-r--r-- | lib/private/legacy/helper.php | 10 | ||||
-rw-r--r-- | lib/private/legacy/image.php | 8 | ||||
-rw-r--r-- | lib/private/legacy/template.php | 2 | ||||
-rw-r--r-- | lib/private/legacy/util.php | 16 |
8 files changed, 52 insertions, 17 deletions
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index 58b617aae45..146262c3f95 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -55,6 +55,7 @@ use OC\App\Platform; use OC\DB\MigrationService; use OC\Installer; use OC\Repair; +use OC\ServerNotAvailableException; use OCP\App\ManagerEvent; use OCP\ILogger; @@ -153,6 +154,9 @@ class OC_App { try { self::requireAppFile($app); } catch (Throwable $ex) { + if($ex instanceof ServerNotAvailableException) { + throw $ex; + } \OC::$server->getLogger()->logException($ex); if (!\OC::$server->getAppManager()->isShipped($app)) { // Only disable apps which are not shipped @@ -485,6 +489,7 @@ class OC_App { * * @param string $appId * @return string|false + * @deprecated 11.0.0 use \OC::$server->getAppManager()->getAppPath() */ public static function getAppPath(string $appId) { if ($appId === null || trim($appId) === '') { @@ -503,6 +508,7 @@ class OC_App { * * @param string $appId * @return string|false + * @deprecated 18.0.0 use \OC::$server->getAppManager()->getAppWebPath() */ public static function getAppWebPath(string $appId) { if (($dir = self::findAppInDirectories($appId)) != false) { diff --git a/lib/private/legacy/defaults.php b/lib/private/legacy/defaults.php index d313366abe7..8633113ba5a 100644 --- a/lib/private/legacy/defaults.php +++ b/lib/private/legacy/defaults.php @@ -52,7 +52,6 @@ class OC_Defaults { private $defaultTextColorPrimary; public function __construct() { - $l10n = \OC::$server->getL10N('lib'); $config = \OC::$server->getConfig(); $this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */ @@ -65,7 +64,6 @@ class OC_Defaults { $this->defaultAndroidClientUrl = $config->getSystemValue('customclient_android', 'https://play.google.com/store/apps/details?id=com.nextcloud.client'); $this->defaultDocBaseUrl = 'https://docs.nextcloud.com'; $this->defaultDocVersion = \OC_Util::getVersion()[0]; // used to generate doc links - $this->defaultSlogan = $l10n->t('a safe home for all your data'); $this->defaultColorPrimary = '#0082c9'; $this->defaultTextColorPrimary = '#ffffff'; @@ -219,6 +217,10 @@ class OC_Defaults { if ($this->themeExist('getSlogan')) { return $this->theme->getSlogan(); } else { + if ($this->defaultSlogan === null) { + $l10n = \OC::$server->getL10N('lib'); + $this->defaultSlogan = $l10n->t('a safe home for all your data'); + } return $this->defaultSlogan; } } diff --git a/lib/private/legacy/eventsource.php b/lib/private/legacy/eventsource.php index 1e68dd24af0..aa3d3395443 100644 --- a/lib/private/legacy/eventsource.php +++ b/lib/private/legacy/eventsource.php @@ -27,7 +27,7 @@ */ /** - * wrapper for server side events (http://en.wikipedia.org/wiki/Server-sent_events) + * wrapper for server side events (https://en.wikipedia.org/wiki/Server-sent_events) * includes a fallback for older browsers and IE * * use server side events with caution, to many open requests can hang the server diff --git a/lib/private/legacy/files.php b/lib/private/legacy/files.php index 577392f1edc..140c02e77b6 100644 --- a/lib/private/legacy/files.php +++ b/lib/private/legacy/files.php @@ -177,10 +177,21 @@ class OC_Files { foreach ($files as $file) { $file = $dir . '/' . $file; if (\OC\Files\Filesystem::is_file($file)) { - $fileSize = \OC\Files\Filesystem::filesize($file); - $fileTime = \OC\Files\Filesystem::filemtime($file); - $fh = \OC\Files\Filesystem::fopen($file, 'r'); - $streamer->addFileFromStream($fh, basename($file), $fileSize, $fileTime); + $userFolder = \OC::$server->getRootFolder()->get(\OC\Files\Filesystem::getRoot()); + $file = $userFolder->get($file); + if($file instanceof \OC\Files\Node\File) { + $fh = $file->fopen('r'); + $fileSize = $file->getSize(); + $fileTime = $file->getMTime(); + } else { + // File is not a file? … + \OC::$server->getLogger()->debug( + 'File given, but no Node available. Name {file}', + [ 'app' => 'files', 'file' => $file ] + ); + continue; + } + $streamer->addFileFromStream($fh, $file->getName(), $fileSize, $fileTime); fclose($fh); } elseif (\OC\Files\Filesystem::is_dir($file)) { $streamer->addDirRecursive($file); diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php index a5ed3a3e24b..3c4915ae748 100644 --- a/lib/private/legacy/helper.php +++ b/lib/private/legacy/helper.php @@ -189,6 +189,7 @@ class OC_Helper { } /** + * @deprecated 18.0.0 * @return \OC\Files\Type\TemplateManager */ static public function getFileTemplateManager() { @@ -585,8 +586,13 @@ class OC_Helper { $relative = 0; } - return array('free' => $free, 'used' => $used, 'total' => $total, 'relative' => $relative); - + return [ + 'free' => $free, + 'used' => $used, + 'total' => $total, + 'relative' => $relative, + 'quota' => $quota + ]; } /** diff --git a/lib/private/legacy/image.php b/lib/private/legacy/image.php index d9af45f2226..2efde2ee688 100644 --- a/lib/private/legacy/image.php +++ b/lib/private/legacy/image.php @@ -878,10 +878,8 @@ class OC_Image implements \OCP\IImage { $widthOrig = imagesx($this->resource); $heightOrig = imagesy($this->resource); $process = imagecreatetruecolor($width, $height); - - if ($process == false) { + if ($process === false) { $this->logger->error(__METHOD__ . '(): Error creating true color image', array('app' => 'core')); - imagedestroy($process); return false; } @@ -892,8 +890,8 @@ class OC_Image implements \OCP\IImage { imagesavealpha($process, true); } - imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig); - if ($process == false) { + $res = imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig); + if ($res === false) { $this->logger->error(__METHOD__ . '(): Error re-sampling process image', array('app' => 'core')); imagedestroy($process); return false; diff --git a/lib/private/legacy/template.php b/lib/private/legacy/template.php index 6d9bf7c99f4..26b1b360adc 100644 --- a/lib/private/legacy/template.php +++ b/lib/private/legacy/template.php @@ -266,7 +266,7 @@ class OC_Template extends \OC\Template\Base { * @return bool */ public static function printGuestPage( $application, $name, $parameters = array() ) { - $content = new OC_Template( $application, $name, "guest" ); + $content = new OC_Template($application, $name, $name === 'error' ? $name : 'guest'); foreach( $parameters as $key => $value ) { $content->assign( $key, $value ); } diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index 810f22fb9e5..f73756dd240 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -61,11 +61,11 @@ * */ +use OC\AppFramework\Http\Request; use OCP\IConfig; use OCP\IGroupManager; use OCP\ILogger; use OCP\IUser; -use OC\AppFramework\Http\Request; class OC_Util { public static $scripts = array(); @@ -1249,6 +1249,18 @@ class OC_Util { $content = false; } + if (strpos($url, 'https:') === 0) { + $url = 'http:' . substr($url, 6); + } else { + $url = 'https:' . substr($url, 5); + } + + try { + $fallbackContent = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody(); + } catch (\Exception $e) { + $fallbackContent = false; + } + // cleanup @unlink($testFile); @@ -1256,7 +1268,7 @@ class OC_Util { * If the content is not equal to test content our .htaccess * is working as required */ - return $content !== $testContent; + return $content !== $testContent && $fallbackContent !== $testContent; } /** |