\n";
// Edit
- if ($user->rights->bookmark->creer && $action != 'edit')
- {
+ if ($user->rights->bookmark->creer && $action != 'edit') {
print '
'."\n";
}
// Remove
- if ($user->rights->bookmark->supprimer && $action != 'edit')
- {
+ if ($user->rights->bookmark->supprimer && $action != 'edit') {
print '
'."\n";
}
diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php
index f5bbefae3d3..4fe8c3cee83 100644
--- a/htdocs/bookmarks/class/bookmark.class.php
+++ b/htdocs/bookmarks/class/bookmark.class.php
@@ -117,7 +117,7 @@ class Bookmark extends CommonObject
$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 .= " WHERE rowid = ".((int) $id);
$sql .= " AND entity = ".$conf->entity;
dol_syslog("Bookmark::fetch", LOG_DEBUG);
@@ -239,7 +239,7 @@ class Bookmark extends CommonObject
public function remove($id)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark";
- $sql .= " WHERE rowid = ".$id;
+ $sql .= " WHERE rowid = ".((int) $id);
dol_syslog("Bookmark::remove", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php
index 6ad2770aa25..e4405f0aea6 100644
--- a/htdocs/bookmarks/list.php
+++ b/htdocs/bookmarks/list.php
@@ -45,12 +45,18 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
-if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
+if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
+ $page = 0;
+} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (!$sortfield) $sortfield = 'position';
-if (!$sortorder) $sortorder = 'ASC';
+if (!$sortfield) {
+ $sortfield = 'position';
+}
+if (!$sortorder) {
+ $sortorder = 'ASC';
+}
$id = GETPOST("id", 'int');
@@ -65,11 +71,9 @@ $permissiontodelete = $user->rights->bookmark->delete;
* Actions
*/
-if ($action == 'delete')
-{
+if ($action == 'delete') {
$res = $object->remove($id);
- if ($res > 0)
- {
+ if ($res > 0) {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
@@ -93,32 +97,30 @@ $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 IN (".getEntity('bookmark').")";
-if (!$user->admin) $sql .= " AND (b.fk_user = ".$user->id." OR b.fk_user is NULL OR b.fk_user = 0)";
+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);
// Count total nb of records
$nbtotalofrecords = '';
-if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
-{
+if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
- if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
- {
+ if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
$page = 0;
$offset = 0;
}
}
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
-if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
-{
+if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
$num = $nbtotalofrecords;
} else {
$sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql);
- if (!$resql)
- {
+ if (!$resql) {
dol_print_error($db);
exit;
}
@@ -127,9 +129,15 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
}
$param = "";
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
-if ($optioncss != '') $param = '&optioncss='.urlencode($optioncss);
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
+ $param .= '&contextpage='.urlencode($contextpage);
+}
+if ($limit > 0 && $limit != $conf->liste_limit) {
+ $param .= '&limit='.urlencode($limit);
+}
+if ($optioncss != '') {
+ $param = '&optioncss='.urlencode($optioncss);
+}
$moreforfilter = '';
@@ -140,12 +148,18 @@ $arrayofmassactions = array(
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
);
-if ($permissiontodelete) $arrayofmassactions['predelete'] = '
'.$langs->trans("Delete");
-if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
+if ($permissiontodelete) {
+ $arrayofmassactions['predelete'] = '
'.$langs->trans("Delete");
+}
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
+ $arrayofmassactions = array();
+}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
print '