tracking icon had disappeared; improve XHTML compliance
[phpmyadmin/crack.git] / db_tracking.php
blob0ae8cbf528a030023022347d7655ff28dc714e07
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * @version $Id$
5 * @author Alexander Rutkowski
6 * @package phpMyAdmin
7 */
9 // Run common work
10 require_once './libraries/common.inc.php';
11 require_once './libraries/Table.class.php';
13 require './libraries/db_common.inc.php';
14 $url_query .= '&amp;goto=tbl_tracking.php&amp;back=db_tracking.php';
16 // Get the database structure
17 $sub_part = '_structure';
18 require './libraries/db_info.inc.php';
20 // Get relation settings
21 require_once './libraries/relation.lib.php';
23 // Get tracked data about the database
24 $data = PMA_Tracker::getTrackedData($_REQUEST['db'], '', '1');
26 // No tables present and no log exist
27 if ($num_tables == 0 && count($data['ddlog']) == 0) {
28 echo '<p>' . $strNoTablesFound . '</p>' . "\n";
30 if (empty($db_is_information_schema)) {
31 require './libraries/display_create_table.lib.php';
34 // Display the footer
35 require_once './libraries/footer.inc.php';
36 exit;
39 // ---------------------------------------------------------------------------
42 * Display top menu links
44 require_once './libraries/db_links.inc.php';
46 // Prepare statement to get HEAD version
47 $all_tables_query = ' SELECT table_name, MAX(version) as version FROM ' .
48 PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' .
49 PMA_backquote($GLOBALS['cfg']['Server']['tracking']) .
50 ' WHERE ' . PMA_backquote('db_name') . ' = \'' . PMA_sqlAddslashes($_REQUEST['db']) . '\' ' .
51 ' GROUP BY '. PMA_backquote('table_name') .
52 ' ORDER BY '. PMA_backquote('table_name') .' ASC';
54 $all_tables_result = PMA_query_as_controluser($all_tables_query);
56 // If a HEAD version exists
57 if (PMA_DBI_num_rows($all_tables_result) > 0) {
59 <h3><?php echo $strTrackingTrackedTables;?></h3>
61 <table id="versions" class="data">
62 <thead>
63 <tr>
64 <th><?php echo $strDatabase;?></th>
65 <th><?php echo $strTable;?></th>
66 <th><?php echo $strTrackingThLastVersion;?></th>
67 <th><?php echo $strTrackingThCreated;?></th>
68 <th><?php echo $strTrackingThUpdated;?></th>
69 <th><?php echo $strStatus;?></th>
70 <th><?php echo $strShow;?></th>
71 </tr>
72 </thead>
73 <tbody>
74 <?php
76 // Print out information about versions
78 $style = 'odd';
79 while ($one_result = PMA_DBI_fetch_array($all_tables_result)) {
80 list($table_name, $version_number) = $one_result;
81 $table_query = ' SELECT * FROM ' .
82 PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' .
83 PMA_backquote($GLOBALS['cfg']['Server']['tracking']) .
84 ' WHERE `db_name` = \'' . PMA_sqlAddslashes($_REQUEST['db']) . '\' AND `table_name` = \'' . PMA_sqlAddslashes($table_name) . '\' AND `version` = \'' . $version_number . '\'';
86 $table_result = PMA_query_as_controluser($table_query);
87 $version_data = PMA_DBI_fetch_array($table_result);
89 if ($version_data['tracking_active'] == 1) {
90 $version_status = $strTrackingStatusActive;
91 } else {
92 $version_status = $strTrackingStatusNotActive;
94 $tmp_link = 'tbl_tracking.php?' . $url_query . '&amp;table=' . htmlspecialchars($version_data['table_name']);
96 <tr class="<?php echo $style;?>">
97 <td><?php echo htmlspecialchars($version_data['db_name']);?></td>
98 <td><?php echo htmlspecialchars($version_data['table_name']);?></td>
99 <td><?php echo $version_data['version'];?></td>
100 <td><?php echo $version_data['date_created'];?></td>
101 <td><?php echo $version_data['date_updated'];?></td>
102 <td><?php echo $version_status;?></td>
103 <td> <a href="<?php echo $tmp_link; ?>"><?php echo $strTrackingVersions;?></a>
104 | <a href="<?php echo $tmp_link; ?>&amp;report=true&amp;version=<?php echo $version_data['version'];?>"><?php echo $strTrackingReport;?></a>
105 | <a href="<?php echo $tmp_link; ?>&amp;snapshot=true&amp;version=<?php echo $version_data['version'];?>"><?php echo $strTrackingStructureSnapshot;?></a></td>
106 </tr>
107 <?php
108 if ($style == 'even') {
109 $style = 'odd';
110 } else {
111 $style = 'even';
114 unset($tmp_link);
116 </tbody>
117 </table>
118 <?php
121 // Get list of tables
122 $table_list = PMA_getTableList($GLOBALS['db']);
124 // For each table try to get the tracking version
125 foreach ($table_list as $key => $value) {
126 if (PMA_Tracker::getVersion($GLOBALS['db'], $value['Name']) == -1) {
127 $my_tables[] = $value['Name'];
131 // If untracked tables exist
132 if (isset($my_tables)) {
134 <h3><?php echo $strTrackingUntrackedTables;?></h3>
136 <table id="noversions" class="data">
137 <thead>
138 <tr>
139 <th width="300"><?php echo $strTable;?></th>
140 <th></th>
141 </tr>
142 </thead>
143 <tbody>
144 <?php
145 // Print out list of untracked tables
147 $style = 'odd';
149 foreach ($my_tables as $key => $tablename) {
150 if (PMA_Tracker::getVersion($GLOBALS['db'], $tablename) == -1) {
151 $my_link = '<a href="tbl_tracking.php?' . $url_query . '&amp;table=' . htmlspecialchars($tablename) .'">';
153 if ($cfg['PropertiesIconic']) {
154 $my_link .= '<img class="icon" src="' . $pmaThemeImage . 'eye.png" width="16" height="16" alt="' . $strTrackingTrackTable . '" /> ';
156 $my_link .= $strTrackingTrackTable . '</a>';
158 <tr class="<?php echo $style;?>">
159 <td><?php echo htmlspecialchars($tablename);?></td>
160 <td><?php echo $my_link;?></td>
161 </tr>
162 <?php
163 if ($style == 'even') {
164 $style = 'odd';
165 } else {
166 $style = 'even';
171 </tbody>
172 </table>
174 <?php
176 // If available print out database log
177 if (count($data['ddlog']) > 0) {
178 $log = '';
179 foreach ($data['ddlog'] as $entry) {
180 $log .= '# ' . $entry['date'] . ' ' . $entry['username'] . "\n" . $entry['statement'] . "\n";
182 PMA_showMessage($strTrackingDatabaseLog, $log);
186 * Display the footer
188 require_once './libraries/footer.inc.php';