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

« back to all changes in this revision

Viewing changes to libraries/List_Database.class.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:
4
4
 * holds the PMA_List_Database class
5
5
 *
6
6
 * @version $Id: List_Database.class.php 12218 2009-02-01 12:52:18Z lem9 $
 
7
 * @package phpMyAdmin
7
8
 */
8
9
 
9
10
/**
23
24
 * @todo ? support --skip-showdatabases and user has only global rights
24
25
 * @access public
25
26
 * @since phpMyAdmin 2.9.10
 
27
 * @package phpMyAdmin
26
28
 */
27
29
/*public*/ class PMA_List_Database extends PMA_List
28
30
{
46
48
     * @access protected
47
49
     */
48
50
    protected $_show_databases_disabled = false;
49
 
    
 
51
 
50
52
    /**
51
53
     * @var string command to retrieve databases from server
52
54
     */
111
113
        if ($this->_show_databases_disabled) {
112
114
            return array();
113
115
        }
114
 
        
 
116
 
115
117
        if (null !== $like_db_name) {
116
118
            $command = "SHOW DATABASES LIKE '" . $like_db_name . "'";
117
119
        } elseif (null === $this->_command) {
118
 
            $command = str_replace('#user#', $GLOBALS['cfg']['Server']['user'], 
 
120
            $command = str_replace('#user#', $GLOBALS['cfg']['Server']['user'],
119
121
                $GLOBALS['cfg']['Server']['ShowDatabasesCommand']);
120
122
            $this->_command = $command;
121
123
        } else {
165
167
            }
166
168
            $this->exchangeArray($items);
167
169
        }
168
 
        
 
170
 
169
171
        $this->_checkHideDatabase();
170
172
    }
171
173
 
197
199
        if (! is_array($GLOBALS['cfg']['Server']['only_db'])) {
198
200
            return false;
199
201
        }
200
 
        
 
202
 
201
203
        $items = array();
202
204
 
203
205
        foreach ($GLOBALS['cfg']['Server']['only_db'] as $each_only_db) {
224
226
 
225
227
            // @todo induce error, about not using wildcards with SHOW DATABASE disabled?
226
228
        }
227
 
        
 
229
 
228
230
        $this->exchangeArray($items);
229
231
 
230
232
        return true;
276
278
            $db_tooltips = PMA_getDbComments();
277
279
        }
278
280
 
 
281
        if (!$GLOBALS['cfg']['LeftFrameDBTree']) {
 
282
            $separators = array();
 
283
        } elseif (is_array($GLOBALS['cfg']['LeftFrameDBSeparator'])) {
 
284
            $separators = $GLOBALS['cfg']['LeftFrameDBSeparator'];
 
285
        } elseif (!empty($GLOBALS['cfg']['LeftFrameDBSeparator'])) {
 
286
            $separators = array($GLOBALS['cfg']['LeftFrameDBSeparator']);
 
287
        } else {
 
288
            $separators = array();
 
289
        }
 
290
 
279
291
        foreach ($this->getLimitedItems($offset, $count) as $key => $db) {
280
292
            // garvin: Get comments from PMA comments table
281
293
            $db_tooltip = '';
284
296
                $db_tooltip = $db_tooltips[$db];
285
297
            }
286
298
 
287
 
            if ($GLOBALS['cfg']['LeftFrameDBTree']
288
 
                && $GLOBALS['cfg']['LeftFrameDBSeparator']
289
 
                && strstr($db, $GLOBALS['cfg']['LeftFrameDBSeparator']))
290
 
            {
 
299
            $pos = false;
 
300
 
 
301
            foreach($separators as $separator) {
291
302
                // use strpos instead of strrpos; it seems more common to
292
303
                // have the db name, the separator, then the rest which
293
304
                // might contain a separator
294
305
                // like dbname_the_rest
295
 
                $pos            = strpos($db, $GLOBALS['cfg']['LeftFrameDBSeparator']);
 
306
                $pos = strpos($db, $separator);
 
307
 
 
308
                if ($pos !== false) {
 
309
                    break;
 
310
                }
 
311
            }
 
312
 
 
313
            if ($pos !== false) {
296
314
                $group          = substr($db, 0, $pos);
297
315
                $disp_name_cut  = substr($db, $pos);
298
316
            } else {
313
331
                'disp_name'     => $disp_name,
314
332
                'comment'       => $db_tooltip,
315
333
            );
316
 
            
 
334
 
317
335
            if ($GLOBALS['cfg']['Server']['CountTables']) {
318
336
                $dbgroups[$group][$db]['num_tables'] = PMA_getTableCount($db);
319
337
            }
371
389
                } else {
372
390
                    $return .= htmlspecialchars($db['disp_name']);
373
391
                }
374
 
                
 
392
 
375
393
                if (! empty($db['num_tables'])) {
376
394
                    $return .= ' (' . $db['num_tables'] . ')';
377
395
                }