From 48d01837a0a5725d2779f30d20478e77572e9ac5 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 6 Apr 2015 12:00:09 +0200 Subject: Fix tables listing routine on mysql and postgres so it skips system or other database tables and views (#1490337) --- program/lib/Roundcube/rcube_db.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'program/lib/Roundcube/rcube_db.php') diff --git a/program/lib/Roundcube/rcube_db.php b/program/lib/Roundcube/rcube_db.php index a31b2005d..4ccc59ba3 100644 --- a/program/lib/Roundcube/rcube_db.php +++ b/program/lib/Roundcube/rcube_db.php @@ -691,14 +691,11 @@ class rcube_db { // get tables if not cached if ($this->tables === null) { - $q = $this->query('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_NAME'); + $q = $this->query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES" + . " WHERE TABLE_TYPE = 'BASE TABLE'" + . " ORDER BY TABLE_NAME"); - if ($q) { - $this->tables = $q->fetchAll(PDO::FETCH_COLUMN, 0); - } - else { - $this->tables = array(); - } + $this->tables = $q ? $q->fetchAll(PDO::FETCH_COLUMN, 0) : array(); } return $this->tables; -- cgit v1.2.3