bug 879005

This commit is contained in:
Marc Delisle
2004-02-11 18:25:28 +00:00
parent 9c949b15db
commit 866653209d
4 changed files with 8 additions and 4 deletions

View File

@@ -7,6 +7,8 @@ $Source$
2004-02-11 Marc Delisle <lem9@users.sourceforge.net>
* server_privileges.php: bug 818654, password not copied
* read_dump.php, libraries/display_tbl.lib.php, /bookmark.lib.php:
bug 879005: execute stored bookmarks when user is different
2004-02-08 Marc Delisle <lem9@users.sourceforge.net>
* lang/spanish: Updated, thanks to Daniel Hinostroza (hinostroza).

View File

@@ -82,12 +82,13 @@ function PMA_listBookmarks($db, $cfgBookmark)
* @param array the bookmark parameters for the current user
* @param mixed the id of the bookmark to get
* @param string which field to look up the $id
* @param boolean TRUE: get all bookmarks regardless of the owning user
*
* @return string the sql query
*
* @access public
*/
function PMA_queryBookmarks($db, $cfgBookmark, $id, $id_field = 'id')
function PMA_queryBookmarks($db, $cfgBookmark, $id, $id_field = 'id', $action_bookmark_all = FALSE)
{
global $dbh;
@@ -97,8 +98,8 @@ function PMA_queryBookmarks($db, $cfgBookmark, $id, $id_field = 'id')
$query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
. ' OR user = \'\')'
. ($action_bookmark_all? '' : ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
. ' OR user = \'\')' )
. ' AND ' . PMA_backquote($id_field) . ' = ' . $id;
$result = PMA_DBI_try_query($query, $dbh);
list($bookmark_query) = PMA_DBI_fetch_row($result) or array(FALSE);

View File

@@ -1145,6 +1145,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
. PMA_generate_common_url($row['dbase'], '')
. '&amp;id_bookmark=' . $row['id']
. '&amp;action_bookmark=0'
. '&amp;action_bookmark_all=1'
. '&amp;SQL=' . $GLOBALS['strExecuteBookmarked']
.' " title="' . $GLOBALS['strExecuteBookmarked'] . '">';

View File

@@ -52,7 +52,7 @@ if (!empty($id_bookmark)) {
require_once('./libraries/bookmark.lib.php');
switch ($action_bookmark) {
case 0: // bookmarked query that have to be run
$sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], $id_bookmark);
$sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], $id_bookmark,'id', (isset($action_bookmark_all) ? TRUE : FALSE));
if (isset($bookmark_variable) && !empty($bookmark_variable)) {
$sql_query = preg_replace('|/\*(.*)\[VARIABLE\](.*)\*/|imsU', '${1}' . PMA_sqlAddslashes($bookmark_variable) . '${2}', $sql_query);
}