3 // vim: expandtab sw=4 ts=4 sts=4:
6 * Get the variables sent or posted to this script and displays the header
8 require('./libraries/grab_globals.lib.php3');
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');
21 $ob_mode = PMA_outBufferModeGet();
23 PMA_outBufferPre($ob_mode);
26 include('./libraries/header_http.inc.php3');
27 $field = urldecode($field);
32 // Gets the font sizes to use
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; ?>">
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; ?>&js_frame=right" />
44 <script src
="libraries/functions.js" type
="text/javascript" language
="javascript"></script
>
45 <script type
="text/javascript" language
="javascript">
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
;
52 alert('<?php echo $strWindowNotFound; ?>');
58 <body bgcolor
="<?php echo $cfg['LeftBgColor']; ?>" style
="margin-left: 5px; margin-top: 5px; margin-right: 5px; margin-bottom: 0px">
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;
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); ?>" />
86 if ($cfg['ShowAll'] && ($the_total > $per_page)) {
87 $showall = '<input type="submit" name="foreign_navig" value="' . $strShowAll . '" />';
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) . '&' . PMA_generate_common_url($db, $table) . '&\');">';
99 if ($nbTotalPage < 200) {
101 $lastPage = $nbTotalPage;
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"';
114 $gotopage .= ' <option ' . $selected . ' value="' . (($i - 1) * $session_max_rows) . '">' . $i . '</option>' . "\n";
121 <th align="left" nowrap="nowrap">' . $strKey . '</th>
122 <th>' . $strDescription . '</th>
123 <td align="center" width="20%" valign="top">
127 <th>' . $strDescription . '</th>
128 <th align="left" nowrap="nowrap">' . $strKey . '</th>
133 if (isset($disp) && $disp) {
135 while ($relrow = @PMA_mysql_fetch_array
($disp)) {
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]) : '');
144 $vtitle = htmlspecialchars($relrow[$foreign_display]);
145 $value = (($foreign_display != FALSE) ?
htmlspecialchars(substr($vtitle, 0, $cfg['LimitChars']) . '...') : '');
148 if ($count > $cfg['RepeatCells']) {
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
>
174 * Close MySql connections
176 if (isset($dbh) && $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);