Fix typo in translation.
[phpmyadmin/crack.git] / server_binlog.php
blob762f12938f9748417f6ace9e857d8ae294ebcba8
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * display the binary logs and the content of the selected
6 * @uses $cfg['MainPageIconic']
7 * @uses $cfg['NavigationBarIconic']
8 * @uses $cfg['MaxRows']
9 * @uses $cfg['LimitChars']
10 * @uses $pmaThemeImage
11 * @uses $GLOBALS['strBinaryLog']
12 * @uses $GLOBALS['strGo']
13 * @uses $GLOBALS['strTruncateQueries']
14 * @uses $GLOBALS['strShowFullQueries']
15 * @uses $GLOBALS['strBinLogName']
16 * @uses $GLOBALS['strBinLogPosition']
17 * @uses $GLOBALS['strBinLogEventType']
18 * @uses $GLOBALS['strBinLogServerId']
19 * @uses $GLOBALS['strBinLogOriginalPosition']
20 * @uses $GLOBALS['strBinLogInfo']
21 * @uses $GLOBALS['strFiles']
22 * @uses $GLOBALS['strPrevious']
23 * @uses $GLOBALS['strNext']
24 * @uses $binary_logs
25 * @uses PMA_generate_common_hidden_inputs()
26 * @uses PMA_generate_common_url()
27 * @uses PMA_formatByteDown()
28 * @uses PMA_DBI_fetch_assoc()
29 * @uses PMA_strlen()
30 * @uses PMA_substr()
31 * @uses $_REQUEST['pos']
32 * @uses $_REQUEST['log']
33 * @uses $_REQUEST['dontlimitchars']
34 * @uses count()
35 * @uses array_key_exists()
36 * @uses implode()
37 * @uses htmlspecialchars()
38 * @version $Id$
41 /**
44 require_once './libraries/common.inc.php';
46 /**
47 * Does the common work, provides $binary_logs
49 require_once './libraries/server_common.inc.php';
51 /**
52 * Displays the links
54 require_once './libraries/server_links.inc.php';
56 $url_params = array();
58 /**
59 * Need to find the real end of rows?
61 if (! isset($_REQUEST['pos'])) {
62 $pos = 0;
63 } else {
64 /* We need this to be a integer */
65 $pos = (int) $_REQUEST['pos'];
68 if (! isset($_REQUEST['log']) || ! array_key_exists($_REQUEST['log'], $binary_logs)) {
69 $_REQUEST['log'] = '';
70 } else {
71 $url_params['log'] = $_REQUEST['log'];
74 $sql_query = 'SHOW BINLOG EVENTS';
75 if (! empty($_REQUEST['log'])) {
76 $sql_query .= ' IN \'' . $_REQUEST['log'] . '\'';
78 if ($GLOBALS['cfg']['MaxRows'] !== 'all') {
79 $sql_query .= ' LIMIT ' . $pos . ', ' . (int) $GLOBALS['cfg']['MaxRows'];
82 /**
83 * Sends the query
85 $result = PMA_DBI_query($sql_query);
87 /**
88 * prepare some vars for displaying the result table
90 // Gets the list of fields properties
91 if (isset($result) && $result) {
92 $num_rows = PMA_DBI_num_rows($result);
93 } else {
94 $num_rows = 0;
97 if (empty($_REQUEST['dontlimitchars'])) {
98 $dontlimitchars = false;
99 } else {
100 $dontlimitchars = true;
101 $url_params['dontlimitchars'] = 1;
105 * Displays the sub-page heading
107 echo '<h2>' . "\n"
108 . ($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 's_process.png" width="16" height="16" border="0" hspace="2" align="middle" alt="" />' : '')
109 . ' ' . $GLOBALS['strBinaryLog'] . "\n"
110 . '</h2>' . "\n";
113 * Display log selector.
115 if (count($binary_logs) > 1) {
116 echo '<form action="server_binlog.php" method="get">';
117 echo PMA_generate_common_hidden_inputs($url_params);
118 echo '<fieldset><legend>';
119 echo $GLOBALS['strSelectBinaryLog'];
120 echo '</legend><select name="log">';
121 $full_size = 0;
122 foreach ($binary_logs as $each_log) {
123 echo '<option value="' . $each_log['Log_name'] . '"';
124 if ($each_log['Log_name'] == $_REQUEST['log']) {
125 echo ' selected="selected"';
127 echo '>' . $each_log['Log_name'];
128 if (isset($each_log['File_size'])) {
129 $full_size += $each_log['File_size'];
130 echo ' (' . implode(' ', PMA_formatByteDown($each_log['File_size'], 3, 2)) . ')';
132 echo '</option>';
134 echo '</select> ';
135 echo count($binary_logs) . ' ' . $GLOBALS['strFiles'] . ', ';
136 if ($full_size > 0) {
137 echo implode(' ', PMA_formatByteDown($full_size));
139 echo '</fieldset>';
140 echo '<fieldset class="tblFooters">';
141 echo '<input type="submit" value="' . $GLOBALS['strGo'] . '" />';
142 echo '</fieldset>';
143 echo '</form>';
146 PMA_Message::success()->display();
149 * Displays the page
152 <table border="0" cellpadding="2" cellspacing="1">
153 <thead>
154 <tr>
155 <td colspan="6" align="center">
156 <?php
157 // we do not now how much rows are in the binlog
158 // so we can just force 'NEXT' button
159 if ($pos > 0) {
160 $this_url_params = $url_params;
161 if ($pos > $GLOBALS['cfg']['MaxRows']) {
162 $this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows'];
165 echo '<a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
166 if ($GLOBALS['cfg']['NavigationBarIconic']) {
167 echo ' title="' . $GLOBALS['strPrevious'] . '">';
168 } else {
169 echo '>' . $GLOBALS['strPrevious'];
170 } // end if... else...
171 echo ' &lt; </a> - ';
174 $this_url_params = $url_params;
175 if ($pos > 0) {
176 $this_url_params['pos'] = $pos;
178 if ($dontlimitchars) {
179 unset($this_url_params['dontlimitchars']);
181 <a href="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
182 title="<?php $GLOBALS['strTruncateQueries']; ?>">
183 <img src="<?php echo $pmaThemeImage; ?>s_partialtext.png"
184 width="50" height="20" border="0"
185 alt="<?php echo $GLOBALS['strTruncateQueries']; ?>" /></a>
186 <?php
187 } else {
188 $this_url_params['dontlimitchars'] = 1;
190 <a href="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
191 title="<?php $GLOBALS['strShowFullQueries']; ?>">
192 <img src="<?php echo $pmaThemeImage; ?>s_fulltext.png"
193 width="50" height="20" border="0"
194 alt="<?php echo $GLOBALS['strShowFullQueries']; ?>" /></a>
195 <?php
197 // we do not now how much rows are in the binlog
198 // so we can just force 'NEXT' button
199 if ($num_rows >= $GLOBALS['cfg']['MaxRows']) {
200 $this_url_params = $url_params;
201 $this_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxRows'];
202 echo ' - <a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
203 if ($GLOBALS['cfg']['NavigationBarIconic']) {
204 echo ' title="' . $GLOBALS['strNext'] . '">';
205 } else {
206 echo '>' . $GLOBALS['strNext'];
207 } // end if... else...
208 echo ' &gt; </a>';
211 </td>
212 </tr>
213 <tr>
214 <th><?php echo $GLOBALS['strBinLogName']; ?></th>
215 <th><?php echo $GLOBALS['strBinLogPosition']; ?></th>
216 <th><?php echo $GLOBALS['strBinLogEventType']; ?></th>
217 <th><?php echo $GLOBALS['strBinLogServerId']; ?></th>
218 <th><?php echo $GLOBALS['strBinLogOriginalPosition']; ?></th>
219 <th><?php echo $GLOBALS['strBinLogInfo']; ?></th>
220 </tr>
221 </thead>
222 <tbody>
223 <?php
224 $odd_row = true;
225 while ($value = PMA_DBI_fetch_assoc($result)) {
226 if (! $dontlimitchars && PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']) {
227 $value['Info'] = PMA_substr($value['Info'], 0, $GLOBALS['cfg']['LimitChars']) . '...';
230 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
231 <td>&nbsp;<?php echo $value['Log_name']; ?>&nbsp;</td>
232 <td align="right">&nbsp;<?php echo $value['Pos']; ?>&nbsp;</td>
233 <td>&nbsp;<?php echo $value['Event_type']; ?>&nbsp;</td>
234 <td align="right">&nbsp;<?php echo $value['Server_id']; ?>&nbsp;</td>
235 <td align="right">&nbsp;<?php echo isset($value['Orig_log_pos']) ? $value['Orig_log_pos'] : $value['End_log_pos']; ?>&nbsp;</td>
236 <td>&nbsp;<?php echo htmlspecialchars($value['Info']); ?>&nbsp;</td>
237 </tr>
238 <?php
239 $odd_row = !$odd_row;
242 </tbody>
243 </table>
244 <?php
248 * Sends the footer
250 require_once './libraries/footer.inc.php';