bug #3400690 [privileges] DB-specific privileges won't submit
[phpmyadmin.git] / tbl_tracking.php
blob96d502418e5f95019c277904015e4bf80fe7b0d5
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin
6 */
8 // Run common work
9 require_once './libraries/common.inc.php';
11 define('TABLE_MAY_BE_ABSENT', true);
12 require './libraries/tbl_common.php';
13 $url_query .= '&amp;goto=tbl_tracking.php&amp;back=tbl_tracking.php';
14 $url_params['goto'] = 'tbl_tracking.php';;
15 $url_params['back'] = 'tbl_tracking.php';
17 // Init vars for tracking report
18 if (isset($_REQUEST['report']) || isset($_REQUEST['report_export'])) {
19 $data = PMA_Tracker::getTrackedData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version']);
21 $selection_schema = false;
22 $selection_data = false;
23 $selection_both = false;
25 if (! isset($_REQUEST['logtype'])) {
26 $_REQUEST['logtype'] = 'schema_and_data';
28 if ($_REQUEST['logtype'] == 'schema') {
29 $selection_schema = true;
30 } elseif($_REQUEST['logtype'] == 'data') {
31 $selection_data = true;
32 } else {
33 $selection_both = true;
35 if (! isset($_REQUEST['date_from'])) {
36 $_REQUEST['date_from'] = $data['date_from'];
38 if (! isset($_REQUEST['date_to'])) {
39 $_REQUEST['date_to'] = $data['date_to'];
41 if (! isset($_REQUEST['users'])) {
42 $_REQUEST['users'] = '*';
44 $filter_ts_from = strtotime($_REQUEST['date_from']);
45 $filter_ts_to = strtotime($_REQUEST['date_to']);
46 $filter_users = array_map('trim', explode(',', $_REQUEST['users']));
49 // Prepare export
50 if (isset($_REQUEST['report_export'])) {
52 /**
53 * Filters tracking entries
55 * @param array the entries to filter
56 * @param string "from" date
57 * @param string "to" date
58 * @param string users
60 * @return array filtered entries
63 function PMA_filter_tracking($data, $filter_ts_from, $filter_ts_to, $filter_users) {
64 $tmp_entries = array();
65 $id = 0;
66 foreach( $data as $entry ) {
67 $timestamp = strtotime($entry['date']);
69 if ($timestamp >= $filter_ts_from && $timestamp <= $filter_ts_to &&
70 ( in_array('*', $filter_users) || in_array($entry['username'], $filter_users) ) ) {
71 $tmp_entries[] = array( 'id' => $id,
72 'timestamp' => $timestamp,
73 'username' => $entry['username'],
74 'statement' => $entry['statement']
77 $id++;
79 return($tmp_entries);
82 $entries = array();
83 // Filtering data definition statements
84 if ($_REQUEST['logtype'] == 'schema' || $_REQUEST['logtype'] == 'schema_and_data') {
85 $entries = array_merge($entries, PMA_filter_tracking($data['ddlog'], $filter_ts_from, $filter_ts_to, $filter_users));
88 // Filtering data manipulation statements
89 if ($_REQUEST['logtype'] == 'data' || $_REQUEST['logtype'] == 'schema_and_data') {
90 $entries = array_merge($entries, PMA_filter_tracking($data['dmlog'], $filter_ts_from, $filter_ts_to, $filter_users));
93 // Sort it
94 foreach ($entries as $key => $row) {
95 $ids[$key] = $row['id'];
96 $timestamps[$key] = $row['timestamp'];
97 $usernames[$key] = $row['username'];
98 $statements[$key] = $row['statement'];
101 array_multisort($timestamps, SORT_ASC, $ids, SORT_ASC, $usernames, SORT_ASC, $statements, SORT_ASC, $entries);
105 // Export as file download
106 if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'sqldumpfile') {
107 @ini_set('url_rewriter.tags','');
109 $dump = "# " . sprintf(__('Tracking report for table `%s`'), htmlspecialchars($_REQUEST['table'])) . "\n" .
110 "# " . date('Y-m-d H:i:s') . "\n";
111 foreach($entries as $entry) {
112 $dump .= $entry['statement'];
114 //$filename = 'log_' . str_replace(';', '', htmlspecialchars($_REQUEST['table'])) . '.sql';
115 $filename = PMA_sanitize_filename('log_' . $_REQUEST['table'] . '.sql');
116 header('Content-Type: text/x-sql');
117 header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
118 header('Content-Disposition: attachment; filename="' . $filename . '"');
119 if (PMA_USR_BROWSER_AGENT == 'IE') {
120 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
121 header('Pragma: public');
122 } else {
123 header('Pragma: no-cache');
124 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
127 echo $dump;
128 exit();
133 * Gets tables informations
137 * Displays top menu links
139 require_once './libraries/tbl_links.inc.php';
140 echo '<br />';
143 * Actions
146 // Create tracking version
147 if (isset($_REQUEST['submit_create_version'])) {
148 $tracking_set = '';
150 if ($_REQUEST['alter_table'] == true) {
151 $tracking_set .= 'ALTER TABLE,';
153 if ($_REQUEST['rename_table'] == true) {
154 $tracking_set .= 'RENAME TABLE,';
156 if ($_REQUEST['create_table'] == true) {
157 $tracking_set .= 'CREATE TABLE,';
159 if ($_REQUEST['drop_table'] == true) {
160 $tracking_set .= 'DROP TABLE,';
162 if ($_REQUEST['create_index'] == true) {
163 $tracking_set .= 'CREATE INDEX,';
165 if ($_REQUEST['drop_index'] == true) {
166 $tracking_set .= 'DROP INDEX,';
168 if ($_REQUEST['insert'] == true) {
169 $tracking_set .= 'INSERT,';
171 if ($_REQUEST['update'] == true) {
172 $tracking_set .= 'UPDATE,';
174 if ($_REQUEST['delete'] == true) {
175 $tracking_set .= 'DELETE,';
177 if ($_REQUEST['truncate'] == true) {
178 $tracking_set .= 'TRUNCATE,';
180 $tracking_set = rtrim($tracking_set, ',');
182 if (PMA_Tracker::createVersion($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'], $tracking_set )) {
183 $msg = PMA_Message::success(sprintf(__('Version %s is created, tracking for %s.%s is activated.'), $_REQUEST['version'], htmlspecialchars($GLOBALS['db']), htmlspecialchars($GLOBALS['table'])));
184 $msg->display();
188 // Deactivate tracking
189 if (isset($_REQUEST['submit_deactivate_now'])) {
190 if (PMA_Tracker::deactivateTracking($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'])) {
191 $msg = PMA_Message::success(sprintf(__('Tracking for %s.%s , version %s is deactivated.'), htmlspecialchars($GLOBALS['db']), htmlspecialchars($GLOBALS['table']), $_REQUEST['version']));
192 $msg->display();
196 // Activate tracking
197 if (isset($_REQUEST['submit_activate_now'])) {
198 if (PMA_Tracker::activateTracking($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'])) {
199 $msg = PMA_Message::success(sprintf(__('Tracking for %s.%s , version %s is activated.'), htmlspecialchars($GLOBALS['db']), htmlspecialchars($GLOBALS['table']), $_REQUEST['version']));
200 $msg->display();
204 // Export as SQL execution
205 if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'execution') {
206 foreach($entries as $entry) {
207 $sql_result = PMA_DBI_query( "/*NOTRACK*/\n" . $entry['statement'] );
209 $msg = PMA_Message::success(__('SQL statements executed.'));
210 $msg->display();
213 // Export as SQL dump
214 if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'sqldump')
216 $new_query = "# " . __('You can execute the dump by creating and using a temporary database. Please ensure that you have the privileges to do so.') . "\n" .
217 "# " . __('Comment out these two lines if you do not need them.') . "\n" .
218 "\n" .
219 "CREATE database IF NOT EXISTS pma_temp_db; \n" .
220 "USE pma_temp_db; \n" .
221 "\n";
223 foreach($entries as $entry) {
224 $new_query .= $entry['statement'];
226 $msg = PMA_Message::success(__('SQL statements exported. Please copy the dump or execute it.'));
227 $msg->display();
229 $db_temp = $db;
230 $table_temp = $table;
232 $db = $table = '';
233 require_once './libraries/sql_query_form.lib.php';
235 PMA_sqlQueryForm($new_query, 'sql');
237 $db = $db_temp;
238 $table = $table_temp;
242 * Schema snapshot
244 if (isset($_REQUEST['snapshot'])) {
246 <h3><?php echo __('Structure snapshot');?> [<a href="tbl_tracking.php?<?php echo $url_query;?>"><?php echo __('Close');?></a>]</h3>
247 <?php
248 $data = PMA_Tracker::getTrackedData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version']);
250 // Get first DROP TABLE and CREATE TABLE statements
251 $drop_create_statements = $data['ddlog'][0]['statement'];
253 if (strstr($data['ddlog'][0]['statement'], 'DROP TABLE')) {
254 $drop_create_statements .= $data['ddlog'][1]['statement'];
256 // Print SQL code
257 PMA_showMessage(sprintf(__('Version %s snapshot (SQL code)'), $_REQUEST['version']), $drop_create_statements);
259 // Unserialize snapshot
260 $temp = unserialize($data['schema_snapshot']);
261 $columns = $temp['COLUMNS'];
262 $indexes = $temp['INDEXES'];
264 <h3><?php echo __('Structure');?></h3>
265 <table id="tablestructure" class="data">
266 <thead>
267 <tr>
268 <th><?php echo __('Column'); ?></th>
269 <th><?php echo __('Type'); ?></th>
270 <th><?php echo __('Collation'); ?></th>
271 <th><?php echo __('Null'); ?></th>
272 <th><?php echo __('Default'); ?></th>
273 <th><?php echo __('Extra'); ?></th>
274 <th><?php echo __('Comment'); ?></th>
275 </tr>
276 </thead>
277 <tbody>
278 <?php
279 $style = 'odd';
280 foreach($columns as $field_index => $field) {
282 <tr class="noclick <?php echo $style; ?>">
283 <?php
284 if ($field['Key'] == 'PRI') {
285 echo '<td><b><u>' . htmlspecialchars($field['Field']) . '</u></b></td>' . "\n";
286 } else {
287 echo '<td><b>' . htmlspecialchars($field['Field']) . '</b></td>' . "\n";
290 <td><?php echo htmlspecialchars($field['Type']);?></td>
291 <td><?php echo htmlspecialchars($field['Collation']);?></td>
292 <td><?php echo htmlspecialchars($field['Null']);?></td>
293 <td><?php echo htmlspecialchars($field['Default']);?></td>
294 <td><?php echo htmlspecialchars($field['Extra']);?></td>
295 <td><?php echo htmlspecialchars($field['Comment']);?></td>
296 </tr>
297 <?php
298 if ($style == 'even') {
299 $style = 'odd';
300 } else {
301 $style = 'even';
305 </tbody>
306 </table>
308 <?php
309 if (count($indexes) > 0) {
311 <h3><?php echo __('Indexes');?></h3>
312 <table id="tablestructure_indexes" class="data">
313 <thead>
314 <tr>
315 <th><?php echo __('Keyname');?></th>
316 <th><?php echo __('Type');?></th>
317 <th><?php echo __('Unique');?></th>
318 <th><?php echo __('Packed');?></th>
319 <th><?php echo __('Column');?></th>
320 <th><?php echo __('Cardinality');?></th>
321 <th><?php echo __('Collation');?></th>
322 <th><?php echo __('Null');?></th>
323 <th><?php echo __('Comment');?></th>
324 </tr>
325 <tbody>
326 <?php
327 $style = 'odd';
328 foreach ($indexes as $indexes_index => $index) {
329 if ($index['Non_unique'] == 0) {
330 $str_unique = __('Yes');
331 } else {
332 $str_unique = __('No');
334 if ($index['Packed'] != '') {
335 $str_packed = __('Yes');
336 } else {
337 $str_packed = __('No');
340 <tr class="noclick <?php echo $style; ?>">
341 <td><b><?php echo htmlspecialchars($index['Key_name']);?></b></td>
342 <td><?php echo htmlspecialchars($index['Index_type']);?></td>
343 <td><?php echo $str_unique;?></td>
344 <td><?php echo $str_packed;?></td>
345 <td><?php echo htmlspecialchars($index['Column_name']);?></td>
346 <td><?php echo htmlspecialchars($index['Cardinality']);?></td>
347 <td><?php echo htmlspecialchars($index['Collation']);?></td>
348 <td><?php echo htmlspecialchars($index['Null']);?></td>
349 <td><?php echo htmlspecialchars($index['Comment']);?></td>
350 </tr>
351 <?php
352 if ($style == 'even') {
353 $style = 'odd';
354 } else {
355 $style = 'even';
359 </tbody>
360 </table>
361 <?php
362 } // endif
364 <br /><hr /><br />
365 <?php
367 // end of snapshot report
370 * Tracking report
372 if (isset($_REQUEST['report']) || isset($_REQUEST['report_export'])) {
374 <h3><?php echo __('Tracking report');?> [<a href="tbl_tracking.php?<?php echo $url_query;?>"><?php echo __('Close');?></a>]</h3>
376 <small><?php echo __('Tracking statements') . ' ' . htmlspecialchars($data['tracking']); ?></small><br/>
377 <br/>
379 <form method="post" action="tbl_tracking.php<?php echo PMA_generate_common_url($url_params + array('report' => 'true', 'version' => $_REQUEST['version'])); ?>">
380 <?php
382 $str1 = '<select name="logtype">' .
383 '<option value="schema"' . ($selection_schema ? ' selected="selected"' : '') . '>' . __('Structure only') . '</option>' .
384 '<option value="data"' . ($selection_data ? ' selected="selected"' : ''). '>' . __('Data only') . '</option>' .
385 '<option value="schema_and_data"' . ($selection_both ? ' selected="selected"' : '') . '>' . __('Structure and data') . '</option>' .
386 '</select>';
387 $str2 = '<input type="text" name="date_from" value="' . htmlspecialchars($_REQUEST['date_from']) . '" size="19" />';
388 $str3 = '<input type="text" name="date_to" value="' . htmlspecialchars($_REQUEST['date_to']) . '" size="19" />';
389 $str4 = '<input type="text" name="users" value="' . htmlspecialchars($_REQUEST['users']) . '" />';
390 $str5 = '<input type="submit" name="list_report" value="' . __('Go') . '" />';
392 printf(__('Show %s with dates from %s to %s by user %s %s'), $str1, $str2, $str3, $str4, $str5);
396 * First, list tracked data definition statements
398 $i = 1;
399 if ($selection_schema || $selection_both ) {
401 <table id="ddl_versions" class="data" width="100%">
402 <thead>
403 <tr>
404 <th width="18">#</th>
405 <th width="100"><?php echo __('Date');?></th>
406 <th width="60"><?php echo __('Username');?></th>
407 <th><?php echo __('Data definition statement');?></th>
408 </tr>
409 </thead>
410 <tbody>
411 <?php
412 $style = 'odd';
413 foreach ($data['ddlog'] as $entry) {
414 if (strlen($entry['statement']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
415 $statement = substr($entry['statement'], 0, $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) . '[...]';
416 } else {
417 $statement = PMA_formatSql(PMA_SQP_parse($entry['statement']));
419 $timestamp = strtotime($entry['date']);
421 if ($timestamp >= $filter_ts_from && $timestamp <= $filter_ts_to &&
422 ( in_array('*', $filter_users) || in_array($entry['username'], $filter_users) ) ) {
424 <tr class="noclick <?php echo $style; ?>">
425 <td><small><?php echo $i;?></small></td>
426 <td><small><?php echo htmlspecialchars($entry['date']);?></small></td>
427 <td><small><?php echo htmlspecialchars($entry['username']); ?></small></td>
428 <td><?php echo $statement; ?></td>
429 </tr>
430 <?php
431 if ($style == 'even') {
432 $style = 'odd';
433 } else {
434 $style = 'even';
436 $i++;
440 </tbody>
441 </table>
442 <?php
444 } //endif
447 * Secondly, list tracked data manipulation statements
450 if (($selection_data || $selection_both) && count($data['dmlog']) > 0) {
452 <table id="dml_versions" class="data" width="100%">
453 <thead>
454 <tr>
455 <th width="18">#</th>
456 <th width="100"><?php echo __('Date');?></th>
457 <th width="60"><?php echo __('Username');?></th>
458 <th><?php echo __('Data manipulation statement');?></th>
459 </tr>
460 </thead>
461 <tbody>
462 <?php
463 $style = 'odd';
464 foreach ($data['dmlog'] as $entry) {
465 if (strlen($entry['statement']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
466 $statement = substr($entry['statement'], 0, $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) . '[...]';
467 } else {
468 $statement = PMA_formatSql(PMA_SQP_parse($entry['statement']));
470 $timestamp = strtotime($entry['date']);
472 if ($timestamp >= $filter_ts_from && $timestamp <= $filter_ts_to &&
473 ( in_array('*', $filter_users) || in_array($entry['username'], $filter_users) ) ) {
475 <tr class="noclick <?php echo $style; ?>">
476 <td><small><?php echo $i; ?></small></td>
477 <td><small><?php echo htmlspecialchars($entry['date']); ?></small></td>
478 <td><small><?php echo htmlspecialchars($entry['username']); ?></small></td>
479 <td><?php echo $statement; ?></td>
480 </tr>
481 <?php
482 if ($style == 'even') {
483 $style = 'odd';
484 } else {
485 $style = 'even';
487 $i++;
491 </tbody>
492 </table>
493 <?php
496 </form>
497 <form method="post" action="tbl_tracking.php<?php echo PMA_generate_common_url($url_params + array('report' => 'true', 'version' => $_REQUEST['version'])); ?>">
498 <?php
499 printf(__('Show %s with dates from %s to %s by user %s %s'), $str1, $str2, $str3, $str4, $str5);
501 $str_export1 = '<select name="export_type">' .
502 '<option value="sqldumpfile">' . __('SQL dump (file download)') . '</option>' .
503 '<option value="sqldump">' . __('SQL dump') . '</option>' .
504 '<option value="execution" onclick="alert(\'' . PMA_escapeJsString(__('This option will replace your table and contained data.')) .'\')">' . __('SQL execution') . '</option>' .
505 '</select>';
507 $str_export2 = '<input type="submit" name="report_export" value="' . __('Go') .'" />';
509 </form>
510 <form method="post" action="tbl_tracking.php<?php echo PMA_generate_common_url($url_params + array('report' => 'true', 'version' => $_REQUEST['version'])); ?>">
511 <input type="hidden" name="logtype" value="<?php echo htmlspecialchars($_REQUEST['logtype']);?>" />
512 <input type="hidden" name="date_from" value="<?php echo htmlspecialchars($_REQUEST['date_from']);?>" />
513 <input type="hidden" name="date_to" value="<?php echo htmlspecialchars($_REQUEST['date_to']);?>" />
514 <input type="hidden" name="users" value="<?php echo htmlspecialchars($_REQUEST['users']);?>" />
515 <?php
516 echo "<br/>" . sprintf(__('Export as %s'), $str_export1) . $str_export2 . "<br/>";
518 </form>
519 <?php
520 echo "<br/><br/><hr/><br/>\n";
521 } // end of report
525 * List selectable tables
528 $sql_query = " SELECT DISTINCT db_name, table_name FROM " .
529 PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . "." .
530 PMA_backquote($GLOBALS['cfg']['Server']['tracking']) .
531 " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($GLOBALS['db']) . "' " .
532 " ORDER BY ". PMA_backquote('db_name') . ", " . PMA_backquote('table_name');
534 $sql_result = PMA_query_as_controluser($sql_query);
536 if (PMA_DBI_num_rows($sql_result) > 0) {
538 <form method="post" action="tbl_tracking.php?<?php echo $url_query;?>">
539 <select name="table">
540 <?php
541 while ($entries = PMA_DBI_fetch_array($sql_result)) {
542 if (PMA_Tracker::isTracked($entries['db_name'], $entries['table_name'])) {
543 $status = ' (' . __('active') . ')';
544 } else {
545 $status = ' (' . __('not active') . ')';
547 if ($entries['table_name'] == $_REQUEST['table']) {
548 $s = ' selected="selected"';
549 } else {
550 $s = '';
552 echo '<option value="' . htmlspecialchars($entries['table_name']) . '"' . $s . '>' . htmlspecialchars($entries['db_name']) . ' . ' . htmlspecialchars($entries['table_name']) . $status . '</option>' . "\n";
555 </select>
556 <input type="submit" name="show_versions_submit" value="<?php echo __('Show versions');?>" />
557 </form>
558 <?php
561 <br />
562 <?php
565 * List versions of current table
568 $sql_query = " SELECT * FROM " .
569 PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . "." .
570 PMA_backquote($GLOBALS['cfg']['Server']['tracking']) .
571 " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($_REQUEST['db']) . "' ".
572 " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($_REQUEST['table']) ."' ".
573 " ORDER BY ". PMA_backquote('version') . " DESC ";
575 $sql_result = PMA_query_as_controluser($sql_query);
577 $last_version = 0;
578 $maxversion = PMA_DBI_fetch_array($sql_result);
579 $last_version = $maxversion['version'];
581 if ($last_version > 0) {
583 <table id="versions" class="data">
584 <thead>
585 <tr>
586 <th><?php echo __('Database');?></th>
587 <th><?php echo __('Table');?></th>
588 <th><?php echo __('Version');?></th>
589 <th><?php echo __('Created');?></th>
590 <th><?php echo __('Updated');?></th>
591 <th><?php echo __('Status');?></th>
592 <th><?php echo __('Show');?></th>
593 </tr>
594 </thead>
595 <tbody>
596 <?php
597 $style = 'odd';
598 PMA_DBI_data_seek($sql_result, 0);
599 while($version = PMA_DBI_fetch_array($sql_result)) {
600 if ($version['tracking_active'] == 1) {
601 $version_status = __('active');
602 } else {
603 $version_status = __('not active');
605 if ($version['version'] == $last_version){
606 if ($version['tracking_active'] == 1) {
607 $tracking_active = true;
608 } else {
609 $tracking_active = false;
613 <tr class="noclick <?php echo $style;?>">
614 <td><?php echo htmlspecialchars($version['db_name']);?></td>
615 <td><?php echo htmlspecialchars($version['table_name']);?></td>
616 <td><?php echo htmlspecialchars($version['version']);?></td>
617 <td><?php echo htmlspecialchars($version['date_created']);?></td>
618 <td><?php echo htmlspecialchars($version['date_updated']);?></td>
619 <td><?php echo $version_status;?></td>
620 <td> <a href="tbl_tracking.php<?php echo PMA_generate_common_url($url_params + array('report' => 'true', 'version' => $version['version'])
621 );?>"><?php echo __('Tracking report');?></a>
622 | <a href="tbl_tracking.php<?php echo PMA_generate_common_url($url_params + array('snapshot' => 'true', 'version' => $version['version'])
623 );?>"><?php echo __('Structure snapshot');?></a>
624 </td>
625 </tr>
626 <?php
627 if ($style == 'even') {
628 $style = 'odd';
629 } else {
630 $style = 'even';
634 </tbody>
635 </table>
636 <?php if ($tracking_active == true) {?>
637 <div id="div_deactivate_tracking">
638 <form method="post" action="tbl_tracking.php?<?php echo $url_query; ?>">
639 <fieldset>
640 <legend><?php printf(__('Deactivate tracking for %s.%s'), htmlspecialchars($GLOBALS['db']), htmlspecialchars($GLOBALS['table'])); ?></legend>
641 <input type="hidden" name="version" value="<?php echo $last_version; ?>" />
642 <input type="submit" name="submit_deactivate_now" value="<?php echo __('Deactivate now'); ?>" />
643 </fieldset>
644 </form>
645 </div>
646 <?php
649 <?php if ($tracking_active == false) {?>
650 <div id="div_activate_tracking">
651 <form method="post" action="tbl_tracking.php?<?php echo $url_query; ?>">
652 <fieldset>
653 <legend><?php printf(__('Activate tracking for %s.%s'), htmlspecialchars($GLOBALS['db']), htmlspecialchars($GLOBALS['table'])); ?></legend>
654 <input type="hidden" name="version" value="<?php echo $last_version; ?>" />
655 <input type="submit" name="submit_activate_now" value="<?php echo __('Activate now'); ?>" />
656 </fieldset>
657 </form>
658 </div>
659 <?php
664 <div id="div_create_version">
665 <form method="post" action="tbl_tracking.php?<?php echo $url_query; ?>">
666 <?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
667 <fieldset>
668 <legend><?php printf(__('Create version %s of %s.%s'), ($last_version + 1), htmlspecialchars($GLOBALS['db']), htmlspecialchars($GLOBALS['table'])); ?></legend>
670 <input type="hidden" name="version" value="<?php echo ($last_version + 1); ?>" />
672 <p><?php echo __('Track these data definition statements:');?></p>
673 <input type="checkbox" name="alter_table" value="true" checked="checked" /> ALTER TABLE<br/>
674 <input type="checkbox" name="rename_table" value="true" checked="checked" /> RENAME TABLE<br/>
675 <input type="checkbox" name="create_table" value="true" checked="checked" /> CREATE TABLE<br/>
676 <input type="checkbox" name="drop_table" value="true" checked="checked" /> DROP TABLE<br/>
677 <br/>
678 <input type="checkbox" name="create_index" value="true" checked="checked" /> CREATE INDEX<br/>
679 <input type="checkbox" name="drop_index" value="true" checked="checked" /> DROP INDEX<br/>
680 <p><?php echo __('Track these data manipulation statements:');?></p>
681 <input type="checkbox" name="insert" value="true" checked="checked" /> INSERT<br/>
682 <input type="checkbox" name="update" value="true" checked="checked" /> UPDATE<br/>
683 <input type="checkbox" name="delete" value="true" checked="checked" /> DELETE<br/>
684 <input type="checkbox" name="truncate" value="true" checked="checked" /> TRUNCATE<br/>
686 </fieldset>
687 <fieldset class="tblFooters">
688 <input type="submit" name="submit_create_version" value="<?php echo __('Create version'); ?>" />
689 </fieldset>
690 </form>
691 </div>
693 <br class="clearfloat"/>
695 <?php
697 * Displays the footer
699 require './libraries/footer.inc.php';