3 // vim: expandtab sw=4 ts=4 sts=4:
6 * Gets a core script and starts output buffering work
8 if (!defined('PMA_COMMON_LIB_INCLUDED')) {
9 include('./libraries/common.lib.php3');
11 if (!defined('PMA_OB_LIB_INCLUDED')) {
12 include('./libraries/ob.lib.php3');
14 if ($GLOBALS['cfg']['OBGzip']) {
15 $GLOBALS['ob_mode'] = PMA_outBufferModeGet();
16 if ($GLOBALS['ob_mode']) {
17 PMA_outBufferPre($GLOBALS['ob_mode']);
21 // garvin: For re-usability, moved http-headers and stylesheets
22 // to a seperate file. It can now be included by header.inc.php3,
23 // queryframe.php3, querywindow.php3.
25 include('./libraries/header_http.inc.php3');
26 include('./libraries/header_meta_style.inc.php3');
29 if (isset($GLOBALS['db'])) {
30 $title .= str_replace('\'', '\\\'', $GLOBALS['db']);
32 if (isset($GLOBALS['table'])) {
33 $title .= (empty($title) ?
'' : '.') . str_replace('\'', '\\\'', $GLOBALS['table']);
35 if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) {
36 $title .= (empty($title) ?
'phpMyAdmin ' : ' ')
37 . sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ?
str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['verbose'])));
39 $title .= (empty($title) ?
'' : ' - ') . 'phpMyAdmin ' . PMA_VERSION
;
41 <script type
="text/javascript" language
="javascript">
43 // Updates the title of the frameset if possible (ns4 does not allow this)
44 if (typeof(parent
.document
) != 'undefined' && typeof(parent
.document
) != 'unknown'
45 && typeof(parent
.document
.title
) == 'string') {
46 parent
.document
.title
= '<?php echo $title; ?>';
49 // Add some javascript instructions if required
50 if (isset($js_to_run) && $js_to_run == 'functions.js') {
53 // js form validation stuff
54 var errorMsg0
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strFormEmpty
']); ?>';
55 var errorMsg1
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strNotNumber
']); ?>';
56 var errorMsg2
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strNotValidNumber
']); ?>';
57 var noDropDbMsg
= '<?php echo((!$GLOBALS['cfg
']['AllowUserDropDatabase
']) ? str_replace('\'
', '\\\'
', $GLOBALS['strNoDropDatabases
']) : ''); ?>';
58 var confirmMsg
= '<?php echo(($GLOBALS['cfg
']['Confirm
']) ? str_replace('\'
', '\\\'
', $GLOBALS['strDoYouReally
']) : ''); ?>';
61 <script src
="libraries/functions.js" type
="text/javascript" language
="javascript"></script
>
63 } else if (isset($js_to_run) && $js_to_run == 'user_password.js') {
66 // js form validation stuff
67 var jsHostEmpty
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strHostEmpty
']); ?>';
68 var jsUserEmpty
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strUserEmpty
']); ?>';
69 var jsPasswordEmpty
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strPasswordEmpty
']); ?>';
70 var jsPasswordNotSame
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strPasswordNotSame
']); ?>';
73 <script src
="libraries/user_password.js" type
="text/javascript" language
="javascript"></script
>
75 } else if (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
78 // js form validation stuff
79 var jsHostEmpty
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strHostEmpty
']); ?>';
80 var jsUserEmpty
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strUserEmpty
']); ?>';
81 var jsPasswordEmpty
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strPasswordEmpty
']); ?>';
82 var jsPasswordNotSame
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strPasswordNotSame
']); ?>';
85 <script src
="libraries/server_privileges.js" type
="text/javascript" language
="javascript"></script
>
87 } else if (isset($js_to_run) && $js_to_run == 'indexes.js') {
90 // js index validation stuff
91 var errorMsg0
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strFormEmpty
']); ?>';
92 var errorMsg1
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strNotNumber
']); ?>';
93 var errorMsg2
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strNotValidNumber
']); ?>';
96 <script src
="libraries/indexes.js" type
="text/javascript" language
="javascript"></script
>
98 } else if (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
103 <script src
="libraries/tbl_change.js" type
="text/javascript" language
="javascript"></script
>
114 // If query window is wanted and open, update with latest selected db/table.
115 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
119 if ($cfg['QueryFrameDebug']) {
121 document
.writeln("Updating query window. DB: <?php echo (isset($db) ? $db : 'FALSE'); ?>, Table: <?php echo (isset($table) ? $table : 'FALSE'); ?><br>");
122 document
.writeln("Window: " + top
.frames
.queryframe
.querywindow
.location +
"<br>");
127 if (top
.frames
.queryframe
&& top
.frames
.queryframe
.document
&& top
.frames
.queryframe
.document
.queryframeform
) {
128 top
.frames
.queryframe
.document
.queryframeform
.db
.value
= "<?php echo (isset($db) ? htmlspecialchars($db) : ''); ?>";
129 top
.frames
.queryframe
.document
.queryframeform
.table
.value
= "<?php echo (isset($table) ? htmlspecialchars($table) : ''); ?>";
132 function reload_querywindow () {
133 if (top
.frames
.queryframe
&& top
.frames
.queryframe
.querywindow
&& !top
.frames
.queryframe
.querywindow
.closed
&& top
.frames
.queryframe
.querywindow
.location
) {
134 <?php
echo ($cfg['QueryFrameDebug'] ?
'document.writeln("<a href=\'#\' onClick=\'top.frames.queryframe.querywindow.focus(); return false;\'>Query Window</a> can be updated.<br>");' : ''); ?
>
136 top
.frames
.queryframe
.querywindow
.document
.querywindow
.db
.value
= "<?php echo (isset($db) ? htmlspecialchars($db) : '') ?>";
137 top
.frames
.queryframe
.querywindow
.document
.querywindow
.query_history_latest_db
.value
= "<?php echo (isset($db) ? htmlspecialchars($db) : '') ?>";
138 top
.frames
.queryframe
.querywindow
.document
.querywindow
.table
.value
= "<?php echo (isset($table) ? htmlspecialchars($table) : '') ?>";
139 top
.frames
.queryframe
.querywindow
.document
.querywindow
.query_history_latest_table
.value
= "<?php echo (isset($table) ? htmlspecialchars($table) : '') ?>";
141 <?php
echo (isset($sql_query) ?
'top.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = "' . urlencode($sql_query) . '";' : ''); ?
>
143 <?php
echo ($cfg['QueryFrameDebug'] ?
'alert(\'Querywindow submits. Last chance to check variables.\');' : ''); ?
>
144 top
.frames
.queryframe
.querywindow
.document
.querywindow
.submit();
148 function focus_querywindow(sql_query
) {
149 if (top
.frames
.queryframe
&& top
.frames
.queryframe
.querywindow
&& !top
.frames
.queryframe
.querywindow
.closed
&& top
.frames
.queryframe
.querywindow
.location
) {
150 top
.frames
.queryframe
.querywindow
.focus();
152 } else if (top
.frames
.queryframe
) {
153 new_win_url
= 'querywindow.php3?sql_query=' + sql_query +
'&<?php echo PMA_generate_common_url('', ''); ?>&db=<?php echo (isset($db) ? htmlspecialchars($db) : ''); ?>&table=<?php echo (isset($table) ? htmlspecialchars($table) : ''); ?>';
154 top
.frames
.queryframe
.querywindow
=window
.open(new_win_url
, 'js_querywindow','toolbar=0,location=1,directories=0,status=1,menubar=0,scrollbars=yes,resizable=yes,width=<?php echo $cfg['QueryWindowWidth
']; ?>,height=<?php echo $cfg['QueryWindowHeight
']; ?>');
156 if (!top
.frames
.queryframe
.querywindow
.opener
) {
157 top
.frames
.queryframe
.querywindow
.opener
= top
.frames
.queryframe
;
160 // reload_querywindow();
165 reload_querywindow();
177 if ($GLOBALS['cfg']['RightBgImage'] != '') {
178 $bkg_img = ' background="' . $GLOBALS['cfg']['RightBgImage'] . '"';
183 <body bgcolor
="<?php echo $GLOBALS['cfg']['RightBgColor'] . '"' . $bkg_img; ?>>
185 if (!defined('PMA_DISPLAY_HEADING
')) {
186 define('PMA_DISPLAY_HEADING
', 1);
188 if (PMA_DISPLAY_HEADING) {
189 $header_url_qry = '?
' . PMA_generate_common_url();
191 $server_info = (!empty($cfg['Server
']['verbose
'])
192 ? $cfg['Server
']['verbose
']
193 : $server_info = $cfg['Server
']['host
'] . (empty($cfg['Server
']['port
'])
195 : ':' . $cfg['Server
']['port
']
198 if (isset($GLOBALS['db
'])) {
199 echo ' ' . $GLOBALS['strDatabase
'] . ' <i
><a
class="h1" href
="' . $GLOBALS['cfg']['DefaultTabDatabase'] . $header_url_qry . '&db=' . urlencode($GLOBALS['db']) . '">' . htmlspecialchars($GLOBALS['db
']) . '</a
></i
>' . "\n";
200 if (!empty($GLOBALS['table
'])) {
201 echo ' - ' . $GLOBALS['strTable
'] . ' <i
><a
class="h1" href
="' . $GLOBALS['cfg']['DefaultTabTable'] . $header_url_qry . '&db=' . urlencode($GLOBALS['db']) . '&table=' . urlencode($GLOBALS['table']) . '">' . htmlspecialchars($GLOBALS['table
']) . '</a
></i
>' . "\n";
203 echo ' ' . sprintf($GLOBALS['strRunning
'], '<i
><a
class="h1" href
="' . $GLOBALS['cfg']['DefaultTabServer'] . $header_url_qry . '">' . htmlspecialchars($server_info) . '</a
></i
>');
205 echo ' ' . sprintf($GLOBALS['strServer
'], '<i
><a
class="h1" href
="' . $GLOBALS['cfg']['DefaultTabServer'] . $header_url_qry . '">' . htmlspecialchars($server_info) . '</a
></i
>');
207 echo "\n" . '</h1
>' . "\n";
213 * Sets a variable to remember headers have been sent
215 $GLOBALS['is_header_sent
'] = TRUE;