lang
[phpmyadmin/crack.git] / browse_foreigners.php3
blob5a0362c055d4519deac041964cc0f62160de7e29
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 /**
6 * Get the variables sent or posted to this script and displays the header
7 */
8 require('./libraries/grab_globals.lib.php3');
10 /**
11 * Gets a core script and starts output buffering work
13 if (!defined('PMA_COMMON_LIB_INCLUDED')) {
14 include('./libraries/common.lib.php3');
17 PMA_checkParameters(array('db', 'table', 'field'));
19 require('./libraries/ob.lib.php3');
20 if ($cfg['OBGzip']) {
21 $ob_mode = PMA_outBufferModeGet();
22 if ($ob_mode) {
23 PMA_outBufferPre($ob_mode);
26 include('./libraries/header_http.inc.php3');
27 $field = urldecode($field);
29 /**
30 * Displays the frame
32 // Gets the font sizes to use
33 PMA_setFontSizes();
35 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
36 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
37 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?>" lang="<?php echo $available_languages[$lang][2]; ?>" dir="<?php echo $text_dir; ?>">
39 <head>
40 <title>phpMyAdmin</title>
41 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
42 <base<?php if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?> />
43 <link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php3?lang=<?php echo $lang; ?>&amp;js_frame=right" />
44 <script src="libraries/functions.js" type="text/javascript" language="javascript"></script>
45 <script type="text/javascript" language="javascript">
46 self.focus();
47 function formupdate(field, key) {
48 if (opener && opener.document && opener.document.insertForm && opener.document.insertForm.elements['field_' + field + '[]']) {
49 opener.document.insertForm.elements['field_' + field + '[]'].value = key;
50 self.close();
51 } else {
52 alert('<?php echo $strWindowNotFound; ?>');
55 </script>
56 </head>
58 <body bgcolor="<?php echo $cfg['LeftBgColor']; ?>" style="margin-left: 5px; margin-top: 5px; margin-right: 5px; margin-bottom: 0px">
59 <?php
60 $per_page = 200;
61 require('./libraries/relation.lib.php3'); // foreign keys
62 require('./libraries/transformations.lib.php3'); // Transformations
63 $cfgRelation = PMA_getRelationsParam();
64 $foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE);
66 $override_total = TRUE;
68 if (!isset($pos)) {
69 $pos = 0;
72 $foreign_limit = 'LIMIT ' . $pos . ', ' . $per_page . ' ';
73 if (isset($foreign_navig) && $foreign_navig == $strShowAll) {
74 unset($foreign_limit);
77 include('./libraries/get_foreign.lib.php3');
80 <form action="browse_foreigners.php3" method="post">
81 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
82 <input type="hidden" name="field" value="<?php echo urlencode($field); ?>" />
84 <table width="100%">
85 <?php
86 if ($cfg['ShowAll'] && ($the_total > $per_page)) {
87 $showall = '<input type="submit" name="foreign_navig" value="' . $strShowAll . '" />';
88 } else {
89 $showall = '';
92 $session_max_rows = $per_page;
93 $pageNow = @floor($pos / $session_max_rows) + 1;
94 $nbTotalPage = @ceil($the_total / $session_max_rows);
96 if ($the_total > $per_page) {
97 $gotopage = '<br />' . $GLOBALS['strPageNumber']
98 . '<select name="goToPage" onChange="goToUrl(this, \'browse_foreigners.php3?field=' . urlencode($field) . '&amp;' . PMA_generate_common_url($db, $table) . '&amp;\');">';
99 if ($nbTotalPage < 200) {
100 $firstPage = 1;
101 $lastPage = $nbTotalPage;
102 } else {
103 $range = 20;
104 $firstPage = ($pageNow - $range < 1 ? 1 : $pageNow - $range);
105 $lastPage = ($pageNow + $range > $nbTotalPage ? $nbTotalPage : $pageNow + $range);
108 for ($i=$firstPage; $i<=$lastPage; $i++){
109 if ($i == $pageNow) {
110 $selected = 'selected="selected"';
111 } else {
112 $selected = "";
114 $gotopage .= ' <option ' . $selected . ' value="' . (($i - 1) * $session_max_rows) . '">' . $i . '</option>' . "\n";
116 } else {
117 $gotopage = '';
120 $header = ' <tr>
121 <th align="left" nowrap="nowrap">' . $strKey . '</th>
122 <th>' . $strDescription . '</th>
123 <td align="center" width="20%" valign="top">
124 ' . $showall . '
125 ' . $gotopage . '
126 </td>
127 <th>' . $strDescription . '</th>
128 <th align="left" nowrap="nowrap">' . $strKey . '</th>
129 </tr>';
131 echo $header;
133 if (isset($disp) && $disp) {
134 $count = 0;
135 while ($relrow = @PMA_mysql_fetch_array($disp)) {
136 $count++;
137 $bgcolor = ($count % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
139 $key = $relrow[$foreign_field];
140 if (strlen($relrow[$foreign_display]) <= $cfg['LimitChars']) {
141 $value = (($foreign_display != FALSE) ? htmlspecialchars($relrow[$foreign_display]) : '');
142 $vtitle = '';
143 } else {
144 $vtitle = htmlspecialchars($relrow[$foreign_display]);
145 $value = (($foreign_display != FALSE) ? htmlspecialchars(substr($vtitle, 0, $cfg['LimitChars']) . '...') : '');
148 if ($count > $cfg['RepeatCells']) {
149 echo $header;
150 $count = -1;
153 <tr>
154 <td nowrap="nowrap" bgcolor="<?php echo $bgcolor; ?>"><?php echo ($key == $data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . htmlspecialchars($key) . '</a>' . ($key == $data ? '</b>' : ''); ?></td>
155 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo ($key == $data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . $value . '</a>' . ($key == $data ? '</b>' : ''); ?></td>
156 <td width="20%"><img src="images/spacer.gif" alt="" width="1" height="1"></td>
157 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo ($key == $data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . $value . '</a>' . ($key == $data ? '</b>' : ''); ?></td>
158 <td nowrap="nowrap" bgcolor="<?php echo $bgcolor; ?>"><?php echo ($key == $data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . htmlspecialchars($key) . '</a>' . ($key == $data ? '</b>' : ''); ?></td>
159 </tr>
160 <?php
161 } // end while
164 echo $header;
166 </table>
167 </form>
169 </body>
170 </html>
172 <?php
174 * Close MySql connections
176 if (isset($dbh) && $dbh) {
177 @mysql_close($dbh);
179 if (isset($userlink) && $userlink) {
180 @mysql_close($userlink);
185 * Sends bufferized data
187 if (isset($cfg['OBGzip']) && $cfg['OBGzip']
188 && isset($ob_mode) && $ob_mode) {
189 PMA_outBufferPost($ob_mode);