aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-08-21 14:00:11 +0200
committervincent-peugnet <v.peugnet@free.fr>2019-08-21 14:00:11 +0200
commit470ff90cfa4fa50a25e428454465da37aff0aa40 (patch)
treedb3544ee6ca49a57459458c5248997c38a3ddc28
parent73ee4462740c0c7d793bb8e0952e34110dfdb78b (diff)
downloadwcms-470ff90cfa4fa50a25e428454465da37aff0aa40.tar.gz
wcms-470ff90cfa4fa50a25e428454465da37aff0aa40.zip
Bug fix : limit bookmark id length
-rw-r--r--app/class/config.php5
-rw-r--r--app/class/user.php7
-rw-r--r--app/view/templates/homemenu.php4
-rw-r--r--composer.json2
4 files changed, 12 insertions, 6 deletions
diff --git a/app/class/config.php b/app/class/config.php
index 5c05657..71ce329 100644
--- a/app/class/config.php
+++ b/app/class/config.php
@@ -465,8 +465,11 @@ abstract class Config
public static function addbookmark(string $id, string $query)
{
- $id = idclean($id);
+ if(!empty($id) && !empty($query)) {
+ $id = idclean($id);
+ $id = substr($id, 0, 16);
self::$bookmark[$id] = $query;
+ }
}
public static function deletebookmark(string $id)
diff --git a/app/class/user.php b/app/class/user.php
index 2b87d62..3f9c19a 100644
--- a/app/class/user.php
+++ b/app/class/user.php
@@ -276,8 +276,11 @@ class User
public function addbookmark(string $id, string $query)
{
- $id = idclean($id);
- $this->bookmark[$id] = $query;
+ if(!empty($id) && !empty($query)) {
+ $id = idclean($id);
+ $id = substr($id, 0, 16);
+ $this->bookmark[$id] = $query;
+ }
}
public function deletebookmark(string $id)
diff --git a/app/view/templates/homemenu.php b/app/view/templates/homemenu.php
index 46e2308..1003f7d 100644
--- a/app/view/templates/homemenu.php
+++ b/app/view/templates/homemenu.php
@@ -101,7 +101,7 @@
<?php } ?>
<?php if($user->issupereditor()) { ?>
<form action="<?= $this->url('homebookmark') ?>" method="post">
- <input type="text" name="id" placeholder="bookmark id">
+ <input type="text" name="id" placeholder="bookmark id" minlength="1" maxlength="16">
<input type="hidden" name="query" value="<?= $opt->getadress() ?>">
<input type="submit" name="action" value="add">
</form>
@@ -125,7 +125,7 @@
<p>This will store your filters settings as a Bookmark that only you can use.</p>
<?php } ?>
<form action="<?= $this->url('homebookmark') ?>" method="post">
- <input type="text" name="id" placeholder="bookmark id">
+ <input type="text" name="id" placeholder="bookmark id" minlength="1" maxlength="16">
<input type="hidden" name="query" value="<?= $opt->getadress() ?>">
<input type="hidden" name="user" value="<?= $user->id() ?>">
<input type="submit" name="action" value="add">
diff --git a/composer.json b/composer.json
index 6b209cc..2696734 100644
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
{
"name": "w-cms",
"description": "point'n think",
- "version": "1.5.1",
+ "version": "1.5.2",
"require": {
"michelf/php-markdown": "^1.8",
"league/plates": "3.*",