Bookmarks are sorted on position

This commit is contained in:
Laurent Destailleur 2010-06-08 08:55:48 +00:00
parent d814606738
commit 8f0baa1790
3 changed files with 5 additions and 4 deletions

View File

@ -66,6 +66,7 @@ function printBookmarksList ($aDb, $aLangs)
{
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
if (! $user->admin) $sql.= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
$sql.= " ORDER BY position";
if ($resql = $db->query($sql) )
{
$i=0;

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -77,7 +77,7 @@ $sql.= " u.login, u.name, 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";
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,$sortorder);
$sql.= $db->order($sortfield.", position",$sortorder);
$sql.= $db->plimit( $limit, $offset);
$resql=$db->query($sql);

View File

@ -78,8 +78,8 @@ class box_bookmarks extends ModeleBoxes {
$sql = "SELECT b.title, b.url, b.target, b.favicon";
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b";
$sql.= " WHERE fk_user = ".$user->id;
$sql .= " ORDER BY b.dateb DESC ";
$sql .= $db->plimit($max, 0);
$sql.= $db->order("position","ASC");
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);