~ubuntu-branches/ubuntu/lucid/phpmyadmin/lucid

« back to all changes in this revision

Viewing changes to libraries/bookmark.lib.php

  • Committer: Bazaar Package Importer
  • Author(s): Michal Čihař
  • Date: 2009-06-30 14:05:13 UTC
  • mfrom: (1.2.1 upstream) (36.1.2 karmic)
  • Revision ID: james.westby@ubuntu.com-20090630140513-hz71do3sij2jhm4s
* New upstream version fixing XSS (PMASA-2009-5).
* Document no empty password in README.Debian and the shipped sample
  configuration file (LP: #388703).
* Install service file for avahi (if web service enabled and if avahi is
  installed) (LP: #369244).
* Mention protecting of setup if not using provided configuration snippets
  for webservers.
* Call ucf with --debconf-ok in postrm (Closes: #534894).

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
/**
4
4
 * Set of functions used with the bookmark feature
5
5
 *
6
 
 * @version $Id: bookmark.lib.php 11453 2008-08-01 20:35:32Z lem9 $
 
6
 * @version $Id: bookmark.lib.php 11982 2008-11-24 10:32:56Z nijel $
 
7
 * @package phpMyAdmin
7
8
 */
8
9
 
9
10
/**
10
 
 * 
 
11
 *
11
12
 */
12
13
require_once './libraries/relation.lib.php';
13
14
 
25
26
function PMA_Bookmark_getParams()
26
27
{
27
28
    static $cfgBookmark = null;
28
 
    
 
29
 
29
30
    if (null !== $cfgBookmark) {
30
31
        return $cfgBookmark;
31
32
    }
32
 
    
 
33
 
33
34
    $cfgRelation = PMA_getRelationsParam();
34
35
 
35
36
    if ($cfgRelation['bookmarkwork']) {
41
42
    } else {
42
43
        $cfgBookmark = false;
43
44
    }
44
 
    
 
45
 
45
46
    return $cfgBookmark;
46
47
} // end of the 'PMA_Bookmark_getParams()' function
47
48
 
58
59
 *
59
60
 * @param   string    the current database name
60
61
 *
61
 
 * @return  array     the bookmarks list (key as index, label as value) 
 
62
 * @return  array     the bookmarks list (key as index, label as value)
62
63
 *
63
64
 * @access  public
64
65
 */
65
66
function PMA_Bookmark_getList($db)
66
67
{
67
68
    global $controllink;
68
 
    
 
69
 
69
70
    $cfgBookmark = PMA_Bookmark_getParams();
70
71
 
71
72
    if (empty($cfgBookmark)) {
102
103
function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = FALSE)
103
104
{
104
105
    global $controllink;
105
 
    
 
106
 
106
107
    $cfgBookmark = PMA_Bookmark_getParams();
107
108
 
108
109
    if (empty($cfgBookmark)) {
109
110
        return '';
110
111
    }
111
 
    
 
112
 
112
113
    $query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
113
114
        . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''
114
115
        . ($action_bookmark_all? '' : ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
137
138
function PMA_Bookmark_save($fields, $all_users = false)
138
139
{
139
140
    global $controllink;
140
 
    
 
141
 
141
142
    $cfgBookmark = PMA_Bookmark_getParams();
142
143
 
143
144
    if (empty($cfgBookmark)) {
144
145
        return false;
145
146
    }
146
 
    
 
147
 
147
148
    $query = 'INSERT INTO ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
148
149
           . ' (id, dbase, user, query, label) VALUES (NULL, \'' . PMA_sqlAddslashes($fields['dbase']) . '\', \'' . ($all_users ? '' : PMA_sqlAddslashes($fields['user'])) . '\', \'' . PMA_sqlAddslashes(urldecode($fields['query'])) . '\', \'' . PMA_sqlAddslashes($fields['label']) . '\')';
149
150
    return PMA_DBI_query($query, $controllink);
167
168
function PMA_Bookmark_delete($db, $id)
168
169
{
169
170
    global $controllink;
170
 
    
 
171
 
171
172
    $cfgBookmark = PMA_Bookmark_getParams();
172
173
 
173
174
    if (empty($cfgBookmark)) {
174
175
        return false;
175
176
    }
176
 
    
 
177
 
177
178
    $query  = 'DELETE FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
178
179
            . ' WHERE (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
179
180
            . '        OR user = \'\')'