getHeader(); $scripts = $header->getScripts(); $scripts->addFile('db_structure.js'); /** * If we are not in an Ajax request, then do the common work and show the links etc. */ require 'libraries/db_common.inc.php'; $url_query .= '&goto=tbl_tracking.php&back=db_tracking.php'; // Get the database structure $sub_part = '_structure'; require 'libraries/db_info.inc.php'; // Work to do? // (here, do not use $_REQUEST['db] as it can be crafted) if (isset($_REQUEST['delete_tracking']) && isset($_REQUEST['table'])) { PMA_Tracker::deleteTracking($GLOBALS['db'], $_REQUEST['table']); /** * If in an Ajax request, generate the success message and use * {@link PMA_Response()} to send the output */ if ($GLOBALS['is_ajax_request'] == true) { $response = PMA_Response::getInstance(); $response->addJSON('message', PMA_Message::success()); exit; } } // Get tracked data about the database $data = PMA_Tracker::getTrackedData($_REQUEST['db'], '', '1'); // No tables present and no log exist if ($num_tables == 0 && count($data['ddlog']) == 0) { echo '

' . __('No tables found in database.') . '

' . "\n"; if (empty($db_is_information_schema)) { include 'libraries/display_create_table.lib.php'; } exit; } // --------------------------------------------------------------------------- // Prepare statement to get HEAD version $all_tables_query = ' SELECT table_name, MAX(version) as version FROM ' . PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' . PMA_Util::backquote($GLOBALS['cfg']['Server']['tracking']) . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($_REQUEST['db']) . '\' ' . ' GROUP BY table_name' . ' ORDER BY table_name ASC'; $all_tables_result = PMA_queryAsControlUser($all_tables_query); // If a HEAD version exists if ($GLOBALS['dbi']->numRows($all_tables_result) > 0) { ?>

fetchArray($all_tables_result)) { list($table_name, $version_number) = $one_result; $table_query = ' SELECT * FROM ' . PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' . PMA_Util::backquote($GLOBALS['cfg']['Server']['tracking']) . ' WHERE `db_name` = \'' . PMA_Util::sqlAddSlashes($_REQUEST['db']) . '\' AND `table_name` = \'' . PMA_Util::sqlAddSlashes($table_name) . '\' AND `version` = \'' . $version_number . '\''; $table_result = PMA_queryAsControlUser($table_query); $version_data = $GLOBALS['dbi']->fetchArray($table_result); if ($version_data['tracking_active'] == 1) { $version_status = __('active'); } else { $version_status = __('not active'); } $tmp_link = 'tbl_tracking.php?' . $url_query . '&table=' . htmlspecialchars($version_data['table_name']); $delete_link = 'db_tracking.php?' . $url_query . '&table=' . htmlspecialchars($version_data['table_name']) . '&delete_tracking=true&'; ?> ' . ''; if ($style == 'even') { $style = 'odd'; } else { $style = 'even'; } } unset($tmp_link); ?>
' . '' . '' . __('Versions') . '' . ' | ' . '' . __('Tracking report') . '' . ' | ' . '' . __('Structure snapshot') . '' . '
$value) { // If $value is a table group. if (array_key_exists(('is' . $sep . 'group'), $value) && $value['is' . $sep . 'group'] ) { foreach ($value as $temp_table) { // If $temp_table is a table with the value for 'Name' is set, // rather than a propery of the table group. if (is_array($temp_table) && array_key_exists('Name', $temp_table) ) { $tracking_version = PMA_Tracker::getVersion( $GLOBALS['db'], $temp_table['Name'] ); if ($tracking_version == -1) { $my_tables[] = $temp_table['Name']; } } } } else { // If $value is a table. if (PMA_Tracker::getVersion($GLOBALS['db'], $value['Name']) == -1) { $my_tables[] = $value['Name']; } } } // If untracked tables exist if (isset($my_tables)) { ?>

$tablename) { if (PMA_Tracker::getVersion($GLOBALS['db'], $tablename) == -1) { $my_link = ''; $my_link .= PMA_Util::getIcon('eye.png', __('Track table')); $my_link .= ''; ?>
0) { $log = ''; foreach ($data['ddlog'] as $entry) { $log .= '# ' . $entry['date'] . ' ' . $entry['username'] . "\n" . $entry['statement'] . "\n"; } echo PMA_Util::getMessage(__('Database Log'), $log); } ?>