diff --git a/libraries/Tracker.class.php b/libraries/Tracker.class.php index d3324bcf5..20c50aaef 100644 --- a/libraries/Tracker.class.php +++ b/libraries/Tracker.class.php @@ -442,10 +442,10 @@ class PMA_Tracker { $sql_query = " UPDATE " . self::$pma_table . - " SET " . PMA_backquote('tracking_active') . " = '" . $new_state . "' " . - " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' " . - " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($tablename) . "' " . - " AND " . PMA_backquote('version') . " = '" . PMA_sqlAddslashes($version) . "' "; + " SET `tracking_active` = '" . $new_state . "' " . + " WHERE `db_name` = '" . PMA_sqlAddslashes($dbname) . "' " . + " AND `table_name` = '" . PMA_sqlAddslashes($tablename) . "' " . + " AND `version` = '" . PMA_sqlAddslashes($version) . "' "; $result = PMA_query_as_controluser($sql_query); @@ -502,8 +502,8 @@ class PMA_Tracker { $sql_query = " SELECT MAX(version) FROM " . self::$pma_table . - " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' " . - " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($tablename) . "' "; + " WHERE `db_name` = '" . PMA_sqlAddslashes($dbname) . "' " . + " AND `table_name` = '" . PMA_sqlAddslashes($tablename) . "' "; if ($statement != "") { $sql_query .= " AND FIND_IN_SET('" . $statement . "',tracking) > 0" ; @@ -532,13 +532,16 @@ class PMA_Tracker */ static public function getTrackedData($dbname, $tablename, $version) { - $sql_query = " SELECT * FROM " . self::$pma_table . - " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' "; - if (! empty($tablename)) { - $sql_query .= " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($tablename) ."' "; + if (! isset(self::$pma_table)) { + self::init(); } - $sql_query .= " AND " . PMA_backquote('version') . " = '" . PMA_sqlAddslashes($version) ."' ". - " ORDER BY ". PMA_backquote('version') . " DESC "; + $sql_query = " SELECT * FROM " . self::$pma_table . + " WHERE `db_name` = '" . PMA_sqlAddslashes($dbname) . "' "; + if (! empty($tablename)) { + $sql_query .= " AND `table_name` = '" . PMA_sqlAddslashes($tablename) ."' "; + } + $sql_query .= " AND `version` = '" . PMA_sqlAddslashes($version) ."' ". + " ORDER BY `version` DESC "; $mixed = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query)); @@ -900,11 +903,11 @@ class PMA_Tracker " /*NOTRACK*/\n" . " UPDATE " . self::$pma_table . " SET " . PMA_backquote($save_to) ." = CONCAT( " . PMA_backquote($save_to) . ",'\n" . PMA_sqlAddslashes($query) . "') ," . - " " . PMA_backquote('date_updated') . " = '" . $date . "' "; + " `date_updated` = '" . $date . "' "; // If table was renamed we have to change the tablename attribute in pma_tracking too if ($result['identifier'] == 'RENAME TABLE') { - $sql_query .= ', ' . PMA_backquote('table_name') . ' = \'' . PMA_sqlAddslashes($result['tablename_after_rename']) . '\' '; + $sql_query .= ', `table_name` = \'' . PMA_sqlAddslashes($result['tablename_after_rename']) . '\' '; } // Save the tracking information only for @@ -914,9 +917,9 @@ class PMA_Tracker // we want to track $sql_query .= " WHERE FIND_IN_SET('" . $result['identifier'] . "',tracking) > 0" . - " AND " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' " . - " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($result['tablename']) . "' " . - " AND " . PMA_backquote('version') . " = '" . PMA_sqlAddslashes($version) . "' "; + " AND `db_name` = '" . PMA_sqlAddslashes($dbname) . "' " . + " AND `table_name` = '" . PMA_sqlAddslashes($result['tablename']) . "' " . + " AND `version` = '" . PMA_sqlAddslashes($version) . "' "; $result = PMA_query_as_controluser($sql_query); } diff --git a/libraries/db_table_exists.lib.php b/libraries/db_table_exists.lib.php index f622b49e1..d1ae16a34 100644 --- a/libraries/db_table_exists.lib.php +++ b/libraries/db_table_exists.lib.php @@ -44,7 +44,7 @@ if (empty($is_db)) { } } // end if (ensures db exists) -if (empty($is_table) && !defined('PMA_SUBMIT_MULT')) { +if (empty($is_table) && !defined('PMA_SUBMIT_MULT') && ! defined('TABLE_MAY_BE_ABSENT')) { // Not a valid table name -> back to the db_sql.php if (strlen($table)) { diff --git a/tbl_tracking.php b/tbl_tracking.php index c7a0b95e7..fbee82a95 100644 --- a/tbl_tracking.php +++ b/tbl_tracking.php @@ -11,6 +11,7 @@ require_once './libraries/common.inc.php'; require_once './libraries/Table.class.php'; +define('TABLE_MAY_BE_ABSENT', true); require './libraries/tbl_common.php'; $url_query .= '&goto=tbl_tracking.php&back=tbl_tracking.php'; $url_params['goto'] = 'tbl_tracking.php';;