ChangeLog for XSS search
[phpmyadmin/sankalp_k.git] / server_binlog.php
blob7ba706f5d378b1129e296916929d5e1bf391e9b3
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_showMessage()
29 * @uses PMA_DBI_fetch_assoc()
30 * @uses PMA_strlen()
31 * @uses PMA_substr()
32 * @uses $_REQUEST['pos']
33 * @uses $_REQUEST['log']
34 * @uses $_REQUEST['dontlimitchars']
35 * @uses count()
36 * @uses array_key_exists()
37 * @uses implode()
38 * @uses htmlspecialchars()
39 * @version $Id$
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 . ' ' . $GLOBALS['strBinaryLog'] . "\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 $GLOBALS['strSelectBinaryLog'];
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) . ' ' . $GLOBALS['strFiles'] . ', ';
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="' . $GLOBALS['strGo'] . '" />';
143 echo '</fieldset>';
144 echo '</form>';
147 PMA_showMessage($GLOBALS['strSuccess']);
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="' . $GLOBALS['strPrevious'] . '">';
169 } else {
170 echo '>' . $GLOBALS['strPrevious'];
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 $GLOBALS['strTruncateQueries']; ?>">
184 <img src="<?php echo $pmaThemeImage; ?>s_partialtext.png"
185 width="50" height="20" border="0"
186 alt="<?php echo $GLOBALS['strTruncateQueries']; ?>" /></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 $GLOBALS['strShowFullQueries']; ?>">
193 <img src="<?php echo $pmaThemeImage; ?>s_fulltext.png"
194 width="50" height="20" border="0"
195 alt="<?php echo $GLOBALS['strShowFullQueries']; ?>" /></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="' . $GLOBALS['strNext'] . '">';
206 } else {
207 echo '>' . $GLOBALS['strNext'];
208 } // end if... else...
209 echo ' &gt; </a>';
212 </td>
213 </tr>
214 <tr>
215 <th><?php echo $GLOBALS['strBinLogName']; ?></th>
216 <th><?php echo $GLOBALS['strBinLogPosition']; ?></th>
217 <th><?php echo $GLOBALS['strBinLogEventType']; ?></th>
218 <th><?php echo $GLOBALS['strBinLogServerId']; ?></th>
219 <th><?php echo $GLOBALS['strBinLogOriginalPosition']; ?></th>
220 <th><?php echo $GLOBALS['strBinLogInfo']; ?></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';