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_once('./libraries/grab_globals.lib.php');
11 * Gets a core script and starts output buffering work
13 require_once('./libraries/common.lib.php');
15 PMA_checkParameters(array('db', 'table', 'field'));
17 require_once('./libraries/ob.lib.php');
19 $ob_mode = PMA_outBufferModeGet();
21 PMA_outBufferPre($ob_mode);
24 require_once('./libraries/header_http.inc.php');
25 $field = urldecode($field);
30 // Gets the font sizes to use
33 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
34 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
35 <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; ?>">
38 <title
>phpMyAdmin
</title
>
39 <meta http
-equiv
="Content-Type" content
="text/html; charset=<?php echo $charset; ?>" />
40 <base
<?php
if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?
> />
41 <link rel
="stylesheet" type
="text/css" href
="./css/phpmyadmin.css.php?lang=<?php echo $lang; ?>&js_frame=right" />
42 <script src
="libraries/functions.js" type
="text/javascript" language
="javascript"></script
>
43 <script type
="text/javascript" language
="javascript">
45 function formupdate(field
, key
) {
46 if (opener
&& opener
.document
&& opener
.document
.insertForm
&& opener
.document
.insertForm
.elements
['field_' + field +
'<?php echo (isset($pk) ? '[multi_edit
][' . $pk . ']' : ''); ?>[]']) {
47 opener
.document
.insertForm
.elements
['field_' + field +
'<?php echo (isset($pk) ? '[multi_edit
][' . $pk . ']' : ''); ?>[]'].value
= key
;
50 alert('<?php echo PMA_jsFormat($strWindowNotFound); ?>');
56 <body bgcolor
="<?php echo $cfg['LeftBgColor']; ?>" style
="margin-left: 5px; margin-top: 5px; margin-right: 5px; margin-bottom: 0px">
59 require_once('./libraries/relation.lib.php'); // foreign keys
60 require_once('./libraries/transformations.lib.php'); // Transformations
61 $cfgRelation = PMA_getRelationsParam();
62 $foreigners = ($cfgRelation['relwork'] ?
PMA_getForeigners($db, $table) : FALSE);
64 $override_total = TRUE;
70 $foreign_limit = 'LIMIT ' . $pos . ', ' . $per_page . ' ';
71 if (isset($foreign_navig) && $foreign_navig == $strShowAll) {
72 unset($foreign_limit);
75 require('./libraries/get_foreign.lib.php');
78 <form action
="browse_foreigners.php" method
="post">
79 <?php
echo PMA_generate_common_hidden_inputs($db, $table); ?
>
80 <input type
="hidden" name
="field" value
="<?php echo urlencode($field); ?>" />
83 $pk_uri = '&pk=' . $pk;
85 <input type
="hidden" name
="pk" value
="<?php echo $pk; ?>" />
94 if ($cfg['ShowAll'] && ($the_total > $per_page)) {
95 $showall = '<input type="submit" name="foreign_navig" value="' . $strShowAll . '" />';
100 $session_max_rows = $per_page;
101 $pageNow = @floor
($pos / $session_max_rows) +
1;
102 $nbTotalPage = @ceil
($the_total / $session_max_rows);
104 if ($the_total > $per_page) {
105 $gotopage = '<br />' . $GLOBALS['strPageNumber']
106 . '<select name="goToPage" onChange="goToUrl(this, \'browse_foreigners.php?field=' . urlencode($field) . '&' . PMA_generate_common_url($db, $table) . $pk_uri . '\');">';
107 if ($nbTotalPage < 200) {
109 $lastPage = $nbTotalPage;
112 $firstPage = ($pageNow - $range < 1 ?
1 : $pageNow - $range);
113 $lastPage = ($pageNow +
$range > $nbTotalPage ?
$nbTotalPage : $pageNow +
$range);
116 for ($i=$firstPage; $i<=$lastPage; $i++
){
117 if ($i == $pageNow) {
118 $selected = 'selected="selected"';
122 $gotopage .= ' <option ' . $selected . ' value="' . (($i - 1) * $session_max_rows) . '">' . $i . '</option>' . "\n";
129 <th align="left" nowrap="nowrap">' . $strKeyname . '</th>
130 <th>' . $strDescription . '</th>
131 <td align="center" width="20%" valign="top">
135 <th>' . $strDescription . '</th>
136 <th align="left" nowrap="nowrap">' . $strKeyname . '</th>
141 if (isset($disp) && $disp) {
143 while ($relrow = @PMA_mysql_fetch_array
($disp)) {
145 $bgcolor = ($count %
2) ?
$cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
147 $key = $relrow[$foreign_field];
148 if (strlen($relrow[$foreign_display]) <= $cfg['LimitChars']) {
149 $value = (($foreign_display != FALSE) ?
htmlspecialchars($relrow[$foreign_display]) : '');
152 $vtitle = htmlspecialchars($relrow[$foreign_display]);
153 $value = (($foreign_display != FALSE) ?
htmlspecialchars(substr($vtitle, 0, $cfg['LimitChars']) . '...') : '');
156 if ($cfg['RepeatCells'] > 0 && $count > $cfg['RepeatCells']) {
160 $key_equals_data = isset($data) && $key == $data;
163 <td nowrap
="nowrap" bgcolor
="<?php echo $bgcolor; ?>"><?php
echo ($key_equals_data ?
'<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ?
': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . htmlspecialchars($key) . '</a>' . ($key_equals_data ?
'</b>' : ''); ?
></td
>
164 <td bgcolor
="<?php echo $bgcolor; ?>"><?php
echo ($key_equals_data ?
'<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ?
': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . $value . '</a>' . ($key_equals_data ?
'</b>' : ''); ?
></td
>
165 <td width
="20%"><img src
="images/spacer.gif" alt
="" width
="1" height
="1"></td
>
166 <td bgcolor
="<?php echo $bgcolor; ?>"><?php
echo ($key_equals_data ?
'<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ?
': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . $value . '</a>' . ($key_equals_data ?
'</b>' : ''); ?
></td
>
167 <td nowrap
="nowrap" bgcolor
="<?php echo $bgcolor; ?>"><?php
echo ($key_equals_data ?
'<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ?
': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . htmlspecialchars($key) . '</a>' . ($key_equals_data ?
'</b>' : ''); ?
></td
>
170 unset($key_equals_data);
184 * Close MySql connections
186 if (isset($dbh) && $dbh) {
189 if (isset($userlink) && $userlink) {
190 @mysql_close
($userlink);
195 * Sends bufferized data
197 if (isset($cfg['OBGzip']) && $cfg['OBGzip']
198 && isset($ob_mode) && $ob_mode) {
199 PMA_outBufferPost($ob_mode);