2 /* vim: set expandtab sw=4 ts=4 sts=4: */
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']
25 * @uses PMA_generate_common_hidden_inputs()
26 * @uses PMA_generate_common_url()
27 * @uses PMA_formatByteDown()
28 * @uses PMA_DBI_fetch_assoc()
31 * @uses $_REQUEST['pos']
32 * @uses $_REQUEST['log']
33 * @uses $_REQUEST['dontlimitchars']
35 * @uses array_key_exists()
37 * @uses htmlspecialchars()
44 require_once './libraries/common.inc.php';
47 * Does the common work, provides $binary_logs
49 require_once './libraries/server_common.inc.php';
54 require_once './libraries/server_links.inc.php';
56 $url_params = array();
59 * Need to find the real end of rows?
61 if (! isset($_REQUEST['pos'])) {
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'] = '';
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'];
85 $result = PMA_DBI_query($sql_query);
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);
97 if (empty($_REQUEST['dontlimitchars'])) {
98 $dontlimitchars = false;
100 $dontlimitchars = true;
101 $url_params['dontlimitchars'] = 1;
105 * Displays the sub-page heading
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"
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">';
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)) . ')';
135 echo count($binary_logs) . ' ' . $GLOBALS['strFiles'] . ', ';
136 if ($full_size > 0) {
137 echo implode(' ', PMA_formatByteDown($full_size));
140 echo '<fieldset class="tblFooters">';
141 echo '<input type="submit" value="' . $GLOBALS['strGo'] . '" />';
146 PMA_Message
::success()->display();
152 <table border
="0" cellpadding
="2" cellspacing
="1">
155 <td colspan
="6" align
="center">
157 // we do not now how much rows are in the binlog
158 // so we can just force 'NEXT' button
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'] . '">';
169 echo '>' . $GLOBALS['strPrevious'];
170 } // end if... else...
171 echo ' < </a> - ';
174 $this_url_params = $url_params;
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
>
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
>
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'] . '">';
206 echo '>' . $GLOBALS['strNext'];
207 } // end if... else...
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
>
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
> 
;<?php
echo $value['Log_name']; ?
> 
;</td
>
232 <td align
="right"> 
;<?php
echo $value['Pos']; ?
> 
;</td
>
233 <td
> 
;<?php
echo $value['Event_type']; ?
> 
;</td
>
234 <td align
="right"> 
;<?php
echo $value['Server_id']; ?
> 
;</td
>
235 <td align
="right"> 
;<?php
echo isset($value['Orig_log_pos']) ?
$value['Orig_log_pos'] : $value['End_log_pos']; ?
> 
;</td
>
236 <td
> 
;<?php
echo htmlspecialchars($value['Info']); ?
> 
;</td
>
239 $odd_row = !$odd_row;
250 require_once './libraries/footer.inc.php';