diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php
index d8083eb9fee..872691d4ee1 100644
--- a/htdocs/bookmarks/bookmarks.lib.php
+++ b/htdocs/bookmarks/bookmarks.lib.php
@@ -67,6 +67,7 @@ function printBookmarksList($aDb, $aLangs)
{
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
$sql.= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
+ $sql.= " AND entity = ".$conf->entity;
$sql.= " ORDER BY position";
if ($resql = $db->query($sql) )
{
diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php
index 088afa10661..c88e2014665 100644
--- a/htdocs/bookmarks/class/bookmark.class.php
+++ b/htdocs/bookmarks/class/bookmark.class.php
@@ -57,10 +57,13 @@ class Bookmark
*/
function fetch($id)
{
+ global $conf;
+
$sql = "SELECT rowid, fk_user, dateb as datec, url, target,";
$sql.= " title, position, favicon";
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark";
$sql.= " WHERE rowid = ".$id;
+ $sql.= " AND entity = ".$conf->entity;
dol_syslog("Bookmark::fetch sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -96,6 +99,8 @@ class Bookmark
*/
function create()
{
+ global $conf;
+
// Clean parameters
$this->url=trim($this->url);
$this->title=trim($this->title);
@@ -106,13 +111,15 @@ class Bookmark
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_user,dateb,url,target";
- $sql.= " ,title,favicon,position";
+ $sql.= ",title,favicon,position";
+ $sql.= ",entity";
if ($this->fk_soc) $sql.=",fk_soc";
$sql.= ") VALUES (";
$sql.= ($this->fk_user > 0?"'".$this->fk_user."'":"0").",";
$sql.= " ".$this->db->idate($now).",";
$sql.= " '".$this->url."', '".$this->target."',";
$sql.= " '".$this->db->escape($this->title)."', '".$this->favicon."', '".$this->position."'";
+ $sql.= ", '".$conf->entity."'";
if ($this->fk_soc) $sql.=",".$this->fk_soc;
$sql.= ")";
diff --git a/htdocs/bookmarks/fiche.php b/htdocs/bookmarks/fiche.php
index d5caac4612e..fb5a78d21ed 100644
--- a/htdocs/bookmarks/fiche.php
+++ b/htdocs/bookmarks/fiche.php
@@ -26,8 +26,14 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
+$langs->load("bookmarks");
$langs->load("other");
+// Security check
+if (! $user->rights->bookmark->lire) {
+ restrictedArea($user, 'bookmarks');
+}
+
$id=GETPOST("id");
$action=GETPOST("action","alpha");
$title=GETPOST("title","alpha");
diff --git a/htdocs/bookmarks/liste.php b/htdocs/bookmarks/liste.php
index c322360fb4a..64bd28aabb4 100644
--- a/htdocs/bookmarks/liste.php
+++ b/htdocs/bookmarks/liste.php
@@ -24,6 +24,12 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
+$langs->load("bookmarks");
+
+// Security check
+if (! $user->rights->bookmark->lire) {
+ restrictedArea($user, 'bookmarks');
+}
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
@@ -73,6 +79,7 @@ $sql = "SELECT b.fk_soc as rowid, b.dateb, b.rowid as bid, b.fk_user, b.url, b.t
$sql.= " u.login, u.lastname, u.firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid";
$sql.= " WHERE 1=1";
+$sql.= " AND b.entity = ".$conf->entity;
if (! $user->admin) $sql.= " AND (b.fk_user = ".$user->id." OR b.fk_user is NULL OR b.fk_user = 0)";
$sql.= $db->order($sortfield.", position",$sortorder);
$sql.= $db->plimit($limit, $offset);
diff --git a/htdocs/comm/bookmark.php b/htdocs/comm/bookmark.php
deleted file mode 100644
index 1b5b1100736..00000000000
--- a/htdocs/comm/bookmark.php
+++ /dev/null
@@ -1,149 +0,0 @@
-
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see
| "; - print_liste_field_titre($langs->trans("Id"),$_SERVER["PHP_SELF"],"bid","","",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.lastname","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","","",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Url"),$_SERVER["PHP_SELF"],"b.url","","",'',$sortfield,$sortorder); - print " | ".$langs->trans("Target")." | "; - print ""; - print " | |||||
| " . ($i + 1 + ($limit * $page)) . " | "; - print "".$obj->bid." | "; - print "".img_object($langs->trans("ShowUser"),"user").' '.$obj->lastname." ".$obj->firstname." | \n"; - print ''.dol_print_date($db->jdate($obj->dateb))." | "; - print "rowid."\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->name." | \n"; - print ''.$obj->url." | "; - print ''.$obj->target." | "; - print "bid."\">".img_delete()." | \n"; - print "