aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/l10n/sl.js15
-rw-r--r--lib/l10n/sl.json15
-rw-r--r--lib/private/Accounts/AccountManager.php9
-rw-r--r--lib/private/App/PlatformRepository.php4
-rw-r--r--lib/private/Contacts/ContactsMenu/ContactsStore.php2
-rw-r--r--lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php2
-rw-r--r--lib/private/Log.php27
-rw-r--r--lib/private/Profile/Actions/EmailAction.php4
-rw-r--r--lib/private/Profile/Actions/PhoneAction.php4
-rw-r--r--lib/private/Profile/Actions/TwitterAction.php4
-rw-r--r--lib/private/Profile/Actions/WebsiteAction.php4
-rw-r--r--lib/private/Profile/ProfileManager.php15
-rw-r--r--lib/private/RedisFactory.php2
-rw-r--r--lib/private/Repair.php11
-rw-r--r--lib/private/TemplateLayout.php4
-rw-r--r--lib/private/legacy/OC_Template.php5
-rw-r--r--lib/private/legacy/OC_Util.php14
-rw-r--r--lib/public/Util.php24
-rw-r--r--lib/public/WorkflowEngine/IOperation.php3
19 files changed, 112 insertions, 56 deletions
diff --git a/lib/l10n/sl.js b/lib/l10n/sl.js
index 074161e4d5c..9d00bb24c62 100644
--- a/lib/l10n/sl.js
+++ b/lib/l10n/sl.js
@@ -49,6 +49,7 @@ OC.L10N.register(
"Unknown filetype" : "Neznana vrsta datoteke",
"Invalid image" : "Neveljavna slika",
"Avatar image is not square" : "Slika podobe ni kvadratna",
+ "View profile" : "Pokaži profil",
"today" : "danes",
"tomorrow" : "jutri",
"yesterday" : "včeraj",
@@ -88,6 +89,20 @@ OC.L10N.register(
"Settings" : "Nastavitve",
"Log out" : "Odjava",
"Users" : "Uporabniki",
+ "Email" : "Elektronski naslov",
+ "Mail %s" : "Elektronski naslov %s",
+ "Phone" : "Telefon",
+ "Call %s" : "Klic %s",
+ "Twitter" : "Račun Twitter",
+ "Website" : "Spletna stran",
+ "Visit %s" : "Obišči %s",
+ "Address" : "Naslov",
+ "Profile picture" : "Slika profila",
+ "About" : "O programu",
+ "Full name" : "Polno ime",
+ "Headline" : "Naslov",
+ "Organisation" : "Ustanova",
+ "Role" : "Vloga",
"Unknown user" : "Neznan uporabnik",
"Additional settings" : "Dodatne nastavitve",
"%s enter the database username and name." : "%s – vnos uporabniškega imena in imena podatkovne zbirke.",
diff --git a/lib/l10n/sl.json b/lib/l10n/sl.json
index 4133732b912..492fc8c5d7c 100644
--- a/lib/l10n/sl.json
+++ b/lib/l10n/sl.json
@@ -47,6 +47,7 @@
"Unknown filetype" : "Neznana vrsta datoteke",
"Invalid image" : "Neveljavna slika",
"Avatar image is not square" : "Slika podobe ni kvadratna",
+ "View profile" : "Pokaži profil",
"today" : "danes",
"tomorrow" : "jutri",
"yesterday" : "včeraj",
@@ -86,6 +87,20 @@
"Settings" : "Nastavitve",
"Log out" : "Odjava",
"Users" : "Uporabniki",
+ "Email" : "Elektronski naslov",
+ "Mail %s" : "Elektronski naslov %s",
+ "Phone" : "Telefon",
+ "Call %s" : "Klic %s",
+ "Twitter" : "Račun Twitter",
+ "Website" : "Spletna stran",
+ "Visit %s" : "Obišči %s",
+ "Address" : "Naslov",
+ "Profile picture" : "Slika profila",
+ "About" : "O programu",
+ "Full name" : "Polno ime",
+ "Headline" : "Naslov",
+ "Organisation" : "Ustanova",
+ "Role" : "Vloga",
"Unknown user" : "Neznan uporabnik",
"Additional settings" : "Dodatne nastavitve",
"%s enter the database username and name." : "%s – vnos uporabniškega imena in imena podatkovne zbirke.",
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index cbd51e71c4a..2c7641243fa 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -343,6 +343,10 @@ class AccountManager implements IAccountManager {
}
public function searchUsers(string $property, array $values): array {
+ // the value col is limited to 255 bytes. It is used for searches only.
+ $values = array_map(function (string $value) {
+ return Util::shortenMultibyteString($value, 255);
+ }, $values);
$chunks = array_chunk($values, 500);
$query = $this->connection->getQueryBuilder();
$query->select('*')
@@ -625,8 +629,11 @@ class AccountManager implements IAccountManager {
continue;
}
+ // the value col is limited to 255 bytes. It is used for searches only.
+ $value = $property['value'] ? Util::shortenMultibyteString($property['value'], 255) : '';
+
$query->setParameter('name', $property['name'])
- ->setParameter('value', $property['value'] ?? '');
+ ->setParameter('value', $value);
$query->executeStatement();
}
}
diff --git a/lib/private/App/PlatformRepository.php b/lib/private/App/PlatformRepository.php
index ed8e550ca77..94fac5260e1 100644
--- a/lib/private/App/PlatformRepository.php
+++ b/lib/private/App/PlatformRepository.php
@@ -65,10 +65,6 @@ class PlatformRepository {
$prettyVersion = $curlVersion['version'];
break;
- case 'iconv':
- $prettyVersion = ICONV_VERSION;
- break;
-
case 'intl':
$name = 'ICU';
if (defined('INTL_ICU_VERSION')) {
diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php
index eb7e752a87a..cd1cc9b6169 100644
--- a/lib/private/Contacts/ContactsMenu/ContactsStore.php
+++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php
@@ -334,7 +334,7 @@ class ContactsStore implements IContactsStore {
if (!empty($user)) {
$account = $this->accountManager->getAccount($user);
if ($this->isProfileEnabled($account)) {
- $entry->setProfileTitle($this->l10nFactory->get('core')->t('View profile'));
+ $entry->setProfileTitle($this->l10nFactory->get('lib')->t('View profile'));
$entry->setProfileUrl($this->urlGenerator->linkToRouteAbsolute('core.ProfilePage.index', ['targetUserId' => $targetUserId]));
}
}
diff --git a/lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php b/lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php
index 88370f193a1..15d24fc7773 100644
--- a/lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php
+++ b/lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php
@@ -81,7 +81,7 @@ class ProfileProvider implements IProvider {
$account = $this->accountManager->getAccount($targetUser);
if ($this->isProfileEnabled($account)) {
$iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/profile.svg'));
- $profileActionText = $this->l10nFactory->get('core')->t('View profile');
+ $profileActionText = $this->l10nFactory->get('lib')->t('View profile');
$profileUrl = $this->urlGenerator->linkToRouteAbsolute('core.ProfilePage.index', ['targetUserId' => $targetUserId]);
$action = $this->actionFactory->newLinkAction($iconUrl, $profileActionText, $profileUrl, 'profile');
// Set highest priority (by descending order), other actions have the default priority 10 as defined in lib/private/Contacts/ContactsMenu/Actions/LinkAction.php
diff --git a/lib/private/Log.php b/lib/private/Log.php
index 9c6a1b614c6..edbfdea7b9d 100644
--- a/lib/private/Log.php
+++ b/lib/private/Log.php
@@ -43,6 +43,7 @@ use OCP\ILogger;
use OCP\Log\IFileBased;
use OCP\Log\IWriter;
use OCP\Support\CrashReport\IRegistry;
+use function strtr;
/**
* logging utilities
@@ -206,13 +207,7 @@ class Log implements ILogger, IDataLogger {
array_walk($context, [$this->normalizer, 'format']);
$app = $context['app'] ?? 'no app in context';
-
- // interpolate $message as defined in PSR-3
- $replace = [];
- foreach ($context as $key => $val) {
- $replace['{' . $key . '}'] = $val;
- }
- $message = strtr($message, $replace);
+ $message = $this->interpolateMessage($context, $message);
try {
if ($level >= $minLevel) {
@@ -315,7 +310,7 @@ class Log implements ILogger, IDataLogger {
$serializer = new ExceptionSerializer($this->config);
$data = $serializer->serializeException($exception);
- $data['CustomMessage'] = $context['message'] ?? '--';
+ $data['CustomMessage'] = $this->interpolateMessage($context, $context['message'] ?? '--');
$minLevel = $this->getLogLevel($context);
@@ -376,4 +371,20 @@ class Log implements ILogger, IDataLogger {
}
throw new \RuntimeException('Log implementation has no path');
}
+
+ /**
+ * Interpolate $message as defined in PSR-3
+ *
+ * @param array $context
+ * @param string $message
+ *
+ * @return string
+ */
+ private function interpolateMessage(array $context, string $message): string {
+ $replace = [];
+ foreach ($context as $key => $val) {
+ $replace['{' . $key . '}'] = $val;
+ }
+ return strtr($message, $replace);
+ }
}
diff --git a/lib/private/Profile/Actions/EmailAction.php b/lib/private/Profile/Actions/EmailAction.php
index 1eef1236630..d3c749e06c3 100644
--- a/lib/private/Profile/Actions/EmailAction.php
+++ b/lib/private/Profile/Actions/EmailAction.php
@@ -70,11 +70,11 @@ class EmailAction implements ILinkAction {
}
public function getDisplayId(): string {
- return $this->l10nFactory->get('core')->t('Email');
+ return $this->l10nFactory->get('lib')->t('Email');
}
public function getTitle(): string {
- return $this->l10nFactory->get('core')->t('Mail %s', [$this->value]);
+ return $this->l10nFactory->get('lib')->t('Mail %s', [$this->value]);
}
public function getPriority(): int {
diff --git a/lib/private/Profile/Actions/PhoneAction.php b/lib/private/Profile/Actions/PhoneAction.php
index df0e30cd277..43974df62fb 100644
--- a/lib/private/Profile/Actions/PhoneAction.php
+++ b/lib/private/Profile/Actions/PhoneAction.php
@@ -70,11 +70,11 @@ class PhoneAction implements ILinkAction {
}
public function getDisplayId(): string {
- return $this->l10nFactory->get('core')->t('Phone');
+ return $this->l10nFactory->get('lib')->t('Phone');
}
public function getTitle(): string {
- return $this->l10nFactory->get('core')->t('Call %s', [$this->value]);
+ return $this->l10nFactory->get('lib')->t('Call %s', [$this->value]);
}
public function getPriority(): int {
diff --git a/lib/private/Profile/Actions/TwitterAction.php b/lib/private/Profile/Actions/TwitterAction.php
index 3dcfa8aaf12..204284be1f5 100644
--- a/lib/private/Profile/Actions/TwitterAction.php
+++ b/lib/private/Profile/Actions/TwitterAction.php
@@ -71,12 +71,12 @@ class TwitterAction implements ILinkAction {
}
public function getDisplayId(): string {
- return $this->l10nFactory->get('core')->t('Twitter');
+ return $this->l10nFactory->get('lib')->t('Twitter');
}
public function getTitle(): string {
$displayUsername = $this->value[0] === '@' ? $this->value : '@' . $this->value;
- return $this->l10nFactory->get('core')->t('View %s on Twitter', [$displayUsername]);
+ return $this->l10nFactory->get('lib')->t('View %s on Twitter', [$displayUsername]);
}
public function getPriority(): int {
diff --git a/lib/private/Profile/Actions/WebsiteAction.php b/lib/private/Profile/Actions/WebsiteAction.php
index ea1daeee20e..0a08879059c 100644
--- a/lib/private/Profile/Actions/WebsiteAction.php
+++ b/lib/private/Profile/Actions/WebsiteAction.php
@@ -70,11 +70,11 @@ class WebsiteAction implements ILinkAction {
}
public function getDisplayId(): string {
- return $this->l10nFactory->get('core')->t('Website');
+ return $this->l10nFactory->get('lib')->t('Website');
}
public function getTitle(): string {
- return $this->l10nFactory->get('core')->t('Visit %s', [$this->value]);
+ return $this->l10nFactory->get('lib')->t('Visit %s', [$this->value]);
}
public function getPriority(): int {
diff --git a/lib/private/Profile/ProfileManager.php b/lib/private/Profile/ProfileManager.php
index f83de7fd358..c4317b294f3 100644
--- a/lib/private/Profile/ProfileManager.php
+++ b/lib/private/Profile/ProfileManager.php
@@ -396,35 +396,36 @@ class ProfileManager {
$propertiesMetadata = [
IAccountManager::PROPERTY_ADDRESS => [
'appId' => self::CORE_APP_ID,
- 'displayId' => $this->l10nFactory->get(self::CORE_APP_ID)->t('Address'),
+ 'displayId' => $this->l10nFactory->get('lib')->t('Address'),
],
IAccountManager::PROPERTY_AVATAR => [
'appId' => self::CORE_APP_ID,
- 'displayId' => $this->l10nFactory->get(self::CORE_APP_ID)->t('Profile picture'),
+ 'displayId' => $this->l10nFactory->get('lib')->t('Profile picture'),
],
IAccountManager::PROPERTY_BIOGRAPHY => [
'appId' => self::CORE_APP_ID,
- 'displayId' => $this->l10nFactory->get(self::CORE_APP_ID)->t('About'),
+ 'displayId' => $this->l10nFactory->get('lib')->t('About'),
],
IAccountManager::PROPERTY_DISPLAYNAME => [
'appId' => self::CORE_APP_ID,
- 'displayId' => $this->l10nFactory->get(self::CORE_APP_ID)->t('Full name'),
+ 'displayId' => $this->l10nFactory->get('lib')->t('Full name'),
],
IAccountManager::PROPERTY_HEADLINE => [
'appId' => self::CORE_APP_ID,
- 'displayId' => $this->l10nFactory->get(self::CORE_APP_ID)->t('Headline'),
+ 'displayId' => $this->l10nFactory->get('lib')->t('Headline'),
],
IAccountManager::PROPERTY_ORGANISATION => [
'appId' => self::CORE_APP_ID,
- 'displayId' => $this->l10nFactory->get(self::CORE_APP_ID)->t('Organisation'),
+ 'displayId' => $this->l10nFactory->get('lib')->t('Organisation'),
],
IAccountManager::PROPERTY_ROLE => [
'appId' => self::CORE_APP_ID,
- 'displayId' => $this->l10nFactory->get(self::CORE_APP_ID)->t('Role'),
+ 'displayId' => $this->l10nFactory->get('lib')->t('Role'),
],
];
$paramMetadata = array_merge($actionsMetadata, $propertiesMetadata);
+ $configArray = array_intersect_key($configArray, $paramMetadata);
foreach ($configArray as $paramId => $paramConfig) {
if (isset($paramMetadata[$paramId])) {
diff --git a/lib/private/RedisFactory.php b/lib/private/RedisFactory.php
index d8c0d12c5cc..3062be28a78 100644
--- a/lib/private/RedisFactory.php
+++ b/lib/private/RedisFactory.php
@@ -46,7 +46,7 @@ class RedisFactory {
}
private function create() {
- $isCluster = in_array('redis.cluster', $this->config->getKeys());
+ $isCluster = in_array('redis.cluster', $this->config->getKeys(), true);
$config = $isCluster
? $this->config->getValue('redis.cluster', [])
: $this->config->getValue('redis', []);
diff --git a/lib/private/Repair.php b/lib/private/Repair.php
index 688b053fa12..408d0f1b7aa 100644
--- a/lib/private/Repair.php
+++ b/lib/private/Repair.php
@@ -80,6 +80,7 @@ use OCP\Migration\IRepairStep;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
+use Throwable;
class Repair implements IOutput {
@@ -140,9 +141,15 @@ class Repair implements IOutput {
$s = \OC::$server->query($repairStep);
} catch (QueryException $e) {
if (class_exists($repairStep)) {
- $s = new $repairStep();
+ try {
+ // Last resort: hope there are no constructor arguments
+ $s = new $repairStep();
+ } catch (Throwable $inner) {
+ // Well, it was worth a try
+ throw new \Exception("Repair step '$repairStep' can't be instantiated: " . $e->getMessage(), 0, $e);
+ }
} else {
- throw new \Exception("Repair step '$repairStep' is unknown");
+ throw new \Exception("Repair step '$repairStep' is unknown", 0, $e);
}
}
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index a620b9fdac3..639e7dc007b 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -82,10 +82,6 @@ class TemplateLayout extends \OC_Template {
/** @var IInitialStateService */
$this->initialState = \OC::$server->get(IInitialStateService::class);
- if (\OC_Util::isIe()) {
- Util::addStyle('ie');
- }
-
// Decide which page we show
if ($renderAs === TemplateResponse::RENDER_AS_USER) {
/** @var INavigationManager */
diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php
index b4bc290429a..9dfdb87e5ee 100644
--- a/lib/private/legacy/OC_Template.php
+++ b/lib/private/legacy/OC_Template.php
@@ -120,11 +120,6 @@ class OC_Template extends \OC\Template\Base {
}
OC_Util::addScript('core', 'dist/main', true);
- if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE])) {
- // shim for the davclient.js library
- \OCP\Util::addScript('dist/files_iedavclient');
- }
-
self::$initTemplateEngineFirstRun = false;
}
}
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php
index 078e3cf9a03..6239583160b 100644
--- a/lib/private/legacy/OC_Util.php
+++ b/lib/private/legacy/OC_Util.php
@@ -837,7 +837,6 @@ class OC_Util {
'json_encode' => 'JSON',
'gd_info' => 'GD',
'gzencode' => 'zlib',
- 'iconv' => 'iconv',
'simplexml_load_string' => 'SimpleXML',
'hash' => 'HASH Message Digest Framework',
'curl_init' => 'cURL',
@@ -1444,17 +1443,4 @@ class OC_Util {
return false;
}
}
-
- /**
- * is this Internet explorer ?
- *
- * @return boolean
- */
- public static function isIe() {
- if (!isset($_SERVER['HTTP_USER_AGENT'])) {
- return false;
- }
-
- return preg_match(Request::USER_AGENT_IE, $_SERVER['HTTP_USER_AGENT']) === 1;
- }
}
diff --git a/lib/public/Util.php b/lib/public/Util.php
index 5165846707a..103b65fe874 100644
--- a/lib/public/Util.php
+++ b/lib/public/Util.php
@@ -513,4 +513,28 @@ class Util {
}
return self::$needUpgradeCache;
}
+
+ /**
+ * Sometimes a string has to be shortened to fit within a certain maximum
+ * data length in bytes. substr() you may break multibyte characters,
+ * because it operates on single byte level. mb_substr() operates on
+ * characters, so does not ensure that the shortend string satisfies the
+ * max length in bytes.
+ *
+ * For example, json_encode is messing with multibyte characters a lot,
+ * replacing them with something along "\u1234".
+ *
+ * This function shortens the string with by $accurancy (-5) from
+ * $dataLength characters, until it fits within $dataLength bytes.
+ *
+ * @since 23.0.0
+ */
+ public static function shortenMultibyteString(string $subject, int $dataLength, int $accuracy = 5): string {
+ $temp = mb_substr($subject, 0, $dataLength);
+ // json encodes encapsulates the string in double quotes, they need to be substracted
+ while ((strlen(json_encode($temp)) - 2) > $dataLength) {
+ $temp = mb_substr($temp, 0, -$accuracy);
+ }
+ return $temp;
+ }
}
diff --git a/lib/public/WorkflowEngine/IOperation.php b/lib/public/WorkflowEngine/IOperation.php
index 3ef810438e0..42aa93140f8 100644
--- a/lib/public/WorkflowEngine/IOperation.php
+++ b/lib/public/WorkflowEngine/IOperation.php
@@ -73,6 +73,9 @@ interface IOperation {
* user scope is permitted, the default behaviour should return `true`,
* otherwise `false`.
*
+ * @param int $scope
+ * @psalm-param IManager::SCOPE_* $scope
+ *
* @since 18.0.0
*/
public function isAvailableForScope(int $scope): bool;