Merge branch 'master' of github.com:phpmyadmin/phpmyadmin
This commit is contained in:
commit
15a436de74
@ -55,6 +55,7 @@ VerboseMultiSubmit, ReplaceHelpImg
|
||||
- bug #3531585 [interface] Broken password validation in copy user form
|
||||
- bug #3531586 [unterface] Add user form prints JSON when user presses enter
|
||||
- bug #3534121 [config] duplicate line in config.sample.inc.php
|
||||
- bug #3534311 [interface] Grid editing incorrectly parses ENUM/SET values
|
||||
|
||||
3.5.1.0 (2012-05-03)
|
||||
- bug #3510784 [edit] Limit clause ignored when sort order is remembered
|
||||
|
||||
@ -2700,9 +2700,8 @@ setfacl -d -m "g:www-data:rwx" tmp
|
||||
|
||||
<p> This seems to be a PWS bug. Filippo Simoncini found a workaround (at this
|
||||
time there is no better fix): remove or comment the <code>DOCTYPE</code>
|
||||
declarations (2 lines) from the scripts <em>libraries/header.inc.php</em>,
|
||||
<em>libraries/header_printview.inc.php</em>, <em>index.php</em>,
|
||||
<em>navigation.php</em> and <em>libraries/common.lib.php</em>.</p>
|
||||
declarations (2 lines) from the scripts <em>libraries/Header.class.php</em>
|
||||
and <em>index.php</em>.</p>
|
||||
|
||||
<h4 id="faq1_7">
|
||||
<a href="#faq1_7">1.7 How can I GZip or Bzip a dump or a
|
||||
|
||||
@ -6,24 +6,23 @@
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets a core script and starts output buffering work
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/transformations.lib.php';
|
||||
|
||||
$field = $_REQUEST['field'];
|
||||
|
||||
PMA_checkParameters(array('db', 'table', 'field'));
|
||||
|
||||
require_once 'libraries/ob.lib.php';
|
||||
PMA_outBufferPre();
|
||||
|
||||
require_once 'libraries/header_http.inc.php';
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->getFooter()->setMinimal();
|
||||
$header = $response->getHeader();
|
||||
$header->disableMenu();
|
||||
$header->setBodyId('body_browse_foreigners');
|
||||
|
||||
/**
|
||||
* Displays the frame
|
||||
*/
|
||||
require_once 'libraries/transformations.lib.php'; // Transformations
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : false);
|
||||
|
||||
@ -79,93 +78,79 @@ if (is_array($foreignData['disp_row'])) {
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
$current_language = $available_languages[$lang][1];
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="<?php echo $current_language; ?>" dir="<?php echo $text_dir; ?>">
|
||||
|
||||
<head>
|
||||
<title>phpMyAdmin</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
|
||||
<?php
|
||||
// includes everything asked for by libraries/common.inc.php
|
||||
require_once 'libraries/header_scripts.inc.php';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
self.focus();
|
||||
function formupdate(fieldmd5, key) {
|
||||
var $inline = window.opener.jQuery('.browse_foreign_clicked');
|
||||
if ($inline.length != 0) {
|
||||
$inline.removeClass('browse_foreign_clicked')
|
||||
// for grid editing,
|
||||
// puts new value in the previous element which is
|
||||
// a span with class curr_value
|
||||
.prev('.curr_value').text(key);
|
||||
// for zoom-search editing, puts new value in the previous
|
||||
// element which is an input field
|
||||
$inline.prev('input[type=text]').val(key);
|
||||
|
||||
|
||||
if (isset($rownumber)) {
|
||||
$element_name = " var element_name = field + '[multi_edit]["
|
||||
. htmlspecialchars($rownumber) . "][' + fieldmd5 + ']';\n"
|
||||
. " var null_name = field_null + '[multi_edit]["
|
||||
. htmlspecialchars($rownumber) . "][' + fieldmd5 + ']';\n";
|
||||
} else {
|
||||
$element_name = "var element_name = field + '[]'";
|
||||
}
|
||||
$error = PMA_jsFormat(
|
||||
__(
|
||||
'The target browser window could not be updated. '
|
||||
. 'Maybe you have closed the parent window, or '
|
||||
. 'your browser\'s security settings are '
|
||||
. 'configured to block cross-window updates.'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if (! isset($fieldkey) || ! is_numeric($fieldkey)) {
|
||||
$fieldkey = 0;
|
||||
}
|
||||
|
||||
$code = <<<EOC
|
||||
self.focus();
|
||||
function formupdate(fieldmd5, key) {
|
||||
var \$inline = window.opener.jQuery('.browse_foreign_clicked');
|
||||
if (\$inline.length != 0) {
|
||||
\$inline.removeClass('browse_foreign_clicked')
|
||||
// for grid editing,
|
||||
// puts new value in the previous element which is
|
||||
// a span with class curr_value
|
||||
.prev('.curr_value').text(key);
|
||||
// for zoom-search editing, puts new value in the previous
|
||||
// element which is an input field
|
||||
\$inline.prev('input[type=text]').val(key);
|
||||
self.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (opener && opener.document && opener.document.insertForm) {
|
||||
var field = 'fields';
|
||||
var field_null = 'fields_null';
|
||||
|
||||
$element_name
|
||||
|
||||
var element_name_alt = field + '[$fieldkey]';
|
||||
|
||||
if (opener.document.insertForm.elements[element_name]) {
|
||||
// Edit/Insert form
|
||||
opener.document.insertForm.elements[element_name].value = key;
|
||||
if (opener.document.insertForm.elements[null_name]) {
|
||||
opener.document.insertForm.elements[null_name].checked = false;
|
||||
}
|
||||
self.close();
|
||||
return false;
|
||||
} else if (opener.document.insertForm.elements[element_name_alt]) {
|
||||
// Search form
|
||||
opener.document.insertForm.elements[element_name_alt].value = key;
|
||||
self.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (opener && opener.document && opener.document.insertForm) {
|
||||
var field = 'fields';
|
||||
var field_null = 'fields_null';
|
||||
|
||||
<?php
|
||||
if (isset($rownumber)) {
|
||||
?>
|
||||
var element_name = field + '[multi_edit][<?php echo htmlspecialchars($rownumber); ?>][' + fieldmd5 + ']';
|
||||
var null_name = field_null + '[multi_edit][<?php echo htmlspecialchars($rownumber); ?>][' + fieldmd5 + ']';
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
var element_name = field + '[]';
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (isset($fieldkey) && is_numeric($fieldkey)) {
|
||||
?>
|
||||
var element_name_alt = field + '[<?php echo $fieldkey; ?>]';
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
var element_name_alt = field + '[0]';
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
if (opener.document.insertForm.elements[element_name]) {
|
||||
// Edit/Insert form
|
||||
opener.document.insertForm.elements[element_name].value = key;
|
||||
if (opener.document.insertForm.elements[null_name]) {
|
||||
opener.document.insertForm.elements[null_name].checked = false;
|
||||
}
|
||||
self.close();
|
||||
return false;
|
||||
} else if (opener.document.insertForm.elements[element_name_alt]) {
|
||||
// Search form
|
||||
opener.document.insertForm.elements[element_name_alt].value = key;
|
||||
self.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
alert('<?php echo PMA_jsFormat(__('The target browser window could not be updated. Maybe you have closed the parent window, or your browser\'s security settings are configured to block cross-window updates.')); ?>');
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body id="body_browse_foreigners">
|
||||
alert('$error');
|
||||
}
|
||||
EOC;
|
||||
|
||||
$header->getScripts()->addCode($code);
|
||||
|
||||
?>
|
||||
<form action="browse_foreigners.php" method="post">
|
||||
<fieldset>
|
||||
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
||||
@ -337,6 +322,3 @@ if (is_array($foreignData['disp_row'])) {
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
19
chk_rel.php
19
chk_rel.php
@ -6,21 +6,10 @@
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/header.inc.php';
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addHTML(
|
||||
PMA_getRelationsParamDiagnostic(PMA_getRelationsParam())
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Gets the relation settings
|
||||
*/
|
||||
$cfgRelation = PMA_getRelationsParam(true);
|
||||
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
|
||||
require_once 'libraries/mysql_charsets.lib.php';
|
||||
if (! PMA_DRIZZLE) {
|
||||
@ -62,14 +61,15 @@ if (! $result) {
|
||||
$GLOBALS['table'] = '';
|
||||
|
||||
/**
|
||||
* If in an Ajax request, just display the message with {@link PMA_ajaxResponse}
|
||||
* If in an Ajax request, just display the message with {@link PMA_Response}
|
||||
*/
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
PMA_ajaxResponse($message, false);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess(false);
|
||||
$response->addJSON('message', $message);
|
||||
} else {
|
||||
include_once 'main.php';
|
||||
}
|
||||
|
||||
include_once 'libraries/header.inc.php';
|
||||
include_once 'main.php';
|
||||
} else {
|
||||
$message = PMA_Message::success(__('Database %1$s has been created.'));
|
||||
$message->addParam($new_db);
|
||||
@ -79,14 +79,6 @@ if (! $result) {
|
||||
* If in an Ajax request, build the output and send it
|
||||
*/
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
|
||||
/**
|
||||
* String containing the SQL Query formatted in pretty HTML
|
||||
* @global array $GLOBALS['extra_data']
|
||||
* @name $extra_data
|
||||
*/
|
||||
$extra_data['sql_query'] = PMA_getMessage(null, $sql_query, 'success');
|
||||
|
||||
//Construct the html for the new database, so that it can be appended to
|
||||
// the list of databases on server_databases.php
|
||||
|
||||
@ -140,12 +132,12 @@ if (! $result) {
|
||||
|
||||
$new_db_string .= '</tr>';
|
||||
|
||||
$extra_data['new_db_string'] = $new_db_string;
|
||||
|
||||
PMA_ajaxResponse($message, true, $extra_data);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON('message', $message);
|
||||
$response->addJSON('new_db_string', $new_db_string);
|
||||
$response->addJSON('sql_query', PMA_getMessage(null, $sql_query, 'success'));
|
||||
} else {
|
||||
include_once '' . $cfg['DefaultTabDatabase'];
|
||||
}
|
||||
|
||||
include_once 'libraries/header.inc.php';
|
||||
include_once '' . $cfg['DefaultTabDatabase'];
|
||||
}
|
||||
?>
|
||||
|
||||
@ -283,5 +283,4 @@ foreach ($tables as $table) {
|
||||
*/
|
||||
PMA_printButton();
|
||||
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
@ -15,9 +15,12 @@ require_once 'libraries/common.lib.php';
|
||||
/**
|
||||
* Include JavaScript libraries
|
||||
*/
|
||||
$GLOBALS['js_include'][] = 'jquery/timepicker.js';
|
||||
$GLOBALS['js_include'][] = 'rte/common.js';
|
||||
$GLOBALS['js_include'][] = 'rte/events.js';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('jquery/timepicker.js');
|
||||
$scripts->addFile('rte/common.js');
|
||||
$scripts->addFile('rte/events.js');
|
||||
|
||||
/**
|
||||
* Include all other files
|
||||
|
||||
@ -11,7 +11,10 @@
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
$GLOBALS['js_include'][] = 'export.js';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('export.js');
|
||||
|
||||
// $sub_part is also used in db_info.inc.php to see if we are coming from
|
||||
// db_export.php, in which case we don't obey $cfg['MaxTableList']
|
||||
@ -28,7 +31,6 @@ $export_page_title = __('View dump (schema) of database');
|
||||
// exit if no tables in db found
|
||||
if ($num_tables < 1) {
|
||||
PMA_Message::error(__('No tables found in database.'))->display();
|
||||
include 'libraries/footer.inc.php';
|
||||
exit;
|
||||
} // end if
|
||||
|
||||
@ -81,8 +83,4 @@ $multi_values .= '</select></div>';
|
||||
$export_type = 'database';
|
||||
require_once 'libraries/display_export.lib.php';
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
@ -10,7 +10,10 @@
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
$GLOBALS['js_include'][] = 'import.js';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('import.js');
|
||||
|
||||
/**
|
||||
* Gets tables informations and displays top links
|
||||
@ -21,9 +24,5 @@ require 'libraries/db_info.inc.php';
|
||||
$import_type = 'database';
|
||||
require 'libraries/display_import.lib.php';
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
|
||||
@ -19,7 +19,10 @@ require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/mysql_charsets.lib.php';
|
||||
|
||||
// add a javascript file for jQuery functions to handle Ajax actions
|
||||
$GLOBALS['js_include'][] = 'db_operations.js';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('db_operations.js');
|
||||
|
||||
/**
|
||||
* Sets globals from $_REQUEST (we're using GET on ajax, POST otherwise)
|
||||
@ -337,13 +340,16 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
|
||||
|
||||
/**
|
||||
* Database has been successfully renamed/moved. If in an Ajax request,
|
||||
* generate the output with {@link PMA_ajaxResponse} and exit
|
||||
* generate the output with {@link PMA_Response} and exit
|
||||
*/
|
||||
if ( $GLOBALS['is_ajax_request'] == true) {
|
||||
$extra_data['newname'] = $newname;
|
||||
$extra_data['sql_query'] = PMA_getMessage(null, $sql_query);
|
||||
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
|
||||
};
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess($message->isSuccess());
|
||||
$response->addJSON('message', $message);
|
||||
$response->addJSON('newname', $newname);
|
||||
$response->addJSON('sql_query', PMA_getMessage(null, $sql_query));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -633,8 +639,4 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
|
||||
echo __('Edit or export relational schema') . '</a></fieldset></div>';
|
||||
} // end if
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
@ -10,10 +10,9 @@
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
/**
|
||||
* Gets the variables sent or posted to this script, then displays headers
|
||||
*/
|
||||
require_once 'libraries/header_printview.inc.php';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$header->enablePrintView();
|
||||
|
||||
PMA_checkParameters(array('db'));
|
||||
|
||||
@ -248,6 +247,4 @@ if ($num_tables == 0) {
|
||||
PMA_printButton();
|
||||
|
||||
echo "<div id='PMA_disable_floating_menubar'></div>\n";
|
||||
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
@ -102,7 +102,6 @@ $tbl_result = PMA_DBI_query(
|
||||
$tbl_result_cnt = PMA_DBI_num_rows($tbl_result);
|
||||
if (0 == $tbl_result_cnt) {
|
||||
PMA_Message::error(__('No tables found in database.'))->display();
|
||||
include 'libraries/footer.inc.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -949,9 +948,3 @@ if (! empty($qry_orderby)) {
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
@ -16,9 +16,12 @@ require_once 'libraries/mysql_charsets.lib.php';
|
||||
/**
|
||||
* Include JavaScript libraries
|
||||
*/
|
||||
$GLOBALS['js_include'][] = 'jquery/timepicker.js';
|
||||
$GLOBALS['js_include'][] = 'rte/common.js';
|
||||
$GLOBALS['js_include'][] = 'rte/routines.js';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('jquery/timepicker.js');
|
||||
$scripts->addFile('rte/common.js');
|
||||
$scripts->addFile('rte/routines.js');
|
||||
|
||||
/**
|
||||
* Include all other files
|
||||
|
||||
@ -13,10 +13,13 @@
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
$GLOBALS['js_include'][] = 'db_search.js';
|
||||
$GLOBALS['js_include'][] = 'sql.js';
|
||||
$GLOBALS['js_include'][] = 'makegrid.js';
|
||||
$GLOBALS['js_include'][] = 'jquery/timepicker.js';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('db_search.js');
|
||||
$scripts->addFile('sql.js');
|
||||
$scripts->addFile('makegrid.js');
|
||||
$scripts->addFile('jquery/timepicker.js');
|
||||
|
||||
/**
|
||||
* Gets some core libraries and send headers
|
||||
@ -368,9 +371,3 @@ $alter_select
|
||||
<!-- toggle query box link-->
|
||||
<a id="togglequerybox"></a>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
13
db_sql.php
13
db_sql.php
@ -13,9 +13,12 @@ require_once 'libraries/common.inc.php';
|
||||
/**
|
||||
* Runs common work
|
||||
*/
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'makegrid.js';
|
||||
$GLOBALS['js_include'][] = 'sql.js';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('functions.js');
|
||||
$scripts->addFile('makegrid.js');
|
||||
$scripts->addFile('sql.js');
|
||||
|
||||
require 'libraries/db_common.inc.php';
|
||||
require_once 'libraries/sql_query_form.lib.php';
|
||||
@ -59,8 +62,4 @@ PMA_sqlQueryForm(
|
||||
isset($_REQUEST['delimiter']) ? htmlspecialchars($_REQUEST['delimiter']) : ';'
|
||||
);
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
@ -10,9 +10,12 @@
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
$GLOBALS['js_include'][] = 'db_structure.js';
|
||||
$GLOBALS['js_include'][] = 'tbl_change.js';
|
||||
$GLOBALS['js_include'][] = 'jquery/timepicker.js';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('db_structure.js');
|
||||
$scripts->addFile('tbl_change.js');
|
||||
$scripts->addFile('jquery/timepicker.js');
|
||||
|
||||
/**
|
||||
* Sets globals from $_POST
|
||||
@ -86,11 +89,6 @@ if ($num_tables == 0) {
|
||||
if (empty($db_is_information_schema)) {
|
||||
include 'libraries/display_create_table.lib.php';
|
||||
} // end if (Create Table dialog)
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
include_once 'libraries/footer.inc.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -756,8 +754,4 @@ if (empty($db_is_information_schema)) {
|
||||
include 'libraries/display_create_table.lib.php';
|
||||
} // end if (Create Table dialog)
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
@ -63,5 +63,6 @@ foreach ($tables_full as $key => $table) {
|
||||
}
|
||||
}
|
||||
|
||||
PMA_ajaxResponse('', true, array('tables' => $tables_response));
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON('tables', $tables_response);
|
||||
?>
|
||||
|
||||
@ -10,15 +10,18 @@
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
//Get some js files needed for Ajax requests
|
||||
$GLOBALS['js_include'][] = 'db_structure.js';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('db_structure.js');
|
||||
|
||||
/**
|
||||
* If we are not in an Ajax request, then do the common work and show the links etc.
|
||||
*/
|
||||
if ($GLOBALS['is_ajax_request'] != true) {
|
||||
include 'libraries/db_common.inc.php';
|
||||
$url_query .= '&goto=tbl_tracking.php&back=db_tracking.php';
|
||||
}
|
||||
$url_query .= '&goto=tbl_tracking.php&back=db_tracking.php';
|
||||
|
||||
// Get the database structure
|
||||
$sub_part = '_structure';
|
||||
@ -31,11 +34,12 @@ if (isset($_REQUEST['delete_tracking']) && isset($_REQUEST['table'])) {
|
||||
|
||||
/**
|
||||
* If in an Ajax request, generate the success message and use
|
||||
* {@link PMA_ajaxResponse()} to send the output
|
||||
* {@link PMA_Response()} to send the output
|
||||
*/
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
$message = PMA_Message::success();
|
||||
PMA_ajaxResponse($message, true);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON('message', PMA_Message::success());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,9 +53,6 @@ if ($num_tables == 0 && count($data['ddlog']) == 0) {
|
||||
if (empty($db_is_information_schema)) {
|
||||
include 'libraries/display_create_table.lib.php';
|
||||
}
|
||||
|
||||
// Display the footer
|
||||
include 'libraries/footer.inc.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -228,8 +229,4 @@ if (count($data['ddlog']) > 0) {
|
||||
echo PMA_getMessage(__('Database Log'), $log);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
@ -10,13 +10,15 @@
|
||||
* Include required files
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/common.lib.php';
|
||||
|
||||
/**
|
||||
* Include JavaScript libraries
|
||||
*/
|
||||
$GLOBALS['js_include'][] = 'rte/common.js';
|
||||
$GLOBALS['js_include'][] = 'rte/triggers.js';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('rte/common.js');
|
||||
$scripts->addFile('rte/triggers.js');
|
||||
|
||||
/**
|
||||
* Include all other files
|
||||
|
||||
10
export.php
10
export.php
@ -88,7 +88,6 @@ if ($_REQUEST['output_format'] == 'astext') {
|
||||
// Does export require to be into file?
|
||||
if (isset($export_list[$type]['force_file']) && ! $asfile) {
|
||||
$message = PMA_Message::error(__('Selected export type has to be saved in file!'));
|
||||
include_once 'libraries/header.inc.php';
|
||||
if ($export_type == 'server') {
|
||||
$active_page = 'server_export.php';
|
||||
include 'server_export.php';
|
||||
@ -369,7 +368,6 @@ if ($save_on_server) {
|
||||
}
|
||||
}
|
||||
if (isset($message)) {
|
||||
include_once 'libraries/header.inc.php';
|
||||
if ($export_type == 'server') {
|
||||
$active_page = 'server_export.php';
|
||||
include 'server_export.php';
|
||||
@ -403,14 +401,12 @@ if (! $save_on_server) {
|
||||
$num_tables = count($tables);
|
||||
if ($num_tables == 0) {
|
||||
$message = PMA_Message::error(__('No tables found in database.'));
|
||||
include_once 'libraries/header.inc.php';
|
||||
$active_page = 'db_export.php';
|
||||
include 'db_export.php';
|
||||
exit();
|
||||
}
|
||||
}
|
||||
$backup_cfgServer = $cfg['Server'];
|
||||
include_once 'libraries/header.inc.php';
|
||||
$cfg['Server'] = $backup_cfgServer;
|
||||
unset($backup_cfgServer);
|
||||
echo "\n" . '<div style="text-align: ' . $cell_align_left . '">' . "\n";
|
||||
@ -720,7 +716,6 @@ do {
|
||||
// End of fake loop
|
||||
|
||||
if ($save_on_server && isset($message)) {
|
||||
include_once 'libraries/header.inc.php';
|
||||
if ($export_type == 'server') {
|
||||
$active_page = 'server_export.php';
|
||||
include 'server_export.php';
|
||||
@ -768,7 +763,7 @@ if (! empty($asfile)) {
|
||||
}
|
||||
}
|
||||
|
||||
/* If ve saved on server, we have to close file now */
|
||||
/* If we saved on server, we have to close file now */
|
||||
if ($save_on_server) {
|
||||
$write_result = @fwrite($file_handle, $dump_buffer);
|
||||
fclose($file_handle);
|
||||
@ -788,7 +783,6 @@ if (! empty($asfile)) {
|
||||
);
|
||||
}
|
||||
|
||||
include_once 'libraries/header.inc.php';
|
||||
if ($export_type == 'server') {
|
||||
$active_page = 'server_export.php';
|
||||
include_once 'server_export.php';
|
||||
@ -801,6 +795,7 @@ if (! empty($asfile)) {
|
||||
}
|
||||
exit();
|
||||
} else {
|
||||
PMA_Response::getInstance()->disable();
|
||||
echo $dump_buffer;
|
||||
}
|
||||
} else {
|
||||
@ -838,6 +833,5 @@ if (! empty($asfile)) {
|
||||
//]]>
|
||||
</script>
|
||||
<?php
|
||||
include 'libraries/footer.inc.php';
|
||||
} // end if
|
||||
?>
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
require_once 'libraries/common.inc.php';
|
||||
if (! isset($_REQUEST['get_gis_editor']) && ! isset($_REQUEST['generate'])) {
|
||||
include_once 'libraries/header_http.inc.php';
|
||||
include_once 'libraries/header_meta_style.inc.php';
|
||||
}
|
||||
require_once 'libraries/gis/pma_gis_factory.php';
|
||||
require_once 'libraries/gis_visualization.lib.php';
|
||||
|
||||
@ -66,18 +62,12 @@ if (isset($_REQUEST['generate']) && $_REQUEST['generate'] == true) {
|
||||
'visualization' => $visualization,
|
||||
'openLayers' => $open_layers,
|
||||
);
|
||||
PMA_ajaxResponse(null, true, $extra_data);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON($extra_data);
|
||||
exit;
|
||||
}
|
||||
|
||||
// If the call is to get the whole content, start buffering, skipping </head> and <body> tags
|
||||
if (isset($_REQUEST['get_gis_editor']) && $_REQUEST['get_gis_editor'] == true) {
|
||||
ob_start();
|
||||
} else {
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
}
|
||||
ob_start();
|
||||
?>
|
||||
<form id="gis_data_editor_form" action="gis_data_editor.php" method="post">
|
||||
<input type="hidden" id="pmaThemeImage" value="<?php echo($GLOBALS['pmaThemeImage']); ?>" />
|
||||
@ -323,18 +313,7 @@ if (isset($_REQUEST['get_gis_editor']) && $_REQUEST['get_gis_editor'] == true) {
|
||||
</form>
|
||||
<?php
|
||||
|
||||
// If the call is to get the whole content, get the content in the buffer and make and AJAX response.
|
||||
if (isset($_REQUEST['get_gis_editor']) && $_REQUEST['get_gis_editor'] == true) {
|
||||
$extra_data['gis_editor'] = ob_get_contents();
|
||||
PMA_ajaxResponse(null, ob_end_clean(), $extra_data);
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
PMA_Response::getInstance()->addJSON('gis_editor', ob_get_contents());
|
||||
ob_end_clean();
|
||||
|
||||
?>
|
||||
|
||||
22
import.php
22
import.php
@ -83,7 +83,6 @@ if (! empty($sql_query)) {
|
||||
// upload limit has been reached, let's assume the second possibility.
|
||||
;
|
||||
if ($_POST == array() && $_GET == array()) {
|
||||
include_once 'libraries/header.inc.php';
|
||||
$message = PMA_Message::error(__('You probably tried to upload too large file. Please refer to %sdocumentation%s for ways to workaround this limit.'));
|
||||
$message->addParam('[a@./Documentation.html#faq1_16@_blank]');
|
||||
$message->addParam('[/a]');
|
||||
@ -93,7 +92,7 @@ if ($_POST == array() && $_GET == array()) {
|
||||
$_SESSION['Import_message']['go_back_url'] = $goto;
|
||||
|
||||
$message->display();
|
||||
include 'libraries/footer.inc.php';
|
||||
exit; // the footer is displayed automatically
|
||||
}
|
||||
|
||||
/**
|
||||
@ -222,10 +221,13 @@ if (! empty($id_bookmark)) {
|
||||
case 1: // bookmarked query that have to be displayed
|
||||
$import_text = PMA_Bookmark_get($db, $id_bookmark);
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
$extra_data['sql_query'] = $import_text;
|
||||
$extra_data['action_bookmark'] = $action_bookmark;
|
||||
$message = PMA_Message::success(__('Showing bookmark'));
|
||||
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess($message->isSuccess());
|
||||
$response->addJSON('message', $message);
|
||||
$response->addJSON('sql_query', $import_text);
|
||||
$response->addJSON('action_bookmark', $action_bookmark);
|
||||
exit;
|
||||
} else {
|
||||
$run_query = false;
|
||||
}
|
||||
@ -235,9 +237,12 @@ if (! empty($id_bookmark)) {
|
||||
PMA_Bookmark_delete($db, $id_bookmark);
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
$message = PMA_Message::success(__('The bookmark has been deleted.'));
|
||||
$extra_data['action_bookmark'] = $action_bookmark;
|
||||
$extra_data['id_bookmark'] = $id_bookmark;
|
||||
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess($message->isSuccess());
|
||||
$response->addJSON('message', $message);
|
||||
$response->addJSON('action_bookmark', $action_bookmark);
|
||||
$response->addJSON('id_bookmark', $id_bookmark);
|
||||
exit;
|
||||
} else {
|
||||
$run_query = false;
|
||||
$error = true; // this is kind of hack to skip processing the query
|
||||
@ -523,5 +528,4 @@ if ($go_sql) {
|
||||
$active_page = $goto;
|
||||
include '' . $goto;
|
||||
}
|
||||
exit();
|
||||
?>
|
||||
|
||||
14
index.php
14
index.php
@ -72,7 +72,11 @@ $lang_iso_code = $GLOBALS['available_languages'][$GLOBALS['lang']][1];
|
||||
|
||||
|
||||
// start output
|
||||
require 'libraries/header_http.inc.php';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$header->sendHttpHeaders();
|
||||
$response->disable();
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
||||
@ -135,9 +139,11 @@ require 'libraries/header_http.inc.php';
|
||||
// ]]>
|
||||
</script>
|
||||
<?php
|
||||
echo PMA_includeJS('jquery/jquery-1.6.2.js');
|
||||
echo PMA_includeJS('update-location.js');
|
||||
echo PMA_includeJS('common.js');
|
||||
$scripts = new PMA_Scripts();
|
||||
$scripts->addFile('jquery/jquery-1.6.2.js');
|
||||
$scripts->addFile('update-location.js');
|
||||
$scripts->addFile('common.js');
|
||||
echo $scripts->getDisplay();
|
||||
?>
|
||||
</head>
|
||||
<frameset cols="<?php
|
||||
|
||||
@ -159,7 +159,7 @@ function markDbTable(db, table)
|
||||
}
|
||||
|
||||
/**
|
||||
* sets current selected server, table and db (called from libraries/footer.inc.php)
|
||||
* sets current selected server, table and db (called from the footer)
|
||||
*/
|
||||
function setAll( new_lang, new_collation_connection, new_server, new_db, new_table, new_token )
|
||||
{
|
||||
|
||||
@ -6,9 +6,6 @@
|
||||
// default values for fields
|
||||
var defaultValues = {};
|
||||
|
||||
// language strings
|
||||
var PMA_messages = {};
|
||||
|
||||
/**
|
||||
* Returns field type
|
||||
*
|
||||
@ -693,6 +690,7 @@ function savePrefsToLocalStorage(form)
|
||||
cache: false,
|
||||
type: 'POST',
|
||||
data: {
|
||||
ajax_request: true,
|
||||
token: form.find('input[name=token]').val(),
|
||||
submit_get_json: true
|
||||
},
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Conditionally called from libraries/header_scripts.inc.php
|
||||
* if third-party framing is not allowed
|
||||
* Conditionally included if third-party framing is not allowed
|
||||
*
|
||||
*/
|
||||
|
||||
@ -13,8 +12,7 @@ try {
|
||||
alert("Redirecting...");
|
||||
top.location.replace(self.document.URL.substring(0, self.document.URL.lastIndexOf("/")+1));
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
} catch(e) {
|
||||
alert("Redirecting... (error: " + e);
|
||||
top.location.replace(self.document.URL.substring(0, self.document.URL.lastIndexOf("/")+1));
|
||||
}
|
||||
|
||||
@ -69,8 +69,7 @@ $(function() {
|
||||
$("<span>" + PMA_messages['strReloadDatabase'] + "?</span>").dialog({
|
||||
buttons: button_options
|
||||
}) //end dialog options
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}) // end $.get()
|
||||
@ -106,8 +105,7 @@ $(function() {
|
||||
// not refresh it
|
||||
window.parent.refreshNavigation(true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$('#floating_menubar').after(data.error);
|
||||
}
|
||||
|
||||
@ -131,8 +129,7 @@ $(function() {
|
||||
$.get($form.attr('action'), $form.serialize() + "&submitcollation=" + $form.find("input[name=submitcollation]").val(), function(data) {
|
||||
if(data.success == true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}) // end $.get()
|
||||
|
||||
@ -193,10 +193,10 @@ $(function() {
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
|
||||
var url = $form.serialize() + "&submit_search=" + $("#buttonGo").val();
|
||||
$.post($form.attr('action'), url, function(response) {
|
||||
if (typeof response == 'string') {
|
||||
$.post($form.attr('action'), url, function(data) {
|
||||
if (data.success == true) {
|
||||
// found results
|
||||
$("#searchresults").html(response);
|
||||
$("#searchresults").html(data.message);
|
||||
|
||||
$('#togglesearchresultlink')
|
||||
// always start with the Show message
|
||||
@ -219,7 +219,7 @@ $(function() {
|
||||
.show();
|
||||
} else {
|
||||
// error message (zero rows)
|
||||
$("#sqlqueryresults").html(response['message']);
|
||||
$("#sqlqueryresults").html(data.error);
|
||||
}
|
||||
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
|
||||
@ -173,7 +173,7 @@ $(function() {
|
||||
}); // end dialog options
|
||||
} else {
|
||||
var $dialog = $div
|
||||
.append(data)
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
title: PMA_messages['strInsertTable'],
|
||||
height: 600,
|
||||
@ -194,7 +194,7 @@ $(function() {
|
||||
$("table.insertRowTable").addClass("ajax");
|
||||
$("#buttonYes").addClass("ajax");
|
||||
$div = $("#insert_table_dialog");
|
||||
PMA_convertFootnotesToTooltips($div);
|
||||
PMA_showHints($div);
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}); // end $.get()
|
||||
|
||||
129
js/functions.js
129
js/functions.js
@ -157,10 +157,9 @@ function PMA_display_git_revision()
|
||||
$.get("main.php?token="
|
||||
+ $("input[type=hidden][name=token]").val()
|
||||
+ "&git_revision=1&ajax_request=true", function (data) {
|
||||
if (data.error != "undefined" && data.error) {
|
||||
return;
|
||||
if (data.success == true) {
|
||||
$(data.message).insertAfter('#li_pma_version');
|
||||
}
|
||||
$(data.message).insertAfter('#li_pma_version');
|
||||
});
|
||||
}
|
||||
|
||||
@ -1612,12 +1611,11 @@ function PMA_createTableDialog( $div, url , target)
|
||||
})// end dialog options
|
||||
//remove the redundant [Back] link in the error message.
|
||||
.find('fieldset').remove();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
var size = getWindowSize();
|
||||
var timeout;
|
||||
$div
|
||||
.append(data)
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
dialogClass: 'create-table',
|
||||
resizable: false,
|
||||
@ -1673,7 +1671,7 @@ function PMA_createTableDialog( $div, url , target)
|
||||
buttons: button_options
|
||||
}); // end dialog options
|
||||
}
|
||||
PMA_convertFootnotesToTooltips($div);
|
||||
PMA_showHints($div);
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}); // end $.get()
|
||||
|
||||
@ -1730,7 +1728,7 @@ function PMA_createChart(passedSettings)
|
||||
thisChart.options.realtime.postData,
|
||||
function(data) {
|
||||
try {
|
||||
curValue = jQuery.parseJSON(data);
|
||||
curValue = jQuery.parseJSON(data.message);
|
||||
} catch (err) {
|
||||
if (thisChart.options.realtime.error) {
|
||||
thisChart.options.realtime.error(err);
|
||||
@ -2335,11 +2333,11 @@ $(function() {
|
||||
$.post($form.attr('action'), $form.serialize() + "&submit_num_fields=" + $(this).val(), function(data) {
|
||||
// if 'create_table_dialog' exists
|
||||
if ($("#create_table_dialog").length > 0) {
|
||||
$("#create_table_dialog").html(data);
|
||||
$("#create_table_dialog").html(data.message);
|
||||
}
|
||||
// if 'create_table_div' exists
|
||||
if ($("#create_table_div").length > 0) {
|
||||
$("#create_table_div").html(data);
|
||||
$("#create_table_div").html(data.message);
|
||||
}
|
||||
PMA_verifyColumnsProperties();
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
@ -2375,7 +2373,7 @@ $(function() {
|
||||
$("<div id='sqlqueryresults'></div>").insertAfter("#floating_menubar");
|
||||
$("#sqlqueryresults").html(data.sql_query);
|
||||
$("#result_query .notice").remove();
|
||||
$("#result_query").prepend((data.message));
|
||||
$("#result_query").prepend(data.message);
|
||||
} else {
|
||||
var $temp_div = $("<div id='temp_div'></div>");
|
||||
$temp_div.html(data.error);
|
||||
@ -2411,7 +2409,7 @@ $(function() {
|
||||
$("<div id='sqlqueryresults'></div>").insertAfter("#floating_menubar");
|
||||
$("#sqlqueryresults").html(data.sql_query);
|
||||
$("#result_query .notice").remove();
|
||||
$("#result_query").prepend((data.message));
|
||||
$("#result_query").prepend(data.message);
|
||||
$("#copyTable").find("select[name='target_db'] option").filterByValue(data.db).prop('selected', true);
|
||||
|
||||
//Refresh navigation frame when the table is coppied
|
||||
@ -2419,10 +2417,7 @@ $(function() {
|
||||
window.parent.frame_navigation.location.reload();
|
||||
}
|
||||
} else {
|
||||
var $temp_div = $("<div id='temp_div'></div>");
|
||||
$temp_div.html(data.error);
|
||||
var $error = $temp_div.find("code").addClass("error");
|
||||
PMA_ajaxShowMessage($error, false);
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}
|
||||
@ -2444,19 +2439,19 @@ $(function() {
|
||||
}
|
||||
//variables which stores the common attributes
|
||||
$.post(href[0], href[1]+"&ajax_request=true", function(data) {
|
||||
if (data.success == undefined) {
|
||||
var $temp_div = $("<div id='temp_div'></div>");
|
||||
$temp_div.html(data);
|
||||
var $success = $temp_div.find("#result_query .success");
|
||||
PMA_ajaxShowMessage($success);
|
||||
$("<div id='sqlqueryresults' class='ajax'></div>").insertAfter("#floating_menubar");
|
||||
$("#sqlqueryresults").html(data);
|
||||
PMA_init_slider();
|
||||
$("#sqlqueryresults").children("fieldset").remove();
|
||||
} else if (data.success == true ) {
|
||||
if (data.success == true && data.sql_query != undefined) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$("<div id='sqlqueryresults' class='ajax'></div>").insertAfter("#floating_menubar");
|
||||
$("#sqlqueryresults").html(data.sql_query);
|
||||
} else if (data.success == true) {
|
||||
var $temp_div = $("<div id='temp_div'></div>");
|
||||
$temp_div.html(data.message);
|
||||
var $success = $temp_div.find("#result_query .success");
|
||||
PMA_ajaxShowMessage($success);
|
||||
$("<div id='sqlqueryresults' class='ajax'></div>").insertAfter("#floating_menubar");
|
||||
$("#sqlqueryresults").html(data.message);
|
||||
PMA_init_slider();
|
||||
$("#sqlqueryresults").children("fieldset").remove();
|
||||
} else {
|
||||
var $temp_div = $("<div id='temp_div'></div>");
|
||||
$temp_div.html(data.error);
|
||||
@ -2535,8 +2530,7 @@ $(function() {
|
||||
if (window.parent && window.parent.frame_navigation) {
|
||||
window.parent.frame_navigation.location.reload();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
@ -2592,16 +2586,11 @@ $(function() {
|
||||
* Attach Ajax event handler on the change password anchor
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$('#change_password_anchor.dialog_active').live('click', function(event) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
});
|
||||
$('#change_password_anchor.ajax').live('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
$(this).removeClass('ajax').addClass('dialog_active');
|
||||
/**
|
||||
* @var button_options Object containing options to be passed to jQueryUI's dialog
|
||||
*/
|
||||
@ -2631,10 +2620,9 @@ $(function() {
|
||||
|
||||
$.post($the_form.attr('action'), $the_form.serialize() + '&change_pw='+ this_value, function(data) {
|
||||
if (data.success == true) {
|
||||
$("#floating_menubar").after(data.sql_query);
|
||||
$("#floating_menubar").after(data.message);
|
||||
$("#change_password_dialog").hide().remove();
|
||||
$("#edit_user_dialog").dialog("close").remove();
|
||||
$('#change_password_anchor.dialog_active').removeClass('dialog_active').addClass('ajax');
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}
|
||||
else {
|
||||
@ -2655,11 +2643,9 @@ $(function() {
|
||||
$(this).remove();
|
||||
},
|
||||
buttons : button_options,
|
||||
beforeClose: function(ev, ui) {
|
||||
$('#change_password_anchor.dialog_active').removeClass('dialog_active').addClass('ajax');
|
||||
}
|
||||
modal: true
|
||||
})
|
||||
.append(data);
|
||||
.append(data.message);
|
||||
// for this dialog, we remove the fieldset wrapping due to double headings
|
||||
$("fieldset#fieldset_change_password")
|
||||
.find("legend").remove().end()
|
||||
@ -2922,10 +2908,6 @@ $(function() {
|
||||
});
|
||||
});
|
||||
|
||||
$(function() {
|
||||
PMA_convertFootnotesToTooltips();
|
||||
});
|
||||
|
||||
/**
|
||||
* Ensures indexes names are valid according to their type and, for a primary
|
||||
* key, lock index name to 'PRIMARY'
|
||||
@ -2961,55 +2943,22 @@ function checkIndexName(form_id)
|
||||
} // end of the 'checkIndexName()' function
|
||||
|
||||
/**
|
||||
* function to convert the footnotes to tooltips
|
||||
* Function to display tooltips that were
|
||||
* generated on the PHP side by PMA_showHint()
|
||||
*
|
||||
* @param jquery-Object $div a div jquery object which specifies the
|
||||
* domain for searching footnootes. If we
|
||||
* ommit this parameter the function searches
|
||||
* the footnotes in the whole body
|
||||
* @param object $div a div jquery object which specifies the
|
||||
* domain for searching for tooltips. If we
|
||||
* omit this parameter the function searches
|
||||
* in the whole body
|
||||
**/
|
||||
function PMA_convertFootnotesToTooltips($div)
|
||||
function PMA_showHints($div)
|
||||
{
|
||||
// Hide the footnotes from the footer (which are displayed for
|
||||
// JavaScript-disabled browsers) since the tooltip is sufficient
|
||||
|
||||
if ($div == undefined || ! $div instanceof jQuery || $div.length == 0) {
|
||||
$div = $("body");
|
||||
}
|
||||
|
||||
$footnotes = $div.find(".footnotes");
|
||||
|
||||
$footnotes.hide();
|
||||
$footnotes.find('span').each(function() {
|
||||
$(this).children("sup").remove();
|
||||
});
|
||||
// The border and padding must be removed otherwise a thin yellow box remains visible
|
||||
$footnotes.css("border", "none");
|
||||
$footnotes.css("padding", "0px");
|
||||
|
||||
// Replace the superscripts with the help icon
|
||||
$div.find("sup.footnotemarker").hide();
|
||||
$div.find("img.footnotemarker").show();
|
||||
|
||||
$div.find("img.footnotemarker").each(function() {
|
||||
var img_class = $(this).attr("class");
|
||||
/** img contains two classes, as example "footnotemarker footnote_1".
|
||||
* We split it by second class and take it for the id of span
|
||||
*/
|
||||
img_class = img_class.split(" ");
|
||||
for (i = 0; i < img_class.length; i++) {
|
||||
if (img_class[i].split("_")[0] == "footnote") {
|
||||
var span_id = img_class[i].split("_")[1];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Now we get the #id of the span with span_id variable. As an example if we
|
||||
* initially get the img class as "footnotemarker footnote_2", now we get
|
||||
* #2 as the span_id. Using that we can find footnote_2 in footnotes.
|
||||
* */
|
||||
var tooltip_text = $footnotes.find("span#footnote_" + span_id).html();
|
||||
$(this).qtip({
|
||||
content: tooltip_text,
|
||||
$div.find('.pma_hint').each(function () {
|
||||
$(this).children('img').qtip({
|
||||
content: $(this).children('span').html(),
|
||||
show: { delay: 0 },
|
||||
hide: { delay: 1000 },
|
||||
style: { background: '#ffffcc' }
|
||||
@ -3017,6 +2966,10 @@ function PMA_convertFootnotesToTooltips($div)
|
||||
});
|
||||
}
|
||||
|
||||
$(function() {
|
||||
PMA_showHints();
|
||||
});
|
||||
|
||||
/**
|
||||
* This function handles the resizing of the content frame
|
||||
* and adjusts the top menu according to the new size of the frame
|
||||
@ -3839,13 +3792,13 @@ $(document).ready(function () {
|
||||
buttonOptions[PMA_messages['strClose']] = function () {
|
||||
$(this).dialog("close");
|
||||
};
|
||||
var $dialog = $('<div/>').attr('id', 'createViewDialog').append(data).dialog({
|
||||
var $dialog = $('<div/>').attr('id', 'createViewDialog').append(data.message).dialog({
|
||||
width: 500,
|
||||
minWidth: 300,
|
||||
maxWidth: 620,
|
||||
modal: true,
|
||||
buttons: buttonOptions,
|
||||
title: $('legend', $(data)).html(),
|
||||
title: $('legend', $(data.message)).html(),
|
||||
close: function () {
|
||||
$(this).remove();
|
||||
}
|
||||
|
||||
@ -142,7 +142,8 @@ function loadGISEditor(value, field, type, input_name, token) {
|
||||
'type' : type,
|
||||
'input_name' : input_name,
|
||||
'get_gis_editor' : true,
|
||||
'token' : token
|
||||
'token' : token,
|
||||
'ajax_request': true
|
||||
}, function(data) {
|
||||
if (data.success == true) {
|
||||
$gis_editor.html(data.gis_editor);
|
||||
@ -190,7 +191,7 @@ function insertDataAndClose() {
|
||||
var $form = $('form#gis_data_editor_form');
|
||||
var input_name = $form.find("input[name='input_name']").val();
|
||||
|
||||
$.post('gis_data_editor.php', $form.serialize() + "&generate=true", function(data) {
|
||||
$.post('gis_data_editor.php', $form.serialize() + "&generate=true&ajax_request=true", function(data) {
|
||||
if(data.success == true) {
|
||||
$("input[name='" + input_name + "']").val(data.result);
|
||||
} else {
|
||||
@ -226,7 +227,7 @@ $(function() {
|
||||
*/
|
||||
$('#gis_editor').find("input[type='text']").live('change', function() {
|
||||
var $form = $('form#gis_data_editor_form');
|
||||
$.post('gis_data_editor.php', $form.serialize() + "&generate=true", function(data) {
|
||||
$.post('gis_data_editor.php', $form.serialize() + "&generate=true&ajax_request=true", function(data) {
|
||||
if(data.success == true) {
|
||||
$('#gis_data_textarea').val(data.result);
|
||||
$('#placeholder').empty().removeClass('hasSVG').html(data.visualization);
|
||||
@ -246,7 +247,7 @@ $(function() {
|
||||
var $gis_editor = $("#gis_editor");
|
||||
var $form = $('form#gis_data_editor_form');
|
||||
|
||||
$.post('gis_data_editor.php', $form.serialize() + "&get_gis_editor=true", function(data) {
|
||||
$.post('gis_data_editor.php', $form.serialize() + "&get_gis_editor=true&ajax_request=true", function(data) {
|
||||
if(data.success == true) {
|
||||
$gis_editor.html(data.gis_editor);
|
||||
initGISEditorVisualization();
|
||||
|
||||
@ -950,8 +950,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$editArea.find('textarea').val($(this).val());
|
||||
});
|
||||
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
|
||||
@ -180,12 +180,14 @@ function fast_filter(value)
|
||||
}
|
||||
fast_filter.ajax_semaphore = true;
|
||||
$.get('db_tables_search.php?db=' + db +'&table=' + lowercase_value, function(data) {
|
||||
if (data.tables) {
|
||||
var tables = data.tables;
|
||||
var l = tables.length;
|
||||
for(var i = 0; i < l; i++) {
|
||||
$('#subel0').append(tables[i].line);
|
||||
}
|
||||
fast_filter.ajax_semaphore = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,8 +59,7 @@ $(function() {
|
||||
window.parent.frame_navigation.location.reload();
|
||||
}
|
||||
$('#tableslistcontainer').load('server_databases.php form#dbStatsForm');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + ": " + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
|
||||
@ -169,22 +169,12 @@ $(function() {
|
||||
} else {
|
||||
$("#usersForm").remove();
|
||||
}
|
||||
var $user_div = $('<div id="userFormDiv"></div>');
|
||||
/*If the JSON string parsed correctly*/
|
||||
if (typeof priv_data.success != 'undefined') {
|
||||
if (priv_data.success == true) {
|
||||
$user_div
|
||||
.html(priv_data.user_form)
|
||||
.insertAfter('#result_query');
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + priv_data.error, false);
|
||||
}
|
||||
if (priv_data.success == true) {
|
||||
$('<div id="userFormDiv"></div>')
|
||||
.html(priv_data.user_form)
|
||||
.insertAfter('#result_query');
|
||||
} else {
|
||||
/*parse the JSON string*/
|
||||
var obj = $.parseJSON(priv_data);
|
||||
$user_div
|
||||
.html(obj.user_form)
|
||||
.insertAfter('#result_query');
|
||||
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + priv_data.error, false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@ -199,7 +189,7 @@ $(function() {
|
||||
|
||||
$.get($(this).attr("href"), {'ajax_request':true}, function(data) {
|
||||
var $div = $('<div id="add_user_dialog"></div>')
|
||||
.prepend(data)
|
||||
.prepend(data.message)
|
||||
.find("#fieldset_add_user_footer").hide() //showing the "Go" and "Create User" buttons together will confuse the user
|
||||
.end()
|
||||
.find("form[name=usersForm]").append('<input type="hidden" name="ajax_request" value="true" />')
|
||||
@ -218,7 +208,7 @@ $(function() {
|
||||
}
|
||||
}); //dialog options end
|
||||
displayPasswordGenerateButton();
|
||||
PMA_convertFootnotesToTooltips($div);
|
||||
PMA_showHints($div);
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
$div.find("input[autofocus]").focus();
|
||||
|
||||
@ -251,8 +241,7 @@ $(function() {
|
||||
$.get($(this).attr("href"), {'ajax_request': true}, function(data) {
|
||||
if(data.success == true) {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); //end $.get()
|
||||
@ -300,8 +289,7 @@ $(function() {
|
||||
.find('tr:even')
|
||||
.removeClass('odd').addClass('even');
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
@ -343,7 +331,7 @@ $(function() {
|
||||
},
|
||||
function(data) {
|
||||
var $div = $('<div id="edit_user_dialog"></div>')
|
||||
.append(data)
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
width: 900,
|
||||
height: 600,
|
||||
@ -354,7 +342,7 @@ $(function() {
|
||||
}); //dialog options end
|
||||
displayPasswordGenerateButton();
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
PMA_convertFootnotesToTooltips($div);
|
||||
PMA_showHints($div);
|
||||
}); // end $.get()
|
||||
});
|
||||
|
||||
@ -436,8 +424,7 @@ $(function() {
|
||||
$("#usersForm")
|
||||
.find('.current_row')
|
||||
.removeClass('current_row');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
@ -562,7 +549,7 @@ $(function() {
|
||||
$("#usersForm").hide("medium").remove();
|
||||
$("#fieldset_add_user").hide("medium").remove();
|
||||
$("#initials_table")
|
||||
.after(data).show("medium")
|
||||
.after(data.message).show("medium")
|
||||
.siblings("h2").not(":first").remove();
|
||||
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
|
||||
@ -220,7 +220,7 @@ $(function() {
|
||||
|
||||
$.get($(this).attr('href'), { ajax_request: 1 }, function(data) {
|
||||
$(that).find('img').hide();
|
||||
initTab(tab, data);
|
||||
initTab(tab, data.message);
|
||||
});
|
||||
|
||||
tabStatus[tab.attr('id')] = 'data';
|
||||
@ -437,7 +437,7 @@ $(function() {
|
||||
if (data != null) {
|
||||
tab.find('.tabInnerContent').html(data);
|
||||
}
|
||||
PMA_convertFootnotesToTooltips();
|
||||
PMA_showHints();
|
||||
break;
|
||||
case 'statustabs_queries':
|
||||
if (data != null) {
|
||||
@ -646,7 +646,7 @@ $(function() {
|
||||
$.get('server_status.php?' + url_query, { ajax_request: true, advisor: true }, function(data) {
|
||||
var $tbody, $tr, str, even = true;
|
||||
|
||||
data = $.parseJSON(data);
|
||||
data = $.parseJSON(data.message);
|
||||
|
||||
$cnt.html('');
|
||||
|
||||
|
||||
@ -621,7 +621,7 @@ $(function() {
|
||||
|
||||
$.get('server_status.php?' + url_query, vars,
|
||||
function(data) {
|
||||
var logVars = $.parseJSON(data),
|
||||
var logVars = $.parseJSON(data.message),
|
||||
icon = PMA_getImage('s_success.png'), msg='', str='';
|
||||
|
||||
if (logVars['general_log'] == 'ON') {
|
||||
@ -1202,7 +1202,7 @@ $(function() {
|
||||
}, function(data) {
|
||||
var chartData;
|
||||
try {
|
||||
chartData = $.parseJSON(data);
|
||||
chartData = $.parseJSON(data.message);
|
||||
} catch(err) {
|
||||
return serverResponseError();
|
||||
}
|
||||
@ -1388,7 +1388,7 @@ $(function() {
|
||||
function(data) {
|
||||
var logData;
|
||||
try {
|
||||
logData = $.parseJSON(data);
|
||||
logData = $.parseJSON(data.message);
|
||||
} catch(err) {
|
||||
return serverResponseError();
|
||||
}
|
||||
@ -1773,7 +1773,7 @@ $(function() {
|
||||
query: codemirror_editor ? codemirror_editor.getValue() : $('#sqlquery').val(),
|
||||
database: db
|
||||
}, function(data) {
|
||||
data = $.parseJSON(data);
|
||||
data = $.parseJSON(data.message);
|
||||
var totalTime = 0;
|
||||
|
||||
if (data.error) {
|
||||
|
||||
@ -174,7 +174,7 @@ function editVariable(link)
|
||||
$cell.html('<span class="oldContent" style="display:none;">' + $cell.html() + '</span>');
|
||||
// put edit field and save/cancel link
|
||||
$cell.prepend('<table class="serverVariableEditTable" border="0"><tr><td></td><td style="width:100%;">' +
|
||||
'<input type="text" id="variableEditArea" value="' + data + '" /></td></tr></table>');
|
||||
'<input type="text" id="variableEditArea" value="' + data.message + '" /></td></tr></table>');
|
||||
$cell.find('table td:first').append(mySaveLink);
|
||||
$cell.find('table td:first').append(' ');
|
||||
$cell.find('table td:first').append(myCancelLink);
|
||||
|
||||
56
js/sql.js
56
js/sql.js
@ -197,6 +197,7 @@ $(function() {
|
||||
//
|
||||
// fade out previous messages, if any
|
||||
$('div.success, div.sqlquery_message').fadeOut();
|
||||
|
||||
// show a message that stays on screen
|
||||
if (typeof data.action_bookmark != 'undefined') {
|
||||
// view only
|
||||
@ -209,7 +210,9 @@ $(function() {
|
||||
if ('2' == data.action_bookmark) {
|
||||
$("#id_bookmark option[value='" + data.id_bookmark + "']").remove();
|
||||
}
|
||||
$('#sqlqueryform').before(data.message);
|
||||
$sqlqueryresults
|
||||
.show()
|
||||
.html(data.message);
|
||||
} else if (typeof data.sql_query != 'undefined') {
|
||||
$('<div class="sqlquery_message"></div>')
|
||||
.html(data.sql_query)
|
||||
@ -217,9 +220,22 @@ $(function() {
|
||||
// unnecessary div that came from data.sql_query
|
||||
$('div.notice').remove();
|
||||
} else {
|
||||
$('#sqlqueryform').before(data.message);
|
||||
$sqlqueryresults
|
||||
.show()
|
||||
.html(data.message);
|
||||
}
|
||||
$sqlqueryresults.show();
|
||||
$sqlqueryresults.show().trigger('makegrid');
|
||||
$('#togglequerybox').show();
|
||||
PMA_init_slider();
|
||||
|
||||
if (typeof data.action_bookmark == 'undefined') {
|
||||
if( $('#sqlqueryform input[name="retain_query_box"]').is(':checked') != true ) {
|
||||
if ($("#togglequerybox").siblings(":visible").length > 0) {
|
||||
$("#togglequerybox").trigger('click');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this happens if a USE command was typed
|
||||
if (typeof data.reload != 'undefined') {
|
||||
// Unbind the submit event before reloading. See bug #3295529
|
||||
@ -236,29 +252,6 @@ $(function() {
|
||||
// show an error message that stays on screen
|
||||
$('#sqlqueryform').before(data.error);
|
||||
$sqlqueryresults.hide();
|
||||
} else {
|
||||
// real results are returned
|
||||
// fade out previous messages, if any
|
||||
$('div.success, div.sqlquery_message').fadeOut();
|
||||
var $received_data = $(data);
|
||||
var $zero_row_results = $received_data.find('textarea[name="sql_query"]');
|
||||
// if zero rows are returned from the query execution
|
||||
if ($zero_row_results.length > 0) {
|
||||
$('#sqlquery').val($zero_row_results.val());
|
||||
setQuery($('#sqlquery').val());
|
||||
} else {
|
||||
$sqlqueryresults
|
||||
.show()
|
||||
.html(data)
|
||||
.trigger('makegrid');
|
||||
$('#togglequerybox').show();
|
||||
if( $('#sqlqueryform input[name="retain_query_box"]').is(':checked') != true ) {
|
||||
if ($("#togglequerybox").siblings(":visible").length > 0) {
|
||||
$("#togglequerybox").trigger('click');
|
||||
}
|
||||
}
|
||||
PMA_init_slider();
|
||||
}
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}); // end $.post()
|
||||
@ -302,10 +295,9 @@ $(function() {
|
||||
|
||||
$.post($form.attr('action'), $form.serialize(), function(data) {
|
||||
$("#sqlqueryresults")
|
||||
.html(data)
|
||||
.html(data.message)
|
||||
.trigger('makegrid');
|
||||
PMA_init_slider();
|
||||
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}); // end $.post()
|
||||
}
|
||||
@ -327,7 +319,7 @@ $(function() {
|
||||
|
||||
$.post($form.attr('action'), $form.serialize() + '&ajax_request=true', function(data) {
|
||||
$("#sqlqueryresults")
|
||||
.html(data)
|
||||
.html(data.message)
|
||||
.trigger('makegrid');
|
||||
PMA_init_slider();
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
@ -353,7 +345,7 @@ $(function() {
|
||||
|
||||
$.get($anchor.attr('href'), $anchor.serialize() + '&ajax_request=true', function(data) {
|
||||
$("#sqlqueryresults")
|
||||
.html(data)
|
||||
.html(data.message)
|
||||
.trigger('makegrid');
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}); // end $.get()
|
||||
@ -372,7 +364,7 @@ $(function() {
|
||||
|
||||
$.post($form.attr('action'), $form.serialize() + '&ajax_request=true' , function(data) {
|
||||
$("#sqlqueryresults")
|
||||
.html(data)
|
||||
.html(data.message)
|
||||
.trigger('makegrid');
|
||||
PMA_init_slider();
|
||||
}); // end $.post()
|
||||
@ -422,7 +414,7 @@ $(function() {
|
||||
}); // end dialog options
|
||||
} else {
|
||||
$div
|
||||
.append(data)
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
title: PMA_messages['strChangeTbl'],
|
||||
height: 600,
|
||||
|
||||
@ -322,6 +322,9 @@ $(function() {
|
||||
* to previous page" and "insert another new row" actions, using AJAX
|
||||
* has no obvious advantage. If inserting, the "go back to previous"
|
||||
* action needs a page refresh anyway.
|
||||
*
|
||||
* 3. The handling of the response is also broken because PMA
|
||||
* no longher returns plain HTML for an ajax request
|
||||
*/
|
||||
$("#insertFormDEACTIVATED").live('submit', function(event) {
|
||||
|
||||
|
||||
@ -52,11 +52,11 @@ $(function() {
|
||||
|
||||
PMA_prepareForAjaxRequest($search_form);
|
||||
|
||||
$.post($search_form.attr('action'), $search_form.serialize(), function(response) {
|
||||
$.post($search_form.attr('action'), $search_form.serialize(), function(data) {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
if (typeof response == 'string') {
|
||||
if (data.success == true) {
|
||||
// found results
|
||||
$("#sqlqueryresults").html(response);
|
||||
$("#sqlqueryresults").html(data.message);
|
||||
$("#sqlqueryresults").trigger('makegrid');
|
||||
$('#tbl_search_form')
|
||||
// workaround for bug #3168569 - Issue on toggling the "Hide search criteria" in chrome.
|
||||
@ -71,14 +71,7 @@ $(function() {
|
||||
// needed for the display options slider in the results
|
||||
PMA_init_slider();
|
||||
} else {
|
||||
// error message (zero rows)
|
||||
if (response.message != undefined) {
|
||||
$("#sqlqueryresults").html(response['message']);
|
||||
}
|
||||
// other error (syntax error?)
|
||||
if (response.error != undefined) {
|
||||
$("#sqlqueryresults").html(response['error']);
|
||||
}
|
||||
$("#sqlqueryresults").html(data.error);
|
||||
}
|
||||
}); // end $.post()
|
||||
});
|
||||
|
||||
@ -64,8 +64,7 @@ $(function() {
|
||||
$curr_row.hide("medium").remove();
|
||||
// refresh the list of indexes (comes from sql.php)
|
||||
$('#indexes').html(data.indexes_list);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
|
||||
}
|
||||
}); // end $.get()
|
||||
@ -104,8 +103,7 @@ $(function() {
|
||||
if (typeof data.reload != 'undefined') {
|
||||
window.parent.frame_content.location.reload();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
|
||||
}
|
||||
}); // end $.get()
|
||||
@ -158,8 +156,7 @@ $(function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
|
||||
}
|
||||
}); // end $.get()
|
||||
@ -265,7 +262,7 @@ $(function() {
|
||||
$("#edit_index_dialog").dialog("close");
|
||||
}
|
||||
$('div.no_indexes_defined').hide();
|
||||
} else if (data.error != undefined) {
|
||||
} else {
|
||||
var $temp_div = $("<div id='temp_div'><div>").append(data.error);
|
||||
if ($temp_div.find(".error code").length != 0) {
|
||||
var $error = $temp_div.find(".error code").addClass("error");
|
||||
@ -281,14 +278,14 @@ $(function() {
|
||||
};
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
$.get("tbl_indexes.php", url, function(data) {
|
||||
if (data.error) {
|
||||
if (data.success == false) {
|
||||
//in the case of an error, show the error message returned.
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
// Show dialog if the request was successful
|
||||
$div
|
||||
.append(data)
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
title: title,
|
||||
width: 450,
|
||||
@ -301,7 +298,7 @@ $(function() {
|
||||
});
|
||||
checkIndexType();
|
||||
checkIndexName("index_frm");
|
||||
PMA_convertFootnotesToTooltips($div);
|
||||
PMA_showHints($div);
|
||||
// Add a slider for selecting how many columns to add to the index
|
||||
$div.find('.slider').slider({
|
||||
animate: true,
|
||||
@ -390,7 +387,7 @@ $(function() {
|
||||
}
|
||||
|
||||
$.post($form.prop("action"), serialized + "&ajax_request=true", function (data) {
|
||||
if (data.success != undefined && data.success == false) {
|
||||
if (data.success == false) {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
$this
|
||||
.clone()
|
||||
@ -410,8 +407,7 @@ $(function() {
|
||||
// loop through the correct order
|
||||
for (var i in data.columns) {
|
||||
var the_column = data.columns[i];
|
||||
var $the_row
|
||||
= $rows
|
||||
var $the_row = $rows
|
||||
.find("input:checkbox[value=" + the_column + "]")
|
||||
.closest("tr");
|
||||
// append the row for this column to the table
|
||||
@ -526,7 +522,7 @@ $(function() {
|
||||
}); // end dialog options
|
||||
} else {
|
||||
$div
|
||||
.append(data)
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
title: PMA_messages['strAddColumns'],
|
||||
height: 600,
|
||||
@ -542,7 +538,7 @@ $(function() {
|
||||
$div = $("#add_columns");
|
||||
/*changed the z-index of the enum editor to allow the edit*/
|
||||
$("#enum_editor").css("z-index", "1100");
|
||||
PMA_convertFootnotesToTooltips($div);
|
||||
PMA_showHints($div);
|
||||
// set focus on first column name input
|
||||
$div.find("input.textfield").eq(0).focus();
|
||||
}
|
||||
@ -604,7 +600,7 @@ function changeColumns(action,url)
|
||||
}); // end dialog options
|
||||
} else {
|
||||
$div
|
||||
.append(data)
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
title: PMA_messages['strChangeTbl'],
|
||||
height: 600,
|
||||
@ -620,7 +616,7 @@ function changeColumns(action,url)
|
||||
/*changed the z-index of the enum editor to allow the edit*/
|
||||
$("#enum_editor").css("z-index", "1100");
|
||||
$div = $("#change_column_dialog");
|
||||
PMA_convertFootnotesToTooltips($div);
|
||||
PMA_showHints($div);
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}); // end $.get()
|
||||
@ -673,7 +669,7 @@ $(function() {
|
||||
/*Reload the field form*/
|
||||
reloadFieldForm(data.message);
|
||||
} else {
|
||||
var $temp_div = $("<div id='temp_div'><div>").append(data);
|
||||
var $temp_div = $("<div id='temp_div'><div>").append(data.error);
|
||||
var $error = $temp_div.find(".error code").addClass("error");
|
||||
PMA_ajaxShowMessage($error, false);
|
||||
}
|
||||
@ -693,7 +689,7 @@ $(function() {
|
||||
*/
|
||||
function reloadFieldForm(message) {
|
||||
$.post($("#fieldsForm").attr('action'), $("#fieldsForm").serialize()+"&ajax_request=true", function(form_data) {
|
||||
var $temp_div = $("<div id='temp_div'><div>").append(form_data);
|
||||
var $temp_div = $("<div id='temp_div'><div>").append(form_data.message);
|
||||
$("#fieldsForm").replaceWith($temp_div.find("#fieldsForm"));
|
||||
$("#addColumns").replaceWith($temp_div.find("#addColumns"));
|
||||
$('#move_columns_dialog ul').replaceWith($temp_div.find("#move_columns_dialog ul"));
|
||||
|
||||
@ -12,10 +12,7 @@
|
||||
** Display Help/Info
|
||||
**/
|
||||
function displayHelp() {
|
||||
var msgbox = PMA_ajaxShowMessage(PMA_messages['strDisplayHelp'], 10000);
|
||||
msgbox.click(function() {
|
||||
PMA_ajaxRemoveMessage(msgbox);
|
||||
});
|
||||
PMA_ajaxShowMessage(PMA_messages['strDisplayHelp'], 10000);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -264,14 +261,14 @@ $(document).ready(function() {
|
||||
//Find changed values by comparing form values with selectedRow Object
|
||||
var newValues = new Object();//Stores the values changed from original
|
||||
var sqlTypes = new Object();
|
||||
var it = 4;
|
||||
var it = 0;
|
||||
var xChange = false;
|
||||
var yChange = false;
|
||||
for (key in selectedRow) {
|
||||
var oldVal = selectedRow[key];
|
||||
var newVal = ($('#fields_null_id_' + it).attr('checked')) ? null : $('#fieldID_' + it).val();
|
||||
var newVal = ($('#edit_fields_null_id_' + it).attr('checked')) ? null : $('#edit_fieldID_' + it).val();
|
||||
if (newVal instanceof Array) { // when the column is of type SET
|
||||
newVal = $('#fieldID_' + it).map(function(){
|
||||
newVal = $('#edit_fieldID_' + it).map(function(){
|
||||
return $(this).val();
|
||||
}).get().join(",");
|
||||
}
|
||||
@ -286,7 +283,7 @@ $(document).ready(function() {
|
||||
searchedData[searchedDataKey][yLabel] = newVal;
|
||||
}
|
||||
}
|
||||
var $input = $('#fieldID_' + it);
|
||||
var $input = $('#edit_fieldID_' + it);
|
||||
if ($input.hasClass('bit')) {
|
||||
sqlTypes[key] = 'bit';
|
||||
}
|
||||
@ -534,6 +531,7 @@ $(document).ready(function() {
|
||||
// resizing, it's ok
|
||||
// under IE 9, everything is fine
|
||||
currentChart = $.jqplot('querychart', series, options);
|
||||
currentChart.resetZoom();
|
||||
|
||||
$('button.button-reset').click(function(event) {
|
||||
event.preventDefault();
|
||||
@ -551,7 +549,7 @@ $(document).ready(function() {
|
||||
$('div#querychart').bind('jqplotDataClick',
|
||||
function(event, seriesIndex, pointIndex, data) {
|
||||
searchedDataKey = data[4]; // key from searchedData (global)
|
||||
var field_id = 4;
|
||||
var field_id = 0;
|
||||
var post_params = {
|
||||
'ajax_request' : true,
|
||||
'get_data_row' : true,
|
||||
@ -565,8 +563,8 @@ $(document).ready(function() {
|
||||
// Row is contained in data.row_info,
|
||||
// now fill the displayResultForm with row values
|
||||
for (key in data.row_info) {
|
||||
$field = $('#fieldID_' + field_id);
|
||||
$field_null = $('#fields_null_id_' + field_id);
|
||||
$field = $('#edit_fieldID_' + field_id);
|
||||
$field_null = $('#edit_fields_null_id_' + field_id);
|
||||
if (data.row_info[key] == null) {
|
||||
$field_null.attr('checked', true);
|
||||
$field.val('');
|
||||
|
||||
@ -255,7 +255,9 @@ class PMA_Error extends PMA_Message
|
||||
$retval = '';
|
||||
|
||||
foreach ($this->getBacktrace() as $step) {
|
||||
$retval .= PMA_Error::relPath($step['file']) . '#' . $step['line'] . ': ';
|
||||
if (isset($step['file']) && isset($step['line'])) {
|
||||
$retval .= PMA_Error::relPath($step['file']) . '#' . $step['line'] . ': ';
|
||||
}
|
||||
if (isset($step['class'])) {
|
||||
$retval .= $step['class'] . $step['type'];
|
||||
}
|
||||
@ -317,6 +319,7 @@ class PMA_Error extends PMA_Message
|
||||
*/
|
||||
public function getDisplay()
|
||||
{
|
||||
$this->isDisplayed(true);
|
||||
$retval = '<div class="' . $this->getLevel() . '">';
|
||||
if (! $this->isUserError()) {
|
||||
$retval .= '<strong>' . $this->getType() . '</strong>';
|
||||
|
||||
@ -64,8 +64,8 @@ class PMA_Error_Handler
|
||||
if (count($_SESSION['errors']) >= 20) {
|
||||
$error = new PMA_Error(0, __('Too many error messages, some are not displayed.'), __FILE__, __LINE__);
|
||||
$_SESSION['errors'][$error->getHash()] = $error;
|
||||
}
|
||||
if (($error instanceof PMA_Error) && ! $error->isDisplayed()) {
|
||||
break;
|
||||
} else if (($error instanceof PMA_Error) && ! $error->isDisplayed()) {
|
||||
$_SESSION['errors'][$key] = $error;
|
||||
}
|
||||
}
|
||||
@ -205,17 +205,29 @@ class PMA_Error_Handler
|
||||
}
|
||||
|
||||
/**
|
||||
* display user errors not displayed
|
||||
* Displays user errors not displayed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function dispUserErrors()
|
||||
{
|
||||
echo $this->getDispUserErrors();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders user errors not displayed
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDispUserErrors()
|
||||
{
|
||||
$retval = '';
|
||||
foreach ($this->getErrors() as $error) {
|
||||
if ($error->isUserError() && ! $error->isDisplayed()) {
|
||||
$error->display();
|
||||
$retval .= $error->getDisplay();
|
||||
}
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -227,6 +239,7 @@ class PMA_Error_Handler
|
||||
*/
|
||||
protected function dispPageStart($error = null)
|
||||
{
|
||||
PMA_Response::getInstance()->disable();
|
||||
echo '<html><head><title>';
|
||||
if ($error) {
|
||||
echo $error->getTitle();
|
||||
@ -259,25 +272,39 @@ class PMA_Error_Handler
|
||||
}
|
||||
|
||||
/**
|
||||
* display errors not displayed
|
||||
* renders errors not displayed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getDispErrors()
|
||||
{
|
||||
$retval = '';
|
||||
if ($GLOBALS['cfg']['Error_Handler']['display']) {
|
||||
foreach ($this->getErrors() as $error) {
|
||||
if ($error instanceof PMA_Error) {
|
||||
if (! $error->isDisplayed()) {
|
||||
$retval .= $error->getDisplay();
|
||||
}
|
||||
} else {
|
||||
ob_start();
|
||||
var_dump($error);
|
||||
$retval .= ob_end_clean();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$retval .= $this->getDispUserErrors();
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* displays errors not displayed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function dispErrors()
|
||||
{
|
||||
if ($GLOBALS['cfg']['Error_Handler']['display']) {
|
||||
foreach ($this->getErrors() as $error) {
|
||||
if ($error instanceof PMA_Error) {
|
||||
if (! $error->isDisplayed()) {
|
||||
$error->display();
|
||||
}
|
||||
} else {
|
||||
var_dump($error);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->dispUserErrors();
|
||||
}
|
||||
echo $this->getDispErrors();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -297,7 +324,7 @@ class PMA_Error_Handler
|
||||
}
|
||||
//$this->errors = array_merge($_SESSION['errors'], $this->errors);
|
||||
|
||||
// delet stored errors
|
||||
// delete stored errors
|
||||
$_SESSION['errors'] = array();
|
||||
unset($_SESSION['errors']);
|
||||
}
|
||||
|
||||
334
libraries/Footer.class.php
Normal file
334
libraries/Footer.class.php
Normal file
@ -0,0 +1,334 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Used to render the footer of PMA's pages
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'libraries/Scripts.class.php';
|
||||
|
||||
/**
|
||||
* Class used to output the footer
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class PMA_Footer
|
||||
{
|
||||
/**
|
||||
* PMA_Scripts instance
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $_scripts;
|
||||
/**
|
||||
* Whether we are servicing an ajax request.
|
||||
* We can't simply use $GLOBALS['is_ajax_request']
|
||||
* here since it may have not been initialised yet.
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_isAjax;
|
||||
/**
|
||||
* Whether to only close the BODY and HTML tags
|
||||
* or also include scripts, errors and links
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_isMinimal;
|
||||
/**
|
||||
* Whether to display anything
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_isEnabled;
|
||||
|
||||
/**
|
||||
* Creates a new class instance
|
||||
*
|
||||
* @return new PMA_Footer object
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_isEnabled = true;
|
||||
$this->_scripts = new PMA_Scripts();
|
||||
$this->_isMinimal = false;
|
||||
$this->_addDefaultScripts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads common scripts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addDefaultScripts()
|
||||
{
|
||||
if (empty($GLOBALS['error_message'])) {
|
||||
$this->_scripts->addCode("
|
||||
$(function() {
|
||||
// updates current settings
|
||||
if (window.parent.setAll) {
|
||||
window.parent.setAll(
|
||||
'" . PMA_escapeJsString($GLOBALS['lang']) . "',
|
||||
'" . PMA_escapeJsString($GLOBALS['collation_connection']) . "',
|
||||
'" . PMA_escapeJsString($GLOBALS['server']) . "',
|
||||
'" . PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db'], '')) . "',
|
||||
'" . PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table'], '')) . "',
|
||||
'" . PMA_escapeJsString($_SESSION[' PMA_token ']) . "'
|
||||
);
|
||||
}
|
||||
});
|
||||
");
|
||||
if (! empty($GLOBALS['reload'])) {
|
||||
$this->_scripts->addCode("
|
||||
// refresh navigation frame content
|
||||
if (window.parent.refreshNavigation) {
|
||||
window.parent.refreshNavigation();
|
||||
}
|
||||
");
|
||||
} else if (isset($_GET['reload_left_frame'])
|
||||
&& $_GET['reload_left_frame'] == '1'
|
||||
) {
|
||||
// reload left frame (used by user preferences)
|
||||
$this->_scripts->addCode("
|
||||
if (window.parent && window.parent.frame_navigation) {
|
||||
window.parent.frame_navigation.location.reload();
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
// set current db, table and sql query in the querywindow
|
||||
$query = '';
|
||||
if (strlen($GLOBALS['sql_query']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
|
||||
$query = PMA_escapeJsString($GLOBALS['sql_query']);
|
||||
}
|
||||
$this->_scripts->addCode("
|
||||
if (window.parent.reload_querywindow) {
|
||||
window.parent.reload_querywindow(
|
||||
'" . PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db'], '')) . "',
|
||||
'" . PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table'], '')) . "',
|
||||
'" . $query . "'
|
||||
);
|
||||
}
|
||||
");
|
||||
|
||||
if (! empty($GLOBALS['focus_querywindow'])) {
|
||||
// set focus to the querywindow
|
||||
$this->_scripts->addCode("
|
||||
if (parent.querywindow && !parent.querywindow.closed
|
||||
&& parent.querywindow.location
|
||||
) {
|
||||
self.focus();
|
||||
}
|
||||
");
|
||||
}
|
||||
$this->_scripts->addCode("
|
||||
if (window.parent.frame_content) {
|
||||
// reset content frame name, as querywindow needs
|
||||
// to set a unique name before submitting form data,
|
||||
// and navigation frame needs the original name
|
||||
if (typeof(window.parent.frame_content.name) != 'undefined'
|
||||
&& window.parent.frame_content.name != 'frame_content') {
|
||||
window.parent.frame_content.name = 'frame_content';
|
||||
}
|
||||
if (typeof(window.parent.frame_content.id) != 'undefined'
|
||||
&& window.parent.frame_content.id != 'frame_content') {
|
||||
window.parent.frame_content.id = 'frame_content';
|
||||
}
|
||||
//window.parent.frame_content.setAttribute('name', 'frame_content');
|
||||
//window.parent.frame_content.setAttribute('id', 'frame_content');
|
||||
}
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the debug messages
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getDebugMessage()
|
||||
{
|
||||
$retval = '';
|
||||
if (! empty($_SESSION['debug'])) {
|
||||
$sum_time = 0;
|
||||
$sum_exec = 0;
|
||||
foreach ($_SESSION['debug']['queries'] as $query) {
|
||||
$sum_time += $query['count'] * $query['time'];
|
||||
$sum_exec += $query['count'];
|
||||
}
|
||||
|
||||
$retval .= '<div>';
|
||||
$retval .= count($_SESSION['debug']['queries']) . ' queries executed ';
|
||||
$retval .= $sum_exec . ' times in ' . $sum_time . ' seconds';
|
||||
$retval .= '<pre>';
|
||||
|
||||
ob_start();
|
||||
print_r($_SESSION['debug']);
|
||||
$retval .= ob_end_clean();
|
||||
|
||||
$retval .= '</pre>';
|
||||
$retval .= '</div>';
|
||||
$_SESSION['debug'] = array();
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the link to open a new page
|
||||
*
|
||||
* @param string $url_params URL paramater string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getSelfLink($url_params)
|
||||
{
|
||||
$retval = '';
|
||||
$retval .= '<div id="selflink" class="print_ignore">';
|
||||
$retval .= '<a href="index.php' . PMA_generate_common_url($url_params) . '"'
|
||||
. ' title="' . __('Open new phpMyAdmin window') . '" target="_blank">';
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic']) {
|
||||
$retval .= PMA_getImage(
|
||||
'window-new.png',
|
||||
__('Open new phpMyAdmin window')
|
||||
);
|
||||
} else {
|
||||
$retval .= __('Open new phpMyAdmin window');
|
||||
}
|
||||
$retval .= '</a>';
|
||||
$retval .= '</div>';
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the link to open a new page
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getErrorMessages()
|
||||
{
|
||||
$retval = '';
|
||||
if ($GLOBALS['error_handler']->hasDisplayErrors()) {
|
||||
$retval .= '<div class="clearfloat">';
|
||||
$retval .= $GLOBALS['error_handler']->getDispErrors();
|
||||
$retval .= '</div>';
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves query in history
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _setHistory()
|
||||
{
|
||||
if (! PMA_isValid($_REQUEST['no_history'])
|
||||
&& empty($GLOBALS['error_message'])
|
||||
&& ! empty($GLOBALS['sql_query'])
|
||||
) {
|
||||
PMA_setHistory(
|
||||
PMA_ifSetOr($GLOBALS['db'], ''),
|
||||
PMA_ifSetOr($GLOBALS['table'], ''),
|
||||
$GLOBALS['cfg']['Server']['user'],
|
||||
$GLOBALS['sql_query']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the rendering of the footer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disable()
|
||||
{
|
||||
$this->_isEnabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ajax flag to indicate whether
|
||||
* we are sevicing an ajax request
|
||||
*
|
||||
* @param bool $isAjax Whether we are sevicing an ajax request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAjax($isAjax)
|
||||
{
|
||||
$this->_isAjax = ($isAjax == true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn on minimal display mode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMinimal()
|
||||
{
|
||||
$this->_isMinimal = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the PMA_Scripts object
|
||||
*
|
||||
* @return PMA_Scripts object
|
||||
*/
|
||||
public function getScripts()
|
||||
{
|
||||
return $this->_scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the footer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDisplay()
|
||||
{
|
||||
$retval = '';
|
||||
$this->_setHistory();
|
||||
if ($this->_isEnabled) {
|
||||
if (! $this->_isAjax && ! $this->_isMinimal) {
|
||||
// Link to itself to replicate windows including frameset
|
||||
if (! isset($GLOBALS['checked_special'])) {
|
||||
$GLOBALS['checked_special'] = false;
|
||||
}
|
||||
if (PMA_getenv('SCRIPT_NAME')
|
||||
&& empty($_POST)
|
||||
&& ! $GLOBALS['checked_special']
|
||||
&& ! $this->_isAjax
|
||||
) {
|
||||
$url_params['target'] = basename(PMA_getenv('SCRIPT_NAME'));
|
||||
$url = PMA_generate_common_url($url_params, 'text', '');
|
||||
$this->_scripts->addCode("
|
||||
// Store current location in hash part
|
||||
// of URL to allow direct bookmarking
|
||||
setURLHash('$url');
|
||||
");
|
||||
$retval .= $this->_getSelfLink($url_params);
|
||||
}
|
||||
$retval .= $this->_getDebugMessage();
|
||||
$retval .= $this->_getErrorMessages();
|
||||
$retval .= $this->_scripts->getDisplay();
|
||||
// Include possible custom footers
|
||||
if (file_exists(CUSTOM_FOOTER_FILE)) {
|
||||
ob_start();
|
||||
include CUSTOM_FOOTER_FILE;
|
||||
$retval .= ob_end_clean();
|
||||
}
|
||||
} else if (! $this->_isAjax) {
|
||||
$retval .= "</body></html>";
|
||||
}
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
}
|
||||
528
libraries/Header.class.php
Normal file
528
libraries/Header.class.php
Normal file
@ -0,0 +1,528 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Used to render the header of PMA's pages
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'libraries/Scripts.class.php';
|
||||
require_once 'libraries/RecentTable.class.php';
|
||||
require_once 'libraries/Menu.class.php';
|
||||
|
||||
/**
|
||||
* Class used to output the HTTP and HTML headers
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class PMA_Header
|
||||
{
|
||||
/**
|
||||
* PMA_Scripts instance
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $_scripts;
|
||||
/**
|
||||
* PMA_Menu instance
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $_menu;
|
||||
/**
|
||||
* Whether to offer the option of importing user settings
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_userprefsOfferImport;
|
||||
/**
|
||||
* The page title
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_title;
|
||||
/**
|
||||
* The value for the id attribute for the body tag
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_bodyId;
|
||||
/**
|
||||
* Whether to show the top menu
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_menuEnabled;
|
||||
/**
|
||||
* Whether to show the warnings
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_warningsEnabled;
|
||||
/**
|
||||
* Whether the page is in 'print view' mode
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_isPrintView;
|
||||
/**
|
||||
* Whether we are servicing an ajax request.
|
||||
* We can't simply use $GLOBALS['is_ajax_request']
|
||||
* here since it may have not been initialised yet.
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_isAjax;
|
||||
/**
|
||||
* Whether to display anything
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_isEnabled;
|
||||
/**
|
||||
* Whether the HTTP headers (and possibly some HTML)
|
||||
* have already been sent to the browser
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_headerIsSent;
|
||||
|
||||
/**
|
||||
* Creates a new class instance
|
||||
*
|
||||
* @return new PMA_Header object
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_isEnabled = true;
|
||||
$this->_isAjax = false;
|
||||
$this->_bodyId = '';
|
||||
$this->_title = '';
|
||||
$this->_menu = new PMA_Menu(
|
||||
$GLOBALS['server'],
|
||||
$GLOBALS['db'],
|
||||
$GLOBALS['table']
|
||||
);
|
||||
$this->_menuEnabled = true;
|
||||
$this->_warningsEnabled = true;
|
||||
$this->_isPrintView = false;
|
||||
$this->_scripts = new PMA_Scripts();
|
||||
$this->_addDefaultScripts();
|
||||
$this->_headerIsSent = false;
|
||||
// if database storage for user preferences is transient,
|
||||
// offer to load exported settings from localStorage
|
||||
// (detection will be done in JavaScript)
|
||||
$this->_userprefsOfferImport = false;
|
||||
if ($GLOBALS['PMA_Config']->get('user_preferences') == 'session'
|
||||
&& ! isset($_SESSION['userprefs_autoload'])
|
||||
) {
|
||||
$this->_userprefsOfferImport = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads common scripts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addDefaultScripts()
|
||||
{
|
||||
$this->_scripts->addFile('jquery/jquery-1.6.2.js');
|
||||
$this->_scripts->addFile('jquery/jquery-ui-1.8.16.custom.js');
|
||||
$this->_scripts->addFile('jquery/jquery.sprintf.js');
|
||||
$this->_scripts->addFile('update-location.js');
|
||||
|
||||
$this->_scripts->addFile('jquery/jquery.qtip-1.0.0-rc3.js');
|
||||
if ($GLOBALS['cfg']['CodemirrorEnable']) {
|
||||
$this->_scripts->addFile('codemirror/lib/codemirror.js');
|
||||
$this->_scripts->addFile('codemirror/mode/mysql/mysql.js');
|
||||
}
|
||||
// Cross-framing protection
|
||||
if ($GLOBALS['cfg']['AllowThirdPartyFraming'] === false) {
|
||||
$this->_scripts->addFile('cross_framing_protection.js');
|
||||
}
|
||||
// Localised strings
|
||||
$params = array('lang' => $GLOBALS['lang']);
|
||||
if (isset($GLOBALS['db'])) {
|
||||
$params['db'] = $GLOBALS['db'];
|
||||
}
|
||||
$this->_scripts->addFile('messages.php' . PMA_generate_common_url($params));
|
||||
// Append the theme id to this url to invalidate
|
||||
// the cache on a theme change
|
||||
$this->_scripts->addFile(
|
||||
'get_image.js.php?theme='
|
||||
. urlencode($_SESSION['PMA_Theme']->getId())
|
||||
);
|
||||
$this->_scripts->addFile('functions.js');
|
||||
$this->_scripts->addCode(PMA_getReloadNavigationScript(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the rendering of the header
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disable()
|
||||
{
|
||||
$this->_isEnabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ajax flag to indicate whether
|
||||
* we are sevicing an ajax request
|
||||
*
|
||||
* @param bool $isAjax Whether we are sevicing an ajax request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAjax($isAjax)
|
||||
{
|
||||
$this->_isAjax = ($isAjax == true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the PMA_Scripts object
|
||||
*
|
||||
* @return PMA_Scripts object
|
||||
*/
|
||||
public function getScripts()
|
||||
{
|
||||
return $this->_scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for the ID attribute in the BODY tag
|
||||
*
|
||||
* @param string $id Value for the ID attribute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setBodyId($id)
|
||||
{
|
||||
$this->_bodyId = htmlspecialchars($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for the title of the page
|
||||
*
|
||||
* @param string $title New title
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->_title = htmlspecialchars($title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the display of the top menu
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disableMenu()
|
||||
{
|
||||
$this->_menuEnabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the display of the top menu
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disableWarnings()
|
||||
{
|
||||
$this->_warningsEnabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on 'print view' mode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enablePrintView()
|
||||
{
|
||||
$this->disableMenu();
|
||||
$this->setTitle(__('Print view') . ' - phpMyAdmin ' . PMA_VERSION);
|
||||
$this->_isPrintView = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the header
|
||||
*
|
||||
* @return string The header
|
||||
*/
|
||||
public function getDisplay()
|
||||
{
|
||||
$retval = '';
|
||||
if (! $this->_headerIsSent) {
|
||||
if (! $this->_isAjax && $this->_isEnabled) {
|
||||
$this->sendHttpHeaders();
|
||||
$retval .= $this->_getHtmlStart();
|
||||
$retval .= $this->_getMetaTags();
|
||||
$retval .= $this->_getLinkTags();
|
||||
$retval .= $this->_getTitleTag();
|
||||
$title = PMA_sanitize(
|
||||
PMA_escapeJsString($this->_getPageTitle()),
|
||||
false,
|
||||
true
|
||||
);
|
||||
$this->_scripts->addCode(
|
||||
"if (typeof(parent.document) != 'undefined'"
|
||||
. " && typeof(parent.document) != 'unknown'"
|
||||
. " && typeof(parent.document.title) == 'string')"
|
||||
. "{"
|
||||
. "parent.document.title = '$title'"
|
||||
. "}"
|
||||
);
|
||||
if ($this->_userprefsOfferImport) {
|
||||
$this->_scripts->addFile('config.js');
|
||||
}
|
||||
$retval .= $this->_scripts->getDisplay();
|
||||
$retval .= $this->_getBodyStart();
|
||||
// Include possible custom headers
|
||||
if (file_exists(CUSTOM_HEADER_FILE)) {
|
||||
ob_start();
|
||||
include CUSTOM_HEADER_FILE;
|
||||
$retval .= ob_end_clean();
|
||||
}
|
||||
// offer to load user preferences from localStorage
|
||||
if ($this->_userprefsOfferImport) {
|
||||
include_once './libraries/user_preferences.lib.php';
|
||||
$retval .= PMA_userprefsAutoloadGetHeader();
|
||||
}
|
||||
// pass configuration for hint tooltip display
|
||||
// (to be used by PMA_createqTip in js/functions.js)
|
||||
if (! $GLOBALS['cfg']['ShowHint']) {
|
||||
$retval .= '<span id="no_hint" class="hide"></span>';
|
||||
}
|
||||
$retval .= $this->_getWarnings();
|
||||
if ($this->_menuEnabled && $GLOBALS['server'] > 0) {
|
||||
$retval .= $this->_menu->getDisplay();
|
||||
}
|
||||
$retval .= $this->_addRecentTable(
|
||||
$GLOBALS['db'],
|
||||
$GLOBALS['table']
|
||||
);
|
||||
}
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends out the HTTP headers
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sendHttpHeaders()
|
||||
{
|
||||
/**
|
||||
* Sends http headers
|
||||
*/
|
||||
$GLOBALS['now'] = gmdate('D, d M Y H:i:s') . ' GMT';
|
||||
/* Prevent against ClickJacking by allowing frames only from same origin */
|
||||
if (! $GLOBALS['cfg']['AllowThirdPartyFraming']) {
|
||||
header(
|
||||
'X-Frame-Options: SAMEORIGIN'
|
||||
);
|
||||
header(
|
||||
"X-Content-Security-Policy: allow 'self'; "
|
||||
. "options inline-script eval-script; "
|
||||
. "frame-ancestors 'self'; img-src 'self' data:; "
|
||||
. "script-src 'self' http://www.phpmyadmin.net"
|
||||
);
|
||||
header(
|
||||
"X-WebKit-CSP: allow 'self' http://www.phpmyadmin.net; "
|
||||
. "options inline-script eval-script"
|
||||
);
|
||||
}
|
||||
PMA_noCacheHeader();
|
||||
if (! defined('IS_TRANSFORMATION_WRAPPER')) {
|
||||
// Define the charset to be used
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
}
|
||||
$this->_headerIsSent = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the DOCTYPE and the start HTML tag
|
||||
*
|
||||
* @return string DOCTYPE and HTML tags
|
||||
*/
|
||||
private function _getHtmlStart()
|
||||
{
|
||||
$lang = $GLOBALS['available_languages'][$GLOBALS['lang']][1];
|
||||
$dir = $GLOBALS['text_dir'];
|
||||
|
||||
$retval = "<!DOCTYPE HTML>";
|
||||
$retval .= "<html lang='$lang' dir='$dir'>";
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the META tags
|
||||
*
|
||||
* @return string the META tags
|
||||
*/
|
||||
private function _getMetaTags()
|
||||
{
|
||||
$retval = '<meta charset="utf-8" />';
|
||||
$retval .= '<meta name="robots" content="noindex,nofollow" />';
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the LINK tags for the favicon and the stylesheets
|
||||
*
|
||||
* @return string the LINK tags
|
||||
*/
|
||||
private function _getLinkTags()
|
||||
{
|
||||
$retval = '<link rel="icon" href="favicon.ico" '
|
||||
. 'type="image/x-icon" />'
|
||||
. '<link rel="shortcut icon" href="favicon.ico" '
|
||||
. 'type="image/x-icon" />';
|
||||
// stylesheets
|
||||
$basedir = defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : '';
|
||||
$common_url = PMA_generate_common_url(array('server' => $GLOBALS['server']));
|
||||
$theme_id = $GLOBALS['PMA_Config']->getThemeUniqueValue();
|
||||
$theme_path = $GLOBALS['pmaThemePath'];
|
||||
|
||||
if ($this->_isPrintView) {
|
||||
$retval .= '<link rel="stylesheet" type="text/css" href="'
|
||||
. $basedir . 'print.css" media="print" />';
|
||||
} else {
|
||||
$retval .= '<link rel="stylesheet" type="text/css" href="'
|
||||
. $basedir . 'phpmyadmin.css.php'
|
||||
. $common_url . '&nocache='
|
||||
. $theme_id . '" />';
|
||||
$retval .= '<link rel="stylesheet" type="text/css" href="'
|
||||
. $theme_path . '/jquery/jquery-ui-1.8.16.custom.css" />';
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TITLE tag
|
||||
*
|
||||
* @return string the TITLE tag
|
||||
*/
|
||||
private function _getTitleTag()
|
||||
{
|
||||
$retval = "<title>";
|
||||
$retval .= $this->_getPageTitle();
|
||||
$retval .= "</title>";
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the page is missing the title, this function
|
||||
* will set it to something reasonable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getPageTitle()
|
||||
{
|
||||
if (empty($this->_title)) {
|
||||
if ($GLOBALS['server'] > 0) {
|
||||
if (! empty($GLOBALS['table'])) {
|
||||
$temp_title = $GLOBALS['cfg']['TitleTable'];
|
||||
} else if (! empty($GLOBALS['db'])) {
|
||||
$temp_title = $GLOBALS['cfg']['TitleDatabase'];
|
||||
} elseif (! empty($GLOBALS['cfg']['Server']['host'])) {
|
||||
$temp_title = $GLOBALS['cfg']['TitleServer'];
|
||||
} else {
|
||||
$temp_title = $GLOBALS['cfg']['TitleDefault'];
|
||||
}
|
||||
$this->_title = htmlspecialchars(
|
||||
PMA_expandUserString($temp_title)
|
||||
);
|
||||
} else {
|
||||
$this->_title = 'phpMyAdmin';
|
||||
}
|
||||
}
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the close tag to the HEAD
|
||||
* and the start tag for the BODY
|
||||
*
|
||||
* @return string HEAD and BODY tags
|
||||
*/
|
||||
private function _getBodyStart()
|
||||
{
|
||||
$retval = "</head><body";
|
||||
if (! empty($this->_bodyId)) {
|
||||
$retval .= " id='" . $this->_bodyId . "'";
|
||||
}
|
||||
$retval .= ">";
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns some warnings to be displayed at the top of the page
|
||||
*
|
||||
* @return string The warnings
|
||||
*/
|
||||
private function _getWarnings()
|
||||
{
|
||||
$retval = '';
|
||||
if ($this->_warningsEnabled) {
|
||||
// message of "Cookies required" displayed for auth_type http or config
|
||||
// note: here, the decoration won't work because without cookies,
|
||||
// our standard CSS is not operational
|
||||
if (empty($_COOKIE)) {
|
||||
$retval .= PMA_Message::notice(
|
||||
__('Cookies must be enabled past this point.')
|
||||
)->getDisplay();
|
||||
}
|
||||
$retval .= "<noscript>";
|
||||
$retval .= PMA_message::error(
|
||||
__("Javascript must be enabled past this point")
|
||||
)->getDisplay();
|
||||
$retval .= "</noscript>";
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add recently used table and reload the navigation.
|
||||
*
|
||||
* @param string $db Database name where the table is located.
|
||||
* @param string $table The table name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _addRecentTable($db, $table)
|
||||
{
|
||||
$retval = '';
|
||||
if (strlen($table) && $GLOBALS['cfg']['LeftRecentTable'] > 0) {
|
||||
$tmp_result = PMA_RecentTable::getInstance()->add($db, $table);
|
||||
if ($tmp_result === true) {
|
||||
$retval = '<span class="hide" id="update_recent_tables"></span>';
|
||||
} else {
|
||||
$error = $tmp_result;
|
||||
$retval = $error->getDisplay();
|
||||
}
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Singleton class for generating the top menu
|
||||
* Class for generating the top menu
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
@ -37,17 +37,9 @@ class PMA_Menu
|
||||
* @var string
|
||||
*/
|
||||
private $_table;
|
||||
/**
|
||||
* PMA_Menu instance
|
||||
*
|
||||
* @access private
|
||||
* @static
|
||||
* @var object
|
||||
*/
|
||||
private static $_instance;
|
||||
|
||||
/**
|
||||
* Private constructor disables direct object creation
|
||||
* Creates a new instance of PMA_Menu
|
||||
*
|
||||
* @param int $server Server id
|
||||
* @param string $db Database name
|
||||
@ -55,28 +47,11 @@ class PMA_Menu
|
||||
*
|
||||
* @return New PMA_Table
|
||||
*/
|
||||
private function __construct($server, $db, $table)
|
||||
public function __construct($server, $db, $table)
|
||||
{
|
||||
$this->_server = $server;
|
||||
$this->_db = $db;
|
||||
$this->_table = $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the menu and the breadcrumbs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
if (empty(self::$_instance)) {
|
||||
self::$_instance = new PMA_Menu(
|
||||
$GLOBALS['server'],
|
||||
$GLOBALS['db'],
|
||||
$GLOBALS['table']
|
||||
);
|
||||
}
|
||||
return self::$_instance;
|
||||
$this->_db = $db;
|
||||
$this->_table = $table;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,12 +61,29 @@ class PMA_Menu
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
echo $this->_getBreadcrumbs();
|
||||
echo $this->_getMenu();
|
||||
echo $this->getDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the menu and the breadcrumbs as a string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDisplay()
|
||||
{
|
||||
$retval = $this->_getBreadcrumbs();
|
||||
$retval .= $this->_getMenu();
|
||||
if (! empty($GLOBALS['message'])) {
|
||||
echo PMA_getMessage($GLOBALS['message']);
|
||||
if (isset($GLOBALS['buffer_message'])) {
|
||||
$buffer_message = $GLOBALS['buffer_message'];
|
||||
}
|
||||
$retval .= PMA_getMessage($GLOBALS['message']);
|
||||
unset($GLOBALS['message']);
|
||||
if (isset($buffer_message)) {
|
||||
$GLOBALS['buffer_message'] = $buffer_message;
|
||||
}
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -214,10 +206,6 @@ class PMA_Menu
|
||||
} // end if
|
||||
} else {
|
||||
// no table selected, display database comment if present
|
||||
/**
|
||||
* Settings for relations stuff
|
||||
*/
|
||||
include_once './libraries/relation.lib.php';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
// Get additional information about tables for tooltip is done
|
||||
@ -353,7 +341,7 @@ class PMA_Menu
|
||||
* export, search and qbe links if there is at least one table
|
||||
*/
|
||||
if ($num_tables == 0) {
|
||||
$tabs['qbe']['warning'] = __('Database seems to be empty!');
|
||||
$tabs['qbe']['warning'] = __('Database seems to be empty!');
|
||||
$tabs['search']['warning'] = __('Database seems to be empty!');
|
||||
$tabs['export']['warning'] = __('Database seems to be empty!');
|
||||
}
|
||||
@ -480,9 +468,9 @@ class PMA_Menu
|
||||
$tabs['import']['link'] = 'server_import.php';
|
||||
$tabs['import']['text'] = __('Import');
|
||||
|
||||
$tabs['settings']['icon'] = 'b_tblops.png';
|
||||
$tabs['settings']['link'] = 'prefs_manage.php';
|
||||
$tabs['settings']['text'] = __('Settings');
|
||||
$tabs['settings']['icon'] = 'b_tblops.png';
|
||||
$tabs['settings']['link'] = 'prefs_manage.php';
|
||||
$tabs['settings']['text'] = __('Settings');
|
||||
$tabs['settings']['active'] = in_array(
|
||||
basename($GLOBALS['PMA_PHP_SELF']),
|
||||
array('prefs_forms.php', 'prefs_manage.php')
|
||||
|
||||
@ -27,15 +27,15 @@
|
||||
* $message = PMA_Message::success('strSomeLocaleMessage');
|
||||
*
|
||||
* // create another message, a hint, with a localized string which expects
|
||||
* // two parameters: $strSomeFootnote = 'Read the %smanual%s'
|
||||
* $hint = PMA_Message::notice('strSomeFootnote');
|
||||
* // two parameters: $strSomeTooltip = 'Read the %smanual%s'
|
||||
* $hint = PMA_Message::notice('strSomeTooltip');
|
||||
* // replace %d with the following params
|
||||
* $hint->addParam('[a@./Documentation.html#cfg_Example@_blank]');
|
||||
* $hint->addParam('[/a]');
|
||||
* // add this hint as a footnote
|
||||
* // add this hint as a tooltip
|
||||
* $hint = PMA_showHint($hint);
|
||||
*
|
||||
* // add the retrieved footnote reference to the original message
|
||||
* // add the retrieved tooltip reference to the original message
|
||||
* $message->addMessage($hint);
|
||||
*
|
||||
* // create another message ...
|
||||
@ -700,6 +700,7 @@ class PMA_Message
|
||||
*/
|
||||
public function getDisplay()
|
||||
{
|
||||
$this->isDisplayed(true);
|
||||
return '<div class="' . $this->getLevel() . '">'
|
||||
. $this->getMessage() . '</div>';
|
||||
}
|
||||
|
||||
129
libraries/OutputBuffering.class.php
Normal file
129
libraries/OutputBuffering.class.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class PMA_OutputBuffering
|
||||
{
|
||||
private static $_instance;
|
||||
private $_mode;
|
||||
private $_content;
|
||||
private $_on;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
$this->_mode = $this->_getMode();
|
||||
$this->_on = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function could be used eventually to support more modes.
|
||||
*
|
||||
* @return integer the output buffer mode
|
||||
*/
|
||||
private function _getMode()
|
||||
{
|
||||
$mode = 0;
|
||||
if ($GLOBALS['cfg']['OBGzip'] && function_exists('ob_start')) {
|
||||
if (ini_get('output_handler') == 'ob_gzhandler') {
|
||||
// If a user sets the output_handler in php.ini to ob_gzhandler, then
|
||||
// any right frame file in phpMyAdmin will not be handled properly by
|
||||
// the browser. My fix was to check the ini file within the
|
||||
// PMA_outBufferModeGet() function.
|
||||
$mode = 0;
|
||||
} elseif (function_exists('ob_get_level') && ob_get_level() > 0) {
|
||||
// If output buffering is enabled in php.ini it's not possible to
|
||||
// add the ob_gzhandler without a warning message from php 4.3.0.
|
||||
// Being better safe than sorry, check for any existing output handler
|
||||
// instead of just checking the 'output_buffering' setting.
|
||||
$mode = 0;
|
||||
} else {
|
||||
$mode = 1;
|
||||
}
|
||||
}
|
||||
// Zero (0) is no mode or in other words output buffering is OFF.
|
||||
// Follow 2^0, 2^1, 2^2, 2^3 type values for the modes.
|
||||
// Usefull if we ever decide to combine modes. Then a bitmask field of
|
||||
// the sum of all modes will be the natural choice.
|
||||
return $mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the singleton PMA_OutputBuffering object
|
||||
*
|
||||
* @return PMA_OutputBuffering object
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
if (empty(self::$_instance)) {
|
||||
self::$_instance = new PMA_OutputBuffering();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will need to run at the top of all pages if output
|
||||
* output buffering is turned on. It also needs to be passed $mode from
|
||||
* the PMA_outBufferModeGet() function or it will be useless.
|
||||
*
|
||||
*/
|
||||
public function start()
|
||||
{
|
||||
if (! $this->_on) {
|
||||
if ($this->_mode) {
|
||||
ob_start('ob_gzhandler');
|
||||
}
|
||||
ob_start();
|
||||
header('X-ob_mode: ' . $this->_mode);
|
||||
register_shutdown_function('PMA_OutputBuffering::stop');
|
||||
$this->_on = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will need to run at the bottom of all pages if output
|
||||
* buffering is turned on. It also needs to be passed $mode from the
|
||||
* PMA_outBufferModeGet() function or it will be useless.
|
||||
*
|
||||
*/
|
||||
public static function stop()
|
||||
{
|
||||
$buffer = PMA_OutputBuffering::getInstance();
|
||||
if ($buffer->_on) {
|
||||
$buffer->_on = false;
|
||||
$buffer->_content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
PMA_Response::response();
|
||||
}
|
||||
|
||||
public function getContents()
|
||||
{
|
||||
return $this->_content;
|
||||
}
|
||||
|
||||
public function flush()
|
||||
{
|
||||
if (ob_get_status() && $this->_mode) {
|
||||
ob_flush();
|
||||
}
|
||||
/**
|
||||
* previously we had here an "else flush()" but some PHP versions
|
||||
* (at least PHP 5.2.11) have a bug (49816) that produces garbled
|
||||
* data
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -85,9 +85,8 @@ class PMA_PDF extends TCPDF
|
||||
*/
|
||||
function Error($error_message = '')
|
||||
{
|
||||
include './libraries/header.inc.php';
|
||||
PMA_Message::error(__('Error while creating PDF:') . ' ' . $error_message)->display();
|
||||
include './libraries/footer.inc.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
315
libraries/Response.class.php
Normal file
315
libraries/Response.class.php
Normal file
@ -0,0 +1,315 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Manages the rendering of pages in PMA
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'libraries/OutputBuffering.class.php';
|
||||
require_once 'libraries/Header.class.php';
|
||||
require_once 'libraries/Footer.class.php';
|
||||
|
||||
/**
|
||||
* Singleton class used to manage the rendering of pages in PMA
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class PMA_Response
|
||||
{
|
||||
/**
|
||||
* PMA_Response instance
|
||||
*
|
||||
* @access private
|
||||
* @static
|
||||
* @var object
|
||||
*/
|
||||
private static $_instance;
|
||||
/**
|
||||
* PMA_Header instance
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $_header;
|
||||
/**
|
||||
* HTML data to be used in the response
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_HTML;
|
||||
/**
|
||||
* An array of JSON key-value pairs
|
||||
* to be sent back for ajax requests
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $_JSON;
|
||||
/**
|
||||
* PMA_Footer instance
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $_footer;
|
||||
/**
|
||||
* Whether we are servicing an ajax request.
|
||||
* We can't simply use $GLOBALS['is_ajax_request']
|
||||
* here since it may have not been initialised yet.
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_isAjax;
|
||||
/**
|
||||
* Whether there were any errors druing the processing of the request
|
||||
* Only used for ajax responses
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_isSuccess;
|
||||
/**
|
||||
* Workaround for PHP bug
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_CWD;
|
||||
|
||||
/**
|
||||
* Creates a new class instance
|
||||
*
|
||||
* @return new PMA_Response object
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
$buffer = PMA_OutputBuffering::getInstance();
|
||||
$buffer->start();
|
||||
$this->_header = new PMA_Header();
|
||||
$this->_HTML = '';
|
||||
$this->_JSON = array();
|
||||
$this->_footer = new PMA_Footer();
|
||||
|
||||
$this->_isSuccess = true;
|
||||
$this->_isAjax = false;
|
||||
if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
|
||||
$this->_isAjax = true;
|
||||
}
|
||||
$this->_header->setAjax($this->_isAjax);
|
||||
$this->_footer->setAjax($this->_isAjax);
|
||||
$this->_CWD = getcwd();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the singleton PMA_Response object
|
||||
*
|
||||
* @return PMA_Response object
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
if (empty(self::$_instance)) {
|
||||
self::$_instance = new PMA_Response();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the status of an ajax response,
|
||||
* whether it is a success or an error
|
||||
*
|
||||
* @param bool $state Whether the request was successfully processed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function isSuccess($state)
|
||||
{
|
||||
$this->_isSuccess = ($state == true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true or false depending on whether
|
||||
* we are servicing an ajax request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function isAjax()
|
||||
{
|
||||
return $this->_isAjax;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to the current working directory
|
||||
* Necessary to work around a PHP bug where the CWD is
|
||||
* reset after the initial script exits
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCWD()
|
||||
{
|
||||
return $this->_CWD;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the rendering of the header
|
||||
* and the footer in responses
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disable()
|
||||
{
|
||||
$this->_header->disable();
|
||||
$this->_footer->disable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a PMA_Header object
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function getHeader()
|
||||
{
|
||||
return $this->_header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a PMA_Footer object
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function getFooter()
|
||||
{
|
||||
return $this->_footer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add HTML code to the response
|
||||
*
|
||||
* @param string $content A string to be appended to
|
||||
* the current output buffer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addHTML($content)
|
||||
{
|
||||
if ($content instanceof PMA_Message) {
|
||||
$this->_HTML .= $content->getDisplay();
|
||||
} else {
|
||||
$this->_HTML .= $content;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add JSON code to the response
|
||||
*
|
||||
* @param mixed $json Either a key (string) or an
|
||||
* array or key-value pairs
|
||||
* @param mixed $value Null, if passing an array in $json otherwise
|
||||
* it's a string value to the key
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addJSON($json, $value = null)
|
||||
{
|
||||
if (is_array($json)) {
|
||||
foreach ($json as $key => $value) {
|
||||
$this->addJSON($key, $value);
|
||||
}
|
||||
} else {
|
||||
if ($value instanceof PMA_Message) {
|
||||
$this->_JSON[$json] = $value->getDisplay();
|
||||
} else {
|
||||
$this->_JSON[$json] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the HTML response text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getDisplay()
|
||||
{
|
||||
// The header may contain nothing at all,
|
||||
// if it's content was already rendered
|
||||
// and, in this case, the header will be
|
||||
// in the content part of the request
|
||||
$retval = $this->_header->getDisplay();
|
||||
$retval .= $this->_HTML;
|
||||
$retval .= $this->_footer->getDisplay();
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an HTML response to the browser
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _htmlResponse()
|
||||
{
|
||||
echo $this->_getDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a JSON response to the browser
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _ajaxResponse()
|
||||
{
|
||||
if (! isset($this->_JSON['message'])) {
|
||||
$this->_JSON['message'] = $this->_getDisplay();
|
||||
} else if ($this->_JSON['message'] instanceof PMA_Message) {
|
||||
$this->_JSON['message'] = $this->_JSON['message']->getDisplay();
|
||||
}
|
||||
|
||||
if ($this->_isSuccess) {
|
||||
$this->_JSON['success'] = true;
|
||||
} else {
|
||||
$this->_JSON['success'] = false;
|
||||
$this->_JSON['error'] = $this->_JSON['message'];
|
||||
unset($this->_JSON['message']);
|
||||
}
|
||||
|
||||
// Set the Content-Type header to JSON so that jQuery parses the
|
||||
// response correctly.
|
||||
if (! defined('TESTSUITE')) {
|
||||
header('Cache-Control: no-cache');
|
||||
header('Content-Type: application/json');
|
||||
}
|
||||
|
||||
echo json_encode($this->_JSON);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an HTML response to the browser
|
||||
*
|
||||
* @static
|
||||
* @return void
|
||||
*/
|
||||
public static function response()
|
||||
{
|
||||
$response = PMA_Response::getInstance();
|
||||
chdir($response->getCWD());
|
||||
$buffer = PMA_OutputBuffering::getInstance();
|
||||
if (empty($response->_HTML)) {
|
||||
$response->_HTML = $buffer->getContents();
|
||||
}
|
||||
if ($response->isAjax()) {
|
||||
$response->_ajaxResponse();
|
||||
} else {
|
||||
$response->_htmlResponse();
|
||||
}
|
||||
$buffer->flush();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
174
libraries/Scripts.class.php
Normal file
174
libraries/Scripts.class.php
Normal file
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* JavaScript management
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects information about which JavaScript
|
||||
* files and objects are necessary to render
|
||||
* the page and generates the relevant code.
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class PMA_Scripts
|
||||
{
|
||||
/**
|
||||
* An array of SCRIPT tags
|
||||
*
|
||||
* @access private
|
||||
* @var array of strings
|
||||
*/
|
||||
private $_files;
|
||||
/**
|
||||
* An array of discrete javascript code snippets
|
||||
*
|
||||
* @access private
|
||||
* @var array of strings
|
||||
*/
|
||||
private $_code;
|
||||
/**
|
||||
* An array of event names to bind and javascript code
|
||||
* snippets to fire for the corresponding events
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $_events;
|
||||
|
||||
/**
|
||||
* Returns HTML code to include javascript file.
|
||||
*
|
||||
* @param string $url Location of javascript, relative to js/ folder.
|
||||
* @param int $timestamp The date when the file was last modified
|
||||
* @param string $ie_conditional true - wrap with IE conditional comment
|
||||
* 'lt 9' etc. - wrap for specific IE version
|
||||
*
|
||||
* @return string HTML code for javascript inclusion.
|
||||
*/
|
||||
private function _includeFile($url, $timestamp = null, $ie_conditional = false)
|
||||
{
|
||||
$include = '';
|
||||
if ($ie_conditional !== false) {
|
||||
if ($ie_conditional === true) {
|
||||
$include .= '<!--[if IE]>' . "\n ";
|
||||
} else {
|
||||
$include .= '<!--[if IE ' . $ie_conditional . ']>' . "\n ";
|
||||
}
|
||||
}
|
||||
$include .= '<script src="' . $url;
|
||||
if (! empty($timestamp)) {
|
||||
$include .= '?ts=' . filemtime($url);
|
||||
}
|
||||
$include .= '" type="text/javascript"></script>' . "\n";
|
||||
if ($ie_conditional !== false) {
|
||||
$include .= '<![endif]-->' . "\n";
|
||||
}
|
||||
return $include;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates new PMA_Scripts objects
|
||||
*
|
||||
* @return PMA_Scripts object
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_files = array();
|
||||
$this->_code = '';
|
||||
$this->_events = array();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new file to the list of scripts
|
||||
*
|
||||
* @param string $filename The name of the file to include
|
||||
* @param bool $conditional_ie Whether to wrap the script tag in
|
||||
* conditional comments for IE
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addFile($filename, $conditional_ie = false)
|
||||
{
|
||||
$filename = 'js/' . $filename;
|
||||
$hash = md5($filename);
|
||||
if (empty($this->_files[$hash])) {
|
||||
$timestamp = null;
|
||||
if (strpos($filename, '?') === false) {
|
||||
$timestamp = filemtime($filename);
|
||||
}
|
||||
$this->_files[$hash] = array(
|
||||
'filename' => $filename,
|
||||
'timestamp' => $timestamp,
|
||||
'conditional_ie' => $conditional_ie
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new code snippet to the code to be executed
|
||||
*
|
||||
* @param string $code The JS code to be added
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addCode($code)
|
||||
{
|
||||
$this->_code .= "$code\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new event to the list of events
|
||||
*
|
||||
* @param string $event The name of the event to register
|
||||
* @param string $function The code to execute when the event fires
|
||||
* E.g: 'function () { doSomething(); }'
|
||||
* or 'doSomething'
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addEvent($event, $function)
|
||||
{
|
||||
$this->_events[] = array(
|
||||
'event' => $event,
|
||||
'function' => $function
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders all the JavaScript file inclusions, code and events
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDisplay()
|
||||
{
|
||||
$retval = '';
|
||||
|
||||
foreach ($this->_files as $file) {
|
||||
$retval .= $this->_includeFile(
|
||||
$file['filename'],
|
||||
$file['conditional_ie']
|
||||
);
|
||||
}
|
||||
$retval .= '<script type="text/javascript">';
|
||||
$retval .= "// <![CDATA[\n";
|
||||
$retval .= $this->_code;
|
||||
foreach ($this->_events as $js_event) {
|
||||
$retval .= sprintf(
|
||||
"$(window.parent).bind('%s', %s);\n",
|
||||
$js_event['event'],
|
||||
$js_event['function']
|
||||
);
|
||||
}
|
||||
$retval .= '// ]]>';
|
||||
$retval .= '</script>';
|
||||
|
||||
return $retval;
|
||||
}
|
||||
}
|
||||
@ -429,35 +429,39 @@ class PMA_Theme
|
||||
}
|
||||
|
||||
/**
|
||||
* prints out the preview for this theme
|
||||
* Renders the preview for this theme
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
public function printPreview()
|
||||
public function getPrintPreview()
|
||||
{
|
||||
echo '<div class="theme_preview">';
|
||||
echo '<h2>' . htmlspecialchars($this->getName())
|
||||
.' (' . htmlspecialchars($this->getVersion()) . ')</h2>';
|
||||
echo '<p>';
|
||||
echo '<a target="_top" class="take_theme" '
|
||||
.'name="' . htmlspecialchars($this->getId()) . '" '
|
||||
. 'href="index.php'. PMA_generate_common_url(
|
||||
array('set_theme' => $this->getId())
|
||||
) . '">';
|
||||
$url_params = array('set_theme' => $this->getId());
|
||||
$url = 'index.php'. PMA_generate_common_url($url_params);
|
||||
|
||||
$retval = '<div class="theme_preview">';
|
||||
$retval .= '<h2>';
|
||||
$retval .= htmlspecialchars($this->getName());
|
||||
$retval .= ' (' . htmlspecialchars($this->getVersion()) . ') ';
|
||||
$retval .= '</h2>';
|
||||
$retval .= '<p>';
|
||||
$retval .= '<a target="_top" class="take_theme" ';
|
||||
$retval .= 'name="' . htmlspecialchars($this->getId()) . '" ';
|
||||
$retval .= 'href="' . $url . '">';
|
||||
if (@file_exists($this->getPath() . '/screen.png')) {
|
||||
// if screen exists then output
|
||||
|
||||
echo '<img src="' . $this->getPath() . '/screen.png" border="1"'
|
||||
.' alt="' . htmlspecialchars($this->getName()) . '"'
|
||||
.' title="' . htmlspecialchars($this->getName()) . '" /><br />';
|
||||
$retval .= '<img src="' . $this->getPath() . '/screen.png" border="1"';
|
||||
$retval .= ' alt="' . htmlspecialchars($this->getName()) . '"';
|
||||
$retval .= ' title="' . htmlspecialchars($this->getName()) . '" />';
|
||||
$retval .= '<br />';
|
||||
} else {
|
||||
echo __('No preview available.');
|
||||
$retval .= __('No preview available.');
|
||||
}
|
||||
|
||||
echo '[ <strong>' . __('take it') . '</strong> ]</a>'
|
||||
.'</p>'
|
||||
.'</div>';
|
||||
$retval .= '[ <strong>' . __('take it') . '</strong> ]';
|
||||
$retval .= '</a>';
|
||||
$retval .= '</p>';
|
||||
$retval .= '</div>';
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -400,16 +400,18 @@ class PMA_Theme_Manager
|
||||
}
|
||||
|
||||
/**
|
||||
* prints out preview for every theme
|
||||
* Renders the previews for all themes
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
public function printPreviews()
|
||||
public function getPrintPreviews()
|
||||
{
|
||||
$retval = '';
|
||||
foreach ($this->themes as $each_theme) {
|
||||
$each_theme->printPreview();
|
||||
$retval .= $each_theme->getPrintPreview();
|
||||
} // end 'open themes'
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -68,21 +68,18 @@ function PMA_auth_set_user()
|
||||
function PMA_auth_fails()
|
||||
{
|
||||
$conn_error = PMA_DBI_getError();
|
||||
if (!$conn_error) {
|
||||
if (! $conn_error) {
|
||||
$conn_error = __('Cannot connect: invalid settings.');
|
||||
}
|
||||
|
||||
// Defines the charset to be used
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
/* HTML header */
|
||||
$page_title = __('Access denied');
|
||||
include './libraries/header_meta_style.inc.php';
|
||||
include './libraries/header_scripts.inc.php';
|
||||
?>
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->getFooter()->setMinimal();
|
||||
$header = $response->getHeader();
|
||||
$header->setTitle(__('Access denied'));
|
||||
$header->disableMenu();
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
?>
|
||||
<br /><br />
|
||||
<center>
|
||||
<h1><?php echo sprintf(__('Welcome to %s'), ' phpMyAdmin '); ?></h1>
|
||||
@ -91,9 +88,7 @@ function PMA_auth_fails()
|
||||
<table cellpadding="0" cellspacing="3" style="margin: 0 auto" width="80%">
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
<?php
|
||||
$GLOBALS['is_header_sent'] = true;
|
||||
|
||||
if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) {
|
||||
trigger_error(__('Access denied'), E_USER_NOTICE);
|
||||
@ -131,7 +126,7 @@ function PMA_auth_fails()
|
||||
echo '</tr>' . "\n";
|
||||
}
|
||||
echo '</table>' . "\n";
|
||||
include './libraries/footer.inc.php';
|
||||
exit;
|
||||
return true;
|
||||
} // end of the 'PMA_auth_fails()' function
|
||||
|
||||
|
||||
@ -130,6 +130,17 @@ function PMA_auth()
|
||||
{
|
||||
global $conn_error;
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
if ($response->isAjax()) {
|
||||
$response->isSuccess(false);
|
||||
if (! empty($conn_error)) {
|
||||
$response->addJSON('message', $conn_error);
|
||||
} else {
|
||||
$response->addJSON('message', PMA_Message::error(__('Your session has expired. Please login again.')));
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Perform logout to custom URL */
|
||||
if (! empty($_REQUEST['old_usr'])
|
||||
&& ! empty($GLOBALS['cfg']['Server']['LogoutURL'])
|
||||
@ -154,20 +165,13 @@ function PMA_auth()
|
||||
|
||||
$cell_align = ($GLOBALS['text_dir'] == 'ltr') ? 'left' : 'right';
|
||||
|
||||
// Defines the charset to be used
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
$response->getFooter()->setMinimal();
|
||||
$header = $response->getHeader();
|
||||
$header->setBodyId('loginform');
|
||||
$header->setTitle('phpMyAdmin');
|
||||
$header->disableMenu();
|
||||
$header->disableWarnings();
|
||||
|
||||
/* HTML header; do not show here the PMA version to improve security */
|
||||
$page_title = 'phpMyAdmin ';
|
||||
include './libraries/header_meta_style.inc.php';
|
||||
// if $page_title is set, this script uses it as the title:
|
||||
include './libraries/header_scripts.inc.php';
|
||||
?>
|
||||
</head>
|
||||
|
||||
<body class="loginform">
|
||||
|
||||
<?php
|
||||
if (file_exists(CUSTOM_HEADER_FILE)) {
|
||||
include CUSTOM_HEADER_FILE;
|
||||
}
|
||||
@ -189,7 +193,7 @@ function PMA_auth()
|
||||
<?php
|
||||
echo sprintf(
|
||||
__('Welcome to %s'),
|
||||
'<bdo dir="ltr" lang="en">' . $page_title . '</bdo>'
|
||||
'<bdo dir="ltr" lang="en">phpMyAdmin</bdo>'
|
||||
);
|
||||
?>
|
||||
</h1>
|
||||
@ -306,13 +310,11 @@ function PMA_auth()
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
// show login form in top frame.
|
||||
if (top != self || document.body.className != 'loginform') {
|
||||
if (top != self || ! $('body#loginform').length) {
|
||||
window.top.location.href=location;
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit;
|
||||
} // end of the 'PMA_auth()' function
|
||||
@ -373,8 +375,6 @@ function PMA_auth_check()
|
||||
|
||||
// according to the PHP manual we should do this before the destroy:
|
||||
//$_SESSION = array();
|
||||
// but we still need some parts of the session information
|
||||
// in libraries/header_meta_style.inc.php
|
||||
|
||||
session_destroy();
|
||||
// -> delete password cookie(s)
|
||||
@ -581,11 +581,13 @@ function PMA_auth_set_user()
|
||||
*/
|
||||
PMA_clearUserCache();
|
||||
|
||||
PMA_Response::getInstance()->disable();
|
||||
|
||||
PMA_sendHeaderLocation(
|
||||
$redirect_url . PMA_generate_common_url($url_params, '&'),
|
||||
true
|
||||
);
|
||||
exit();
|
||||
exit;
|
||||
} // end if
|
||||
|
||||
return true;
|
||||
|
||||
@ -48,20 +48,14 @@ function PMA_auth()
|
||||
header('status: 401 Unauthorized');
|
||||
}
|
||||
|
||||
// Defines the charset to be used
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
/* HTML header */
|
||||
$page_title = __('Access denied');
|
||||
include './libraries/header_meta_style.inc.php';
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
if (file_exists(CUSTOM_HEADER_FILE)) {
|
||||
include CUSTOM_HEADER_FILE;
|
||||
}
|
||||
?>
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->getFooter()->setMinimal();
|
||||
$header = $response->getHeader();
|
||||
$header->setTitle(__('Access denied'));
|
||||
$header->disableMenu();
|
||||
|
||||
?>
|
||||
<br /><br />
|
||||
<center>
|
||||
<h1><?php echo sprintf(__('Welcome to %s'), ' phpMyAdmin'); ?></h1>
|
||||
@ -74,12 +68,8 @@ function PMA_auth()
|
||||
if (file_exists(CUSTOM_FOOTER_FILE)) {
|
||||
include CUSTOM_FOOTER_FILE;
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit();
|
||||
exit;
|
||||
} // end of the 'PMA_auth()' function
|
||||
|
||||
|
||||
|
||||
@ -129,7 +129,7 @@ require './libraries/Table.class.php';
|
||||
*/
|
||||
require './libraries/Types.class.php';
|
||||
|
||||
if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
/**
|
||||
* common functions
|
||||
*/
|
||||
@ -144,29 +144,16 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
* Include URL/hidden inputs generating.
|
||||
*/
|
||||
include_once './libraries/url_generating.lib.php';
|
||||
|
||||
/**
|
||||
* Used to generate the page
|
||||
*/
|
||||
include_once 'libraries/Response.class.php';
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* start procedural code label_start_procedural */
|
||||
|
||||
/**
|
||||
* protect against possible exploits - there is no need to have so much variables
|
||||
*/
|
||||
if (count($_REQUEST) > 1000) {
|
||||
PMA_fatalError(__('possible exploit'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for numeric keys
|
||||
* (if register_globals is on, numeric key can be found in $GLOBALS)
|
||||
*/
|
||||
foreach ($GLOBALS as $key => $dummy) {
|
||||
if (is_numeric($key)) {
|
||||
PMA_fatalError(__('numeric key detected'));
|
||||
}
|
||||
}
|
||||
unset($dummy);
|
||||
|
||||
/**
|
||||
* PATH_INFO could be compromised if set, so remove it from PHP_SELF
|
||||
* and provide a clean PHP_SELF here
|
||||
@ -489,7 +476,9 @@ if (! PMA_isValid($_REQUEST['token'])
|
||||
/* Cookie preferences */
|
||||
'pma_lang', 'pma_collation_connection',
|
||||
/* Possible login form */
|
||||
'pma_servername', 'pma_username', 'pma_password'
|
||||
'pma_servername', 'pma_username', 'pma_password',
|
||||
/* Needed to send the correct reply */
|
||||
'ajax_request'
|
||||
);
|
||||
/**
|
||||
* Allow changing themes in test/theme.php
|
||||
@ -558,40 +547,6 @@ if (PMA_isValid($_REQUEST['sql_query'])) {
|
||||
//$_REQUEST['server']; // checked later in this file
|
||||
//$_REQUEST['lang']; // checked by LABEL_loading_language_file
|
||||
|
||||
|
||||
/**
|
||||
* holds name of JavaScript files to be included in HTML header
|
||||
* @global array $js_include
|
||||
*/
|
||||
$GLOBALS['js_include'] = array();
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-1.6.2.js';
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.16.custom.js';
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery.sprintf.js';
|
||||
$GLOBALS['js_include'][] = 'update-location.js';
|
||||
|
||||
/**
|
||||
* holds an array of javascript code snippets to be included in the HTML header
|
||||
* Can be used with PMA_addJSCode() to pass on js variables to the browser.
|
||||
* @global array $js_script
|
||||
*/
|
||||
$GLOBALS['js_script'] = array();
|
||||
|
||||
/**
|
||||
* Add common jQuery functions script here if necessary.
|
||||
*/
|
||||
|
||||
/**
|
||||
* JavaScript events that will be registered
|
||||
* @global array $js_events
|
||||
*/
|
||||
$GLOBALS['js_events'] = array();
|
||||
|
||||
/**
|
||||
* footnotes to be displayed ot the page bottom
|
||||
* @global array $footnotes
|
||||
*/
|
||||
$GLOBALS['footnotes'] = array();
|
||||
|
||||
/******************************************************************************/
|
||||
/* loading language file LABEL_loading_language_file */
|
||||
|
||||
@ -600,6 +555,15 @@ $GLOBALS['footnotes'] = array();
|
||||
*/
|
||||
require './libraries/select_lang.lib.php';
|
||||
|
||||
// Defines the cell alignment values depending on text direction
|
||||
if ($GLOBALS['text_dir'] == 'ltr') {
|
||||
$GLOBALS['cell_align_left'] = 'left';
|
||||
$GLOBALS['cell_align_right'] = 'right';
|
||||
} else {
|
||||
$GLOBALS['cell_align_left'] = 'right';
|
||||
$GLOBALS['cell_align_right'] = 'left';
|
||||
}
|
||||
|
||||
/**
|
||||
* check for errors occurred while loading configuration
|
||||
* this check is done here after loading language files to present errors in locale
|
||||
@ -766,6 +730,9 @@ if (@file_exists($_SESSION['PMA_Theme']->getLayoutFile())) {
|
||||
}
|
||||
|
||||
if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
// get a dummy object to ensure that the class is instanciated
|
||||
PMA_Response::getInstance();
|
||||
|
||||
/**
|
||||
* Character set conversion.
|
||||
*/
|
||||
@ -881,7 +848,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
* the required auth type plugin
|
||||
*/
|
||||
include_once './libraries/auth/' . $cfg['Server']['auth_type'] . '.auth.lib.php';
|
||||
if (!PMA_auth_check()) {
|
||||
if (! PMA_auth_check()) {
|
||||
/* Force generating of new session on login */
|
||||
PMA_secureSession();
|
||||
PMA_auth();
|
||||
@ -932,7 +899,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
PMA_log_user($cfg['Server']['user'], 'allow-denied');
|
||||
PMA_auth_fails();
|
||||
}
|
||||
unset($allowDeny_forbidden); //Clean up after you!
|
||||
} // end if
|
||||
|
||||
// is root allowed?
|
||||
@ -940,7 +906,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
$allowDeny_forbidden = true;
|
||||
PMA_log_user($cfg['Server']['user'], 'root-denied');
|
||||
PMA_auth_fails();
|
||||
unset($allowDeny_forbidden); //Clean up after you!
|
||||
}
|
||||
|
||||
// is a login without password allowed?
|
||||
@ -948,7 +913,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
$login_without_password_is_forbidden = true;
|
||||
PMA_log_user($cfg['Server']['user'], 'empty-denied');
|
||||
PMA_auth_fails();
|
||||
unset($login_without_password_is_forbidden); //Clean up after you!
|
||||
}
|
||||
|
||||
// if using TCP socket is not needed
|
||||
@ -1099,6 +1063,32 @@ if (isset($_REQUEST['grid_edit']) && $_REQUEST['grid_edit'] == true) {
|
||||
$GLOBALS['grid_edit'] = false;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
|
||||
PMA_fatalError(__("GLOBALS overwrite attempt"));
|
||||
}
|
||||
|
||||
/**
|
||||
* protect against possible exploits - there is no need to have so much variables
|
||||
*/
|
||||
if (count($_REQUEST) > 1000) {
|
||||
PMA_fatalError(__('possible exploit'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for numeric keys
|
||||
* (if register_globals is on, numeric key can be found in $GLOBALS)
|
||||
*/
|
||||
foreach ($GLOBALS as $key => $dummy) {
|
||||
if (is_numeric($key)) {
|
||||
PMA_fatalError(__('numeric key detected'));
|
||||
}
|
||||
}
|
||||
unset($dummy);
|
||||
|
||||
// here, the function does not exist with this configuration:
|
||||
// $cfg['ServerDefault'] = 0;
|
||||
$GLOBALS['is_superuser'] = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
|
||||
|
||||
if (!empty($__redirect) && in_array($__redirect, $goto_whitelist)) {
|
||||
/**
|
||||
* include subform target page
|
||||
@ -1106,4 +1096,5 @@ if (!empty($__redirect) && in_array($__redirect, $goto_whitelist)) {
|
||||
include $__redirect;
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -528,49 +528,23 @@ function PMA_showPHPDocu($target)
|
||||
} // end of the 'PMA_showPHPDocu()' function
|
||||
|
||||
/**
|
||||
* returns HTML for a footnote marker and add the messsage to the footnotes
|
||||
* Returns HTML code for a tooltip
|
||||
*
|
||||
* @param string $message the error message
|
||||
* @param bool $bbcode whether to interpret BB code
|
||||
* @param string $type message types
|
||||
* @param string $message the message for the tooltip
|
||||
*
|
||||
* @return string html code for a footnote marker
|
||||
* @return string
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_showHint($message, $bbcode = false, $type = 'notice')
|
||||
function PMA_showHint($message)
|
||||
{
|
||||
if ($message instanceof PMA_Message) {
|
||||
$key = $message->getHash();
|
||||
$type = $message->getLevel();
|
||||
} else {
|
||||
$key = md5($message);
|
||||
}
|
||||
|
||||
if (! isset($GLOBALS['footnotes'][$key])) {
|
||||
if (empty($GLOBALS['footnotes']) || ! is_array($GLOBALS['footnotes'])) {
|
||||
$GLOBALS['footnotes'] = array();
|
||||
}
|
||||
$nr = count($GLOBALS['footnotes']) + 1;
|
||||
$GLOBALS['footnotes'][$key] = array(
|
||||
'note' => $message,
|
||||
'type' => $type,
|
||||
'nr' => $nr,
|
||||
);
|
||||
} else {
|
||||
$nr = $GLOBALS['footnotes'][$key]['nr'];
|
||||
}
|
||||
|
||||
if ($bbcode) {
|
||||
return '[sup]' . $nr . '[/sup]';
|
||||
}
|
||||
|
||||
// footnotemarker used in js/tooltip.js
|
||||
return '<sup class="footnotemarker">' . $nr . '</sup>'
|
||||
. PMA_getImage(
|
||||
'b_help.png', '',
|
||||
array('class' => 'footnotemarker footnote_' . $nr)
|
||||
);
|
||||
$retval = '<span class="pma_hint">';
|
||||
$retval .= PMA_getImage('b_help.png');
|
||||
$retval .= '<span class="hide">';
|
||||
$retval .= $message;
|
||||
$retval .= '</span>';
|
||||
$retval .= '</span>';
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -595,11 +569,6 @@ function PMA_mysqlDie(
|
||||
) {
|
||||
global $table, $db;
|
||||
|
||||
/**
|
||||
* start http output, display html headers
|
||||
*/
|
||||
include_once './libraries/header.inc.php';
|
||||
|
||||
$error_msg = '';
|
||||
|
||||
if (! $error_message) {
|
||||
@ -710,10 +679,13 @@ function PMA_mysqlDie(
|
||||
/**
|
||||
* If in an Ajax request
|
||||
* - avoid displaying a Back link
|
||||
* - use PMA_ajaxResponse() to transmit the message and exit
|
||||
* - use PMA_Response() to transmit the message and exit
|
||||
*/
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
PMA_ajaxResponse($error_msg, false);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess(false);
|
||||
$response->addJSON('message', $error_msg);
|
||||
exit;
|
||||
}
|
||||
if (! empty($back_url)) {
|
||||
if (strstr($back_url, '?')) {
|
||||
@ -730,10 +702,7 @@ function PMA_mysqlDie(
|
||||
}
|
||||
|
||||
echo $error_msg;
|
||||
/**
|
||||
* display footer and exit
|
||||
*/
|
||||
include './libraries/footer.inc.php';
|
||||
exit;
|
||||
} else {
|
||||
echo $error_msg;
|
||||
}
|
||||
@ -939,8 +908,9 @@ function PMA_whichCrlf()
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_reloadNavigation($jsonly = false)
|
||||
function PMA_getReloadNavigationScript($jsonly = false)
|
||||
{
|
||||
$retval = '';
|
||||
// Reloads the navigation frame via JavaScript if required
|
||||
if (isset($GLOBALS['reload']) && $GLOBALS['reload']) {
|
||||
// one of the reasons for a reload is when a table is dropped
|
||||
@ -948,29 +918,29 @@ function PMA_reloadNavigation($jsonly = false)
|
||||
// we have a problem when dropping a table on the last page
|
||||
// and the offset becomes greater than the total number of tables
|
||||
unset($_SESSION['tmp_user_values']['table_limit_offset']);
|
||||
echo "\n";
|
||||
$reload_url = './navigation.php?' . PMA_generate_common_url(
|
||||
$GLOBALS['db'],
|
||||
'',
|
||||
'&'
|
||||
);
|
||||
if (! $jsonly) {
|
||||
echo '<script type="text/javascript">' . PHP_EOL;
|
||||
$retval .= '<script type="text/javascript">' . PHP_EOL;
|
||||
}
|
||||
echo '//<![CDATA[' . PHP_EOL;
|
||||
echo 'if (typeof(window.parent) != "undefined"' . PHP_EOL;
|
||||
echo ' && typeof(window.parent.frame_navigation) != "undefined"'
|
||||
. PHP_EOL;
|
||||
echo ' && window.parent.goTo) {' . PHP_EOL;
|
||||
echo ' window.parent.goTo("' . $reload_url . '");' . PHP_EOL;
|
||||
echo '}' . PHP_EOL;
|
||||
echo '//]]>' . PHP_EOL;
|
||||
$retval .= '//<![CDATA[' . PHP_EOL;
|
||||
$retval .= 'if (typeof(window.parent) != "undefined"' . PHP_EOL;
|
||||
$retval .= ' && typeof(window.parent.frame_navigation) != "undefined"'
|
||||
. PHP_EOL;
|
||||
$retval .= ' && window.parent.goTo) {' . PHP_EOL;
|
||||
$retval .= ' window.parent.goTo("' . $reload_url . '");' . PHP_EOL;
|
||||
$retval .= '}' . PHP_EOL;
|
||||
$retval .= '//]]>' . PHP_EOL;
|
||||
if (! $jsonly) {
|
||||
echo '</script>' . PHP_EOL;
|
||||
$retval .= '</script>' . PHP_EOL;
|
||||
}
|
||||
|
||||
unset($GLOBALS['reload']);
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3277,61 +3247,6 @@ function PMA_expandUserString($string, $escape = null, $updates = array())
|
||||
return strtr(strftime($string), $replace);
|
||||
}
|
||||
|
||||
/**
|
||||
* function that generates a json output for an ajax request and ends script
|
||||
* execution
|
||||
*
|
||||
* @param PMA_Message|string $message message string containing the
|
||||
* html of the message
|
||||
* @param bool $success success whether the ajax request
|
||||
* was successfull
|
||||
* @param array $extra_data extra data optional - any other data
|
||||
* as part of the json request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_ajaxResponse($message, $success = true, $extra_data = array())
|
||||
{
|
||||
$response = array();
|
||||
if ( $success == true ) {
|
||||
$response['success'] = true;
|
||||
if ($message instanceof PMA_Message) {
|
||||
$response['message'] = $message->getDisplay();
|
||||
} else {
|
||||
$response['message'] = $message;
|
||||
}
|
||||
} else {
|
||||
$response['success'] = false;
|
||||
if ($message instanceof PMA_Message) {
|
||||
$response['error'] = $message->getDisplay();
|
||||
} else {
|
||||
$response['error'] = $message;
|
||||
}
|
||||
}
|
||||
|
||||
// If extra_data has been provided, append it to the response array
|
||||
if ( ! empty($extra_data) && count($extra_data) > 0 ) {
|
||||
$response = array_merge($response, $extra_data);
|
||||
}
|
||||
|
||||
// Set the Content-Type header to JSON so that jQuery parses the
|
||||
// response correctly.
|
||||
//
|
||||
// At this point, other headers might have been sent;
|
||||
// even if $GLOBALS['is_header_sent'] is true,
|
||||
// we have to send these additional headers.
|
||||
if (! defined('TESTSUITE')) {
|
||||
header('Cache-Control: no-cache');
|
||||
header("Content-Type: application/json");
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
|
||||
if (! defined('TESTSUITE')) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the form used to browse anywhere on the local server for a file to
|
||||
* import
|
||||
@ -3945,4 +3860,48 @@ function PMA_printButton()
|
||||
. __('Print') . '" />';
|
||||
echo '</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses ENUM/SET values
|
||||
*
|
||||
* @param string $definition The definition of the column
|
||||
* for which to parse the values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function PMA_parseEnumSetValues($definition)
|
||||
{
|
||||
$values_string = htmlentities($definition);
|
||||
// There is a JS port of the below parser in functions.js
|
||||
// If you are fixing something here,
|
||||
// you need to also update the JS port.
|
||||
$values = array();
|
||||
$in_string = false;
|
||||
$buffer = '';
|
||||
for ($i=0; $i<strlen($values_string); $i++) {
|
||||
$curr = $values_string[$i];
|
||||
$next = $i == strlen($values_string)-1 ? '' : $values_string[$i+1];
|
||||
if (! $in_string && $curr == "'") {
|
||||
$in_string = true;
|
||||
} else if ($in_string && $curr == "\\" && $next == "\\") {
|
||||
$buffer .= "\";
|
||||
$i++;
|
||||
} else if ($in_string && $next == "'" && ($curr == "'" || $curr == "\\")) {
|
||||
$buffer .= "'";
|
||||
$i++;
|
||||
} else if ($in_string && $curr == "'") {
|
||||
$in_string = false;
|
||||
$values[] = $buffer;
|
||||
$buffer = '';
|
||||
} else if ($in_string) {
|
||||
$buffer .= $curr;
|
||||
}
|
||||
}
|
||||
if (strlen($buffer) > 0) {
|
||||
// The leftovers in the buffer are the last value (if any)
|
||||
$values[] = $buffer;
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -515,6 +515,7 @@ function PMA_sendHeaderLocation($uri, $use_refresh = false)
|
||||
{
|
||||
if (PMA_IS_IIS && strlen($uri) > 600) {
|
||||
include_once './libraries/js_escape.lib.php';
|
||||
PMA_Response::getInstance()->disable();
|
||||
|
||||
echo '<html><head><title>- - -</title>' . "\n";
|
||||
echo '<meta http-equiv="expires" content="0">' . "\n";
|
||||
@ -742,40 +743,8 @@ function PMA_linkURL($url)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML code to include javascript file.
|
||||
*
|
||||
* @param string $url Location of javascript, relative to js/ folder.
|
||||
* @param string $ie_conditional true - wrap with IE conditional comment
|
||||
* 'lt 9' etc. - wrap for specific IE version
|
||||
*
|
||||
* @return string HTML code for javascript inclusion.
|
||||
*/
|
||||
function PMA_includeJS($url, $ie_conditional = false)
|
||||
{
|
||||
$include = '';
|
||||
if ($ie_conditional !== false) {
|
||||
if ($ie_conditional === true) {
|
||||
$include .= '<!--[if IE]>' . "\n ";
|
||||
} else {
|
||||
$include .= '<!--[if IE ' . $ie_conditional . ']>' . "\n ";
|
||||
}
|
||||
}
|
||||
if (strpos($url, '?') === false) {
|
||||
$include .= '<script src="js/' . $url . '?ts=' . filemtime('js/' . $url)
|
||||
. '" type="text/javascript"></script>' . "\n";
|
||||
} else {
|
||||
$include .= '<script src="js/' . $url
|
||||
. '" type="text/javascript"></script>' . "\n";
|
||||
}
|
||||
if ($ie_conditional !== false) {
|
||||
$include .= '<![endif]-->' . "\n";
|
||||
}
|
||||
return $include;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds JS code snippets to be displayed by header.inc.php. Adds a
|
||||
* newline to each snippet.
|
||||
* Adds JS code snippets to be displayed by the PMA_Response class.
|
||||
* Adds a newline to each snippet.
|
||||
*
|
||||
* @param string $str Js code to be added (e.g. "token=1234;")
|
||||
*
|
||||
@ -783,11 +752,15 @@ function PMA_includeJS($url, $ie_conditional = false)
|
||||
*/
|
||||
function PMA_addJSCode($str)
|
||||
{
|
||||
$GLOBALS['js_script'][] = $str;
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addCode($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds JS code snippet for variable assignment to be displayed by header.inc.php.
|
||||
* Adds JS code snippet for variable assignment
|
||||
* to be displayed by the PMA_Response class.
|
||||
*
|
||||
* @param string $key Name of value to set
|
||||
* @param mixed $value Value to set, can be either string or array of strings
|
||||
|
||||
@ -72,12 +72,13 @@ if (isset($submitcollation) && !empty($db_collation)) {
|
||||
* other pages, we might have to move this to a different location.
|
||||
*/
|
||||
if ( $GLOBALS['is_ajax_request'] == true) {
|
||||
PMA_ajaxResponse($message, $message->isSuccess());
|
||||
};
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess($message->isSuccess());
|
||||
$response->addJSON('message', $message);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
require_once './libraries/header.inc.php';
|
||||
|
||||
/**
|
||||
* Set parameters for links
|
||||
*/
|
||||
|
||||
@ -38,7 +38,7 @@ $export_list = PMA_getPlugins('./libraries/export/', array('export_type' => $exp
|
||||
/* Fail if we didn't find any plugin */
|
||||
if (empty($export_list)) {
|
||||
PMA_Message::error(__('Could not load export plugins, please check your installation!'))->display();
|
||||
include './libraries/footer.inc.php';
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
@ -232,18 +232,18 @@ if (isset($_GET['sql_query'])) {
|
||||
}
|
||||
}
|
||||
|
||||
$message = new PMA_Message(__('This value is interpreted using %1$sstrftime%2$s, so you can use time formatting strings. Additionally the following transformations will happen: %3$s. Other text will be kept as is. See the %4$sFAQ%5$s for details.'));
|
||||
$message->addParam(
|
||||
$msg = new PMA_Message(__('This value is interpreted using %1$sstrftime%2$s, so you can use time formatting strings. Additionally the following transformations will happen: %3$s. Other text will be kept as is. See the %4$sFAQ%5$s for details.'));
|
||||
$msg->addParam(
|
||||
'<a href="' . PMA_linkURL(PMA_getPHPDocLink('function.strftime.php'))
|
||||
. '" target="documentation" title="' . __('Documentation') . '">',
|
||||
false
|
||||
);
|
||||
$message->addParam('</a>', false);
|
||||
$message->addParam($trans);
|
||||
$message->addParam('<a href="Documentation.html#faq6_27" target="documentation">', false);
|
||||
$message->addParam('</a>', false);
|
||||
$msg->addParam('</a>', false);
|
||||
$msg->addParam($trans);
|
||||
$msg->addParam('<a href="Documentation.html#faq6_27" target="documentation">', false);
|
||||
$msg->addParam('</a>', false);
|
||||
|
||||
echo PMA_showHint($message);
|
||||
echo PMA_showHint($msg);
|
||||
?>
|
||||
</label>
|
||||
<input type="text" name="filename_template" id="filename_template"
|
||||
|
||||
@ -17,7 +17,9 @@ if (! defined('PHPMYADMIN')) {
|
||||
function PMA_printGitRevision()
|
||||
{
|
||||
if (! $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT')) {
|
||||
PMA_ajaxResponse('', false);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// load revision data from repo
|
||||
@ -56,7 +58,6 @@ function PMA_printGitRevision()
|
||||
$branch = $commit_hash . ' (' . __('no branch') . ')';
|
||||
}
|
||||
|
||||
ob_start();
|
||||
$committer = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITTER');
|
||||
$author = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_AUTHOR');
|
||||
PMA_printListItem(
|
||||
@ -79,7 +80,4 @@ function PMA_printGitRevision()
|
||||
: ''),
|
||||
'li_pma_version_git', null, null, null
|
||||
);
|
||||
$item = ob_get_contents();
|
||||
ob_end_clean();
|
||||
PMA_ajaxResponse($item, true);
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ $import_list = PMA_getPlugins('./libraries/import/', $import_type);
|
||||
/* Fail if we didn't find any plugin */
|
||||
if (empty($import_list)) {
|
||||
PMA_Message::error(__('Could not load import plugins, please check your installation!'))->display();
|
||||
include './libraries/footer.inc.php';
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
@ -130,7 +130,7 @@ if ($_SESSION[$SESSION_KEY]["handler"]!="noplugin") {
|
||||
<?php
|
||||
// reload the left sidebar when the import is finished
|
||||
$GLOBALS['reload'] = true;
|
||||
PMA_reloadNavigation(true);
|
||||
echo PMA_getReloadNavigationScript(true);
|
||||
?>
|
||||
|
||||
} // if finished
|
||||
|
||||
@ -1061,7 +1061,6 @@ function PMA_getTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0,
|
||||
} elseif ((($GLOBALS['cfg']['RowActionLinks'] == 'left')
|
||||
|| ($GLOBALS['cfg']['RowActionLinks'] == 'both'))
|
||||
&& (($is_display['edit_lnk'] == 'nn') && ($is_display['del_lnk'] == 'nn'))
|
||||
&& (! isset($GLOBALS['is_header_sent']) || ! $GLOBALS['is_header_sent'])
|
||||
) {
|
||||
// ... elseif no button, displays empty columns if required
|
||||
// (unless coming from Browse mode print view)
|
||||
|
||||
@ -10,9 +10,12 @@ if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('TESTSUITE')) {
|
||||
if (! defined('TESTSUITE')) {
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
}
|
||||
|
||||
PMA_Response::getInstance()->disable();
|
||||
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="<?php echo $lang; ?>" dir="<?php echo $dir; ?>">
|
||||
|
||||
@ -1,196 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* finishes HTML output
|
||||
*
|
||||
* updates javascript variables in index.php for correct working with querywindow
|
||||
* and navigation frame refreshing
|
||||
*
|
||||
* send buffered data if buffered
|
||||
*
|
||||
* WARNING: This script has to be included at the very end of your code because
|
||||
* it will stop the script execution!
|
||||
*
|
||||
* always use $GLOBALS, as this script is also included by functions
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* for PMA_setHistory()
|
||||
*/
|
||||
if (! PMA_isValid($_REQUEST['no_history']) && empty($GLOBALS['error_message'])
|
||||
&& ! empty($GLOBALS['sql_query'])
|
||||
) {
|
||||
PMA_setHistory(
|
||||
PMA_ifSetOr($GLOBALS['db'], ''),
|
||||
PMA_ifSetOr($GLOBALS['table'], ''),
|
||||
$GLOBALS['cfg']['Server']['user'],
|
||||
$GLOBALS['sql_query']
|
||||
);
|
||||
}
|
||||
|
||||
if ($GLOBALS['error_handler']->hasDisplayErrors()) {
|
||||
echo '<div class="clearfloat">';
|
||||
$GLOBALS['error_handler']->dispErrors();
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if (count($GLOBALS['footnotes'])) {
|
||||
echo '<div class="footnotes">';
|
||||
foreach ($GLOBALS['footnotes'] as $footnote) {
|
||||
echo '<span id="footnote_' . $footnote['nr'] . '"><sup>'
|
||||
. $footnote['nr'] . '</sup> ' . $footnote['note'] . '</span><br />';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if (! empty($_SESSION['debug'])) {
|
||||
$sum_time = 0;
|
||||
$sum_exec = 0;
|
||||
foreach ($_SESSION['debug']['queries'] as $query) {
|
||||
$sum_time += $query['count'] * $query['time'];
|
||||
$sum_exec += $query['count'];
|
||||
}
|
||||
|
||||
echo '<div>';
|
||||
echo count($_SESSION['debug']['queries']) . ' queries executed '
|
||||
. $sum_exec . ' times in ' . $sum_time . ' seconds';
|
||||
echo '<pre>';
|
||||
print_r($_SESSION['debug']);
|
||||
echo '</pre>';
|
||||
echo '</div>';
|
||||
$_SESSION['debug'] = array();
|
||||
}
|
||||
|
||||
if (!$GLOBALS['is_ajax_request']) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
<?php
|
||||
if (empty($GLOBALS['error_message'])) {
|
||||
?>
|
||||
$(function() {
|
||||
// updates current settings
|
||||
if (window.parent.setAll) {
|
||||
window.parent.setAll('<?php
|
||||
echo PMA_escapeJsString($GLOBALS['lang']) . "', '";
|
||||
echo PMA_escapeJsString($GLOBALS['collation_connection']) . "', '";
|
||||
echo PMA_escapeJsString($GLOBALS['server']) . "', '";
|
||||
echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db'], '')) . "', '";
|
||||
echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table'], '')) . "', '";
|
||||
echo PMA_escapeJsString($_SESSION[' PMA_token ']);?>');
|
||||
}
|
||||
<?php
|
||||
if (! empty($GLOBALS['reload'])) {
|
||||
?>
|
||||
// refresh navigation frame content
|
||||
if (window.parent.refreshNavigation) {
|
||||
window.parent.refreshNavigation();
|
||||
}
|
||||
<?php
|
||||
} else if (isset($_GET['reload_left_frame']) && $_GET['reload_left_frame'] == '1') {
|
||||
// reload left frame (used by user preferences)
|
||||
?>
|
||||
if (window.parent && window.parent.frame_navigation) {
|
||||
window.parent.frame_navigation.location.reload();
|
||||
}
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
// set current db, table and sql query in the querywindow
|
||||
if (window.parent.reload_querywindow) {
|
||||
window.parent.reload_querywindow(
|
||||
'<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db'], '')) ?>',
|
||||
'<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table'], '')) ?>',
|
||||
'<?php echo strlen($GLOBALS['sql_query']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] ? PMA_escapeJsString($GLOBALS['sql_query']) : ''; ?>');
|
||||
}
|
||||
<?php
|
||||
}
|
||||
|
||||
if (! empty($GLOBALS['focus_querywindow'])) {
|
||||
?>
|
||||
// set focus to the querywindow
|
||||
if (parent.querywindow && !parent.querywindow.closed && parent.querywindow.location) {
|
||||
self.focus();
|
||||
}
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
if (window.parent.frame_content) {
|
||||
// reset content frame name, as querywindow needs to set a unique name
|
||||
// before submitting form data, and navigation frame needs the original name
|
||||
if (typeof(window.parent.frame_content.name) != 'undefined'
|
||||
&& window.parent.frame_content.name != 'frame_content') {
|
||||
window.parent.frame_content.name = 'frame_content';
|
||||
}
|
||||
if (typeof(window.parent.frame_content.id) != 'undefined'
|
||||
&& window.parent.frame_content.id != 'frame_content') {
|
||||
window.parent.frame_content.id = 'frame_content';
|
||||
}
|
||||
//window.parent.frame_content.setAttribute('name', 'frame_content');
|
||||
//window.parent.frame_content.setAttribute('id', 'frame_content');
|
||||
}
|
||||
});
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
// Link to itself to replicate windows including frameset
|
||||
if (! isset($GLOBALS['checked_special'])) {
|
||||
$GLOBALS['checked_special'] = false;
|
||||
}
|
||||
|
||||
if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && !$GLOBALS['checked_special'] && ! $GLOBALS['is_ajax_request']) {
|
||||
echo '<div id="selflink" class="print_ignore">' . "\n";
|
||||
$url_params['target'] = basename(PMA_getenv('SCRIPT_NAME'));
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
/* Store current location in hash part of URL to allow direct bookmarking */
|
||||
setURLHash("<?php echo PMA_generate_common_url($url_params, 'text', ''); ?>");
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
<?php
|
||||
|
||||
echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"'
|
||||
. ' title="' . __('Open new phpMyAdmin window') . '" target="_blank">';
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic']) {
|
||||
echo PMA_getImage('window-new.png', __('Open new phpMyAdmin window'));
|
||||
}
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
|
||||
echo __('Open new phpMyAdmin window');
|
||||
}
|
||||
echo '</a>' . "\n";
|
||||
echo '</div>' . "\n";
|
||||
}
|
||||
|
||||
// Include possible custom footers
|
||||
if (! $GLOBALS['is_ajax_request'] && file_exists(CUSTOM_FOOTER_FILE)) {
|
||||
include CUSTOM_FOOTER_FILE;
|
||||
}
|
||||
|
||||
/**
|
||||
* If we are in an AJAX request, we do not need to generate the closing tags for
|
||||
* body and html.
|
||||
*/
|
||||
if (! $GLOBALS['is_ajax_request']) {
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
/**
|
||||
* Stops the script execution
|
||||
*/
|
||||
exit;
|
||||
?>
|
||||
@ -1,135 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once './libraries/RecentTable.class.php';
|
||||
require_once 'libraries/Menu.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Add recently used table and reload the navigation.
|
||||
*
|
||||
* @param string $db Database name where the table is located.
|
||||
* @param string $table The table name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_addRecentTable($db, $table)
|
||||
{
|
||||
$tmp_result = PMA_RecentTable::getInstance()->add($db, $table);
|
||||
if ($tmp_result === true) {
|
||||
echo '<span class="hide" id="update_recent_tables"></span>';
|
||||
} else {
|
||||
$error = $tmp_result;
|
||||
$error->display();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is not an Ajax request so we need to generate all this output.
|
||||
*/
|
||||
if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
|
||||
|
||||
if (empty($GLOBALS['is_header_sent'])) {
|
||||
|
||||
/**
|
||||
* Gets a core script and starts output buffering work
|
||||
*/
|
||||
include_once './libraries/ob.lib.php';
|
||||
PMA_outBufferPre();
|
||||
|
||||
// if database storage for user preferences is transient, offer to load
|
||||
// exported settings from localStorage (detection will be done in JavaScript)
|
||||
$userprefs_offer_import = $GLOBALS['PMA_Config']->get('user_preferences') == 'session'
|
||||
&& ! isset($_SESSION['userprefs_autoload']);
|
||||
if ($userprefs_offer_import) {
|
||||
$GLOBALS['js_include'][] = 'config.js';
|
||||
}
|
||||
|
||||
// For re-usability, moved http-headers and stylesheets
|
||||
// to a seperate file. It can now be included by header.inc.php,
|
||||
// querywindow.php.
|
||||
|
||||
include_once './libraries/header_http.inc.php';
|
||||
include_once './libraries/header_meta_style.inc.php';
|
||||
include_once './libraries/header_scripts.inc.php';
|
||||
|
||||
/* remove vertical scroll bar bug in ie */ ?>
|
||||
<!--[if IE 6]>
|
||||
<style type="text/css">
|
||||
/* <![CDATA[ */
|
||||
html {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
/* ]]> */
|
||||
</style>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
// Include possible custom headers
|
||||
if (file_exists(CUSTOM_HEADER_FILE)) {
|
||||
include CUSTOM_HEADER_FILE;
|
||||
}
|
||||
|
||||
|
||||
// message of "Cookies required" displayed for auth_type http or config
|
||||
// note: here, the decoration won't work because without cookies,
|
||||
// our standard CSS is not operational
|
||||
if (empty($_COOKIE)) {
|
||||
PMA_Message::notice(__('Cookies must be enabled past this point.'))->display();
|
||||
}
|
||||
|
||||
echo "<noscript>\n";
|
||||
PMA_message::error(__("Javascript must be enabled past this point"))->display();
|
||||
echo "</noscript>\n";
|
||||
|
||||
// offer to load user preferences from localStorage
|
||||
if ($userprefs_offer_import) {
|
||||
include_once './libraries/user_preferences.lib.php';
|
||||
PMA_userprefs_autoload_header();
|
||||
}
|
||||
|
||||
// add recently used table and reload the navigation
|
||||
if (strlen($GLOBALS['table']) && $GLOBALS['cfg']['LeftRecentTable'] > 0) {
|
||||
PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
|
||||
}
|
||||
|
||||
if (! defined('PMA_DISPLAY_HEADING')) {
|
||||
define('PMA_DISPLAY_HEADING', 1);
|
||||
}
|
||||
|
||||
// pass configuration for hint tooltip display
|
||||
// (to be used by PMA_createqTip in js/functions.js)
|
||||
if (! $GLOBALS['cfg']['ShowHint']) {
|
||||
echo '<span id="no_hint" class="hide"></span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Display heading if needed. Design can be set in css file.
|
||||
*/
|
||||
if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) {
|
||||
PMA_Menu::getInstance()->display();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a variable to remember headers have been sent
|
||||
*/
|
||||
$GLOBALS['is_header_sent'] = true;
|
||||
//end if (!$GLOBALS['is_ajax_request'])
|
||||
} else {
|
||||
if (empty($GLOBALS['is_header_sent'])) {
|
||||
include_once './libraries/header_http.inc.php';
|
||||
$GLOBALS['is_header_sent'] = true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
|
||||
PMA_fatalError(__("GLOBALS overwrite attempt"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends http headers
|
||||
*/
|
||||
$GLOBALS['now'] = gmdate('D, d M Y H:i:s') . ' GMT';
|
||||
/* Prevent against ClickJacking by allowing frames only from same origin */
|
||||
if (!$GLOBALS['cfg']['AllowThirdPartyFraming']) {
|
||||
header('X-Frame-Options: SAMEORIGIN');
|
||||
header("X-Content-Security-Policy: allow 'self'; options inline-script eval-script; frame-ancestors 'self'; img-src 'self' data:; script-src 'self' http://www.phpmyadmin.net");
|
||||
header("X-WebKit-CSP: allow 'self' http://www.phpmyadmin.net; options inline-script eval-script");
|
||||
}
|
||||
PMA_noCacheHeader();
|
||||
if (!defined('IS_TRANSFORMATION_WRAPPER')) {
|
||||
// Define the charset to be used
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
}
|
||||
?>
|
||||
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
|
||||
PMA_fatalError(__("GLOBALS overwrite attempt"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the beginning of the html page then returns to the calling script
|
||||
*/
|
||||
// Defines the cell alignment values depending on text direction
|
||||
if ($GLOBALS['text_dir'] == 'ltr') {
|
||||
$GLOBALS['cell_align_left'] = 'left';
|
||||
$GLOBALS['cell_align_right'] = 'right';
|
||||
} else {
|
||||
$GLOBALS['cell_align_left'] = 'right';
|
||||
$GLOBALS['cell_align_right'] = 'left';
|
||||
}
|
||||
// removes the bug with the horizontal scrollbar in IE (it's allways shown, if need it or not)
|
||||
// xml declaration moves IE into quirks mode, making much trouble with CSS
|
||||
/* echo '<?xml version="1.0" encoding="utf-8"?>'; */
|
||||
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][1]; ?>" dir="<?php echo $GLOBALS['text_dir']; ?>">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
<title><?php
|
||||
if (!empty($page_title)) {
|
||||
echo htmlspecialchars($page_title);
|
||||
} else {
|
||||
echo 'phpMyAdmin';
|
||||
}
|
||||
?></title>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>phpmyadmin.css.php<?php echo PMA_generate_common_url(array('server' => $GLOBALS['server'])); ?>&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>print.css" media="print" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['pmaThemePath']; ?>/jquery/jquery-ui-1.8.16.custom.css" />
|
||||
<meta name="robots" content="noindex,nofollow" />
|
||||
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts output buffering work
|
||||
*/
|
||||
require_once './libraries/ob.lib.php';
|
||||
PMA_outBufferPre();
|
||||
|
||||
// For re-usability, moved http-headers
|
||||
// to a separate file. It can now be included by libraries/header.inc.php,
|
||||
// querywindow.php.
|
||||
|
||||
require_once './libraries/header_http.inc.php';
|
||||
|
||||
/**
|
||||
* Sends the beginning of the html page then returns to the calling script
|
||||
*/
|
||||
// Defines the cell alignment values depending on text direction
|
||||
if ($text_dir == 'ltr') {
|
||||
$cell_align_left = 'left';
|
||||
$cell_align_right = 'right';
|
||||
} else {
|
||||
$cell_align_left = 'right';
|
||||
$cell_align_right = 'left';
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="<?php echo $available_languages[$lang][1]; ?>" dir="<?php echo $text_dir; ?>">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
<title><?php echo __('Print view'); ?> - phpMyAdmin <?php echo PMA_VERSION ?></title>
|
||||
<link rel="stylesheet" type="text/css" href="print.css" />
|
||||
<?php
|
||||
require_once './libraries/header_scripts.inc.php';
|
||||
?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Sets a variable to remember headers have been sent
|
||||
*/
|
||||
$is_header_sent = true;
|
||||
?>
|
||||
@ -1,95 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Cross-framing protection
|
||||
if ( false === $GLOBALS['cfg']['AllowThirdPartyFraming']) {
|
||||
echo PMA_includeJS('cross_framing_protection.js');
|
||||
}
|
||||
// generate title (unless we already have $page_title, from cookie auth)
|
||||
if (! isset($page_title)) {
|
||||
if ($GLOBALS['server'] > 0) {
|
||||
if (! empty($GLOBALS['table'])) {
|
||||
$temp_title = $GLOBALS['cfg']['TitleTable'];
|
||||
} else if (! empty($GLOBALS['db'])) {
|
||||
$temp_title = $GLOBALS['cfg']['TitleDatabase'];
|
||||
} elseif (! empty($GLOBALS['cfg']['Server']['host'])) {
|
||||
$temp_title = $GLOBALS['cfg']['TitleServer'];
|
||||
} else {
|
||||
$temp_title = $GLOBALS['cfg']['TitleDefault'];
|
||||
}
|
||||
$title = PMA_expandUserString($temp_title);
|
||||
}
|
||||
} else {
|
||||
$title = $page_title;
|
||||
}
|
||||
// here, the function does not exist with this configuration:
|
||||
// $cfg['ServerDefault'] = 0;
|
||||
$is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
|
||||
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery.qtip-1.0.0-rc3.js';
|
||||
if ($GLOBALS['cfg']['CodemirrorEnable']) {
|
||||
$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
|
||||
$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
|
||||
}
|
||||
|
||||
$params = array('lang' => $GLOBALS['lang']);
|
||||
if (isset($GLOBALS['db'])) {
|
||||
$params['db'] = $GLOBALS['db'];
|
||||
}
|
||||
$GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params);
|
||||
// Append the theme id to this url to invalidate the cache on a theme change
|
||||
$GLOBALS['js_include'][] = 'get_image.js.php?theme='
|
||||
. urlencode($_SESSION['PMA_Theme']->getId());
|
||||
|
||||
/**
|
||||
* Here we add a timestamp when loading the file, so that users who
|
||||
* upgrade phpMyAdmin are not stuck with older .js files in their
|
||||
* browser cache. This produces an HTTP 304 request for each file.
|
||||
*/
|
||||
|
||||
// avoid loading twice a js file
|
||||
$GLOBALS['js_include'] = array_unique($GLOBALS['js_include']);
|
||||
foreach ($GLOBALS['js_include'] as $js_script_file) {
|
||||
$ie_conditional = false;
|
||||
if (is_array($js_script_file)) {
|
||||
list($js_script_file, $ie_conditional) = $js_script_file;
|
||||
}
|
||||
echo PMA_includeJS($js_script_file, $ie_conditional);
|
||||
}
|
||||
|
||||
$title_to_set = isset($title)
|
||||
? PMA_sanitize(PMA_escapeJsString($title), false, true)
|
||||
: '';
|
||||
// Below javascript Updates the title of the frameset if possible
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
|
||||
&& typeof(parent.document.title) == 'string') {
|
||||
parent.document.title = '<?php echo $title_to_set; ?>';
|
||||
}
|
||||
<?php
|
||||
if (count($GLOBALS['js_script']) > 0) {
|
||||
echo implode("\n", $GLOBALS['js_script'])."\n";
|
||||
}
|
||||
|
||||
foreach ($GLOBALS['js_events'] as $js_event) {
|
||||
echo "$(window.parent).bind('" . $js_event['event'] . "', "
|
||||
. $js_event['function'] . ");\n";
|
||||
}
|
||||
?>
|
||||
// ]]>
|
||||
</script>
|
||||
<?php
|
||||
// Reloads the navigation frame via JavaScript if required
|
||||
PMA_reloadNavigation();
|
||||
|
||||
?>
|
||||
@ -126,8 +126,7 @@ function PMA_showEmptyResultMessageOrSetUniqueCondition($rows, $key_id,
|
||||
if (! $rows[$key_id]) {
|
||||
unset($rows[$key_id], $where_clause_array[$key_id]);
|
||||
PMA_showMessage(__('MySQL returned an empty result set (i.e. zero rows).'), $local_query);
|
||||
echo "\n";
|
||||
include 'libraries/footer.inc.php';
|
||||
exit;
|
||||
} else {// end if (no row returned)
|
||||
$meta = PMA_DBI_get_fields_meta($result[$key_id]);
|
||||
list($unique_condition, $tmp_clause_is_unique)
|
||||
@ -1551,8 +1550,10 @@ function PMA_isInsertRow()
|
||||
&& $_REQUEST['insert_rows'] != $GLOBALS['cfg']['InsertRows']
|
||||
) {
|
||||
$GLOBALS['cfg']['InsertRows'] = $_REQUEST['insert_rows'];
|
||||
$GLOBALS['js_include'][] = 'tbl_change.js';
|
||||
include_once 'libraries/header.inc.php';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('tbl_change.js');
|
||||
include 'tbl_change.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -142,7 +142,6 @@ if (! empty($submit_mult)
|
||||
if (!empty($submit_mult) && !empty($what)) {
|
||||
unset($message);
|
||||
|
||||
include_once './libraries/header.inc.php';
|
||||
if (strlen($table)) {
|
||||
include './libraries/tbl_common.inc.php';
|
||||
$url_query .= '&goto=tbl_sql.php&back=tbl_sql.php';
|
||||
@ -325,7 +324,7 @@ if (!empty($submit_mult) && !empty($what)) {
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
include './libraries/footer.inc.php';
|
||||
exit;
|
||||
|
||||
} elseif ($mult_btn == __('Yes')) {
|
||||
/**
|
||||
|
||||
@ -53,7 +53,7 @@ if ($GLOBALS['cfg']['LeftDisplayLogo']) {
|
||||
?>
|
||||
<div id="leftframelinks">
|
||||
<?php
|
||||
echo '<a href="main.php?' . $query_url . '"'
|
||||
echo '<a target="frame_content" href="main.php?' . $query_url . '"'
|
||||
.' title="' . __('Home') . '">'
|
||||
. PMA_getImage('b_home.png', __('Home'))
|
||||
.'</a>' . "\n";
|
||||
|
||||
@ -1,99 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Output buffer functions for phpMyAdmin
|
||||
*
|
||||
* Copyright 2001 Jeremy Brand <jeremy@nirvani.net>
|
||||
* http://www.jeremybrand.com/Jeremy/Brand/Jeremy_Brand.html
|
||||
*
|
||||
* Check for all the needed functions for output buffering
|
||||
* Make some wrappers for the top and bottoms of our files.
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function be used eventually to support more modes. It is needed
|
||||
* because both header and footer functions must know what each other is
|
||||
* doing.
|
||||
*
|
||||
* @staticvar integer remember last calculated value
|
||||
* @return integer the output buffer mode
|
||||
*/
|
||||
function PMA_outBufferModeGet()
|
||||
{
|
||||
static $mode = null;
|
||||
|
||||
if (null !== $mode) {
|
||||
return $mode;
|
||||
}
|
||||
|
||||
$mode = 0;
|
||||
|
||||
if ($GLOBALS['cfg']['OBGzip'] && function_exists('ob_start')) {
|
||||
if (ini_get('output_handler') == 'ob_gzhandler') {
|
||||
// If a user sets the output_handler in php.ini to ob_gzhandler, then
|
||||
// any right frame file in phpMyAdmin will not be handled properly by
|
||||
// the browser. My fix was to check the ini file within the
|
||||
// PMA_outBufferModeGet() function.
|
||||
$mode = 0;
|
||||
} elseif (function_exists('ob_get_level') && ob_get_level() > 0) {
|
||||
// If output buffering is enabled in php.ini it's not possible to
|
||||
// add the ob_gzhandler without a warning message from php 4.3.0.
|
||||
// Being better safe than sorry, check for any existing output handler
|
||||
// instead of just checking the 'output_buffering' setting.
|
||||
$mode = 0;
|
||||
} else {
|
||||
$mode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Zero (0) is no mode or in other words output buffering is OFF.
|
||||
// Follow 2^0, 2^1, 2^2, 2^3 type values for the modes.
|
||||
// Usefull if we ever decide to combine modes. Then a bitmask field of
|
||||
// the sum of all modes will be the natural choice.
|
||||
|
||||
return $mode;
|
||||
} // end of the 'PMA_outBufferModeGet()' function
|
||||
|
||||
|
||||
/**
|
||||
* This function will need to run at the top of all pages if output
|
||||
* output buffering is turned on. It also needs to be passed $mode from
|
||||
* the PMA_outBufferModeGet() function or it will be useless.
|
||||
*
|
||||
*/
|
||||
function PMA_outBufferPre()
|
||||
{
|
||||
if ($mode = PMA_outBufferModeGet()) {
|
||||
ob_start('ob_gzhandler');
|
||||
}
|
||||
|
||||
header('X-ob_mode: ' . $mode);
|
||||
|
||||
register_shutdown_function('PMA_outBufferPost');
|
||||
} // end of the 'PMA_outBufferPre()' function
|
||||
|
||||
|
||||
/**
|
||||
* This function will need to run at the bottom of all pages if output
|
||||
* buffering is turned on. It also needs to be passed $mode from the
|
||||
* PMA_outBufferModeGet() function or it will be useless.
|
||||
*
|
||||
*/
|
||||
function PMA_outBufferPost()
|
||||
{
|
||||
if (ob_get_status() && PMA_outBufferModeGet()) {
|
||||
ob_flush();
|
||||
}
|
||||
/**
|
||||
* previously we had here an "else flush()" but some PHP versions
|
||||
* (at least PHP 5.2.11) have a bug (49816) that produces garbled
|
||||
* data
|
||||
*/
|
||||
} // end of the 'PMA_outBufferPost()' function
|
||||
|
||||
?>
|
||||
@ -10,24 +10,18 @@ if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// not understand
|
||||
require_once './libraries/header_http.inc.php';
|
||||
|
||||
$GLOBALS['PMD']['STYLE'] = 'default';
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
$GLOBALS['script_display_field']
|
||||
= '<script type="text/javascript">' . "\n" .
|
||||
'// <![CDATA[' . "\n" .
|
||||
'var display_field = new Array();' . "\n";
|
||||
|
||||
/**
|
||||
* retrieves table info and stores it in $GLOBALS['PMD']
|
||||
*
|
||||
*/
|
||||
function get_tables_info()
|
||||
{
|
||||
$GLOBALS['script_display_field'] = 'var display_field = new Array();' . "\n";
|
||||
|
||||
$GLOBALS['PMD']['TABLE_NAME'] = array();// that foreach no error
|
||||
$GLOBALS['PMD']['OWNER'] = array();
|
||||
$GLOBALS['PMD']['TABLE_NAME_SMALL'] = array();
|
||||
@ -61,10 +55,7 @@ function get_tables_info()
|
||||
$i++;
|
||||
}
|
||||
|
||||
$GLOBALS['script_display_field'] .=
|
||||
'// ]]>' . "\n" .
|
||||
'</script>' . "\n";
|
||||
// return $GLOBALS['PMD']; // many bases // not use ??????
|
||||
return $GLOBALS['script_display_field'];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,10 +122,7 @@ function get_script_contr()
|
||||
}
|
||||
|
||||
$ti = 0;
|
||||
$script_contr
|
||||
= '<script type="text/javascript">' . "\n" .
|
||||
'// <![CDATA[' . "\n" .
|
||||
'var contr = new Array();' . "\n";
|
||||
$script_contr = 'var contr = new Array();' . "\n";
|
||||
for ($i = 0, $cnt = count($con["C_NAME"]); $i < $cnt; $i++) {
|
||||
$js_var = ' contr[' . $ti . ']';
|
||||
$script_contr .= $js_var . " = new Array();\n";
|
||||
@ -153,9 +141,6 @@ function get_script_contr()
|
||||
}
|
||||
$ti++;
|
||||
}
|
||||
$script_contr .=
|
||||
'// ]]>' . "\n" .
|
||||
'</script>' . "\n";
|
||||
return $script_contr;
|
||||
}
|
||||
|
||||
@ -203,19 +188,13 @@ function get_all_keys($unique_only = false)
|
||||
*/
|
||||
function get_script_tabs()
|
||||
{
|
||||
$script_tabs
|
||||
= '<script type="text/javascript">' . "\n" .
|
||||
'// <![CDATA[' . "\n" .
|
||||
'var j_tabs = new Array();' . "\n" .
|
||||
'var h_tabs = new Array();' . "\n" ;
|
||||
$script_tabs = 'var j_tabs = new Array();' . "\n"
|
||||
. 'var h_tabs = new Array();' . "\n" ;
|
||||
for ($i = 0, $cnt = count($GLOBALS['PMD']['TABLE_NAME']); $i < $cnt; $i++) {
|
||||
$script_tabs .= "j_tabs['" . $GLOBALS['PMD_URL']['TABLE_NAME'][$i] . "'] = '"
|
||||
. (PMA_isForeignKeySupported($GLOBALS['PMD']['TABLE_TYPE'][$i]) ? '1' : '0') . "';\n";
|
||||
$script_tabs .="h_tabs['" . $GLOBALS['PMD_URL']['TABLE_NAME'][$i] . "'] = 1;"."\n" ;
|
||||
}
|
||||
$script_tabs .=
|
||||
'// ]]>' . "\n" .
|
||||
'</script>' . "\n";
|
||||
return $script_tabs;
|
||||
}
|
||||
|
||||
@ -241,5 +220,4 @@ function get_tab_pos()
|
||||
return count($tab_pos) ? $tab_pos : null;
|
||||
}
|
||||
|
||||
get_tables_info();
|
||||
?>
|
||||
|
||||
@ -55,26 +55,18 @@ function PMA_query_as_controluser($sql, $show_error = true, $options = 0)
|
||||
/**
|
||||
* Returns current relation parameters
|
||||
*
|
||||
* @param bool $verbose whether to print diagnostic info
|
||||
*
|
||||
* @return array $cfgRelation
|
||||
*/
|
||||
function PMA_getRelationsParam($verbose = false)
|
||||
function PMA_getRelationsParam()
|
||||
{
|
||||
if (empty($_SESSION['relation'][$GLOBALS['server']])) {
|
||||
$_SESSION['relation'][$GLOBALS['server']] = PMA__getRelationsParam();
|
||||
}
|
||||
|
||||
// just for BC but needs to be before PMA_printRelationsParamDiagnostic()
|
||||
// just for BC but needs to be before PMA_getRelationsParamDiagnostic()
|
||||
// which uses it
|
||||
$GLOBALS['cfgRelation'] = $_SESSION['relation'][$GLOBALS['server']];
|
||||
|
||||
if ($verbose) {
|
||||
PMA_printRelationsParamDiagnostic(
|
||||
$_SESSION['relation'][$GLOBALS['server']]
|
||||
);
|
||||
}
|
||||
|
||||
return $_SESSION['relation'][$GLOBALS['server']];
|
||||
}
|
||||
|
||||
@ -83,10 +75,12 @@ function PMA_getRelationsParam($verbose = false)
|
||||
*
|
||||
* @param array $cfgRelation Relation configuration
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function PMA_printRelationsParamDiagnostic($cfgRelation)
|
||||
function PMA_getRelationsParamDiagnostic($cfgRelation)
|
||||
{
|
||||
$retval = '';
|
||||
|
||||
$messages['error'] = '<font color="red"><strong>'
|
||||
. __('not OK')
|
||||
. '</strong></font>'
|
||||
@ -97,211 +91,195 @@ function PMA_printRelationsParamDiagnostic($cfgRelation)
|
||||
$messages['ok'] = '<font color="green"><strong>'
|
||||
. _pgettext('Correctly working', 'OK')
|
||||
. '</strong></font>';
|
||||
|
||||
$messages['enabled'] = '<font color="green">' . __('Enabled') . '</font>';
|
||||
$messages['disabled'] = '<font color="red">' . __('Disabled') . '</font>';
|
||||
|
||||
if (false === $GLOBALS['cfg']['Server']['pmadb']) {
|
||||
echo 'PMA Database ... '
|
||||
$retval .= 'PMA Database ... '
|
||||
. sprintf($messages['error'], 'pmadb')
|
||||
. '<br />' . "\n"
|
||||
. __('General relation features')
|
||||
. ' <font color="green">' . __('Disabled')
|
||||
. '</font>' . "\n";
|
||||
return;
|
||||
} else {
|
||||
$retval .= '<table>' . "\n";
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'pmadb',
|
||||
$GLOBALS['cfg']['Server']['pmadb'],
|
||||
$messages,
|
||||
'pmadb'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'relation',
|
||||
isset($cfgRelation['relation']),
|
||||
$messages,
|
||||
'relation'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForFeature(
|
||||
__('General relation features'),
|
||||
'relwork',
|
||||
$messages
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'table_info',
|
||||
isset($cfgRelation['table_info']),
|
||||
$messages,
|
||||
'table_info'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForFeature(
|
||||
__('Display Features'),
|
||||
'displaywork',
|
||||
$messages
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'table_coords',
|
||||
isset($cfgRelation['table_coords']),
|
||||
$messages,
|
||||
'table_coords'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'pdf_pages',
|
||||
isset($cfgRelation['pdf_pages']),
|
||||
$messages,
|
||||
'table_coords'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForFeature(
|
||||
__('Creation of PDFs'),
|
||||
'pdfwork',
|
||||
$messages
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'column_info',
|
||||
isset($cfgRelation['column_info']),
|
||||
$messages,
|
||||
'col_com'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForFeature(
|
||||
__('Displaying Column Comments'),
|
||||
'commwork',
|
||||
$messages,
|
||||
false
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForFeature(
|
||||
__('Browser transformation'),
|
||||
'mimework',
|
||||
$messages
|
||||
);
|
||||
if ($cfgRelation['commwork'] && ! $cfgRelation['mimework']) {
|
||||
$retval .= '<tr><td colspan=2 class="left">';
|
||||
$retval .= __('Please see the documentation on how to update your column_comments table');
|
||||
$retval .= '</td></tr>';
|
||||
}
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'bookmarktable',
|
||||
isset($cfgRelation['bookmark']),
|
||||
$messages,
|
||||
'bookmark'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForFeature(
|
||||
__('Bookmarked SQL query'),
|
||||
'bookmarkwork',
|
||||
$messages
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'history',
|
||||
isset($cfgRelation['history']),
|
||||
$messages,
|
||||
'history'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForFeature(
|
||||
__('SQL history'),
|
||||
'historywork',
|
||||
$messages
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'designer_coords',
|
||||
isset($cfgRelation['designer_coords']),
|
||||
$messages,
|
||||
'designer_coords'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForFeature(
|
||||
__('Designer'),
|
||||
'designerwork',
|
||||
$messages
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'recent',
|
||||
isset($cfgRelation['recent']),
|
||||
$messages,
|
||||
'recent'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForFeature(
|
||||
__('Persistent recently used tables'),
|
||||
'recentwork',
|
||||
$messages
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'table_uiprefs',
|
||||
isset($cfgRelation['table_uiprefs']),
|
||||
$messages,
|
||||
'table_uiprefs'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForFeature(
|
||||
__('Persistent tables\' UI preferences'),
|
||||
'uiprefswork',
|
||||
$messages
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'tracking',
|
||||
isset($cfgRelation['tracking']),
|
||||
$messages,
|
||||
'tracking'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForFeature(
|
||||
__('Tracking'),
|
||||
'trackingwork',
|
||||
$messages
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForParameter(
|
||||
'userconfig',
|
||||
isset($cfgRelation['userconfig']),
|
||||
$messages,
|
||||
'userconfig'
|
||||
);
|
||||
$retval .= PMA_getDiagMessageForFeature(
|
||||
__('User preferences'),
|
||||
'userconfigwork',
|
||||
$messages
|
||||
);
|
||||
$retval .= '</table>' . "\n";
|
||||
|
||||
$retval .= '<p>' . __('Quick steps to setup advanced features:') . '</p>';
|
||||
$retval .= '<ul>';
|
||||
$retval .= '<li>';
|
||||
$retval .= __(
|
||||
'Create the needed tables with the '
|
||||
. '<code>examples/create_tables.sql</code>.'
|
||||
);
|
||||
$retval .= ' ' . PMA_showDocu('linked-tables');
|
||||
$retval .= '</li>';
|
||||
$retval .= '<li>';
|
||||
$retval .= __('Create a pma user and give access to these tables.');
|
||||
$retval .= ' ' . PMA_showDocu('pmausr');
|
||||
$retval .= '</li>';
|
||||
$retval .= '<li>';
|
||||
$retval .= __(
|
||||
'Enable advanced features in configuration file '
|
||||
. '(<code>config.inc.php</code>), for example by '
|
||||
. 'starting from <code>config.sample.inc.php</code>.'
|
||||
);
|
||||
$retval .= ' ' . PMA_showDocu('quick_install');
|
||||
$retval .= '</li>';
|
||||
$retval .= '<li>';
|
||||
$retval .= __(
|
||||
'Re-login to phpMyAdmin to load the updated configuration file.'
|
||||
);
|
||||
$retval .= '</li>';
|
||||
$retval .= '</ul>';
|
||||
}
|
||||
|
||||
echo '<table>' . "\n";
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'pmadb',
|
||||
$GLOBALS['cfg']['Server']['pmadb'],
|
||||
$messages,
|
||||
'pmadb'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'relation',
|
||||
isset($cfgRelation['relation']),
|
||||
$messages,
|
||||
'relation'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForFeature(
|
||||
__('General relation features'),
|
||||
'relwork',
|
||||
$messages
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'table_info',
|
||||
isset($cfgRelation['table_info']),
|
||||
$messages,
|
||||
'table_info'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForFeature(
|
||||
__('Display Features'),
|
||||
'displaywork',
|
||||
$messages
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'table_coords',
|
||||
isset($cfgRelation['table_coords']),
|
||||
$messages,
|
||||
'table_coords'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'pdf_pages',
|
||||
isset($cfgRelation['pdf_pages']),
|
||||
$messages,
|
||||
'table_coords'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForFeature(
|
||||
__('Creation of PDFs'),
|
||||
'pdfwork',
|
||||
$messages
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'column_info',
|
||||
isset($cfgRelation['column_info']),
|
||||
$messages,
|
||||
'col_com'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForFeature(
|
||||
__('Displaying Column Comments'),
|
||||
'commwork',
|
||||
$messages,
|
||||
false
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForFeature(
|
||||
__('Browser transformation'),
|
||||
'mimework',
|
||||
$messages
|
||||
);
|
||||
|
||||
if ($cfgRelation['commwork'] && ! $cfgRelation['mimework']) {
|
||||
echo '<tr><td colspan=2 class="left">'
|
||||
. __('Please see the documentation on how to update your column_comments table')
|
||||
. '</td></tr>' . "\n";
|
||||
}
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'bookmarktable',
|
||||
isset($cfgRelation['bookmark']),
|
||||
$messages,
|
||||
'bookmark'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForFeature(
|
||||
__('Bookmarked SQL query'),
|
||||
'bookmarkwork',
|
||||
$messages
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'history',
|
||||
isset($cfgRelation['history']),
|
||||
$messages,
|
||||
'history'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForFeature(
|
||||
__('SQL history'),
|
||||
'historywork',
|
||||
$messages
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'designer_coords',
|
||||
isset($cfgRelation['designer_coords']),
|
||||
$messages,
|
||||
'designer_coords'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForFeature(
|
||||
__('Designer'),
|
||||
'designerwork',
|
||||
$messages
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'recent',
|
||||
isset($cfgRelation['recent']),
|
||||
$messages,
|
||||
'recent'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForFeature(
|
||||
__('Persistent recently used tables'),
|
||||
'recentwork',
|
||||
$messages
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'table_uiprefs',
|
||||
isset($cfgRelation['table_uiprefs']),
|
||||
$messages,
|
||||
'table_uiprefs'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForFeature(
|
||||
__('Persistent tables\' UI preferences'),
|
||||
'uiprefswork',
|
||||
$messages
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'tracking',
|
||||
isset($cfgRelation['tracking']),
|
||||
$messages,
|
||||
'tracking'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForFeature(
|
||||
__('Tracking'),
|
||||
'trackingwork',
|
||||
$messages
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForParameter(
|
||||
'userconfig',
|
||||
isset($cfgRelation['userconfig']),
|
||||
$messages,
|
||||
'userconfig'
|
||||
);
|
||||
|
||||
PMA_printDiagMessageForFeature(
|
||||
__('User preferences'),
|
||||
'userconfigwork',
|
||||
$messages
|
||||
);
|
||||
|
||||
echo '</table>' . "\n";
|
||||
|
||||
echo '<p>' . __('Quick steps to setup advanced features:') . '</p>';
|
||||
echo '<ul>';
|
||||
echo '<li>'
|
||||
. __('Create the needed tables with the <code>examples/create_tables.sql</code>.')
|
||||
. ' ' . PMA_showDocu('linked-tables')
|
||||
. '</li>';
|
||||
echo '<li>'
|
||||
. __('Create a pma user and give access to these tables.')
|
||||
. ' ' . PMA_showDocu('pmausr')
|
||||
. '</li>';
|
||||
echo '<li>'
|
||||
. __('Enable advanced features in configuration file (<code>config.inc.php</code>), for example by starting from <code>config.sample.inc.php</code>.')
|
||||
. ' ' . PMA_showDocu('quick_install')
|
||||
. '</li>';
|
||||
echo '<li>'
|
||||
. __('Re-login to phpMyAdmin to load the updated configuration file.')
|
||||
. '</li>';
|
||||
echo '</ul>';
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -312,21 +290,22 @@ function PMA_printRelationsParamDiagnostic($cfgRelation)
|
||||
* @param array $messages utility messages
|
||||
* @param boolean $skip_line whether to skip a line after the message
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function PMA_printDiagMessageForFeature($feature_name,
|
||||
function PMA_getDiagMessageForFeature($feature_name,
|
||||
$relation_parameter, $messages, $skip_line = true
|
||||
) {
|
||||
echo ' <tr><td colspan=2 class="right">' . $feature_name . ': ';
|
||||
$retval = ' <tr><td colspan=2 class="right">' . $feature_name . ': ';
|
||||
if ($GLOBALS['cfgRelation'][$relation_parameter]) {
|
||||
echo $messages['enabled'];
|
||||
$retval .= $messages['enabled'];
|
||||
} else {
|
||||
echo $messages['disabled'];
|
||||
$retval .= $messages['disabled'];
|
||||
}
|
||||
echo '</td></tr>' . "\n";
|
||||
$retval .= '</td></tr>';
|
||||
if ($skip_line) {
|
||||
echo ' <tr><td> </td></tr>' . "\n";
|
||||
$retval .= '<tr><td> </td></tr>';
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -339,18 +318,19 @@ function PMA_printDiagMessageForFeature($feature_name,
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_printDiagMessageForParameter($parameter,
|
||||
function PMA_getDiagMessageForParameter($parameter,
|
||||
$relation_parameter_set, $messages, $doc_anchor
|
||||
) {
|
||||
echo '<tr><th class="left">';
|
||||
echo '$cfg[\'Servers\'][$i][\'' . $parameter . '\'] ... ';
|
||||
echo '</th><td class="right">';
|
||||
$retval = '<tr><th class="left">';
|
||||
$retval .= '$cfg[\'Servers\'][$i][\'' . $parameter . '\'] ... ';
|
||||
$retval .= '</th><td class="right">';
|
||||
if ($relation_parameter_set) {
|
||||
echo $messages['ok'];
|
||||
$retval .= $messages['ok'];
|
||||
} else {
|
||||
printf($messages['error'], $doc_anchor);
|
||||
$retval .= sprintf($messages['error'], $doc_anchor);
|
||||
}
|
||||
echo '</td></tr>' . "\n";
|
||||
$retval .= '</td></tr>' . "\n";
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -148,21 +148,22 @@ function PMA_EVN_handleEditor()
|
||||
|
||||
$output = PMA_getMessage($message, $sql_query);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
$extra_data = array();
|
||||
$response = PMA_Response::getInstance();
|
||||
if ($message->isSuccess()) {
|
||||
$columns = "`EVENT_NAME`, `EVENT_TYPE`, `STATUS`";
|
||||
$where = "EVENT_SCHEMA='" . PMA_sqlAddSlashes($db) . "' "
|
||||
. "AND EVENT_NAME='" . PMA_sqlAddSlashes($_REQUEST['item_name']) . "'";
|
||||
$query = "SELECT $columns FROM `INFORMATION_SCHEMA`.`EVENTS` WHERE $where;";
|
||||
$event = PMA_DBI_fetch_single_row($query);
|
||||
$extra_data['name'] = htmlspecialchars(strtoupper($_REQUEST['item_name']));
|
||||
$extra_data['new_row'] = PMA_EVN_getRowForList($event);
|
||||
$extra_data['insert'] = ! empty($event);
|
||||
$response = $output;
|
||||
$response->addJSON('name', htmlspecialchars(strtoupper($_REQUEST['item_name'])));
|
||||
$response->addJSON('new_row', PMA_EVN_getRowForList($event));
|
||||
$response->addJSON('insert', ! empty($event));
|
||||
$response->addJSON('message', $output);
|
||||
} else {
|
||||
$response = $message;
|
||||
$response->isSuccess(false);
|
||||
$response->addJSON('message', $message);
|
||||
}
|
||||
PMA_ajaxResponse($response, $message->isSuccess(), $extra_data);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
/**
|
||||
@ -200,14 +201,14 @@ function PMA_EVN_handleEditor()
|
||||
// Show form
|
||||
$editor = PMA_EVN_getEditorForm($mode, $operation, $item);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
$extra_data = array('title' => $title);
|
||||
PMA_ajaxResponse($editor, true, $extra_data);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON('message', $editor);
|
||||
$response->addJSON('title', $title);
|
||||
} else {
|
||||
echo "\n\n<h2>$title</h2>\n\n$editor";
|
||||
unset($_POST);
|
||||
include './libraries/footer.inc.php';
|
||||
}
|
||||
// exit;
|
||||
exit;
|
||||
} else {
|
||||
$message = __('Error in processing request') . ' : ';
|
||||
$message .= sprintf(
|
||||
@ -217,7 +218,10 @@ function PMA_EVN_handleEditor()
|
||||
);
|
||||
$message = PMA_message::error($message);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
PMA_ajaxResponse($message, false);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess(false);
|
||||
$response->addJSON('message', $message);
|
||||
exit;
|
||||
} else {
|
||||
$message->display();
|
||||
}
|
||||
|
||||
@ -26,8 +26,10 @@ function PMA_RTE_handleExport($item_name, $export_data)
|
||||
. htmlspecialchars(trim($export_data)) . '</textarea>';
|
||||
$title = sprintf(PMA_RTE_getWord('export'), $item_name);
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
$extra_data = array('title' => $title);
|
||||
PMA_ajaxResponse($export_data, true, $extra_data);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON('message', $export_data);
|
||||
$response->addJSON('title', $title);
|
||||
exit;
|
||||
} else {
|
||||
echo "<fieldset>\n"
|
||||
. "<legend>$title</legend>\n"
|
||||
@ -40,7 +42,10 @@ function PMA_RTE_handleExport($item_name, $export_data)
|
||||
. sprintf(PMA_RTE_getWord('not_found'), $item_name, $_db);
|
||||
$response = PMA_message::error($response);
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
PMA_ajaxResponse($response, false);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess(false);
|
||||
$response->addJSON('message', $response);
|
||||
exit;
|
||||
} else {
|
||||
$response->display();
|
||||
}
|
||||
|
||||
@ -87,11 +87,4 @@ case 'EVN':
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the footer, if necessary
|
||||
*/
|
||||
if ($GLOBALS['is_ajax_request'] != true) {
|
||||
include './libraries/footer.inc.php';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -301,21 +301,22 @@ function PMA_RTN_handleEditor()
|
||||
|
||||
$output = PMA_getMessage($message, $sql_query);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
$extra_data = array();
|
||||
$response = PMA_Response::getInstance();
|
||||
if ($message->isSuccess()) {
|
||||
$columns = "`SPECIFIC_NAME`, `ROUTINE_NAME`, `ROUTINE_TYPE`, `DTD_IDENTIFIER`, `ROUTINE_DEFINITION`";
|
||||
$where = "ROUTINE_SCHEMA='" . PMA_sqlAddSlashes($db) . "' "
|
||||
. "AND ROUTINE_NAME='" . PMA_sqlAddSlashes($_REQUEST['item_name']) . "'"
|
||||
. "AND ROUTINE_TYPE='" . PMA_sqlAddSlashes($_REQUEST['item_type']) . "'";
|
||||
$routine = PMA_DBI_fetch_single_row("SELECT $columns FROM `INFORMATION_SCHEMA`.`ROUTINES` WHERE $where;");
|
||||
$extra_data['name'] = htmlspecialchars(strtoupper($_REQUEST['item_name']));
|
||||
$extra_data['new_row'] = PMA_RTN_getRowForList($routine);
|
||||
$extra_data['insert'] = ! empty($routine);
|
||||
$response = $output;
|
||||
$response->addJSON('name', htmlspecialchars(strtoupper($_REQUEST['item_name'])));
|
||||
$response->addJSON('new_row', PMA_RTN_getRowForList($routine));
|
||||
$response->addJSON('insert', ! empty($routine));
|
||||
$response->addJSON('message', $output);
|
||||
} else {
|
||||
$response = $message;
|
||||
$response->isSuccess(false);
|
||||
$response->addJSON('message', $output);
|
||||
}
|
||||
PMA_ajaxResponse($response, $message->isSuccess(), $extra_data);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -359,15 +360,15 @@ function PMA_RTN_handleEditor()
|
||||
// Show form
|
||||
$editor = PMA_RTN_getEditorForm($mode, $operation, $routine);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
$template = PMA_RTN_getParameterRow();
|
||||
$extra_data = array('title' => $title,
|
||||
'param_template' => $template,
|
||||
'type' => $routine['item_type']);
|
||||
PMA_ajaxResponse($editor, true, $extra_data);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON('message', $editor);
|
||||
$response->addJSON('title', $title);
|
||||
$response->addJSON('param_template', PMA_RTN_getParameterRow());
|
||||
$response->addJSON('type', $routine['item_type']);
|
||||
} else {
|
||||
echo "\n\n<h2>$title</h2>\n\n$editor";
|
||||
}
|
||||
echo "\n\n<h2>$title</h2>\n\n$editor";
|
||||
include './libraries/footer.inc.php';
|
||||
// exit;
|
||||
exit;
|
||||
} else {
|
||||
$message = __('Error in processing request') . ' : ';
|
||||
$message .= sprintf(
|
||||
@ -377,7 +378,9 @@ function PMA_RTN_handleEditor()
|
||||
);
|
||||
$message = PMA_message::error($message);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
PMA_ajaxResponse($message, false);
|
||||
$response->isSuccess(false);
|
||||
$response->addJSON('message', $message);
|
||||
exit;
|
||||
} else {
|
||||
$message->display();
|
||||
}
|
||||
@ -1268,12 +1271,11 @@ function PMA_RTN_handleExecute()
|
||||
}
|
||||
// Print/send output
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
$extra_data = array('dialog' => false);
|
||||
PMA_ajaxResponse(
|
||||
$message->getDisplay() . $output,
|
||||
$message->isSuccess(),
|
||||
$extra_data
|
||||
);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess($message->isSuccess());
|
||||
$response->addJSON('message', $message->getDisplay() . $output);
|
||||
$response->addJSON('dialog', false);
|
||||
exit;
|
||||
} else {
|
||||
echo $message->getDisplay() . $output;
|
||||
if ($message->isError()) {
|
||||
@ -1293,7 +1295,10 @@ function PMA_RTN_handleExecute()
|
||||
);
|
||||
$message = PMA_message::error($message);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
PMA_ajaxResponse($message, $message->isSuccess());
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess(false);
|
||||
$response->addJSON('message', $message);
|
||||
exit;
|
||||
} else {
|
||||
echo $message->getDisplay();
|
||||
unset($_POST);
|
||||
@ -1307,19 +1312,18 @@ function PMA_RTN_handleExecute()
|
||||
if ($routine !== false) {
|
||||
$form = PMA_RTN_getExecuteForm($routine);
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
$extra_data = array();
|
||||
$extra_data['dialog'] = true;
|
||||
$extra_data['title'] = __("Execute routine") . " ";
|
||||
$extra_data['title'] .= PMA_backquote(
|
||||
$title = __("Execute routine") . " " . PMA_backquote(
|
||||
htmlentities($_GET['item_name'], ENT_QUOTES)
|
||||
);
|
||||
PMA_ajaxResponse($form, true, $extra_data);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON('message', $form);
|
||||
$response->addJSON('title', $title);
|
||||
$response->addJSON('dialog', true);
|
||||
} else {
|
||||
echo "\n\n<h2>" . __("Execute routine") . "</h2>\n\n";
|
||||
echo $form;
|
||||
include './libraries/footer.inc.php';
|
||||
// exit;
|
||||
}
|
||||
exit;
|
||||
} else if (($GLOBALS['is_ajax_request'] == true)) {
|
||||
$message = __('Error in processing request') . ' : ';
|
||||
$message .= sprintf(
|
||||
@ -1328,7 +1332,11 @@ function PMA_RTN_handleExecute()
|
||||
htmlspecialchars(PMA_backquote($db))
|
||||
);
|
||||
$message = PMA_message::error($message);
|
||||
PMA_ajaxResponse($message, false);
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess(false);
|
||||
$response->addJSON('message', $message);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ function PMA_TRI_handleEditor()
|
||||
|
||||
$output = PMA_getMessage($message, $sql_query);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
$extra_data = array();
|
||||
$response = PMA_Response::getInstance();
|
||||
if ($message->isSuccess()) {
|
||||
$items = PMA_DBI_get_triggers($db, $table, '');
|
||||
$trigger = false;
|
||||
@ -130,19 +130,24 @@ function PMA_TRI_handleEditor()
|
||||
$trigger = $value;
|
||||
}
|
||||
}
|
||||
$extra_data['insert'] = false;
|
||||
$insert = false;
|
||||
if (empty($table) || ($trigger !== false && $table == $trigger['table'])) {
|
||||
$extra_data['insert'] = true;
|
||||
$extra_data['new_row'] = PMA_TRI_getRowForList($trigger);
|
||||
$extra_data['name'] = htmlspecialchars(
|
||||
strtoupper($_REQUEST['item_name'])
|
||||
$insert = true;
|
||||
$response->addJSON('new_row', PMA_TRI_getRowForList($trigger));
|
||||
$response->addJSON(
|
||||
'name',
|
||||
htmlspecialchars(
|
||||
strtoupper($_REQUEST['item_name'])
|
||||
)
|
||||
);
|
||||
}
|
||||
$response = $output;
|
||||
$response->addJSON('insert', $insert);
|
||||
$response->addJSON('message', $output);
|
||||
} else {
|
||||
$response = $message;
|
||||
$response->addJSON('message', $message);
|
||||
$response->isSuccess(false);
|
||||
}
|
||||
PMA_ajaxResponse($response, $message->isSuccess(), $extra_data);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,14 +180,14 @@ function PMA_TRI_handleEditor()
|
||||
// Show form
|
||||
$editor = PMA_TRI_getEditorForm($mode, $item);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
$extra_data = array('title' => $title);
|
||||
PMA_ajaxResponse($editor, true, $extra_data);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON('message', $editor);
|
||||
$response->addJSON('title', $title);
|
||||
} else {
|
||||
echo "\n\n<h2>$title</h2>\n\n$editor";
|
||||
unset($_POST);
|
||||
include './libraries/footer.inc.php';
|
||||
}
|
||||
// exit;
|
||||
exit;
|
||||
} else {
|
||||
$message = __('Error in processing request') . ' : ';
|
||||
$message .= sprintf(
|
||||
@ -192,7 +197,10 @@ function PMA_TRI_handleEditor()
|
||||
);
|
||||
$message = PMA_message::error($message);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
PMA_ajaxResponse($message, false);
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess(false);
|
||||
$response->addJSON('message', $message);
|
||||
exit;
|
||||
} else {
|
||||
$message->display();
|
||||
}
|
||||
|
||||
@ -226,7 +226,6 @@ class PMA_Export_Relation_Schema
|
||||
{
|
||||
global $db;
|
||||
|
||||
include_once './libraries/header.inc.php';
|
||||
echo "<p><strong>" . __("SCHEMA ERROR: ") . $type . "</strong></p>" . "\n";
|
||||
if (!empty($error_message)) {
|
||||
$error_message = htmlspecialchars($error_message);
|
||||
@ -238,8 +237,7 @@ class PMA_Export_Relation_Schema
|
||||
. '&do=selectpage&chpage=' . $pageNumber . '&action_choose=0'
|
||||
. '">' . __('Back') . '</a>';
|
||||
echo "\n";
|
||||
include_once './libraries/footer.inc.php';
|
||||
exit();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -27,11 +27,6 @@ $url_query = PMA_generate_common_url($db);
|
||||
*/
|
||||
$err_url = 'main.php' . $url_query;
|
||||
|
||||
/**
|
||||
* Displays the headers
|
||||
*/
|
||||
require_once './libraries/header.inc.php';
|
||||
|
||||
/**
|
||||
* @global boolean Checks for superuser privileges
|
||||
*/
|
||||
|
||||
@ -45,11 +45,6 @@ $err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params);
|
||||
*/
|
||||
require_once './libraries/db_table_exists.lib.php';
|
||||
|
||||
/**
|
||||
* Displays headers
|
||||
*/
|
||||
require_once './libraries/header.inc.php';
|
||||
|
||||
if (PMA_Tracker::isActive()
|
||||
&& PMA_Tracker::isTracked($GLOBALS["db"], $GLOBALS["table"])
|
||||
) {
|
||||
|
||||
@ -17,7 +17,6 @@ PMA_checkParameters(array('db', 'table'));
|
||||
|
||||
/**
|
||||
* Defining global variables, in case this script is included by a function.
|
||||
* This is necessary because this script can be included by libraries/header.inc.php.
|
||||
*/
|
||||
global $showtable, $tbl_is_view, $tbl_storage_engine, $show_comment, $tbl_collation,
|
||||
$table_info_num_rows, $auto_increment;
|
||||
|
||||
@ -22,18 +22,18 @@ if (! defined('PHPMYADMIN')) {
|
||||
function PMA_tbl_getFields($db, $table)
|
||||
{
|
||||
// Gets the list and number of fields
|
||||
$fields = PMA_DBI_get_columns($db, $table, null, true);
|
||||
$fields_list = $fields_null = $fields_type = $fields_collation = array();
|
||||
$geom_column_present = false;
|
||||
$columns = PMA_DBI_get_columns($db, $table, null, true);
|
||||
$columnNames = $columnNullFlags = $columnTypes = $columnCollations = array();
|
||||
$geomColumnFlag = false;
|
||||
$geom_types = PMA_getGISDatatypes();
|
||||
|
||||
foreach ($fields as $key => $row) {
|
||||
$fields_list[] = $row['Field'];
|
||||
foreach ($columns as $key => $row) {
|
||||
$columnNames[] = $row['Field'];
|
||||
$type = $row['Type'];
|
||||
|
||||
// check whether table contains geometric columns
|
||||
if (in_array($type, $geom_types)) {
|
||||
$geom_column_present = true;
|
||||
$geomColumnFlag = true;
|
||||
}
|
||||
|
||||
// reformat mysql query output
|
||||
@ -55,35 +55,35 @@ function PMA_tbl_getFields($db, $table)
|
||||
if (empty($type)) {
|
||||
$type = ' ';
|
||||
}
|
||||
$fields_null[] = $row['Null'];
|
||||
$fields_type[] = $type;
|
||||
$fields_collation[]
|
||||
$columnNullFlags[] = $row['Null'];
|
||||
$columnTypes[] = $type;
|
||||
$columnCollations[]
|
||||
= ! empty($row['Collation']) && $row['Collation'] != 'NULL'
|
||||
? $row['Collation']
|
||||
: '';
|
||||
} // end while
|
||||
|
||||
return array(
|
||||
$fields_list,
|
||||
$fields_type,
|
||||
$fields_collation,
|
||||
$fields_null,
|
||||
$geom_column_present
|
||||
$columnNames,
|
||||
$columnTypes,
|
||||
$columnCollations,
|
||||
$columnNullFlags,
|
||||
$geomColumnFlag
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the table header for displaying a table in query-by-example format.
|
||||
*
|
||||
* @param bool $geom_column_present whether a geometry column is present
|
||||
* @param bool $geomColumnFlag whether a geometry column is present
|
||||
*
|
||||
* @return HTML content, the tags and content for table header
|
||||
*/
|
||||
function PMA_tbl_setTableHeader($geom_column_present = false)
|
||||
function PMA_tbl_getTableHeader($geomColumnFlag = false)
|
||||
{
|
||||
// Display the Function column only if there is alteast one geomety colum
|
||||
// Display the Function column only if there is at least one geometry column
|
||||
$func = '';
|
||||
if ($geom_column_present) {
|
||||
if ($geomColumnFlag) {
|
||||
$func = '<th>' . __('Function') . '</th>';
|
||||
}
|
||||
|
||||
@ -129,13 +129,13 @@ function PMA_tbl_getSubTabs()
|
||||
* @param array $foreigners Array of foreign keys
|
||||
* @param array $foreignData Foreign keys data
|
||||
* @param string $field Column name
|
||||
* @param string $tbl_fields_type Column type
|
||||
* @param int $i Column index
|
||||
* @param string $field_type Column type
|
||||
* @param int $column_index Column index
|
||||
* @param string $db Selected database
|
||||
* @param string $table Selected table
|
||||
* @param array $titles Selected title
|
||||
* @param int $foreignMaxLimit Max limit of displaying foreign elements
|
||||
* @param array $fields Array of search criteria inputs
|
||||
* @param array $criteriaValues Array of search criteria inputs
|
||||
* @param bool $in_fbs Whether we are in 'function based search'
|
||||
* @param bool $in_zoom_search_edit Whether we are in zoom search edit
|
||||
*
|
||||
@ -143,16 +143,19 @@ function PMA_tbl_getSubTabs()
|
||||
* for search criteria input.
|
||||
*/
|
||||
function PMA_getForeignFields_Values($foreigners, $foreignData, $field,
|
||||
$tbl_fields_type, $i, $db, $table, $titles, $foreignMaxLimit, $fields,
|
||||
$in_fbs = false, $in_zoom_search_edit = false
|
||||
$field_type, $column_index, $db, $table, $titles, $foreignMaxLimit,
|
||||
$criteriaValues, $in_fbs = false, $in_zoom_search_edit = false
|
||||
) {
|
||||
$str = '';
|
||||
$field_type = (string)$field_type;
|
||||
$field_id = ($in_zoom_search_edit) ? 'edit_fieldID_' : 'fieldID_';
|
||||
if ($foreigners
|
||||
&& isset($foreigners[$field])
|
||||
&& is_array($foreignData['disp_row'])
|
||||
) {
|
||||
// f o r e i g n k e y s
|
||||
$str .= '<select name="fields[' . $i . ']" id="fieldID_' . $i .'">';
|
||||
$str .= '<select name="criteriaValues[' . $column_index . ']" id="'
|
||||
. $field_id . $column_index .'">';
|
||||
// go back to first row
|
||||
// here, the 4th parameter is empty because there is no current
|
||||
// value of data for the dropdown (the search page initial values
|
||||
@ -164,29 +167,34 @@ function PMA_getForeignFields_Values($foreigners, $foreignData, $field,
|
||||
$str .= '</select>';
|
||||
|
||||
} elseif ($foreignData['foreign_link'] == true) {
|
||||
if (isset($fields[$i]) && is_string($fields[$i])) {
|
||||
$str .= '<input type="text" id="fieldID_' . $i . '"'
|
||||
. ' name="fields[' . $i . ']" value="' . $fields[$i] . '"'
|
||||
. ' id="field_' . md5($field) . '[' . $i .']" class="textfield" />';
|
||||
if (isset($criteriaValues[$column_index])
|
||||
&& is_string($criteriaValues[$column_index])
|
||||
) {
|
||||
$str .= '<input type="text" id="' . $field_id . $column_index . '"'
|
||||
. ' name="criteriaValues[' . $column_index . ']" value="'
|
||||
. $criteriaValues[$column_index] . '" id="field_' . md5($field)
|
||||
. '[' . $column_index .']" class="textfield" />';
|
||||
} else {
|
||||
$str .= '<input type="text" id="fieldID_' . $i . '"'
|
||||
. ' name="fields[' . $i . ']"'
|
||||
. ' id="field_' . md5($field) . '[' . $i .']" class="textfield" />';
|
||||
$str .= '<input type="text" id="' . $field_id . $column_index . '"'
|
||||
. ' name="criteriaValues[' . $column_index . ']"'
|
||||
. ' id="field_' . md5($field) . '[' . $column_index .']" '
|
||||
.'class="textfield" />';
|
||||
}
|
||||
$str .= <<<EOT
|
||||
<a target="_blank" onclick="window.open(this.href, 'foreigners', 'width=640,height=240,scrollbars=yes'); return false" href="browse_foreigners.php?
|
||||
EOT;
|
||||
$str .= '' . PMA_generate_common_url($db, $table)
|
||||
. '&field=' . urlencode($field) . '&fieldkey=' . $i . '"';
|
||||
. '&field=' . urlencode($field) . '&fieldkey=' . $column_index
|
||||
. '"';
|
||||
if ($in_zoom_search_edit) {
|
||||
$str .= ' class="browse_foreign"';
|
||||
}
|
||||
$str .= '>' . str_replace("'", "\'", $titles['Browse']) . '</a>';
|
||||
|
||||
} elseif (in_array($tbl_fields_type[$i], PMA_getGISDatatypes())) {
|
||||
} elseif (in_array($field_type, PMA_getGISDatatypes())) {
|
||||
// g e o m e t r y
|
||||
$str .= '<input type="text" name="fields[' . $i . ']"'
|
||||
. ' size="40" class="textfield" id="field_' . $i . '" />';
|
||||
$str .= '<input type="text" name="criteriaValues[' . $column_index . ']"'
|
||||
. ' size="40" class="textfield" id="field_' . $column_index . '" />';
|
||||
|
||||
if ($in_fbs) {
|
||||
$edit_url = 'gis_data_editor.php?' . PMA_generate_common_url();
|
||||
@ -198,8 +206,8 @@ EOT;
|
||||
$str .= '</span>';
|
||||
}
|
||||
|
||||
} elseif (strncasecmp($tbl_fields_type[$i], 'enum', 4) == 0
|
||||
|| (strncasecmp($tbl_fields_type[$i], 'set', 3) == 0 && $in_zoom_search_edit)
|
||||
} elseif (strncasecmp($field_type, 'enum', 4) == 0
|
||||
|| (strncasecmp($field_type, 'set', 3) == 0 && $in_zoom_search_edit)
|
||||
) {
|
||||
// e n u m s a n d s e t s
|
||||
|
||||
@ -211,23 +219,25 @@ EOT;
|
||||
|
||||
$value = explode(
|
||||
', ',
|
||||
str_replace("'", '', substr($tbl_fields_type[$i], 5, -1))
|
||||
str_replace("'", '', substr($field_type, 5, -1))
|
||||
);
|
||||
$cnt_value = count($value);
|
||||
|
||||
if ((strncasecmp($tbl_fields_type[$i], 'enum', 4) && ! $in_zoom_search_edit)
|
||||
|| (strncasecmp($tbl_fields_type[$i], 'set', 3) && $in_zoom_search_edit)
|
||||
if ((strncasecmp($field_type, 'enum', 4) && ! $in_zoom_search_edit)
|
||||
|| (strncasecmp($field_type, 'set', 3) && $in_zoom_search_edit)
|
||||
) {
|
||||
$str .= '<select name="fields[' . ($i) . '][]" id="fieldID_' . $i .'">';
|
||||
$str .= '<select name="criteriaValues[' . ($column_index)
|
||||
. '][]" id="' . $field_id . $column_index .'">';
|
||||
} else {
|
||||
$str .= '<select name="fields[' . ($i) . '][]" id="fieldID_' . $i .'"'
|
||||
. ' multiple="multiple" size="' . min(3, $cnt_value) . '">';
|
||||
$str .= '<select name="criteriaValues[' . ($column_index)
|
||||
. '][]" id="' . $field_id . $column_index .'" multiple="multiple" size="'
|
||||
. min(3, $cnt_value) . '">';
|
||||
}
|
||||
|
||||
for ($j = 0; $j < $cnt_value; $j++) {
|
||||
if (isset($fields[$i])
|
||||
&& is_array($fields[$i])
|
||||
&& in_array($value[$j], $fields[$i])
|
||||
if (isset($criteriaValues[$column_index])
|
||||
&& is_array($criteriaValues[$column_index])
|
||||
&& in_array($value[$j], $criteriaValues[$column_index])
|
||||
) {
|
||||
$str .= '<option value="' . $value[$j] . '" Selected>'
|
||||
. $value[$j] . '</option>';
|
||||
@ -241,24 +251,26 @@ EOT;
|
||||
} else {
|
||||
// o t h e r c a s e s
|
||||
$the_class = 'textfield';
|
||||
$type = $tbl_fields_type[$i];
|
||||
|
||||
if ($type == 'date') {
|
||||
if ($field_type == 'date') {
|
||||
$the_class .= ' datefield';
|
||||
} elseif ($type == 'datetime' || substr($type, 0, 9) == 'timestamp') {
|
||||
} elseif ($field_type == 'datetime' || substr($field_type, 0, 9) == 'timestamp') {
|
||||
$the_class .= ' datetimefield';
|
||||
} elseif (substr($type, 0, 3) == 'bit') {
|
||||
} elseif (substr($field_type, 0, 3) == 'bit') {
|
||||
$the_class .= ' bit';
|
||||
}
|
||||
|
||||
if (isset($fields[$i]) && is_string($fields[$i])) {
|
||||
$str .= '<input type="text" name="fields[' . $i . ']"'
|
||||
.' size="40" class="' . $the_class . '" id="fieldID_'
|
||||
. $i .'" value = "' . $fields[$i] . '"/>';
|
||||
if (isset($criteriaValues[$column_index])
|
||||
&& is_string($criteriaValues[$column_index])
|
||||
) {
|
||||
$str .= '<input type="text" name="criteriaValues[' . $column_index . ']"'
|
||||
.' size="40" class="' . $the_class . '" id="' . $field_id
|
||||
. $column_index .'" value = "' . $criteriaValues[$column_index]
|
||||
. '"/>';
|
||||
} else {
|
||||
$str .= '<input type="text" name="fields[' . $i . ']"'
|
||||
.' size="40" class="' . $the_class . '" id="fieldID_'
|
||||
. $i .'" />';
|
||||
$str .= '<input type="text" name="criteriaValues[' . $column_index . ']"'
|
||||
.' size="40" class="' . $the_class . '" id="' . $field_id
|
||||
. $column_index .'" />';
|
||||
}
|
||||
}
|
||||
return $str;
|
||||
@ -267,18 +279,18 @@ EOT;
|
||||
/**
|
||||
* Return the where clause for query generation based on the inputs provided.
|
||||
*
|
||||
* @param mixed $fields Search criteria input
|
||||
* @param string $names Name of the column on which search is submitted
|
||||
* @param string $types Type of the field
|
||||
* @param string $collations Field collation
|
||||
* @param string $func_type Search fucntion/operator
|
||||
* @param bool $unaryFlag Whether operator unary or not
|
||||
* @param bool $geom_func Whether geometry functions should be applied
|
||||
* @param mixed $criteriaValues Search criteria input
|
||||
* @param string $names Name of the column on which search is submitted
|
||||
* @param string $types Type of the field
|
||||
* @param string $collations Field collation
|
||||
* @param string $func_type Search fucntion/operator
|
||||
* @param bool $unaryFlag Whether operator unary or not
|
||||
* @param bool $geom_func Whether geometry functions should be applied
|
||||
*
|
||||
* @return string HTML content for viewing foreing data and elements
|
||||
* for search criteria input.
|
||||
*/
|
||||
function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
|
||||
function PMA_tbl_search_getWhereClause($criteriaValues, $names, $types, $collations,
|
||||
$func_type, $unaryFlag, $geom_func = null
|
||||
) {
|
||||
/**
|
||||
@ -303,7 +315,7 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
|
||||
} else {
|
||||
// If the function takes two parameters
|
||||
// create gis data from the string
|
||||
$gis_data = PMA_createGISData($fields);
|
||||
$gis_data = PMA_createGISData($criteriaValues);
|
||||
|
||||
$w = $geom_func . '(' . PMA_backquote($names) . ',' . $gis_data . ')';
|
||||
return $w;
|
||||
@ -313,7 +325,7 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
|
||||
$types = $geom_funcs[$geom_func]['type'];
|
||||
|
||||
// If the where clause is something like 'IsEmpty(`spatial_col_name`)'
|
||||
if (isset($geom_unary_functions[$geom_func]) && trim($fields) == '') {
|
||||
if (isset($geom_unary_functions[$geom_func]) && trim($criteriaValues) == '') {
|
||||
$w = $backquoted_name;
|
||||
return $w;
|
||||
}
|
||||
@ -322,20 +334,20 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
|
||||
}
|
||||
|
||||
if ($unaryFlag) {
|
||||
$fields = '';
|
||||
$criteriaValues = '';
|
||||
$w = $backquoted_name . ' ' . $func_type;
|
||||
|
||||
} elseif (in_array($types, PMA_getGISDatatypes()) && ! empty($fields)) {
|
||||
} elseif (in_array($types, PMA_getGISDatatypes()) && ! empty($criteriaValues)) {
|
||||
// create gis data from the string
|
||||
$gis_data = PMA_createGISData($fields);
|
||||
$gis_data = PMA_createGISData($criteriaValues);
|
||||
$w = $backquoted_name . ' ' . $func_type . ' ' . $gis_data;
|
||||
|
||||
} elseif (strncasecmp($types, 'enum', 4) == 0) {
|
||||
if (! empty($fields)) {
|
||||
if (! is_array($fields)) {
|
||||
$fields = explode(',', $fields);
|
||||
if (! empty($criteriaValues)) {
|
||||
if (! is_array($criteriaValues)) {
|
||||
$criteriaValues = explode(',', $criteriaValues);
|
||||
}
|
||||
$enum_selected_count = count($fields);
|
||||
$enum_selected_count = count($criteriaValues);
|
||||
if ($func_type == '=' && $enum_selected_count > 1) {
|
||||
$func_type = 'IN';
|
||||
$parens_open = '(';
|
||||
@ -350,16 +362,17 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
|
||||
$parens_open = '';
|
||||
$parens_close = '';
|
||||
}
|
||||
$enum_where = '\'' . PMA_sqlAddslashes($fields[0]) . '\'';
|
||||
$enum_where = '\'' . PMA_sqlAddslashes($criteriaValues[0]) . '\'';
|
||||
for ($e = 1; $e < $enum_selected_count; $e++) {
|
||||
$enum_where .= ', \'' . PMA_sqlAddslashes($fields[$e]) . '\'';
|
||||
$enum_where .= ', \'' . PMA_sqlAddslashes($criteriaValues[$e])
|
||||
. '\'';
|
||||
}
|
||||
|
||||
$w = $backquoted_name . ' ' . $func_type . ' ' . $parens_open
|
||||
. $enum_where . $parens_close;
|
||||
}
|
||||
|
||||
} elseif ($fields != '') {
|
||||
} elseif ($criteriaValues != '') {
|
||||
// For these types we quote the value. Even if it's another type (like INT),
|
||||
// for a LIKE we always quote the value. MySQL converts strings to numbers
|
||||
// and numbers to strings as necessary during the comparison
|
||||
@ -374,11 +387,11 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
|
||||
// LIKE %...%
|
||||
if ($func_type == 'LIKE %...%') {
|
||||
$func_type = 'LIKE';
|
||||
$fields = '%' . $fields . '%';
|
||||
$criteriaValues = '%' . $criteriaValues . '%';
|
||||
}
|
||||
if ($func_type == 'REGEXP ^...$') {
|
||||
$func_type = 'REGEXP';
|
||||
$fields = '^' . $fields . '$';
|
||||
$criteriaValues = '^' . $criteriaValues . '$';
|
||||
}
|
||||
|
||||
if ($func_type == 'IN (...)'
|
||||
@ -389,7 +402,7 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
|
||||
$func_type = str_replace(' (...)', '', $func_type);
|
||||
|
||||
// quote values one by one
|
||||
$values = explode(',', $fields);
|
||||
$values = explode(',', $criteriaValues);
|
||||
foreach ($values as &$value) {
|
||||
$value = $quot . PMA_sqlAddslashes(trim($value)) . $quot;
|
||||
}
|
||||
@ -404,7 +417,7 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
|
||||
}
|
||||
} else {
|
||||
$w = $backquoted_name . ' ' . $func_type . ' '
|
||||
. $quot . PMA_sqlAddslashes($fields) . $quot;;
|
||||
. $quot . PMA_sqlAddslashes($criteriaValues) . $quot;;
|
||||
}
|
||||
} // end if
|
||||
|
||||
@ -414,18 +427,10 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
|
||||
/**
|
||||
* Builds the sql search query from the post parameters
|
||||
*
|
||||
* @param string $table Selected table
|
||||
* @param array $fields Entered values of the columns
|
||||
* @param array $criteriaColumnNames Names of all columns
|
||||
* @param array $criteriaColumnTypes Types of all columns
|
||||
* @param array $criteriaColumnCollations Collations of all columns
|
||||
* @param array $criteriaColumnOperators Operators for given column type
|
||||
*
|
||||
* @return string the generated SQL query
|
||||
*/
|
||||
function PMA_tblSearchBuildSqlQuery($table, $fields, $criteriaColumnNames,
|
||||
$criteriaColumnTypes, $criteriaColumnCollations, $criteriaColumnOperators
|
||||
) {
|
||||
function PMA_tblSearchBuildSqlQuery()
|
||||
{
|
||||
$sql_query = 'SELECT ';
|
||||
|
||||
// If only distinct values are needed
|
||||
@ -437,21 +442,21 @@ function PMA_tblSearchBuildSqlQuery($table, $fields, $criteriaColumnNames,
|
||||
// if all column names were selected to display, we do a 'SELECT *'
|
||||
// (more efficient and this helps prevent a problem in IE
|
||||
// if one of the rows is edited and we come back to the Select results)
|
||||
if (count($_POST['columnsToDisplay']) == count($criteriaColumnNames)) {
|
||||
if (isset($_POST['zoom_submit'])) {
|
||||
$sql_query .= '* ';
|
||||
} else {
|
||||
$sql_query .= implode(', ', PMA_backquote($_POST['columnsToDisplay']));
|
||||
$sql_query .= (count($_POST['columnsToDisplay'])
|
||||
== count($_POST['criteriaColumnNames'])
|
||||
? '* '
|
||||
: implode(', ', PMA_backquote($_POST['columnsToDisplay'])));
|
||||
} // end if
|
||||
|
||||
$sql_query .= ' FROM ' . PMA_backquote($table);
|
||||
$whereClause = PMA_tblSearchGenerateWhereClause(
|
||||
$fields, $criteriaColumnNames, $criteriaColumnTypes,
|
||||
$criteriaColumnCollations, $criteriaColumnOperators
|
||||
);
|
||||
$sql_query .= ' FROM ' . PMA_backquote($_POST['table']);
|
||||
$whereClause = PMA_tblSearchGenerateWhereClause();
|
||||
$sql_query .= $whereClause;
|
||||
|
||||
|
||||
// if the search results are to be ordered
|
||||
if ($_POST['orderByColumn'] != '--nil--') {
|
||||
if (isset($_POST['orderByColumn']) && $_POST['orderByColumn'] != '--nil--') {
|
||||
$sql_query .= ' ORDER BY ' . PMA_backquote($_POST['orderByColumn'])
|
||||
. ' ' . $_POST['order'];
|
||||
} // end if
|
||||
@ -461,40 +466,39 @@ function PMA_tblSearchBuildSqlQuery($table, $fields, $criteriaColumnNames,
|
||||
/**
|
||||
* Generates the where clause for the SQL search query to be executed
|
||||
*
|
||||
* @param array $fields Entered values of the columns
|
||||
* @param array $criteriaColumnNames Names of all columns
|
||||
* @param array $criteriaColumnTypes Types of all columns
|
||||
* @param array $criteriaColumnCollations Collations of all columns
|
||||
* @param array $criteriaColumnOperators Operators for given column type
|
||||
*
|
||||
* @return string the generated where clause
|
||||
*/
|
||||
function PMA_tblSearchGenerateWhereClause($fields, $criteriaColumnNames,
|
||||
$criteriaColumnTypes, $criteriaColumnCollations, $criteriaColumnOperators
|
||||
) {
|
||||
function PMA_tblSearchGenerateWhereClause()
|
||||
{
|
||||
$fullWhereClause = '';
|
||||
|
||||
if (trim($_POST['customWhereClause']) != '') {
|
||||
if (isset($_POST['customWhereClause']) && trim($_POST['customWhereClause']) != '') {
|
||||
$fullWhereClause .= ' WHERE ' . $_POST['customWhereClause'];
|
||||
return $fullWhereClause;
|
||||
}
|
||||
|
||||
// If there are no search criterias set, return
|
||||
if (! array_filter($fields)) {
|
||||
// If there are no search criteria set, return
|
||||
if (! array_filter($_POST['criteriaValues'])) {
|
||||
return $fullWhereClause;
|
||||
}
|
||||
|
||||
// else continue to form the where clause from column criteria values
|
||||
$fullWhereClause = $charsets = array();
|
||||
reset($criteriaColumnOperators);
|
||||
while (list($i, $operator) = each($criteriaColumnOperators)) {
|
||||
list($charsets[$i]) = explode('_', $criteriaColumnCollations[$i]);
|
||||
reset($_POST['criteriaColumnOperators']);
|
||||
while (list($column_index, $operator) = each($_POST['criteriaColumnOperators'])) {
|
||||
list($charsets[$column_index]) = explode(
|
||||
'_', $_POST['criteriaColumnCollations'][$column_index]
|
||||
);
|
||||
$unaryFlag = $GLOBALS['PMA_Types']->isUnaryOperator($operator);
|
||||
$tmp_geom_func = isset($geom_func[$i]) ? $geom_func[$i] : null;
|
||||
$tmp_geom_func = isset($geom_func[$column_index])
|
||||
? $geom_func[$column_index] : null;
|
||||
|
||||
$whereClause = PMA_tbl_search_getWhereClause(
|
||||
$fields[$i], $criteriaColumnNames[$i], $criteriaColumnTypes[$i],
|
||||
$criteriaColumnCollations[$i], $operator, $unaryFlag, $tmp_geom_func
|
||||
$_POST['criteriaValues'][$column_index],
|
||||
$_POST['criteriaColumnNames'][$column_index],
|
||||
$_POST['criteriaColumnTypes'][$column_index],
|
||||
$_POST['criteriaColumnCollations'][$column_index], $operator, $unaryFlag,
|
||||
$tmp_geom_func
|
||||
);
|
||||
|
||||
if ($whereClause) {
|
||||
@ -519,8 +523,8 @@ function PMA_tblSearchGenerateWhereClause($fields, $criteriaColumnNames,
|
||||
*
|
||||
* @return string the generated HTML
|
||||
*/
|
||||
function PMA_tblSearchGetGeomFuncHtml($geomColumnFlag, $columnTypes,
|
||||
$geom_types, $column_index
|
||||
function PMA_tblSearchGetGeomFuncHtml($geomColumnFlag, $columnTypes, $geom_types,
|
||||
$column_index
|
||||
) {
|
||||
$html_output = '';
|
||||
// return if geometrical column is not present
|
||||
@ -557,12 +561,11 @@ function PMA_tblSearchGetGeomFuncHtml($geomColumnFlag, $columnTypes,
|
||||
/**
|
||||
* Generates formatted HTML for extra search options in table search form
|
||||
*
|
||||
* @param array $columnNames Array containing types of all columns in the table
|
||||
* @param integer $columnCount Number of columns in the table
|
||||
* @param array $columnNames Array containing types of all columns in the table
|
||||
*
|
||||
* @return string the generated HTML
|
||||
*/
|
||||
function PMA_tblSearchGetOptions($columnNames, $columnCount)
|
||||
function PMA_tblSearchGetOptions($columnNames)
|
||||
{
|
||||
$html_output = '';
|
||||
$html_output .= PMA_getDivForSliderEffect('searchoptions', __('Options'));
|
||||
@ -571,7 +574,7 @@ function PMA_tblSearchGetOptions($columnNames, $columnCount)
|
||||
*/
|
||||
$html_output .= '<fieldset id="fieldset_select_fields">'
|
||||
. '<legend>' . __('Select columns (at least one):') . '</legend>'
|
||||
. '<select name="columnsToDisplay[]" size="' . min($columnCount, 10)
|
||||
. '<select name="columnsToDisplay[]" size="' . min(count($columnNames), 10)
|
||||
. '" multiple="multiple">';
|
||||
// Displays the list of the fields
|
||||
foreach ($columnNames as $each_field) {
|
||||
@ -591,8 +594,9 @@ function PMA_tblSearchGetOptions($columnNames, $columnCount)
|
||||
. '<legend>' . '<em>' . __('Or') . '</em> '
|
||||
. __('Add search conditions (body of the "where" clause):') . '</legend>';
|
||||
$html_output .= PMA_showMySQLDocu('SQL-Syntax', 'Functions');
|
||||
$html_output .= '<input type="text" name="customWhereClause" class="textfield" size="64" />'
|
||||
. '</fieldset>';
|
||||
$html_output .= '<input type="text" name="customWhereClause" class="textfield"'
|
||||
. 'size="64" />';
|
||||
$html_output .= '</fieldset>';
|
||||
|
||||
/**
|
||||
* Displays option of changing default number of rows displayed per page
|
||||
@ -629,99 +633,340 @@ function PMA_tblSearchGetOptions($columnNames, $columnCount)
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates HTML for displaying fields table in search form
|
||||
* Other search criteria like data label
|
||||
* (for tbl_zoom_select.php)
|
||||
*
|
||||
* @param array $columnNames Names of columns in the table
|
||||
* @param array $dataLabel Label for points in zoom plot
|
||||
*
|
||||
* @return string the generated html
|
||||
*/
|
||||
function PMA_tblSearchGetOptionsZoom($columnNames, $dataLabel)
|
||||
{
|
||||
$html_output = '';
|
||||
$html_output .= '<table class="data">';
|
||||
//Select options for datalabel
|
||||
$html_output .= '<tr>';
|
||||
$html_output .= '<td><label for="dataLabel">'
|
||||
. __("Use this column to label each point") . '</label></td>';
|
||||
$html_output .= '<td><select name="dataLabel" id="dataLabel" >'
|
||||
. '<option value = "">' . __('None') . '</option>';
|
||||
for ($j = 0; $j < count($columnNames); $j++) {
|
||||
if (isset($dataLabel)
|
||||
&& $dataLabel == htmlspecialchars($columnNames[$j])
|
||||
) {
|
||||
$html_output .= '<option value="'
|
||||
. htmlspecialchars($columnNames[$j]) . '" selected="selected">'
|
||||
. htmlspecialchars($columnNames[$j]) . '</option>';
|
||||
} else {
|
||||
$html_output .= '<option value="'
|
||||
. htmlspecialchars($columnNames[$j]) . '" >'
|
||||
. htmlspecialchars($columnNames[$j]) . '</option>';
|
||||
}
|
||||
}
|
||||
$html_output .= '</select></td>';
|
||||
$html_output .= '</tr>';
|
||||
//Inputbox for changing default maximum rows to plot
|
||||
$html_output .= '<tr>';
|
||||
$html_output .= '<td><label for="maxRowPlotLimit">'
|
||||
. __("Maximum rows to plot") . '</label></td>';
|
||||
$html_output .= '<td>';
|
||||
$html_output .= '<input type="text" name="maxPlotLimit" id="maxRowPlotLimit" '
|
||||
. 'value="' . ((! empty($_POST['maxPlotLimit']))
|
||||
? htmlspecialchars($_POST['maxPlotLimit'])
|
||||
: $GLOBALS['cfg']['maxRowPlotLimit'])
|
||||
. '" />';
|
||||
$html_output .= '</td></tr>';
|
||||
$html_output .= '</table>';
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a column's type, collation, operators list, and crietria value
|
||||
* to display in table search form
|
||||
*
|
||||
* @param string $db Selected Database
|
||||
* @param string $table Selected Table
|
||||
* @param array $columnNames Names of columns in the table
|
||||
* @param array $columnTypes Types of columns in the table
|
||||
* @param array $columnCollations Collation of all columns
|
||||
* @param array $columnNullFlags Null information of columns
|
||||
* @param array $foreigners Array of foreign keys
|
||||
* @param integer $search_index Row number in table search form
|
||||
* @param integer $column_index Column index in ColumnNames array
|
||||
*
|
||||
* @return array Array contaning column's properties
|
||||
*/
|
||||
function PMA_tblSearchGetColumnProperties($db, $table, $columnNames, $columnTypes,
|
||||
$columnCollations, $columnNullFlags, $foreigners, $search_index, $column_index
|
||||
) {
|
||||
$selected_operator = (isset($_POST['criteriaColumnOperators'])
|
||||
? $_POST['criteriaColumnOperators'][$search_index] : '');
|
||||
$entered_value = (isset($_POST['criteriaValues'])
|
||||
? $_POST['criteriaValues'] : '');
|
||||
$titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values'));
|
||||
//Gets column's type and collation
|
||||
$type = $columnTypes[$column_index];
|
||||
$collation = $columnCollations[$column_index];
|
||||
//Gets column's comparison operators depending on column type
|
||||
$func = '<select name="criteriaColumnOperators[' . $search_index . ']">';
|
||||
$func .= $GLOBALS['PMA_Types']->getTypeOperatorsHtml(
|
||||
preg_replace('@\(.*@s', '', $columnTypes[$column_index]),
|
||||
$columnNullFlags[$column_index], $selected_operator
|
||||
);
|
||||
$func .= '</select>';
|
||||
//Gets link to browse foreign data(if any) and criteria inputbox
|
||||
$foreignData = PMA_getForeignData(
|
||||
$foreigners, $columnNames[$column_index], false, '', ''
|
||||
);
|
||||
$value = PMA_getForeignFields_Values(
|
||||
$foreigners, $foreignData, $columnNames[$column_index], $type, $search_index,
|
||||
$db, $table, $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], $entered_value
|
||||
);
|
||||
return array(
|
||||
'type' => $type,
|
||||
'collation' => $collation,
|
||||
'func' => $func,
|
||||
'value' => $value
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the search form's table row in case of Normal Search
|
||||
* (for tbl_select.php)
|
||||
*
|
||||
* @param string $db Selected Database
|
||||
* @param string $table Selected Table
|
||||
* @param array $columnNames Names of columns in the table
|
||||
* @param array $columnTypes Types of columns in the table
|
||||
* @param array $columnCollations Collation of all columns
|
||||
* @param array $columnNullFlags Null information of columns
|
||||
* @param boolean $geomColumnFlag Whether a geometry column is present
|
||||
* @param integer $columnCount Number of columns in the table
|
||||
* @param array $foreigners Array of foreign keys
|
||||
* @param string $db Selected database
|
||||
* @param string $table Selected table
|
||||
*
|
||||
* @return string the generated table row
|
||||
*/
|
||||
function PMA_tblSearchGetRowsNormal($db, $table, $columnNames, $columnTypes,
|
||||
$columnCollations, $columnNullFlags, $geomColumnFlag, $foreigners
|
||||
) {
|
||||
$titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values'));
|
||||
$geom_types = PMA_getGISDatatypes();
|
||||
$odd_row = true;
|
||||
$html_output = '';
|
||||
// for every column present in table
|
||||
for ($column_index = 0; $column_index < count($columnNames); $column_index++) {
|
||||
$html_output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
|
||||
$odd_row = !$odd_row;
|
||||
//If 'Function' column is present
|
||||
$html_output .= PMA_tblSearchGetGeomFuncHtml(
|
||||
$geomColumnFlag, $columnTypes, $geom_types, $column_index
|
||||
);
|
||||
//Displays column's name, type, collation and value
|
||||
$html_output .= '<th>' . htmlspecialchars($columnNames[$column_index])
|
||||
. '</th>';
|
||||
$properties = PMA_tblSearchGetColumnProperties(
|
||||
$db, $table, $columnNames, $columnTypes, $columnCollations,
|
||||
$columnNullFlags, $foreigners, $column_index, $column_index
|
||||
);
|
||||
$html_output .= '<td>' . $properties['type'] . '</td>';
|
||||
$html_output .= '<td>' . $properties['collation'] . '</td>';
|
||||
$html_output .= '<td>' . $properties['func'] . '</td>';
|
||||
$html_output .= '<td>' . $properties['value'] . '</td>';
|
||||
$html_output .= '</tr>';
|
||||
//Displays hidden fields
|
||||
$html_output .= '<tr><td>';
|
||||
$html_output .= '<input type="hidden" name="criteriaColumnNames['
|
||||
. $column_index . ']" value="'
|
||||
. htmlspecialchars($columnNames[$column_index]) . '" />';
|
||||
$html_output .= '<input type="hidden" name="criteriaColumnTypes['
|
||||
. $column_index . ']" value="' . $columnTypes[$column_index] . '" />';
|
||||
$html_output .= '<input type="hidden" name="criteriaColumnCollations['
|
||||
. $column_index . ']" value="' . $columnCollations[$column_index]
|
||||
. '" /></td></tr>';
|
||||
} // end for
|
||||
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the search form's table row in case of Zoom Search
|
||||
* (for tbl_zoom_select.php)
|
||||
*
|
||||
* @param string $db Selected Database
|
||||
* @param string $table Selected Table
|
||||
* @param array $columnNames Names of columns in the table
|
||||
* @param array $columnTypes Types of columns in the table
|
||||
* @param array $columnCollations Collation of all columns
|
||||
* @param array $columnNullFlags Null information of columns
|
||||
* @param array $foreigners Array of foreign keys
|
||||
*
|
||||
* @return string the generated table row
|
||||
*/
|
||||
function PMA_tblSearchGetRowsZoom($db, $table, $columnNames, $columnTypes,
|
||||
$columnCollations, $columnNullFlags, $foreigners
|
||||
) {
|
||||
$odd_row = true;
|
||||
$html_output = '';
|
||||
/**
|
||||
* Get already set search criteria (if any)
|
||||
*/
|
||||
|
||||
//Displays column rows for search criteria input
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
//After X-Axis and Y-Axis column rows, display additional criteria option
|
||||
if ($i == 2) {
|
||||
$html_output .= '<tr><td>';
|
||||
$html_output .= __("Additional search criteria");
|
||||
$html_output .= '</td></tr>';
|
||||
}
|
||||
$html_output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
|
||||
$odd_row = ! $odd_row;
|
||||
//Select options for column names
|
||||
$html_output .= '<th><select name="criteriaColumnNames[]" id="'
|
||||
. 'tableid_' . $i . '" >';
|
||||
$html_output .= '<option value="' . 'pma_null' . '">' . __('None')
|
||||
. '</option>';
|
||||
for ($j = 0 ; $j < count($columnNames); $j++) {
|
||||
if (isset($_POST['criteriaColumnNames'][$i])
|
||||
&& $_POST['criteriaColumnNames'][$i] == htmlspecialchars($columnNames[$j])
|
||||
) {
|
||||
$html_output .= '<option value="'
|
||||
. htmlspecialchars($columnNames[$j]) . '" selected="selected">'
|
||||
. htmlspecialchars($columnNames[$j]) . '</option>';
|
||||
} else {
|
||||
$html_output .= '<option value="'
|
||||
. htmlspecialchars($columnNames[$j]) . '">'
|
||||
. htmlspecialchars($columnNames[$j]) . '</option>';
|
||||
}
|
||||
}
|
||||
$html_output .= '</select></th>';
|
||||
if (isset($_POST['criteriaColumnNames'])
|
||||
&& $_POST['criteriaColumnNames'][$i] != 'pma_null'
|
||||
) {
|
||||
$key = array_search($_POST['criteriaColumnNames'][$i], $columnNames);
|
||||
$properties = PMA_tblSearchGetColumnProperties(
|
||||
$db, $table, $columnNames, $columnTypes, $columnCollations,
|
||||
$columnNullFlags, $foreigners, $i, $key
|
||||
);
|
||||
$type[$i] = $properties['type'];
|
||||
$collation[$i] = $properties['collation'];
|
||||
$func[$i] = $properties['func'];
|
||||
$value[$i] = $properties['value'];
|
||||
}
|
||||
//Column type
|
||||
$html_output .= '<td>' . (isset($type[$i]) ? $type[$i] : '') . '</td>';
|
||||
//Column Collation
|
||||
$html_output .= '<td>' . (isset($collation[$i]) ? $collation[$i] : '')
|
||||
. '</td>';
|
||||
//Select options for column operators
|
||||
$html_output .= '<td>' . (isset($func[$i]) ? $func[$i] : '') . '</td>';
|
||||
//Inputbox for search criteria value
|
||||
$html_output .= '<td>' . (isset($value[$i]) ? $value[$i] : '') . '</td>';
|
||||
$html_output .= '</tr>';
|
||||
//Displays hidden fields
|
||||
$html_output .= '<tr><td>';
|
||||
$html_output .= '<input type="hidden" name="criteriaColumnTypes[' . $i . ']"'
|
||||
. ' id="types_' . $i . '" ';
|
||||
if (isset($_POST['criteriaColumnTypes'][$i])) {
|
||||
$html_output .= 'value="' . $_POST['criteriaColumnTypes'][$i] . '" ';
|
||||
}
|
||||
$html_output .= '/>';
|
||||
$html_output .= '<input type="hidden" name="criteriaColumnCollations['
|
||||
. $i . ']" id="collations_' . $i . '" />';
|
||||
$html_output .= '</td></tr>';
|
||||
}//end for
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates HTML for displaying fields table in search form
|
||||
*
|
||||
* @param string $db Selected Database
|
||||
* @param string $table Selected Table
|
||||
* @param array $columnNames Names of columns in the table
|
||||
* @param array $columnTypes Types of columns in the table
|
||||
* @param array $columnCollations Collation of all columns
|
||||
* @param array $columnNullFlags Null information of columns
|
||||
* @param boolean $geomColumnFlag Whether a geometry column is present
|
||||
* @param array $foreigners Array of foreign keys
|
||||
* @param string $searchType Whether normal search or zoom search
|
||||
*
|
||||
* @return string the generated HTML
|
||||
*/
|
||||
function PMA_tblSearchGetFieldsTableHtml($columnNames, $columnTypes,
|
||||
$columnCollations, $columnNullFlags, $geomColumnFlag, $columnCount,
|
||||
$foreigners, $db, $table
|
||||
function PMA_tblSearchGetFieldsTableHtml($db, $table, $columnNames, $columnTypes,
|
||||
$columnCollations, $columnNullFlags, $geomColumnFlag, $foreigners, $searchType
|
||||
) {
|
||||
$html_output = '';
|
||||
$html_output .= '<table class="data">';
|
||||
$html_output .= PMA_tbl_setTableHeader($geomColumnFlag) . '<tbody>';
|
||||
$odd_row = true;
|
||||
$titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values'));
|
||||
$geom_types = PMA_getGISDatatypes();
|
||||
$html_output .= '<table class="data"'
|
||||
. ($searchType == 'zoom' ? ' id="tableFieldsId"' : '') . '>';
|
||||
$html_output .= PMA_tbl_getTableHeader($geomColumnFlag);
|
||||
$html_output .= '<tbody>';
|
||||
|
||||
// for every column present in table
|
||||
for ($i = 0; $i < $columnCount; $i++) {
|
||||
$html_output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
|
||||
$odd_row = !$odd_row;
|
||||
|
||||
/**
|
||||
* If 'Function' column is present
|
||||
*/
|
||||
$html_output .= PMA_tblSearchGetGeomFuncHtml(
|
||||
$geomColumnFlag, $columnTypes, $geom_types, $i
|
||||
if ($searchType == 'zoom') {
|
||||
$html_output .= PMA_tblSearchGetRowsZoom(
|
||||
$db, $table, $columnNames, $columnTypes, $columnCollations,
|
||||
$columnNullFlags, $foreigners
|
||||
);
|
||||
/**
|
||||
* Displays column's name, type and collation
|
||||
*/
|
||||
$html_output .= '<th>' . htmlspecialchars($columnNames[$i]) . '</th>';
|
||||
$html_output .= '<td>' . htmlspecialchars($columnTypes[$i]) . '</td>';
|
||||
$html_output .= '<td>' . $columnCollations[$i] . '</td>';
|
||||
/**
|
||||
* Displays column's comparison operators depending on column type
|
||||
*/
|
||||
$html_output .= '<td><select name="criteriaColumnOperators[]">';
|
||||
$html_output .= $GLOBALS['PMA_Types']->getTypeOperatorsHtml(
|
||||
preg_replace('@\(.*@s', '', $columnTypes[$i]),
|
||||
$columnNullFlags[$i]
|
||||
} else {
|
||||
$html_output .= PMA_tblSearchGetRowsNormal(
|
||||
$db, $table, $columnNames, $columnTypes, $columnCollations,
|
||||
$columnNullFlags, $geomColumnFlag, $foreigners
|
||||
);
|
||||
$html_output .= '</select></td>';
|
||||
/**
|
||||
* Displays column's foreign relations if any
|
||||
*/
|
||||
$html_output .= '<td>';
|
||||
$field = $columnNames[$i];
|
||||
$foreignData = PMA_getForeignData($foreigners, $field, false, '', '');
|
||||
$html_output .= PMA_getForeignFields_Values(
|
||||
$foreigners, $foreignData, $field, $columnTypes, $i, $db, $table,
|
||||
$titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], '', true
|
||||
);
|
||||
|
||||
$html_output .= '<input type="hidden" name="criteriaColumnNames[' . $i . ']" value="'
|
||||
. htmlspecialchars($columnNames[$i]) . '" />'
|
||||
. '<input type="hidden" name="criteriaColumnTypes[' . $i . ']" value="'
|
||||
. $columnTypes[$i] . '" />'
|
||||
. '<input type="hidden" name="criteriaColumnCollations[' . $i . ']" value="'
|
||||
. $columnCollations[$i] . '" /></td></tr>';
|
||||
} // end for
|
||||
}
|
||||
|
||||
$html_output .= '</tbody></table>';
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the form tag for table search form
|
||||
* (normal search or zoom search)
|
||||
*
|
||||
* @param string $goto Goto URL
|
||||
* @param string $db Selected Database
|
||||
* @param string $table Selected Table
|
||||
* @param string $searchType Whether normal search or zoom search
|
||||
*
|
||||
* @return string the HTML for form tag
|
||||
*/
|
||||
function PMA_tblSearchGetFormTag($goto, $db, $table, $searchType)
|
||||
{
|
||||
$html_output = '';
|
||||
$scriptName = ($searchType == 'zoom' ? 'tbl_zoom_select.php' : 'tbl_select.php');
|
||||
$formId = ($searchType == 'zoom' ? 'zoom_search_form' : 'tbl_search_form');
|
||||
|
||||
$html_output .= '<form method="post" action="' . $scriptName . '" '
|
||||
. 'name="insertForm" id="' . $formId . '" '
|
||||
. ($GLOBALS['cfg']['AjaxEnable'] ? 'class="ajax"' : '') . '>';
|
||||
|
||||
$html_output .= PMA_generate_common_hidden_inputs($db, $table);
|
||||
$html_output .= '<input type="hidden" name="goto" value="' . $goto . '" />';
|
||||
$html_output .= '<input type="hidden" name="back" value="' . $scriptName
|
||||
. '" />';
|
||||
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the table search form under table search tab
|
||||
*
|
||||
* @param string $goto Goto URL
|
||||
* @param string $db Selected Database
|
||||
* @param string $table Selected Table
|
||||
* @param array $columnNames Names of columns in the table
|
||||
* @param array $columnTypes Types of columns in the table
|
||||
* @param array $columnCollations Collation of all columns
|
||||
* @param array $columnNullFlags Null information of columns
|
||||
* @param boolean $geomColumnFlag Whether a geometry column is present
|
||||
* @param integer $columnCount Number of columns in the table
|
||||
* @param array $foreigners Array of foreign keys
|
||||
* @param string $db Selected database
|
||||
* @param string $table Selected table
|
||||
* @param string $searchType Whether normal search or zoom search
|
||||
* @param string $dataLabel Label for points in zoom plot
|
||||
*
|
||||
* @return string the generated HTML for table search form
|
||||
*/
|
||||
function PMA_tblSearchGetSelectionForm($goto, $columnNames, $columnTypes,
|
||||
$columnCollations, $columnNullFlags, $geomColumnFlag, $columnCount,
|
||||
$foreigners, $db, $table
|
||||
function PMA_tblSearchGetSelectionForm($goto, $db, $table, $columnNames,
|
||||
$columnTypes, $columnCollations, $columnNullFlags, $geomColumnFlag, $foreigners,
|
||||
$searchType, $dataLabel = null
|
||||
) {
|
||||
$html_output = '';
|
||||
$html_output .= '<fieldset id="fieldset_subtab">';
|
||||
@ -729,39 +974,62 @@ function PMA_tblSearchGetSelectionForm($goto, $columnNames, $columnTypes,
|
||||
$url_params['db'] = $db;
|
||||
$url_params['table'] = $table;
|
||||
|
||||
$html_output .= PMA_generateHtmlTabs(PMA_tbl_getSubTabs(), $url_params, 'topmenu2');
|
||||
$html_output .= '<form method="post" action="tbl_select.php" name="insertForm"'
|
||||
. ' id="tbl_search_form" ' . ($GLOBALS['cfg']['AjaxEnable'] ? 'class="ajax"' : '')
|
||||
. '>';
|
||||
$html_output .= PMA_generate_common_hidden_inputs($db, $table);
|
||||
$html_output .= '<input type="hidden" name="goto" value="' . $goto . '" />';
|
||||
$html_output .= '<input type="hidden" name="back" value="tbl_select.php" />'
|
||||
. '<fieldset id="fieldset_table_search"><fieldset id="fieldset_table_qbe">'
|
||||
. '<legend>' . __('Do a "query by example" (wildcard: "%")') . '</legend>';
|
||||
$html_output .= PMA_generateHtmlTabs(
|
||||
PMA_tbl_getSubTabs(), $url_params, 'topmenu2'
|
||||
);
|
||||
$html_output .= PMA_tblSearchGetFormTag($goto, $db, $table, $searchType);
|
||||
|
||||
$html_output .= '<fieldset id='
|
||||
. ($searchType == 'zoom' ? '"inputSection"' : '"fieldset_table_search"') . '>';
|
||||
$html_output .= ($searchType == 'zoom'
|
||||
? '' : '<fieldset id="fieldset_table_qbe">');
|
||||
|
||||
// Set caption for fieldset
|
||||
if ($searchType == 'zoom') {
|
||||
$html_output .= '<legend>'
|
||||
. __('Do a "query by example" (wildcard: "%") for two different columns')
|
||||
. '</legend>';
|
||||
} else {
|
||||
$html_output .= '<legend>'
|
||||
. __('Do a "query by example" (wildcard: "%")')
|
||||
. '</legend>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays table fields
|
||||
* Displays fields table in search form
|
||||
*/
|
||||
$html_output .= PMA_tblSearchGetFieldsTableHtml(
|
||||
$columnNames, $columnTypes, $columnCollations, $columnNullFlags,
|
||||
$geomColumnFlag, $columnCount, $foreigners, $db, $table
|
||||
$db, $table, $columnNames, $columnTypes, $columnCollations, $columnNullFlags,
|
||||
$geomColumnFlag, $foreigners, $searchType
|
||||
);
|
||||
|
||||
$html_output .= '<div id="gis_editor"></div>'
|
||||
. '<div id="popup_background"></div>'
|
||||
. '</fieldset>';
|
||||
|
||||
/**
|
||||
* Displays slider options form
|
||||
* Displays more search options
|
||||
*/
|
||||
$html_output .= PMA_tblSearchGetOptions($columnNames, $columnCount);
|
||||
if ($searchType == 'zoom') {
|
||||
$html_output .= PMA_tblSearchGetOptionsZoom($columnNames, $dataLabel);
|
||||
} else {
|
||||
$html_output .= '<div id="gis_editor"></div>'
|
||||
. '<div id="popup_background"></div>'
|
||||
. '</fieldset>';
|
||||
$html_output .= PMA_tblSearchGetOptions($columnNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays selection form's footer elements
|
||||
*/
|
||||
$html_output .= '<fieldset class="tblFooters">'
|
||||
. '<input type="submit" name="submit" value="' . __('Go') . '" />'
|
||||
. '</fieldset></form><div id="sqlqueryresults"></div></fieldset>';
|
||||
$html_output .= '<fieldset class="tblFooters">';
|
||||
$html_output .= '<input type="submit" name="'
|
||||
. ($searchType == 'zoom' ? 'zoom_submit' : 'submit')
|
||||
. ($searchType == 'zoom' ? '" id="inputFormSubmitId"' : '" ')
|
||||
. 'value="' . __('Go') . '" />';
|
||||
$html_output .= '</fieldset></form>';
|
||||
if ($searchType == 'zoom') {
|
||||
$html_output = '<div id="sqlqueryresults"></div>'
|
||||
. $html_output . '</fieldset>';
|
||||
} else {
|
||||
$html_output .= '<div id="sqlqueryresults"></div></fieldset>';
|
||||
}
|
||||
return $html_output;
|
||||
}
|
||||
?>
|
||||
|
||||
@ -43,8 +43,7 @@ echo '</ul><div class="clearfloat"></div>';
|
||||
|
||||
// show "configuration saved" message and reload navigation frame if needed
|
||||
if (!empty($_GET['saved'])) {
|
||||
$message = PMA_Message::rawSuccess(__('Configuration has been saved'));
|
||||
$message->display();
|
||||
PMA_Message::rawSuccess(__('Configuration has been saved'))->display();
|
||||
}
|
||||
|
||||
/* debug code
|
||||
|
||||
@ -270,29 +270,42 @@ function PMA_userprefs_redirect(array $forms, array $old_settings, $file_name,
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows form which allows to quickly load settings stored in browser's local storage
|
||||
* Shows form which allows to quickly load
|
||||
* settings stored in browser's local storage
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_userprefs_autoload_header()
|
||||
function PMA_userprefsAutoloadGetHeader()
|
||||
{
|
||||
if (isset($_REQUEST['prefs_autoload']) && $_REQUEST['prefs_autoload'] == 'hide') {
|
||||
$retval = '';
|
||||
|
||||
if (isset($_REQUEST['prefs_autoload'])
|
||||
&& $_REQUEST['prefs_autoload'] == 'hide'
|
||||
) {
|
||||
$_SESSION['userprefs_autoload'] = true;
|
||||
exit;
|
||||
} else {
|
||||
$script_name = basename(basename($GLOBALS['PMA_PHP_SELF']));
|
||||
$return_url = htmlspecialchars(
|
||||
$script_name . '?' . http_build_query($_GET, '', '&')
|
||||
);
|
||||
|
||||
$retval .= '<div id="prefs_autoload" class="notice" style="display:none">';
|
||||
$retval .= '<form action="prefs_manage.php" method="post">';
|
||||
$retval .= PMA_generate_common_hidden_inputs();
|
||||
$retval .= '<input type="hidden" name="json" value="" />';
|
||||
$retval .= '<input type="hidden" name="submit_import" value="1" />';
|
||||
$retval .= '<input type="hidden" name="return_url" value="' . $return_url . '" />';
|
||||
$retval .= __(
|
||||
'Your browser has phpMyAdmin configuration for this domain. '
|
||||
. 'Would you like to import it for current session?'
|
||||
);
|
||||
$retval .= '<br />';
|
||||
$retval .= '<a href="#yes">' . __('Yes') . '</a>';
|
||||
$retval .= ' / ';
|
||||
$retval .= '<a href="#no">' . __('No') . '</a>';
|
||||
$retval .= '</form>';
|
||||
$retval .= '</div>';
|
||||
}
|
||||
$script_name = basename(basename($GLOBALS['PMA_PHP_SELF']));
|
||||
$return_url = $script_name . '?' . http_build_query($_GET, '', '&');
|
||||
?>
|
||||
<div id="prefs_autoload" class="notice" style="display:none">
|
||||
<form action="prefs_manage.php" method="post">
|
||||
<?php echo PMA_generate_common_hidden_inputs() . "\n"; ?>
|
||||
<input type="hidden" name="json" value="" />
|
||||
<input type="hidden" name="submit_import" value="1" />
|
||||
<input type="hidden" name="return_url" value="<?php echo htmlspecialchars($return_url) ?>" />
|
||||
<?php echo __('Your browser has phpMyAdmin configuration for this domain. Would you like to import it for current session?') ?>
|
||||
<br />
|
||||
<a href="#yes"><?php echo __('Yes') ?></a> / <a href="#no"><?php echo __('No') ?></a>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
return $retval;
|
||||
}
|
||||
?>
|
||||
|
||||
7
main.php
7
main.php
@ -18,6 +18,7 @@ require_once 'libraries/display_git_revision.lib.php';
|
||||
if ($GLOBALS['PMA_Config']->isGitRevision()) {
|
||||
if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) {
|
||||
PMA_printGitRevision();
|
||||
exit;
|
||||
}
|
||||
PMA_addJSVar('is_git_revision', true);
|
||||
}
|
||||
@ -26,7 +27,6 @@ if ($GLOBALS['PMA_Config']->isGitRevision()) {
|
||||
$GLOBALS['db'] = '';
|
||||
$GLOBALS['table'] = '';
|
||||
$show_query = '1';
|
||||
require_once 'libraries/header.inc.php';
|
||||
|
||||
// Any message to display?
|
||||
if (! empty($message)) {
|
||||
@ -452,9 +452,4 @@ function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = nu
|
||||
}
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
@ -19,7 +19,6 @@ require_once 'libraries/common.inc.php';
|
||||
*/
|
||||
function PMA_exitNavigationFrame()
|
||||
{
|
||||
echo '</body></html>';
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -30,11 +29,12 @@ require_once 'libraries/RecentTable.class.php';
|
||||
* Check if it is an ajax request to reload the recent tables list.
|
||||
*/
|
||||
if ($GLOBALS['is_ajax_request'] && $_REQUEST['recent_table']) {
|
||||
PMA_ajaxResponse(
|
||||
'',
|
||||
true,
|
||||
array('options' => PMA_RecentTable::getInstance()->getHtmlSelectOption())
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON(
|
||||
'options',
|
||||
PMA_RecentTable::getInstance()->getHtmlSelectOption()
|
||||
);
|
||||
exit;
|
||||
}
|
||||
|
||||
// keep the offset of the db list in session before closing it
|
||||
@ -62,13 +62,6 @@ if (empty($_SESSION['debug'])) {
|
||||
session_write_close();
|
||||
}
|
||||
|
||||
/**
|
||||
* the output compression library
|
||||
*/
|
||||
require_once 'libraries/ob.lib.php';
|
||||
|
||||
PMA_outBufferPre();
|
||||
|
||||
/*
|
||||
* selects the database if there is only one on current server
|
||||
*/
|
||||
@ -83,41 +76,14 @@ $db_start = $GLOBALS['db'];
|
||||
*/
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
/**
|
||||
* For re-usability, moved http-headers to a seperate file.
|
||||
* It can now be included by libraries/header.inc.php, querywindow.php.
|
||||
*/
|
||||
require_once 'libraries/header_http.inc.php';
|
||||
|
||||
/*
|
||||
* Displays the frame
|
||||
*/
|
||||
// xml declaration moves IE into quirks mode, making much trouble with CSS
|
||||
/* echo '<?xml version="1.0" encoding="utf-8"?>'; */
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="<?php echo $available_languages[$lang][1]; ?>" dir="<?php echo $GLOBALS['text_dir']; ?>">
|
||||
|
||||
<head>
|
||||
<link rel="icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
<title>phpMyAdmin</title>
|
||||
<meta charset="utf-8" />
|
||||
<base target="frame_content" />
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
|
||||
<?php
|
||||
echo PMA_includeJS('jquery/jquery-1.6.2.js');
|
||||
echo PMA_includeJS('jquery/jquery-ui-1.8.16.custom.js');
|
||||
echo PMA_includeJS('jquery/jquery.qtip-1.0.0-rc3.js');
|
||||
echo PMA_includeJS('navigation.js');
|
||||
echo PMA_includeJS('functions.js');
|
||||
echo PMA_includeJS('messages.php');
|
||||
// Append the theme id to this url to invalidate the cache on a theme change
|
||||
echo PMA_includeJS('get_image.js.php?theme=' . urlencode($_SESSION['PMA_Theme']->getId()));
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->getFooter()->setMinimal();
|
||||
$header = $response->getHeader();
|
||||
$header->disableMenu();
|
||||
$header->setBodyId('body_leftFrame');
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('navigation.js');
|
||||
$scripts->addCode('
|
||||
// INIT PMA_setFrameSize
|
||||
var onloadCnt = 0;
|
||||
var onLoadHandler = window.onload;
|
||||
@ -128,8 +94,8 @@ require_once 'libraries/header_http.inc.php';
|
||||
if (typeof(onLoadHandler) == "function") {
|
||||
onLoadHandler();
|
||||
}
|
||||
if (typeof(PMA_setFrameSize) != 'undefined'
|
||||
&& typeof(PMA_setFrameSize) == 'function'
|
||||
if (typeof(PMA_setFrameSize) != "undefined"
|
||||
&& typeof(PMA_setFrameSize) == "function"
|
||||
) {
|
||||
PMA_setFrameSize();
|
||||
}
|
||||
@ -140,32 +106,14 @@ require_once 'libraries/header_http.inc.php';
|
||||
if (typeof(resizeHandler) == "function") {
|
||||
resizeHandler();
|
||||
}
|
||||
if (typeof(PMA_saveFrameSize) != 'undefined'
|
||||
&& typeof(PMA_saveFrameSize) == 'function'
|
||||
if (typeof(PMA_saveFrameSize) != "undefined"
|
||||
&& typeof(PMA_saveFrameSize) == "function"
|
||||
) {
|
||||
PMA_saveFrameSize();
|
||||
}
|
||||
};
|
||||
// ]]>
|
||||
</script>
|
||||
<?php
|
||||
/*
|
||||
* remove horizontal scroll bar bug in IE 6 by forcing a vertical scroll bar
|
||||
*/
|
||||
?>
|
||||
<!--[if IE 6]>
|
||||
<style type="text/css">
|
||||
/* <![CDATA[ */
|
||||
html {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
/* ]]> */
|
||||
</style>
|
||||
<![endif]-->
|
||||
</head>
|
||||
');
|
||||
|
||||
<body id="body_leftFrame">
|
||||
<?php
|
||||
require 'libraries/navigation_header.inc.php';
|
||||
|
||||
// display recently used tables
|
||||
@ -667,7 +615,7 @@ function PMA_displayTableList(
|
||||
);
|
||||
// quick access icon next to each table name
|
||||
echo '<li>' . "\n";
|
||||
echo '<a class="tableicon" title="'
|
||||
echo '<a target="frame_content" class="tableicon" title="'
|
||||
. htmlspecialchars($link_title)
|
||||
. ': ' . htmlspecialchars($table['Comment'])
|
||||
.' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')"'
|
||||
@ -699,7 +647,7 @@ function PMA_displayTableList(
|
||||
$href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
|
||||
.$GLOBALS['common_url_query'] . '&table='
|
||||
.urlencode($table['Name']) . '&pos=0';
|
||||
echo '<a href="' . $href . '" title="'
|
||||
echo '<a target="frame_content" href="' . $href . '" title="'
|
||||
. htmlspecialchars(
|
||||
PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable'])
|
||||
. ': ' . $table['Comment']
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
|
||||
PMA_Response::getInstance()->disable();
|
||||
|
||||
require_once 'libraries/pmd_common.php';
|
||||
|
||||
|
||||
|
||||
@ -9,10 +9,8 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/pmd_common.php';
|
||||
require 'libraries/db_common.inc.php';
|
||||
require 'libraries/db_info.inc.php';
|
||||
|
||||
/**
|
||||
* Sets globals from $_GET
|
||||
@ -28,6 +26,7 @@ foreach ($get_params as $one_get_param) {
|
||||
}
|
||||
}
|
||||
|
||||
$script_display_field = get_tables_info();
|
||||
$tab_column = get_columns_info();
|
||||
$script_tabs = get_script_tabs();
|
||||
$script_contr = get_script_contr();
|
||||
@ -39,42 +38,45 @@ $params = array('lang' => $GLOBALS['lang']);
|
||||
if (isset($GLOBALS['db'])) {
|
||||
$params['db'] = $GLOBALS['db'];
|
||||
}
|
||||
require_once 'libraries/header_scripts.inc.php';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
<?php
|
||||
echo '
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->getFooter()->setMinimal();
|
||||
$header = $response->getHeader();
|
||||
$header->setBodyId('pmd_body');
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('pmd/ajax.js');
|
||||
$scripts->addFile('pmd/history.js');
|
||||
$scripts->addFile('pmd/move.js');
|
||||
$scripts->addFile('pmd/iecanvas.js', true);
|
||||
$scripts->addCode('
|
||||
var server = "' . PMA_escapeJsString($server) . '";
|
||||
var db = "' . PMA_escapeJsString($db) . '";
|
||||
var token = "' . PMA_escapeJsString($token) . '";';
|
||||
echo "\n";
|
||||
var token = "' . PMA_escapeJsString($token) . '";
|
||||
');
|
||||
if (isset($_REQUEST['query'])) {
|
||||
echo '
|
||||
$(function() {
|
||||
$scripts->addCode('
|
||||
$(function() {
|
||||
$(".trigger").click(function() {
|
||||
$(".panel").toggle("fast");
|
||||
$(this).toggleClass("active");
|
||||
return false;
|
||||
});
|
||||
});';
|
||||
});
|
||||
');
|
||||
}
|
||||
?>
|
||||
// ]]>
|
||||
</script>
|
||||
<script src="js/pmd/ajax.js" type="text/javascript"></script>
|
||||
<script src="js/pmd/history.js" type="text/javascript"></script>
|
||||
<script src="js/pmd/move.js" type="text/javascript"></script>
|
||||
<!--[if IE]>
|
||||
<script src="js/pmd/iecanvas.js" type="text/javascript"></script>
|
||||
<![endif]-->
|
||||
<?php
|
||||
echo $script_tabs . $script_contr . $script_display_field;
|
||||
?>
|
||||
$scripts->addCode('
|
||||
$(function() {
|
||||
Main();
|
||||
});
|
||||
');
|
||||
$scripts->addCode($script_tabs);
|
||||
$scripts->addCode($script_contr);
|
||||
$scripts->addCode($script_display_field);
|
||||
|
||||
</head>
|
||||
<body onload="Main()" class="general_body" id="pmd_body">
|
||||
require 'libraries/db_common.inc.php';
|
||||
require 'libraries/db_info.inc.php';
|
||||
|
||||
?>
|
||||
<div class="pmd_header" id="top_menu">
|
||||
<a href="#"
|
||||
onclick="Show_left_menu(document.getElementById('key_Show_left_menu')); return false" class="M_butt first" target="_self">
|
||||
@ -857,5 +859,3 @@ if (! empty($_REQUEST['query'])) {
|
||||
<img src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/rightarrow2.png'); ?>" width="0" height="0" alt="" />
|
||||
<img src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/uparrow2_m.png'); ?>" width="0" height="0" alt="" />
|
||||
<div id="PMA_disable_floating_menubar"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
11
pmd_pdf.php
11
pmd_pdf.php
@ -77,11 +77,12 @@ if (isset($mode)) {
|
||||
}
|
||||
}
|
||||
|
||||
// no need to use pmd/styles
|
||||
require_once 'libraries/header_meta_style.inc.php';
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->getFooter()->setMinimal();
|
||||
$header = $response->getHeader();
|
||||
$header->disableMenu();
|
||||
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<br>
|
||||
<div>
|
||||
<?php
|
||||
@ -144,6 +145,4 @@ echo '<p>' . __('Export/Import to scale') . ':';
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@ -9,6 +9,9 @@
|
||||
*
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
|
||||
PMA_Response::getInstance()->disable();
|
||||
|
||||
require_once 'libraries/pmd_common.php';
|
||||
$die_save_pos = 0;
|
||||
require_once 'pmd_save_pos.php';
|
||||
@ -31,14 +34,20 @@ if (PMA_isForeignKeySupported($type_T1) && PMA_isForeignKeySupported($type_T2) &
|
||||
// note: in InnoDB, the index does not requires to be on a PRIMARY
|
||||
// or UNIQUE key
|
||||
// improve: check all other requirements for InnoDB relations
|
||||
$result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($T1) . ';');
|
||||
$result = PMA_DBI_query(
|
||||
'SHOW INDEX FROM ' . PMA_backquote($db)
|
||||
. '.' . PMA_backquote($T1) . ';'
|
||||
);
|
||||
$index_array1 = array(); // will be use to emphasis prim. keys in the table view
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
$index_array1[$row['Column_name']] = 1;
|
||||
}
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
$result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($T2) . ';');
|
||||
$result = PMA_DBI_query(
|
||||
'SHOW INDEX FROM ' . PMA_backquote($db)
|
||||
. '.' . PMA_backquote($T2) . ';'
|
||||
);
|
||||
$index_array2 = array(); // will be used to emphasis prim. keys in the table view
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
$index_array2[$row['Column_name']] = 1;
|
||||
@ -46,13 +55,14 @@ if (PMA_isForeignKeySupported($type_T1) && PMA_isForeignKeySupported($type_T2) &
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
if (! empty($index_array1[$F1]) && ! empty($index_array2[$F2])) {
|
||||
$upd_query = 'ALTER TABLE ' . PMA_backquote($T2)
|
||||
. ' ADD FOREIGN KEY ('
|
||||
. PMA_backquote($F2) . ')'
|
||||
. ' REFERENCES '
|
||||
. PMA_backquote($db) . '.'
|
||||
. PMA_backquote($T1) . '('
|
||||
. PMA_backquote($F1) . ')';
|
||||
$upd_query = 'ALTER TABLE ' . PMA_backquote($db)
|
||||
. '.' . PMA_backquote($T2)
|
||||
. ' ADD FOREIGN KEY ('
|
||||
. PMA_backquote($F2) . ')'
|
||||
. ' REFERENCES '
|
||||
. PMA_backquote($db) . '.'
|
||||
. PMA_backquote($T1) . '('
|
||||
. PMA_backquote($F1) . ')';
|
||||
|
||||
if ($on_delete != 'nix') {
|
||||
$upd_query .= ' ON DELETE ' . $on_delete;
|
||||
|
||||
@ -9,6 +9,9 @@
|
||||
*
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
|
||||
PMA_Response::getInstance()->disable();
|
||||
|
||||
require_once 'libraries/pmd_common.php';
|
||||
extract($_POST, EXTR_SKIP);
|
||||
extract($_GET, EXTR_SKIP);
|
||||
@ -29,8 +32,8 @@ if (PMA_isForeignKeySupported($type_T1) && PMA_isForeignKeySupported($type_T2) &
|
||||
$existrel_foreign = PMA_getForeigners($DB2, $T2, '', 'foreign');
|
||||
|
||||
if (isset($existrel_foreign[$F2]['constraint'])) {
|
||||
$upd_query = 'ALTER TABLE ' . PMA_backquote($T2)
|
||||
. ' DROP FOREIGN KEY '
|
||||
$upd_query = 'ALTER TABLE ' . PMA_backquote($DB2)
|
||||
. '.' . PMA_backquote($T2) . ' DROP FOREIGN KEY '
|
||||
. PMA_backquote($existrel_foreign[$F2]['constraint'])
|
||||
. ';';
|
||||
$upd_rs = PMA_DBI_query($upd_query);
|
||||
|
||||
@ -69,8 +69,11 @@ if ($form_display->process(false) && !$form_display->hasErrors()) {
|
||||
}
|
||||
|
||||
// display forms
|
||||
$GLOBALS['js_include'][] = 'config.js';
|
||||
require 'libraries/header.inc.php';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('config.js');
|
||||
|
||||
require 'libraries/user_preferences.inc.php';
|
||||
if ($error) {
|
||||
$error->display();
|
||||
@ -85,9 +88,4 @@ if ($form_display->hasErrors()) {
|
||||
<?php
|
||||
}
|
||||
$form_display->display(true, true);
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
@ -23,21 +23,18 @@ PMA_userprefs_pageinit();
|
||||
$error = '';
|
||||
if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') == 'text_file') {
|
||||
// export to JSON file
|
||||
PMA_Response::getInstance()->disable();
|
||||
$filename = 'phpMyAdmin-config-' . urlencode(PMA_getenv('HTTP_HOST')) . '.json';
|
||||
PMA_downloadHeader($filename, 'application/json');
|
||||
$settings = PMA_load_userprefs();
|
||||
echo json_encode($settings['config_data']);
|
||||
return;
|
||||
exit;
|
||||
} else if (isset($_POST['submit_get_json'])) {
|
||||
$settings = PMA_load_userprefs();
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(
|
||||
array(
|
||||
'prefs' => json_encode($settings['config_data']),
|
||||
'mtime' => $settings['mtime']
|
||||
)
|
||||
);
|
||||
return;
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON('prefs', json_encode($settings['config_data']));
|
||||
$response->addJSON('mtime', $settings['mtime']);
|
||||
exit;
|
||||
} else if (isset($_POST['submit_import'])) {
|
||||
// load from JSON file
|
||||
$json = '';
|
||||
@ -109,7 +106,6 @@ if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') ==
|
||||
}
|
||||
if (!$all_ok) {
|
||||
// mimic original form and post json in a hidden field
|
||||
include 'libraries/header.inc.php';
|
||||
include 'libraries/user_preferences.inc.php';
|
||||
$msg = PMA_Message::error(__('Configuration contains incorrect data for some fields.'));
|
||||
$msg->display();
|
||||
@ -132,8 +128,7 @@ if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') ==
|
||||
<input type="submit" name="submit_ignore" value="<?php echo __('No') ?>" />
|
||||
</form>
|
||||
<?php
|
||||
include 'libraries/footer.inc.php';
|
||||
return;
|
||||
exit;
|
||||
}
|
||||
|
||||
// check for ThemeDefault and fontsize
|
||||
@ -216,8 +211,11 @@ if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') ==
|
||||
exit;
|
||||
}
|
||||
|
||||
$GLOBALS['js_include'][] = 'config.js';
|
||||
require 'libraries/header.inc.php';
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('config.js');
|
||||
|
||||
require 'libraries/user_preferences.inc.php';
|
||||
if ($error) {
|
||||
if (!$error instanceof PMA_Message) {
|
||||
@ -294,8 +292,7 @@ PMA_printJsValue("PMA_messages['strSavedOn']", __('Saved on: @DATE@'));
|
||||
<h2><?php echo __('Export') ?></h2>
|
||||
<div class="click-hide-message group-cnt" style="display:none">
|
||||
<?php
|
||||
$message = PMA_Message::rawSuccess(__('Configuration has been saved'));
|
||||
$message->display();
|
||||
PMA_Message::rawSuccess(__('Configuration has been saved'))->display();
|
||||
?>
|
||||
</div>
|
||||
<form class="group-cnt prefs-form" name="prefs_export" action="prefs_manage.php" method="post">
|
||||
@ -335,9 +332,3 @@ PMA_printJsValue("PMA_messages['strSavedOn']", __('Saved on: @DATE@'));
|
||||
</div>
|
||||
<br class="clearfloat" />
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require 'libraries/footer.inc.php';
|
||||
?>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user