aboutsummaryrefslogtreecommitdiff
path: root/app/class/Bookmark.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-04-27 13:35:29 +0200
committervincent-peugnet <v.peugnet@free.fr>2020-04-28 20:21:34 +0200
commitcba95c5eb19a33654a6f0995c6f9e0885b7afc20 (patch)
treea334a0fa3c074f44fe41a4114ea1853ac7f6c0e3 /app/class/Bookmark.php
parentc832f91ca41490f69f478045c86038f9ef4a5cb5 (diff)
downloadwcms-cba95c5eb19a33654a6f0995c6f9e0885b7afc20.tar.gz
wcms-cba95c5eb19a33654a6f0995c6f9e0885b7afc20.zip
fix password max size
add error in hydrate
Diffstat (limited to 'app/class/Bookmark.php')
-rw-r--r--app/class/Bookmark.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/app/class/Bookmark.php b/app/class/Bookmark.php
index bc77310..9e038aa 100644
--- a/app/class/Bookmark.php
+++ b/app/class/Bookmark.php
@@ -21,10 +21,12 @@ class Bookmark extends Item
/** @var string $icon associated emoji */
protected $icon = '⭐';
-
+ /**
+ * @throws RuntimeException
+ */
public function __construct(array $datas = [])
{
- $this->hydrate($datas);
+ $this->hydrate($datas, true);
}
public function init(string $id, string $route, string $query, array $params = [], string $icon = '⭐')
@@ -69,13 +71,19 @@ class Bookmark extends Item
// _____________________________ S E T __________________________________
- public function setid($id)
+ public function setid($id): bool
{
if (is_string($id)) {
- $this->id = idclean($id);
+ try {
+ $this->id = idclean($id, Model::MAX_ID_LENGTH, 1);
+ } catch (\Throwable $th) {
+ return false;
+ }
+ return true;
}
+ return false;
}
-
+
public function setquery($query)
{
if (is_string($query)) {
@@ -87,6 +95,9 @@ class Bookmark extends Item
{
if ($route === 'home' || $route === 'media') {
$this->route = $route;
+ return true;
+ } else {
+ return false;
}
}