Merge branch 'MAINT_2_11_11' into QA_2_11
This commit is contained in:
@@ -87,12 +87,13 @@ function PMA_listBookmarks($db, $cfgBookmark)
|
|||||||
* @param mixed the id of the bookmark to get
|
* @param mixed the id of the bookmark to get
|
||||||
* @param string which field to look up the $id
|
* @param string which field to look up the $id
|
||||||
* @param boolean TRUE: get all bookmarks regardless of the owning user
|
* @param boolean TRUE: get all bookmarks regardless of the owning user
|
||||||
|
* @param boolean whether to ignore bookmarks with no user
|
||||||
*
|
*
|
||||||
* @return string the sql query
|
* @return string the sql query
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function PMA_queryBookmarks($db, $cfgBookmark, $id, $id_field = 'id', $action_bookmark_all = FALSE)
|
function PMA_queryBookmarks($db, $cfgBookmark, $id, $id_field = 'id', $action_bookmark_all = FALSE, $exact_user_match = FALSE)
|
||||||
{
|
{
|
||||||
global $controllink;
|
global $controllink;
|
||||||
|
|
||||||
@@ -100,11 +101,19 @@ function PMA_queryBookmarks($db, $cfgBookmark, $id, $id_field = 'id', $action_bo
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
|
$query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
|
||||||
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''
|
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||||
. ($action_bookmark_all? '' : ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
|
|
||||||
. ' OR user = \'\')')
|
if (!$action_bookmark_all) {
|
||||||
. ' AND ' . PMA_backquote($id_field) . ' = ' . $id;
|
$query .= ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\'';
|
||||||
|
if (!$exact_user_match) {
|
||||||
|
$query .= ' OR user = \'\'';
|
||||||
|
}
|
||||||
|
$query .= ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query .= ' AND ' . PMA_backquote($id_field) . ' = ' . $id;
|
||||||
|
|
||||||
$result = PMA_DBI_try_query($query, $controllink);
|
$result = PMA_DBI_try_query($query, $controllink);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
2
sql.php
2
sql.php
@@ -54,7 +54,7 @@ if (empty($sql_query) && strlen($table) && strlen($db)) {
|
|||||||
require_once './libraries/bookmark.lib.php';
|
require_once './libraries/bookmark.lib.php';
|
||||||
$book_sql_query = PMA_queryBookmarks($db,
|
$book_sql_query = PMA_queryBookmarks($db,
|
||||||
$GLOBALS['cfg']['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'',
|
$GLOBALS['cfg']['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'',
|
||||||
'label');
|
'label', FALSE, TRUE);
|
||||||
|
|
||||||
if (! empty($book_sql_query)) {
|
if (! empty($book_sql_query)) {
|
||||||
$sql_query = $book_sql_query;
|
$sql_query = $book_sql_query;
|
||||||
|
Reference in New Issue
Block a user