Translation update done using Pootle.
[phpmyadmin/crack.git] / server_binlog.php
blobc8dd614973adbd118207c06d2e012b5b4dae05c9
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 __('Binary log')
12 * @uses __('Go')
13 * @uses __('Truncate Shown Queries')
14 * @uses __('Show Full Queries')
15 * @uses __('Log name')
16 * @uses __('Position')
17 * @uses __('Event type')
18 * @uses __('Server ID')
19 * @uses __('Original position')
20 * @uses __('Information')
21 * @uses __('Files')
22 * @uses __('Previous')
23 * @uses __('Next')
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$
39 * @package phpMyAdmin
42 /**
45 require_once './libraries/common.inc.php';
47 /**
48 * Does the common work, provides $binary_logs
50 require_once './libraries/server_common.inc.php';
52 /**
53 * Displays the links
55 require_once './libraries/server_links.inc.php';
57 $url_params = array();
59 /**
60 * Need to find the real end of rows?
62 if (! isset($_REQUEST['pos'])) {
63 $pos = 0;
64 } else {
65 /* We need this to be a integer */
66 $pos = (int) $_REQUEST['pos'];
69 if (! isset($_REQUEST['log']) || ! array_key_exists($_REQUEST['log'], $binary_logs)) {
70 $_REQUEST['log'] = '';
71 } else {
72 $url_params['log'] = $_REQUEST['log'];
75 $sql_query = 'SHOW BINLOG EVENTS';
76 if (! empty($_REQUEST['log'])) {
77 $sql_query .= ' IN \'' . $_REQUEST['log'] . '\'';
79 if ($GLOBALS['cfg']['MaxRows'] !== 'all') {
80 $sql_query .= ' LIMIT ' . $pos . ', ' . (int) $GLOBALS['cfg']['MaxRows'];
83 /**
84 * Sends the query
86 $result = PMA_DBI_query($sql_query);
88 /**
89 * prepare some vars for displaying the result table
91 // Gets the list of fields properties
92 if (isset($result) && $result) {
93 $num_rows = PMA_DBI_num_rows($result);
94 } else {
95 $num_rows = 0;
98 if (empty($_REQUEST['dontlimitchars'])) {
99 $dontlimitchars = false;
100 } else {
101 $dontlimitchars = true;
102 $url_params['dontlimitchars'] = 1;
106 * Displays the sub-page heading
108 echo '<h2>' . "\n"
109 . ($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 's_process.png" width="16" height="16" border="0" hspace="2" align="middle" alt="" />' : '')
110 . ' ' . __('Binary log') . "\n"
111 . '</h2>' . "\n";
114 * Display log selector.
116 if (count($binary_logs) > 1) {
117 echo '<form action="server_binlog.php" method="get">';
118 echo PMA_generate_common_hidden_inputs($url_params);
119 echo '<fieldset><legend>';
120 echo __('Select binary log to view');
121 echo '</legend><select name="log">';
122 $full_size = 0;
123 foreach ($binary_logs as $each_log) {
124 echo '<option value="' . $each_log['Log_name'] . '"';
125 if ($each_log['Log_name'] == $_REQUEST['log']) {
126 echo ' selected="selected"';
128 echo '>' . $each_log['Log_name'];
129 if (isset($each_log['File_size'])) {
130 $full_size += $each_log['File_size'];
131 echo ' (' . implode(' ', PMA_formatByteDown($each_log['File_size'], 3, 2)) . ')';
133 echo '</option>';
135 echo '</select> ';
136 echo count($binary_logs) . ' ' . __('Files') . ', ';
137 if ($full_size > 0) {
138 echo implode(' ', PMA_formatByteDown($full_size));
140 echo '</fieldset>';
141 echo '<fieldset class="tblFooters">';
142 echo '<input type="submit" value="' . __('Go') . '" />';
143 echo '</fieldset>';
144 echo '</form>';
147 PMA_Message::success()->display();
150 * Displays the page
153 <table border="0" cellpadding="2" cellspacing="1">
154 <thead>
155 <tr>
156 <td colspan="6" align="center">
157 <?php
158 // we do not now how much rows are in the binlog
159 // so we can just force 'NEXT' button
160 if ($pos > 0) {
161 $this_url_params = $url_params;
162 if ($pos > $GLOBALS['cfg']['MaxRows']) {
163 $this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows'];
166 echo '<a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
167 if ($GLOBALS['cfg']['NavigationBarIconic']) {
168 echo ' title="' . __('Previous') . '">';
169 } else {
170 echo '>' . __('Previous');
171 } // end if... else...
172 echo ' &lt; </a> - ';
175 $this_url_params = $url_params;
176 if ($pos > 0) {
177 $this_url_params['pos'] = $pos;
179 if ($dontlimitchars) {
180 unset($this_url_params['dontlimitchars']);
182 <a href="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
183 title="<?php __('Truncate Shown Queries'); ?>">
184 <img src="<?php echo $pmaThemeImage; ?>s_partialtext.png"
185 width="50" height="20" border="0"
186 alt="<?php echo __('Truncate Shown Queries'); ?>" /></a>
187 <?php
188 } else {
189 $this_url_params['dontlimitchars'] = 1;
191 <a href="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
192 title="<?php __('Show Full Queries'); ?>">
193 <img src="<?php echo $pmaThemeImage; ?>s_fulltext.png"
194 width="50" height="20" border="0"
195 alt="<?php echo __('Show Full Queries'); ?>" /></a>
196 <?php
198 // we do not now how much rows are in the binlog
199 // so we can just force 'NEXT' button
200 if ($num_rows >= $GLOBALS['cfg']['MaxRows']) {
201 $this_url_params = $url_params;
202 $this_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxRows'];
203 echo ' - <a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
204 if ($GLOBALS['cfg']['NavigationBarIconic']) {
205 echo ' title="' . __('Next') . '">';
206 } else {
207 echo '>' . __('Next');
208 } // end if... else...
209 echo ' &gt; </a>';
212 </td>
213 </tr>
214 <tr>
215 <th><?php echo __('Log name'); ?></th>
216 <th><?php echo __('Position'); ?></th>
217 <th><?php echo __('Event type'); ?></th>
218 <th><?php echo __('Server ID'); ?></th>
219 <th><?php echo __('Original position'); ?></th>
220 <th><?php echo __('Information'); ?></th>
221 </tr>
222 </thead>
223 <tbody>
224 <?php
225 $odd_row = true;
226 while ($value = PMA_DBI_fetch_assoc($result)) {
227 if (! $dontlimitchars && PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']) {
228 $value['Info'] = PMA_substr($value['Info'], 0, $GLOBALS['cfg']['LimitChars']) . '...';
231 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
232 <td>&nbsp;<?php echo $value['Log_name']; ?>&nbsp;</td>
233 <td align="right">&nbsp;<?php echo $value['Pos']; ?>&nbsp;</td>
234 <td>&nbsp;<?php echo $value['Event_type']; ?>&nbsp;</td>
235 <td align="right">&nbsp;<?php echo $value['Server_id']; ?>&nbsp;</td>
236 <td align="right">&nbsp;<?php echo isset($value['Orig_log_pos']) ? $value['Orig_log_pos'] : $value['End_log_pos']; ?>&nbsp;</td>
237 <td>&nbsp;<?php echo htmlspecialchars($value['Info']); ?>&nbsp;</td>
238 </tr>
239 <?php
240 $odd_row = !$odd_row;
243 </tbody>
244 </table>
245 <?php
249 * Sends the footer
251 require_once './libraries/footer.inc.php';