Translation update done using Pootle.
[phpmyadmin/crack.git] / server_binlog.php
blobdf41b977e504341bcc1caed515b41b6fac8cf01b
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_logs
12 * @uses PMA_generate_common_hidden_inputs()
13 * @uses PMA_generate_common_url()
14 * @uses PMA_formatByteDown()
15 * @uses PMA_DBI_fetch_assoc()
16 * @uses PMA_strlen()
17 * @uses PMA_substr()
18 * @uses $_REQUEST['pos']
19 * @uses $_REQUEST['log']
20 * @uses $_REQUEST['dontlimitchars']
21 * @uses count()
22 * @uses array_key_exists()
23 * @uses implode()
24 * @uses htmlspecialchars()
25 * @package phpMyAdmin
28 /**
31 require_once './libraries/common.inc.php';
33 /**
34 * Does the common work, provides $binary_logs
36 require_once './libraries/server_common.inc.php';
38 /**
39 * Displays the links
41 require_once './libraries/server_links.inc.php';
43 $url_params = array();
45 /**
46 * Need to find the real end of rows?
48 if (! isset($_REQUEST['pos'])) {
49 $pos = 0;
50 } else {
51 /* We need this to be a integer */
52 $pos = (int) $_REQUEST['pos'];
55 if (! isset($_REQUEST['log']) || ! array_key_exists($_REQUEST['log'], $binary_logs)) {
56 $_REQUEST['log'] = '';
57 } else {
58 $url_params['log'] = $_REQUEST['log'];
61 $sql_query = 'SHOW BINLOG EVENTS';
62 if (! empty($_REQUEST['log'])) {
63 $sql_query .= ' IN \'' . $_REQUEST['log'] . '\'';
65 if ($GLOBALS['cfg']['MaxRows'] !== 'all') {
66 $sql_query .= ' LIMIT ' . $pos . ', ' . (int) $GLOBALS['cfg']['MaxRows'];
69 /**
70 * Sends the query
72 $result = PMA_DBI_query($sql_query);
74 /**
75 * prepare some vars for displaying the result table
77 // Gets the list of fields properties
78 if (isset($result) && $result) {
79 $num_rows = PMA_DBI_num_rows($result);
80 } else {
81 $num_rows = 0;
84 if (empty($_REQUEST['dontlimitchars'])) {
85 $dontlimitchars = false;
86 } else {
87 $dontlimitchars = true;
88 $url_params['dontlimitchars'] = 1;
91 /**
92 * Displays the sub-page heading
94 echo '<h2>' . "\n"
95 . ($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 's_tbl.png" width="16" height="16" border="0" hspace="2" align="middle" alt="" />' : '')
96 . ' ' . __('Binary log') . "\n"
97 . '</h2>' . "\n";
99 /**
100 * Display log selector.
102 if (count($binary_logs) > 1) {
103 echo '<form action="server_binlog.php" method="get">';
104 echo PMA_generate_common_hidden_inputs($url_params);
105 echo '<fieldset><legend>';
106 echo __('Select binary log to view');
107 echo '</legend><select name="log">';
108 $full_size = 0;
109 foreach ($binary_logs as $each_log) {
110 echo '<option value="' . $each_log['Log_name'] . '"';
111 if ($each_log['Log_name'] == $_REQUEST['log']) {
112 echo ' selected="selected"';
114 echo '>' . $each_log['Log_name'];
115 if (isset($each_log['File_size'])) {
116 $full_size += $each_log['File_size'];
117 echo ' (' . implode(' ', PMA_formatByteDown($each_log['File_size'], 3, 2)) . ')';
119 echo '</option>';
121 echo '</select> ';
122 echo count($binary_logs) . ' ' . __('Files') . ', ';
123 if ($full_size > 0) {
124 echo implode(' ', PMA_formatByteDown($full_size));
126 echo '</fieldset>';
127 echo '<fieldset class="tblFooters">';
128 echo '<input type="submit" value="' . __('Go') . '" />';
129 echo '</fieldset>';
130 echo '</form>';
133 PMA_showMessage(PMA_Message::success());
136 * Displays the page
139 <table border="0" cellpadding="2" cellspacing="1">
140 <thead>
141 <tr>
142 <td colspan="6" align="center">
143 <?php
144 // we do not now how much rows are in the binlog
145 // so we can just force 'NEXT' button
146 if ($pos > 0) {
147 $this_url_params = $url_params;
148 if ($pos > $GLOBALS['cfg']['MaxRows']) {
149 $this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows'];
152 echo '<a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
153 if ($GLOBALS['cfg']['NavigationBarIconic']) {
154 echo ' title="' . __('Previous') . '">';
155 } else {
156 echo '>' . __('Previous');
157 } // end if... else...
158 echo ' &lt; </a> - ';
161 $this_url_params = $url_params;
162 if ($pos > 0) {
163 $this_url_params['pos'] = $pos;
165 if ($dontlimitchars) {
166 unset($this_url_params['dontlimitchars']);
168 <a href="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
169 title="<?php __('Truncate Shown Queries'); ?>">
170 <img src="<?php echo $pmaThemeImage; ?>s_partialtext.png"
171 alt="<?php echo __('Truncate Shown Queries'); ?>" /></a>
172 <?php
173 } else {
174 $this_url_params['dontlimitchars'] = 1;
176 <a href="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
177 title="<?php __('Show Full Queries'); ?>">
178 <img src="<?php echo $pmaThemeImage; ?>s_fulltext.png"
179 alt="<?php echo __('Show Full Queries'); ?>" /></a>
180 <?php
182 // we do not now how much rows are in the binlog
183 // so we can just force 'NEXT' button
184 if ($num_rows >= $GLOBALS['cfg']['MaxRows']) {
185 $this_url_params = $url_params;
186 $this_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxRows'];
187 echo ' - <a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
188 if ($GLOBALS['cfg']['NavigationBarIconic']) {
189 echo ' title="' . __('Next') . '">';
190 } else {
191 echo '>' . __('Next');
192 } // end if... else...
193 echo ' &gt; </a>';
196 </td>
197 </tr>
198 <tr>
199 <th><?php echo __('Log name'); ?></th>
200 <th><?php echo __('Position'); ?></th>
201 <th><?php echo __('Event type'); ?></th>
202 <th><?php echo __('Server ID'); ?></th>
203 <th><?php echo __('Original position'); ?></th>
204 <th><?php echo __('Information'); ?></th>
205 </tr>
206 </thead>
207 <tbody>
208 <?php
209 $odd_row = true;
210 while ($value = PMA_DBI_fetch_assoc($result)) {
211 if (! $dontlimitchars && PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']) {
212 $value['Info'] = PMA_substr($value['Info'], 0, $GLOBALS['cfg']['LimitChars']) . '...';
215 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
216 <td>&nbsp;<?php echo $value['Log_name']; ?>&nbsp;</td>
217 <td align="right">&nbsp;<?php echo $value['Pos']; ?>&nbsp;</td>
218 <td>&nbsp;<?php echo $value['Event_type']; ?>&nbsp;</td>
219 <td align="right">&nbsp;<?php echo $value['Server_id']; ?>&nbsp;</td>
220 <td align="right">&nbsp;<?php echo isset($value['Orig_log_pos']) ? $value['Orig_log_pos'] : $value['End_log_pos']; ?>&nbsp;</td>
221 <td>&nbsp;<?php echo htmlspecialchars($value['Info']); ?>&nbsp;</td>
222 </tr>
223 <?php
224 $odd_row = !$odd_row;
227 </tbody>
228 </table>
229 <?php
233 * Sends the footer
235 require './libraries/footer.inc.php';