Upgrade to 3.4.1
This commit is contained in:
@@ -75,14 +75,6 @@ class App
|
||||
protected $users;
|
||||
protected $visitor;
|
||||
|
||||
/**
|
||||
* List of options that shouldn't be converted
|
||||
* to a tree structure by dot syntax
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $nestIgnoreOptions = ['hooks'];
|
||||
|
||||
/**
|
||||
* Creates a new App instance
|
||||
*
|
||||
@@ -127,13 +119,8 @@ class App
|
||||
$this->extensionsFromSystem();
|
||||
$this->extensionsFromProps($props);
|
||||
$this->extensionsFromPlugins();
|
||||
$this->extensionsFromFolders();
|
||||
|
||||
// bake the options for the first time
|
||||
$this->bakeOptions();
|
||||
|
||||
// register the extensions from the normalized options
|
||||
$this->extensionsFromOptions();
|
||||
$this->extensionsFromFolders();
|
||||
|
||||
// trigger hook for use in plugins
|
||||
$this->trigger('system.loadPlugins:after');
|
||||
@@ -141,7 +128,7 @@ class App
|
||||
// execute a ready callback from the config
|
||||
$this->optionsFromReadyCallback();
|
||||
|
||||
// bake the options again with those from the ready callback
|
||||
// bake config
|
||||
$this->bakeOptions();
|
||||
}
|
||||
|
||||
@@ -238,7 +225,30 @@ class App
|
||||
*/
|
||||
protected function bakeOptions()
|
||||
{
|
||||
$this->options = A::nest($this->options, static::$nestIgnoreOptions);
|
||||
// convert the old plugin option syntax to the new one
|
||||
foreach ($this->options as $key => $value) {
|
||||
// detect option keys with the `vendor.plugin.option` format
|
||||
if (preg_match('/^([a-z0-9-]+\.[a-z0-9-]+)\.(.*)$/i', $key, $matches) === 1) {
|
||||
list(, $plugin, $option) = $matches;
|
||||
|
||||
// verify that it's really a plugin option
|
||||
if (isset(static::$plugins[str_replace('.', '/', $plugin)]) !== true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// ensure that the target option array exists
|
||||
// (which it will if the plugin has any options)
|
||||
if (isset($this->options[$plugin]) !== true) {
|
||||
$this->options[$plugin] = []; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
// move the option to the plugin option array
|
||||
// don't overwrite nested arrays completely but merge them
|
||||
$this->options[$plugin] = array_replace_recursive($this->options[$plugin], [$option => $value]);
|
||||
unset($this->options[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
Config::$data = $this->options;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -292,19 +292,9 @@ trait AppPlugins
|
||||
protected function extendOptions(array $options, Plugin $plugin = null): array
|
||||
{
|
||||
if ($plugin !== null) {
|
||||
$prefixed = [];
|
||||
|
||||
foreach ($options as $key => $value) {
|
||||
$prefixed[$plugin->prefix() . '.' . $key] = $value;
|
||||
}
|
||||
|
||||
$options = $prefixed;
|
||||
$options = [$plugin->prefix() => $options];
|
||||
}
|
||||
|
||||
// register each option in the nesting blacklist;
|
||||
// this prevents Kirby from nesting the array keys inside each option
|
||||
static::$nestIgnoreOptions = array_merge(static::$nestIgnoreOptions, array_keys($options));
|
||||
|
||||
return $this->extensions['options'] = $this->options = A::merge($options, $this->options, A::MERGE_REPLACE);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use Kirby\Data\Data;
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use Kirby\Exception\NotFoundException;
|
||||
use Kirby\Exception\PermissionException;
|
||||
use Kirby\Http\Idn;
|
||||
use Kirby\Http\Request\Auth\BasicAuth;
|
||||
use Kirby\Toolkit\F;
|
||||
use Throwable;
|
||||
@@ -256,6 +257,9 @@ class Auth
|
||||
*/
|
||||
public function validatePassword(string $email, string $password)
|
||||
{
|
||||
// ensure that email addresses with IDN domains are in Unicode format
|
||||
$email = Idn::decodeEmail($email);
|
||||
|
||||
// check for blocked ips
|
||||
if ($this->isBlocked($email) === true) {
|
||||
if ($this->kirby->option('debug') === true) {
|
||||
|
||||
@@ -95,7 +95,7 @@ class LanguageRoutes
|
||||
}
|
||||
}
|
||||
|
||||
return $kirby->defaultLanguage()->router()->call($path);
|
||||
return $kirby->language()->router()->call($path);
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ trait PageActions
|
||||
if ($action === 'create') {
|
||||
$argumentsAfter = ['page' => $result];
|
||||
} elseif ($action === 'duplicate') {
|
||||
$argumentsAfter = ['duplicatePage' => $result];
|
||||
$argumentsAfter = ['duplicatePage' => $result, 'originalPage' => $old];
|
||||
} elseif ($action === 'delete') {
|
||||
$argumentsAfter = ['status' => $result, 'page' => $old];
|
||||
} else {
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace Kirby\Cms;
|
||||
use Exception;
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use Kirby\Exception\NotFoundException;
|
||||
use Kirby\Session\Session;
|
||||
use Kirby\Toolkit\F;
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
@@ -764,7 +763,7 @@ class User extends ModelWithContent
|
||||
protected function setEmail(string $email = null)
|
||||
{
|
||||
if ($email !== null) {
|
||||
$this->email = strtolower(trim($email));
|
||||
$this->email = Str::lower(trim($email));
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
@@ -825,7 +824,7 @@ class User extends ModelWithContent
|
||||
*/
|
||||
protected function setRole(string $role = null)
|
||||
{
|
||||
$this->role = $role !== null ? strtolower(trim($role)) : null;
|
||||
$this->role = $role !== null ? Str::lower(trim($role)) : null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use Closure;
|
||||
use Kirby\Data\Data;
|
||||
use Kirby\Exception\LogicException;
|
||||
use Kirby\Exception\PermissionException;
|
||||
use Kirby\Http\Idn;
|
||||
use Kirby\Toolkit\Dir;
|
||||
use Kirby\Toolkit\F;
|
||||
use Kirby\Toolkit\Str;
|
||||
@@ -29,7 +30,7 @@ trait UserActions
|
||||
*/
|
||||
public function changeEmail(string $email)
|
||||
{
|
||||
return $this->commit('changeEmail', ['user' => $this, 'email' => $email], function ($user, $email) {
|
||||
return $this->commit('changeEmail', ['user' => $this, 'email' => Idn::decodeEmail($email)], function ($user, $email) {
|
||||
$user = $user->clone([
|
||||
'email' => $email
|
||||
]);
|
||||
@@ -176,6 +177,10 @@ trait UserActions
|
||||
{
|
||||
$data = $props;
|
||||
|
||||
if (isset($props['email']) === true) {
|
||||
$data['email'] = Idn::decodeEmail($props['email']);
|
||||
}
|
||||
|
||||
if (isset($props['password']) === true) {
|
||||
$data['password'] = User::hashPassword($props['password']);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class Users extends Collection
|
||||
public function findByKey(string $key)
|
||||
{
|
||||
if (Str::contains($key, '@') === true) {
|
||||
return parent::findBy('email', strtolower($key));
|
||||
return parent::findBy('email', Str::lower($key));
|
||||
}
|
||||
|
||||
return parent::findByKey($key);
|
||||
|
||||
Reference in New Issue
Block a user