Huge set of optimizations, please test!
This commit is contained in:
21
ChangeLog
21
ChangeLog
@@ -5,17 +5,34 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2003-11-26 Alexander M. Turek <lifeforrent@derrabus.de>
|
||||
* Almost every file:
|
||||
- Replaced all include / require commands by require_once where possible;
|
||||
- Further php 4.1+ optimizations;
|
||||
- footer.inc.php now automatically stops the script execution;
|
||||
- Coding standards.
|
||||
* config.inc.php: Don't include select_lang.lib.php here.
|
||||
* libraries/common.lib.php, libraries/defines.lib.php,
|
||||
libraries/defines_php.lib.php, libraries/defines_mysql.lib.php,
|
||||
scripts/create-release.sh:
|
||||
defines.lib.php was included twice. For optimization reasons I moved all
|
||||
the code that is independent from the MySQL connection out of defines.lib
|
||||
into defines_php.lib.
|
||||
To point out the (new) meanings of the files I renamed defines.lib.php to
|
||||
defines_mysql.lib.php while defines_php.lib.php is now known as
|
||||
defines.lib.php.
|
||||
|
||||
2003-11-26 Michal Cihar <cleanerfasterbetter@cihar.com>
|
||||
* lang/check_lang.sh: Cleanup.
|
||||
* lang/sort_lang.sh: Cleanup.
|
||||
* lang/czech: Better translated some strings.
|
||||
|
||||
|
||||
2003-11-26 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* lang/arabic: update, thanks to Ossama Khayat (okhayat)
|
||||
* lang/hindi: update, thanks to Girish Nair (girish_nair)
|
||||
* lang/slovak: Updated, thanks to Lubos Klokner (erkac).
|
||||
* lang/spanish: Updated, thanks to Daniel Hinostroza (hinostroza).
|
||||
|
||||
|
||||
2003-11-25 Alexander M. Turek <jaggedlittlepill@derrabus.de>
|
||||
* translators.html: Changed email of Hindi translator, again.
|
||||
* badwords.txt: File is obsolete.
|
||||
|
@@ -5,25 +5,23 @@
|
||||
/**
|
||||
* Get the variables sent or posted to this script and displays the header
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
|
||||
/**
|
||||
* Gets a core script and starts output buffering work
|
||||
*/
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
PMA_checkParameters(array('db', 'table', 'field'));
|
||||
|
||||
require('./libraries/ob.lib.php');
|
||||
require_once('./libraries/ob.lib.php');
|
||||
if ($cfg['OBGzip']) {
|
||||
$ob_mode = PMA_outBufferModeGet();
|
||||
if ($ob_mode) {
|
||||
PMA_outBufferPre($ob_mode);
|
||||
}
|
||||
}
|
||||
include('./libraries/header_http.inc.php');
|
||||
require_once('./libraries/header_http.inc.php');
|
||||
$field = urldecode($field);
|
||||
|
||||
/**
|
||||
@@ -58,8 +56,8 @@ PMA_setFontSizes();
|
||||
<body bgcolor="<?php echo $cfg['LeftBgColor']; ?>" style="margin-left: 5px; margin-top: 5px; margin-right: 5px; margin-bottom: 0px">
|
||||
<?php
|
||||
$per_page = 200;
|
||||
require('./libraries/relation.lib.php'); // foreign keys
|
||||
require('./libraries/transformations.lib.php'); // Transformations
|
||||
require_once('./libraries/relation.lib.php'); // foreign keys
|
||||
require_once('./libraries/transformations.lib.php'); // Transformations
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE);
|
||||
|
||||
@@ -74,7 +72,7 @@ if (isset($foreign_navig) && $foreign_navig == $strShowAll) {
|
||||
unset($foreign_limit);
|
||||
}
|
||||
|
||||
include('./libraries/get_foreign.lib.php');
|
||||
require('./libraries/get_foreign.lib.php');
|
||||
?>
|
||||
|
||||
<form action="browse_foreigners.php" method="post">
|
||||
|
13
chk_rel.php
13
chk_rel.php
@@ -6,10 +6,10 @@
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./libraries/common.lib.php');
|
||||
require('./db_details_common.php');
|
||||
require('./libraries/relation.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./db_details_common.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
@@ -21,6 +21,5 @@ $cfgRelation = PMA_getRelationsParam(TRUE);
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -434,10 +434,6 @@ $cfg['AvailableCharsets'] = array(
|
||||
'SHIFT_JIS'
|
||||
);
|
||||
|
||||
// Loads language file
|
||||
require('./libraries/select_lang.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
* Customization & design
|
||||
*/
|
||||
|
@@ -4,8 +4,8 @@
|
||||
|
||||
chdir('..');
|
||||
$is_minimum_common = TRUE;
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./libraries/common.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
// Gets the default font sizes
|
||||
// garvin: TODO: Should be optimized to not include the whole common.lib.php bunch
|
||||
@@ -13,7 +13,7 @@ require('./libraries/common.lib.php');
|
||||
PMA_setFontSizes();
|
||||
|
||||
$ctype = 'css';
|
||||
require('./libraries/header_http.inc.php');
|
||||
require_once('./libraries/header_http.inc.php');
|
||||
|
||||
if (!isset($js_frame)) {
|
||||
$js_frame = 'left';
|
||||
|
@@ -6,13 +6,11 @@
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
$js_to_run = 'functions.js';
|
||||
require('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
|
||||
PMA_checkParameters(array('db'));
|
||||
|
||||
@@ -32,6 +30,6 @@ $result = PMA_mysql_query('CREATE DATABASE ' . PMA_backquote($db)) or PMA_m
|
||||
* Displays the result and calls default page
|
||||
*/
|
||||
$message = $strDatabase . ' ' . htmlspecialchars($db) . ' ' . $strHasBeenCreated;
|
||||
require('./' . $cfg['DefaultTabDatabase']);
|
||||
require_once('./' . $cfg['DefaultTabDatabase']);
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -6,16 +6,16 @@
|
||||
* Gets the variables sent or posted to this script, then displays headers
|
||||
*/
|
||||
if (!isset($selected_tbl)) {
|
||||
include('./libraries/grab_globals.lib.php');
|
||||
include('./header.inc.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./header.inc.php');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the relations settings
|
||||
*/
|
||||
require('./libraries/relation.lib.php');
|
||||
require('./libraries/transformations.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
require_once('./libraries/transformations.lib.php');
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
@@ -317,5 +317,5 @@ function printPage()
|
||||
<?php
|
||||
echo '<br /><br /> <input type="button" style="visibility: ; width: 100px; height: 25px" name="print" value="' . $strPrint . '" onclick="printPage()">' . "\n";
|
||||
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -35,7 +35,7 @@ $sub_part = '';
|
||||
require('./db_details_db_info.php');
|
||||
if ($num_tables == 0 && empty($db_query_force)) {
|
||||
$is_info = TRUE;
|
||||
include('./db_details_structure.php');
|
||||
require('./db_details_structure.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ $auto_sel = ($cfg['TextareaAutoSelect']
|
||||
<?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT'); ?> :<br />
|
||||
<div style="margin-bottom: 5px">
|
||||
<textarea name="sql_query" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" rows="<?php echo $cfg['TextareaRows']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>>
|
||||
<?php
|
||||
<?php
|
||||
if (!empty($query_to_display)) {
|
||||
echo htmlspecialchars($query_to_display);
|
||||
} else {
|
||||
@@ -200,5 +200,5 @@ if (function_exists('PMA_set_enc_form')) {
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -5,15 +5,9 @@
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
|
||||
include('./libraries/grab_globals.lib.php');
|
||||
}
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
if (!defined('PMA_BOOKMARK_LIB_INCLUDED')) {
|
||||
include('./libraries/bookmark.lib.php');
|
||||
}
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/bookmark.lib.php');
|
||||
|
||||
PMA_checkParameters(array('db'));
|
||||
|
||||
@@ -35,13 +29,13 @@ if (!isset($is_db) || !$is_db) {
|
||||
}
|
||||
if (empty($db) || !$is_db) {
|
||||
header('Location: ' . $cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
|
||||
exit();
|
||||
exit;
|
||||
}
|
||||
} // end if (ensures db exists)
|
||||
// Displays headers
|
||||
if (!isset($message)) {
|
||||
$js_to_run = 'functions.js';
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
// Reloads the navigation frame via JavaScript if required
|
||||
if (isset($reload) && $reload) {
|
||||
echo "\n";
|
||||
@@ -63,4 +57,4 @@ window.parent.frames['nav'].location.replace('./left.php?<?php echo PMA_generate
|
||||
*/
|
||||
$url_query = PMA_generate_common_url($db);
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -5,9 +5,7 @@
|
||||
|
||||
// Check parameters
|
||||
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
PMA_checkParameters(array('db'));
|
||||
|
||||
@@ -70,4 +68,4 @@ $num_tables = (isset($tables) ? count($tables) : 0);
|
||||
echo '<!-- Top menu links -->' . "\n";
|
||||
require('./db_details_links.php');
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -25,7 +25,7 @@ if ($num_tables > 1) {
|
||||
|
||||
$multi_values = '<div align="center"><select name="table_select[]" size="6" multiple="multiple">';
|
||||
$multi_values .= "\n";
|
||||
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num_tables) {
|
||||
$table = $tables[$i]['Name'];
|
||||
@@ -41,10 +41,10 @@ if ($num_tables > 1) {
|
||||
$multi_values .= "\n";
|
||||
$multi_values .= '</select></div>';
|
||||
|
||||
$checkall_url = 'db_details_export.php?'
|
||||
$checkall_url = 'db_details_export.php?'
|
||||
. PMA_generate_common_url($db)
|
||||
. '&goto=db_details_export.php';
|
||||
|
||||
|
||||
$multi_values .= '<br />
|
||||
<a href="' . $checkall_url . '&selectall=1" onclick="setSelectOptions(\'dump\', \'table_select[]\', true); return false;">' . $strSelectAll . '</a>
|
||||
/
|
||||
@@ -52,15 +52,14 @@ if ($num_tables > 1) {
|
||||
<br /><br />';
|
||||
} elseif ($num_tables == 0) {
|
||||
echo $strDatabaseNoTable;
|
||||
include('./footer.inc.php');
|
||||
exit;
|
||||
require_once('./footer.inc.php');
|
||||
} // end if
|
||||
|
||||
$export_type = 'database';
|
||||
require('./libraries/display_export.lib.php');
|
||||
require_once('./libraries/display_export.lib.php');
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -12,13 +12,13 @@
|
||||
* Get the values of the variables posted or sent to this script and display
|
||||
* the headers
|
||||
*/
|
||||
require('./libraries/read_dump.lib.php');
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./header.inc.php');
|
||||
require_once('./libraries/read_dump.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./header.inc.php');
|
||||
|
||||
//require common added for string importing - Robbat2, 15 January 2003 9.34PM
|
||||
//all hardcoded strings converted by Robbat2, 15 January 2003 9.34PM
|
||||
require('./libraries/common.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
// Check parameters
|
||||
PMA_checkParameters(array('db'));
|
||||
@@ -62,7 +62,7 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
|
||||
$content = str_replace("\r", "\n", $content);
|
||||
$lines = explode("\n", $content);
|
||||
}
|
||||
|
||||
|
||||
if (isset($lines) && is_array($lines) && count($lines) > 0) {
|
||||
foreach($lines AS $lkey => $line) {
|
||||
//echo '<p>' . $line . '</p>';
|
||||
@@ -105,7 +105,7 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
|
||||
} else {
|
||||
echo '<p><font color="red">' . $GLOBALS['strFileCouldNotBeRead'] . '</font></p>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
if ($content != 'none') {
|
||||
@@ -142,13 +142,13 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
|
||||
*/
|
||||
if (isset($do) && $do == 'import') {
|
||||
$orig_docpath = $docpath;
|
||||
|
||||
|
||||
if (empty($sql_file)) {
|
||||
$sql_file = 'none';
|
||||
}
|
||||
|
||||
// Get relation settings
|
||||
include('./libraries/relation.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
// Gets the query from a file if required
|
||||
@@ -157,15 +157,15 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
|
||||
&& is_uploaded_file($sql_file)) {
|
||||
|
||||
$open_basedir = @ini_get('open_basedir');
|
||||
|
||||
|
||||
// If we are on a server with open_basedir, we must move the file
|
||||
// before opening it. The doc explains how to create the "./tmp"
|
||||
// directory
|
||||
|
||||
|
||||
if (!empty($open_basedir)) {
|
||||
|
||||
|
||||
$tmp_subdir = (PMA_IS_WINDOWS ? '.\\tmp\\' : './tmp/');
|
||||
|
||||
|
||||
// function is_writeable() is valid on PHP3 and 4
|
||||
if (!is_writeable($tmp_subdir)) {
|
||||
$docsql_text = PMA_readFile($sql_file, $sql_file_compression);
|
||||
@@ -185,13 +185,13 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
|
||||
// read from the normal upload dir
|
||||
$docsql_text = PMA_readFile($sql_file, $sql_file_compression);
|
||||
}
|
||||
|
||||
|
||||
// Convert the file's charset if necessary
|
||||
if ($cfg['AllowAnywhereRecoding'] && $allow_recoding
|
||||
&& isset($charset_of_file) && $charset_of_file != $charset) {
|
||||
$docsql_text = PMA_convert_string($charset_of_file, $charset, $docsql_text);
|
||||
}
|
||||
|
||||
|
||||
if (!isset($docsql_text) || $docsql_text == FALSE || $docsql_text == '') {
|
||||
echo '<p><font color="red">' . $GLOBALS['strFileCouldNotBeRead'] . '</font></p>' . "\n";
|
||||
} else {
|
||||
@@ -199,15 +199,15 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
|
||||
}
|
||||
} // end uploaded file stuff
|
||||
} else {
|
||||
|
||||
|
||||
// echo '<h1>Starting Import</h1>';
|
||||
$docpath = $cfg['docSQLDir'] . preg_replace('@\.\.*@', '.', $docpath);
|
||||
if (substr($docpath, -1) != '/') {
|
||||
$docpath .= '/';
|
||||
}
|
||||
|
||||
|
||||
$matched_files = 0;
|
||||
|
||||
|
||||
if (is_dir($docpath)) {
|
||||
// Do the work
|
||||
$handle = opendir($docpath);
|
||||
@@ -299,6 +299,6 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -7,9 +7,9 @@
|
||||
* Get the values of the variables posted or sent to this script and display
|
||||
* the headers
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./libraries/common.lib.php');
|
||||
require('./libraries/relation.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
@@ -25,13 +25,13 @@ if (isset($submit_sql) && preg_match('@^SELECT@i', $encoded_sql_query)) {
|
||||
$goto = 'db_details.php';
|
||||
$zero_rows = htmlspecialchars($strSuccess);
|
||||
$sql_query = urldecode($encoded_sql_query);
|
||||
include('./sql.php');
|
||||
require('./sql.php');
|
||||
exit();
|
||||
} else {
|
||||
$sub_part = '_qbe';
|
||||
include('./db_details_common.php');
|
||||
require('./db_details_common.php');
|
||||
$url_query .= '&goto=db_details_qbe.php';
|
||||
include('./db_details_db_info.php');
|
||||
require('./db_details_db_info.php');
|
||||
}
|
||||
|
||||
if (isset($submit_sql) && !preg_match('@^SELECT@i', $encoded_sql_query)) {
|
||||
@@ -1076,5 +1076,5 @@ if (!empty($qry_orderby)) {
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -8,26 +8,22 @@
|
||||
* because there is no table in the database ($is_info is TRUE)
|
||||
*/
|
||||
if (empty($is_info)) {
|
||||
if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
|
||||
include('./libraries/grab_globals.lib.php');
|
||||
}
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
// Drops/deletes/etc. multiple tables if required
|
||||
if ((!empty($submit_mult) && isset($selected_tbl))
|
||||
|| isset($mult_btn)) {
|
||||
$action = 'db_details_structure.php';
|
||||
$err_url = 'db_details_structure.php?'. PMA_generate_common_url($db);
|
||||
include('./mult_submits.inc.php');
|
||||
require('./mult_submits.inc.php');
|
||||
}
|
||||
include('./db_details_common.php');
|
||||
require('./db_details_common.php');
|
||||
$url_query .= '&goto=db_details_structure.php';
|
||||
|
||||
// Gets the database structure
|
||||
$sub_part = '_structure';
|
||||
include('./db_details_db_info.php');
|
||||
require('./db_details_db_info.php');
|
||||
echo "\n";
|
||||
|
||||
/**
|
||||
@@ -82,7 +78,7 @@ function pma_TableHeader($alternate = FALSE) {
|
||||
/**
|
||||
* Settings for relations stuff
|
||||
*/
|
||||
require('./libraries/relation.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
/**
|
||||
@@ -201,7 +197,7 @@ else {
|
||||
<td valign="top">
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
pma_TableHeader();
|
||||
|
||||
$i = $sum_entries = 0;
|
||||
@@ -251,9 +247,9 @@ else {
|
||||
</td>
|
||||
<td align="center" bgcolor="<?php echo $bgcolor; ?>">
|
||||
<?php
|
||||
include('./libraries/bookmark.lib.php');
|
||||
require_once('./libraries/bookmark.lib.php');
|
||||
$book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
|
||||
|
||||
|
||||
if (!empty($sts_data['Rows'])) {
|
||||
echo '<a href="sql.php?' . $tbl_url_query . '&sql_query='
|
||||
. (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table)))
|
||||
@@ -322,7 +318,7 @@ else {
|
||||
$sum_size += $tblsize;
|
||||
list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0);
|
||||
if (isset($sts_data['Data_free']) && $sts_data['Data_free'] > 0) {
|
||||
list($formated_overhead, $overhead_unit) = PMA_formatByteDown($sts_data['Data_free']);
|
||||
list($formated_overhead, $overhead_unit) = PMA_formatByteDown($sts_data['Data_free']);
|
||||
$overhead_size += $sts_data['Data_free'];
|
||||
}
|
||||
}
|
||||
@@ -388,7 +384,7 @@ else {
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
if ($cfg['ShowStats']) {
|
||||
echo "\n";
|
||||
?>
|
||||
@@ -398,7 +394,7 @@ else {
|
||||
</td>
|
||||
<td align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
|
||||
|
||||
<?php
|
||||
<?php
|
||||
if (isset($formated_overhead)) {
|
||||
echo '<a href="tbl_properties_structure.php?' . $tbl_url_query . '#showusage">' . $formated_overhead . ' ' . $overhead_unit . '</a>' . "\n";
|
||||
unset($formated_overhead);
|
||||
@@ -692,5 +688,5 @@ echo "\n" . '</ul>';
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -6,14 +6,11 @@
|
||||
/**
|
||||
* Gets the variables sent or posted to this script, then displays headers
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./header.inc.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./header.inc.php');
|
||||
|
||||
// Check parameters
|
||||
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
PMA_checkParameters(array('db'));
|
||||
|
||||
@@ -25,7 +22,7 @@ $err_url = 'db_details.php?' . PMA_generate_common_url($db);
|
||||
/**
|
||||
* Settings for relations stuff
|
||||
*/
|
||||
require('./libraries/relation.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
/**
|
||||
@@ -210,7 +207,7 @@ else {
|
||||
} else {
|
||||
$needs_break = '';
|
||||
}
|
||||
|
||||
|
||||
if ((isset($sts_data['Create_time']) && !empty($sts_data['Create_time']))
|
||||
|| (isset($sts_data['Update_time']) && !empty($sts_data['Update_time']))
|
||||
|| (isset($sts_data['Check_time']) && !empty($sts_data['Check_time']))) {
|
||||
@@ -218,7 +215,7 @@ else {
|
||||
?>
|
||||
<table border="0" cellpadding="1" cellspacing="1" width="100%">
|
||||
<?php
|
||||
|
||||
|
||||
if (isset($sts_data['Create_time']) && !empty($sts_data['Create_time'])) {
|
||||
?>
|
||||
<tr>
|
||||
@@ -227,7 +224,7 @@ else {
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
if (isset($sts_data['Update_time']) && !empty($sts_data['Update_time'])) {
|
||||
?>
|
||||
<tr>
|
||||
@@ -236,7 +233,7 @@ else {
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
if (isset($sts_data['Check_time']) && !empty($sts_data['Check_time'])) {
|
||||
?>
|
||||
<tr>
|
||||
@@ -308,5 +305,5 @@ function printPage()
|
||||
<?php
|
||||
echo '<br /><br /> <input type="button" style="visibility: ; width: 100px; height: 25px" name="print" value="' . $strPrint . '" onclick="printPage()">' . "\n";
|
||||
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -379,5 +379,5 @@ echo"\n";
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
63
export.php
63
export.php
@@ -5,9 +5,9 @@
|
||||
/**
|
||||
* Get the variables sent or posted to this script and a core script
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./libraries/common.lib.php');
|
||||
require('./libraries/zip.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/zip.lib.php');
|
||||
|
||||
PMA_checkParameters(array('what'));
|
||||
|
||||
@@ -68,7 +68,7 @@ function PMA_exportOutputHandler($line)
|
||||
if ($GLOBALS['onfly_compression']) {
|
||||
|
||||
$dump_buffer_len += strlen($dump_buffer);
|
||||
|
||||
|
||||
if ($dump_buffer_len > $GLOBALS['memory_limit']) {
|
||||
// as bzipped
|
||||
if ($GLOBALS['output_charset_conversion']) {
|
||||
@@ -149,7 +149,7 @@ if (empty($asfile)) {
|
||||
$crlf = PMA_whichCrlf();
|
||||
|
||||
// Do we need to convert charset?
|
||||
$output_charset_conversion = $asfile &&
|
||||
$output_charset_conversion = $asfile &&
|
||||
$cfg['AllowAnywhereRecoding'] && $allow_recoding
|
||||
&& isset($charset_of_file) && $charset_of_file != $charset;
|
||||
|
||||
@@ -182,22 +182,22 @@ if ($asfile) {
|
||||
$pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
|
||||
if ($export_type == 'server') {
|
||||
if (isset($remember_template)) {
|
||||
setcookie('pma_server_filename_template', $filename_template , 0,
|
||||
substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/')),
|
||||
setcookie('pma_server_filename_template', $filename_template , 0,
|
||||
substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/')),
|
||||
'', ($pma_uri_parts['scheme'] == 'https'));
|
||||
}
|
||||
$filename = str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template));
|
||||
} elseif ($export_type == 'database') {
|
||||
if (isset($remember_template)) {
|
||||
setcookie('pma_db_filename_template', $filename_template , 0,
|
||||
substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/')),
|
||||
setcookie('pma_db_filename_template', $filename_template , 0,
|
||||
substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/')),
|
||||
'', ($pma_uri_parts['scheme'] == 'https'));
|
||||
}
|
||||
$filename = str_replace('__DB__', $db, str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template)));
|
||||
} else {
|
||||
if (isset($remember_template)) {
|
||||
setcookie('pma_table_filename_template', $filename_template , 0,
|
||||
substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/')),
|
||||
setcookie('pma_table_filename_template', $filename_template , 0,
|
||||
substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/')),
|
||||
'', ($pma_uri_parts['scheme'] == 'https'));
|
||||
}
|
||||
$filename = str_replace('__TABLE__', $table, str_replace('__DB__', $db, str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template))));
|
||||
@@ -263,16 +263,16 @@ if ($save_on_server) {
|
||||
}
|
||||
if (isset($message)) {
|
||||
$js_to_run = 'functions.js';
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
if ($export_type == 'server') {
|
||||
$active_page = 'server_export.php';
|
||||
include('./server_export.php');
|
||||
require('./server_export.php');
|
||||
} elseif ($export_type == 'database') {
|
||||
$active_page = 'db_details_export.php';
|
||||
include('./db_details_export.php');
|
||||
require('./db_details_export.php');
|
||||
} else {
|
||||
$active_page = 'tbl_properties_export.php';
|
||||
include('./tbl_properties_export.php');
|
||||
require('./tbl_properties_export.php');
|
||||
}
|
||||
exit();
|
||||
}
|
||||
@@ -299,7 +299,7 @@ if (!$save_on_server) {
|
||||
} else {
|
||||
// HTML
|
||||
$backup_cfgServer = $cfg['Server'];
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
$cfg['Server'] = $backup_cfgServer;
|
||||
unset($backup_cfgServer);
|
||||
echo '<div align="' . $cell_align_left . '">' . "\n";
|
||||
@@ -314,16 +314,16 @@ if ($export_type == 'database') {
|
||||
if ($num_tables == 0) {
|
||||
$message = $strNoTablesFound;
|
||||
$js_to_run = 'functions.js';
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
if ($export_type == 'server') {
|
||||
$active_page = 'server_export.php';
|
||||
include('./server_export.php');
|
||||
require('./server_export.php');
|
||||
} elseif ($export_type == 'database') {
|
||||
$active_page = 'db_details_export.php';
|
||||
include('./db_details_export.php');
|
||||
require('./db_details_export.php');
|
||||
} else {
|
||||
$active_page = 'tbl_properties_export.php';
|
||||
include('./tbl_properties_export.php');
|
||||
require('./tbl_properties_export.php');
|
||||
}
|
||||
exit();
|
||||
}
|
||||
@@ -337,11 +337,11 @@ $do_relation = isset($GLOBALS[$what . '_relation']);
|
||||
$do_comments = isset($GLOBALS[$what . '_comments']);
|
||||
$do_mime = isset($GLOBALS[$what . '_mime']);
|
||||
if ($do_relation || $do_comments || $do_mime) {
|
||||
require('./libraries/relation.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
}
|
||||
if ($do_mime) {
|
||||
require('./libraries/transformations.lib.php');
|
||||
require_once('./libraries/transformations.lib.php');
|
||||
}
|
||||
|
||||
// Include dates in export?
|
||||
@@ -358,7 +358,7 @@ if ($export_type == 'server') {
|
||||
if ($server > 0 && empty($dblist)) {
|
||||
PMA_availableDatabases();
|
||||
}
|
||||
|
||||
|
||||
if (isset($db_select)) {
|
||||
$tmp_select = implode($db_select, '|');
|
||||
$tmp_select = '|' . $tmp_select . '|';
|
||||
@@ -455,10 +455,9 @@ if (!empty($asfile)) {
|
||||
if (@function_exists('bzcompress')) {
|
||||
$dump_buffer = bzcompress($dump_buffer);
|
||||
if ($dump_buffer === -8) {
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
echo sprintf($strBzError, '<a href="http://bugs.php.net/bug.php?id=17300" target="_blank">17300</a>');
|
||||
include('./footer.inc.php');
|
||||
exit;
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -481,16 +480,16 @@ if (!empty($asfile)) {
|
||||
}
|
||||
|
||||
$js_to_run = 'functions.js';
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
if ($export_type == 'server') {
|
||||
$active_page = 'server_export.php';
|
||||
include('./server_export.php');
|
||||
require_once('./server_export.php');
|
||||
} elseif ($export_type == 'database') {
|
||||
$active_page = 'db_details_export.php';
|
||||
include('./db_details_export.php');
|
||||
require_once('./db_details_export.php');
|
||||
} else {
|
||||
$active_page = 'tbl_properties_export.php';
|
||||
include('./tbl_properties_export.php');
|
||||
require_once('./tbl_properties_export.php');
|
||||
}
|
||||
exit();
|
||||
} else {
|
||||
@@ -507,6 +506,6 @@ else {
|
||||
echo ' </pre>' . "\n";
|
||||
echo '</div>' . "\n";
|
||||
echo "\n";
|
||||
include('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
} // end if
|
||||
?>
|
||||
?>
|
||||
|
@@ -2,10 +2,15 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
// In this file you may add PHP or HTML statements that will be used to define
|
||||
// the footer for phpMyAdmin pages.
|
||||
/**
|
||||
* In this file you may add PHP or HTML statements that will be used to define
|
||||
* the footer for phpMyAdmin pages.
|
||||
*
|
||||
* WARNING: This script has to be included at the very end of your code because
|
||||
* it will stop the script execution!
|
||||
*/
|
||||
|
||||
require('./libraries/relation.lib.php'); // for PMA_setHistory()
|
||||
require_once('./libraries/relation.lib.php'); // for PMA_setHistory()
|
||||
|
||||
/**
|
||||
* Query window
|
||||
@@ -14,6 +19,7 @@ require('./libraries/relation.lib.php'); // for PMA_setHistory()
|
||||
// If query window is wanted and open, update with latest selected db/table.
|
||||
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
<?php
|
||||
@@ -137,10 +143,10 @@ if (isset($GLOBALS['cfg']['DBG']['enable'])
|
||||
&& isset($GLOBALS['cfg']['DBG']['profile']['enable'])
|
||||
&& $GLOBALS['cfg']['DBG']['profile']['enable']) {
|
||||
//run the basic setup code first
|
||||
include('./libraries/dbg/setup.php');
|
||||
require_once('./libraries/dbg/setup.php');
|
||||
//if the setup ran fine, then do the profiling
|
||||
if (isset($GLOBALS['DBG']) && $GLOBALS['DBG']) {
|
||||
include('./libraries/dbg/profiling.php');
|
||||
require_once('./libraries/dbg/profiling.php');
|
||||
dbg_dump_profiling_results();
|
||||
}
|
||||
}
|
||||
@@ -153,4 +159,9 @@ if (isset($GLOBALS['cfg']['OBGzip']) && $GLOBALS['cfg']['OBGzip']
|
||||
PMA_outBufferPost($GLOBALS['ob_mode']);
|
||||
}
|
||||
|
||||
?>
|
||||
/**
|
||||
* Stops the script execution
|
||||
*/
|
||||
exit;
|
||||
|
||||
?>
|
||||
|
291
header.inc.php
291
header.inc.php
@@ -2,161 +2,154 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_HEADER_INC_INCLUDED')) {
|
||||
define('PMA_HEADER_INC_INCLUDED', 1);
|
||||
|
||||
/**
|
||||
* Gets a core script and starts output buffering work
|
||||
*/
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
if (!defined('PMA_OB_LIB_INCLUDED')) {
|
||||
include('./libraries/ob.lib.php');
|
||||
}
|
||||
if ($GLOBALS['cfg']['OBGzip']) {
|
||||
$GLOBALS['ob_mode'] = PMA_outBufferModeGet();
|
||||
if ($GLOBALS['ob_mode']) {
|
||||
PMA_outBufferPre($GLOBALS['ob_mode']);
|
||||
}
|
||||
/**
|
||||
* Gets a core script and starts output buffering work
|
||||
*/
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/ob.lib.php');
|
||||
if ($GLOBALS['cfg']['OBGzip']) {
|
||||
$GLOBALS['ob_mode'] = PMA_outBufferModeGet();
|
||||
if ($GLOBALS['ob_mode']) {
|
||||
PMA_outBufferPre($GLOBALS['ob_mode']);
|
||||
}
|
||||
}
|
||||
|
||||
// garvin: For re-usability, moved http-headers and stylesheets
|
||||
// to a seperate file. It can now be included by header.inc.php,
|
||||
// queryframe.php, querywindow.php.
|
||||
// garvin: For re-usability, moved http-headers and stylesheets
|
||||
// to a seperate file. It can now be included by header.inc.php,
|
||||
// queryframe.php, querywindow.php.
|
||||
|
||||
include('./libraries/header_http.inc.php');
|
||||
include('./libraries/header_meta_style.inc.php');
|
||||
require_once('./libraries/header_http.inc.php');
|
||||
require_once('./libraries/header_meta_style.inc.php');
|
||||
|
||||
$title = '';
|
||||
$title = '';
|
||||
if (isset($GLOBALS['db'])) {
|
||||
$title .= str_replace('\'', '\\\'', $GLOBALS['db']);
|
||||
}
|
||||
if (isset($GLOBALS['table'])) {
|
||||
$title .= (empty($title) ? '' : '.') . str_replace('\'', '\\\'', $GLOBALS['table']);
|
||||
}
|
||||
if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) {
|
||||
$title .= (empty($title) ? 'phpMyAdmin ' : ' ')
|
||||
. sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ? str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['verbose'])));
|
||||
}
|
||||
$title .= (empty($title) ? '' : ' - ') . 'phpMyAdmin ' . PMA_VERSION;
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
// Updates the title of the frameset if possible (ns4 does not allow this)
|
||||
if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
|
||||
&& typeof(parent.document.title) == 'string') {
|
||||
parent.document.title = '<?php echo $title; ?>';
|
||||
}
|
||||
<?php
|
||||
// Add some javascript instructions if required
|
||||
if (isset($js_to_run) && $js_to_run == 'functions.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
// js form validation stuff
|
||||
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
|
||||
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
|
||||
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
|
||||
var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>';
|
||||
var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
|
||||
//-->
|
||||
</script>
|
||||
<script src="libraries/functions.js" type="text/javascript" language="javascript"></script>
|
||||
<?php
|
||||
} else if (isset($js_to_run) && $js_to_run == 'user_password.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
// js form validation stuff
|
||||
var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
|
||||
var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
|
||||
var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
|
||||
var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
|
||||
//-->
|
||||
</script>
|
||||
<script src="libraries/user_password.js" type="text/javascript" language="javascript"></script>
|
||||
<?php
|
||||
} else if (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
// js form validation stuff
|
||||
var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
|
||||
var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
|
||||
var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
|
||||
var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
|
||||
//-->
|
||||
</script>
|
||||
<script src="libraries/server_privileges.js" type="text/javascript" language="javascript"></script>
|
||||
<?php
|
||||
} else if (isset($js_to_run) && $js_to_run == 'indexes.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
// js index validation stuff
|
||||
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
|
||||
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
|
||||
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
|
||||
//-->
|
||||
</script>
|
||||
<script src="libraries/indexes.js" type="text/javascript" language="javascript"></script>
|
||||
<?php
|
||||
} else if (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
//-->
|
||||
</script>
|
||||
<script src="libraries/tbl_change.js" type="text/javascript" language="javascript"></script>
|
||||
<?php
|
||||
} else {
|
||||
echo "\n";
|
||||
?>
|
||||
//-->
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<meta name="OBGZip" content="<?php echo ($cfg['OBGzip'] ? 'true' : 'false'); ?>" />
|
||||
</head>
|
||||
|
||||
|
||||
<?php
|
||||
if ($GLOBALS['cfg']['RightBgImage'] != '') {
|
||||
$bkg_img = ' background="' . $GLOBALS['cfg']['RightBgImage'] . '"';
|
||||
} else {
|
||||
$bkg_img = '';
|
||||
}
|
||||
?>
|
||||
<body bgcolor="<?php echo $GLOBALS['cfg']['RightBgColor'] . '"' . $bkg_img; ?>>
|
||||
<?php
|
||||
if (!defined('PMA_DISPLAY_HEADING')) {
|
||||
define('PMA_DISPLAY_HEADING', 1);
|
||||
}
|
||||
if (PMA_DISPLAY_HEADING) {
|
||||
$header_url_qry = '?' . PMA_generate_common_url();
|
||||
echo '<h1>' . "\n";
|
||||
$server_info = (!empty($cfg['Server']['verbose'])
|
||||
? $cfg['Server']['verbose']
|
||||
: $server_info = $cfg['Server']['host'] . (empty($cfg['Server']['port'])
|
||||
? ''
|
||||
: ':' . $cfg['Server']['port']
|
||||
)
|
||||
);
|
||||
if (isset($GLOBALS['db'])) {
|
||||
$title .= str_replace('\'', '\\\'', $GLOBALS['db']);
|
||||
}
|
||||
if (isset($GLOBALS['table'])) {
|
||||
$title .= (empty($title) ? '' : '.') . str_replace('\'', '\\\'', $GLOBALS['table']);
|
||||
}
|
||||
if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) {
|
||||
$title .= (empty($title) ? 'phpMyAdmin ' : ' ')
|
||||
. sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ? str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['verbose'])));
|
||||
}
|
||||
$title .= (empty($title) ? '' : ' - ') . 'phpMyAdmin ' . PMA_VERSION;
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
// Updates the title of the frameset if possible (ns4 does not allow this)
|
||||
if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
|
||||
&& typeof(parent.document.title) == 'string') {
|
||||
parent.document.title = '<?php echo $title; ?>';
|
||||
}
|
||||
<?php
|
||||
// Add some javascript instructions if required
|
||||
if (isset($js_to_run) && $js_to_run == 'functions.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
// js form validation stuff
|
||||
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
|
||||
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
|
||||
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
|
||||
var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>';
|
||||
var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
|
||||
//-->
|
||||
</script>
|
||||
<script src="libraries/functions.js" type="text/javascript" language="javascript"></script>
|
||||
<?php
|
||||
} else if (isset($js_to_run) && $js_to_run == 'user_password.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
// js form validation stuff
|
||||
var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
|
||||
var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
|
||||
var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
|
||||
var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
|
||||
//-->
|
||||
</script>
|
||||
<script src="libraries/user_password.js" type="text/javascript" language="javascript"></script>
|
||||
<?php
|
||||
} else if (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
// js form validation stuff
|
||||
var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
|
||||
var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
|
||||
var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
|
||||
var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
|
||||
//-->
|
||||
</script>
|
||||
<script src="libraries/server_privileges.js" type="text/javascript" language="javascript"></script>
|
||||
<?php
|
||||
} else if (isset($js_to_run) && $js_to_run == 'indexes.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
// js index validation stuff
|
||||
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
|
||||
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
|
||||
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
|
||||
//-->
|
||||
</script>
|
||||
<script src="libraries/indexes.js" type="text/javascript" language="javascript"></script>
|
||||
<?php
|
||||
} else if (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
|
||||
echo "\n";
|
||||
?>
|
||||
//-->
|
||||
</script>
|
||||
<script src="libraries/tbl_change.js" type="text/javascript" language="javascript"></script>
|
||||
<?php
|
||||
} else {
|
||||
echo "\n";
|
||||
?>
|
||||
//-->
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<meta name="OBGZip" content="<?php echo ($cfg['OBGzip'] ? 'true' : 'false'); ?>" />
|
||||
</head>
|
||||
|
||||
|
||||
<?php
|
||||
if ($GLOBALS['cfg']['RightBgImage'] != '') {
|
||||
$bkg_img = ' background="' . $GLOBALS['cfg']['RightBgImage'] . '"';
|
||||
} else {
|
||||
$bkg_img = '';
|
||||
}
|
||||
?>
|
||||
<body bgcolor="<?php echo $GLOBALS['cfg']['RightBgColor'] . '"' . $bkg_img; ?>>
|
||||
<?php
|
||||
if (!defined('PMA_DISPLAY_HEADING')) {
|
||||
define('PMA_DISPLAY_HEADING', 1);
|
||||
}
|
||||
if (PMA_DISPLAY_HEADING) {
|
||||
$header_url_qry = '?' . PMA_generate_common_url();
|
||||
echo '<h1>' . "\n";
|
||||
$server_info = (!empty($cfg['Server']['verbose'])
|
||||
? $cfg['Server']['verbose']
|
||||
: $server_info = $cfg['Server']['host'] . (empty($cfg['Server']['port'])
|
||||
? ''
|
||||
: ':' . $cfg['Server']['port']
|
||||
)
|
||||
);
|
||||
if (isset($GLOBALS['db'])) {
|
||||
echo ' ' . $GLOBALS['strDatabase'] . ' <i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . $header_url_qry . '&db=' . urlencode($GLOBALS['db']) . '">' . htmlspecialchars($GLOBALS['db']) . '</a></i>' . "\n";
|
||||
if (!empty($GLOBALS['table'])) {
|
||||
echo ' - ' . $GLOBALS['strTable'] . ' <i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabTable'] . $header_url_qry . '&db=' . urlencode($GLOBALS['db']) . '&table=' . urlencode($GLOBALS['table']) . '">' . htmlspecialchars($GLOBALS['table']) . '</a></i>' . "\n";
|
||||
}
|
||||
echo ' ' . sprintf($GLOBALS['strRunning'], '<i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabServer'] . $header_url_qry . '">' . htmlspecialchars($server_info) . '</a></i>');
|
||||
} else {
|
||||
echo ' ' . sprintf($GLOBALS['strServer'], '<i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabServer'] . $header_url_qry . '">' . htmlspecialchars($server_info) . '</a></i>');
|
||||
echo ' ' . $GLOBALS['strDatabase'] . ' <i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . $header_url_qry . '&db=' . urlencode($GLOBALS['db']) . '">' . htmlspecialchars($GLOBALS['db']) . '</a></i>' . "\n";
|
||||
if (!empty($GLOBALS['table'])) {
|
||||
echo ' - ' . $GLOBALS['strTable'] . ' <i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabTable'] . $header_url_qry . '&db=' . urlencode($GLOBALS['db']) . '&table=' . urlencode($GLOBALS['table']) . '">' . htmlspecialchars($GLOBALS['table']) . '</a></i>' . "\n";
|
||||
}
|
||||
echo "\n" . '</h1>' . "\n";
|
||||
echo ' ' . sprintf($GLOBALS['strRunning'], '<i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabServer'] . $header_url_qry . '">' . htmlspecialchars($server_info) . '</a></i>');
|
||||
} else {
|
||||
echo ' ' . sprintf($GLOBALS['strServer'], '<i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabServer'] . $header_url_qry . '">' . htmlspecialchars($server_info) . '</a></i>');
|
||||
}
|
||||
echo "\n";
|
||||
echo "\n" . '</h1>' . "\n";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
|
||||
/**
|
||||
* Sets a variable to remember headers have been sent
|
||||
*/
|
||||
$GLOBALS['is_header_sent'] = TRUE;
|
||||
} // PMA_HEADER_INC_INCLUDED
|
||||
?>
|
||||
/**
|
||||
* Sets a variable to remember headers have been sent
|
||||
*/
|
||||
$GLOBALS['is_header_sent'] = TRUE;
|
||||
|
||||
?>
|
||||
|
@@ -5,8 +5,8 @@
|
||||
/**
|
||||
* Gets a core script and starts output buffering work
|
||||
*/
|
||||
require('./libraries/common.lib.php');
|
||||
require('./libraries/ob.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/ob.lib.php');
|
||||
if ($cfg['OBGzip']) {
|
||||
$ob_mode = PMA_outBufferModeGet();
|
||||
if ($ob_mode) {
|
||||
@@ -23,7 +23,7 @@ PMA_checkParameters(array('db', 'full_sql_query'));
|
||||
// to a seperate file. It can now be included by header.inc.php,
|
||||
// queryframe.php, querywindow.php.
|
||||
|
||||
include('./libraries/header_http.inc.php');
|
||||
require_once('./libraries/header_http.inc.php');
|
||||
|
||||
/**
|
||||
* Sends the beginning of the html page then returns to the calling script
|
||||
@@ -68,4 +68,4 @@ if ($text_dir == 'ltr') {
|
||||
* Sets a variable to remember headers have been sent
|
||||
*/
|
||||
$is_header_sent = TRUE;
|
||||
?>
|
||||
?>
|
||||
|
@@ -6,8 +6,8 @@
|
||||
/**
|
||||
* Gets core libraries and defines some variables
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./libraries/common.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
// Gets the default font sizes
|
||||
PMA_setFontSizes();
|
||||
@@ -41,7 +41,7 @@ $url_query = PMA_generate_common_url(isset($db) ? $db : '');
|
||||
|
||||
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
|
||||
|
||||
require('./libraries/relation.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
|
||||
@@ -112,4 +112,4 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||
}
|
||||
?>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
@@ -18,8 +18,8 @@
|
||||
/**
|
||||
* Gets some core scripts
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./libraries/common.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
// Check parameters
|
||||
|
||||
@@ -80,9 +80,9 @@ if (isset($btnLDI) && isset($local_textfile) && $local_textfile != '') {
|
||||
*/
|
||||
if (isset($btnLDI) && empty($textfile)) {
|
||||
$js_to_run = 'functions.js';
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
$message = $strMustSelectFile;
|
||||
include('./ldi_table.php');
|
||||
require('./ldi_table.php');
|
||||
} elseif (isset($btnLDI) && ($textfile != 'none')) {
|
||||
if (!isset($replace)) {
|
||||
$replace = '';
|
||||
@@ -91,7 +91,7 @@ if (isset($btnLDI) && empty($textfile)) {
|
||||
// the error message does not correspond exactly to the error...
|
||||
if (!@chmod($textfile, 0644)) {
|
||||
echo $strFileCouldNotBeRead . ' ' . $textfile . '<br />';
|
||||
exit();
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
|
||||
// Kanji encoding convert appended by Y.Kawada
|
||||
@@ -159,7 +159,7 @@ if (isset($btnLDI) && empty($textfile)) {
|
||||
//
|
||||
// The $goto in ldi_table.php is set to tbl_properties.php but maybe
|
||||
// if would be better to Browse the latest inserted data.
|
||||
include('./sql.php');
|
||||
require('./sql.php');
|
||||
if ($unlink_local_textfile) {
|
||||
unlink($textfile);
|
||||
}
|
||||
@@ -170,6 +170,6 @@ if (isset($btnLDI) && empty($textfile)) {
|
||||
* The form used to define the query hasn't been yet submitted -> loads it
|
||||
*/
|
||||
else {
|
||||
include('./ldi_table.php');
|
||||
require('./ldi_table.php');
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@@ -7,12 +7,10 @@
|
||||
* This file defines the forms used to insert a textfile into a table
|
||||
*/
|
||||
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
|
||||
// Check parameters
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
require_once('./libraries/common.lib.php');
|
||||
PMA_checkParameters(array('db', 'table'));
|
||||
|
||||
|
||||
@@ -165,7 +163,7 @@ if (PMA_MYSQL_INT_VERSION > 40003) {
|
||||
<tr>
|
||||
<td><?php echo $strLoadMethod; ?>
|
||||
</td>
|
||||
<td>
|
||||
<td>
|
||||
<input type="radio" id="radio_local_option_0" name="local_option" value="0" <?php echo (!$local_option_selected ? ' checked="checked" ' : ''); ?>/><label for="radio_local_option_0">...DATA</label><br />
|
||||
<input type="radio" id="radio_local_option_1" name="local_option" value="1" <?php echo ($local_option_selected ? ' checked="checked" ' : ''); ?>/><label for="radio_local_option_1">...DATA LOCAL</label>
|
||||
</td>
|
||||
@@ -194,5 +192,5 @@ if (PMA_MYSQL_INT_VERSION > 40003) {
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
54
left.php
54
left.php
@@ -7,7 +7,7 @@
|
||||
* Gets the variables sent to this script, retains the db name that may have
|
||||
* been defined as startup option and include a core library
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
if (isset($lightm_db) && !empty($lightm_db)) {
|
||||
// no longer urlencoded because of html entities in the db name
|
||||
// $db = urldecode($lightm_db);
|
||||
@@ -22,8 +22,8 @@ if (!empty($db)) {
|
||||
/**
|
||||
* Gets a core script and starts output buffering work
|
||||
*/
|
||||
require('./libraries/common.lib.php');
|
||||
require('./libraries/ob.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/ob.lib.php');
|
||||
if ($cfg['OBGzip']) {
|
||||
$ob_mode = PMA_outBufferModeGet();
|
||||
if ($ob_mode) {
|
||||
@@ -33,8 +33,8 @@ if ($cfg['OBGzip']) {
|
||||
|
||||
PMA_checkParameters(array('hash'));
|
||||
|
||||
include('./libraries/bookmark.lib.php');
|
||||
require('./libraries/relation.lib.php');
|
||||
require_once('./libraries/bookmark.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
function PMA_reduceNest($_table) {
|
||||
@@ -63,7 +63,7 @@ function PMA_indent($spaces) {
|
||||
for ($i = 0; $i <= $spaces; $i++) {
|
||||
$string .= ' ';
|
||||
}
|
||||
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ function PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_
|
||||
}
|
||||
$counter = count($countarray);
|
||||
}
|
||||
|
||||
|
||||
echo "\n";
|
||||
echo PMA_indent($indent * 5) . '<div id="el' . $id . 'Parent" class="parent"' . $on_mouse . '>' . "\n";
|
||||
echo PMA_indent($indent * 6) . '<nobr><img src="images/spacer.gif" border="0" width="' . (($indent - 1) * $indent_level) . '" height="9" alt="" /><a class="item" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['common_url_query'] . '" onclick="if (capable) {expandBase(\'el' . $id . '\', true); return false} else {return true}">';
|
||||
@@ -102,25 +102,25 @@ function PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent
|
||||
PMA_nestedSetHeaderParent($baseid, $firstGroup, $keyhistory, $indent, $indent_level, $tablestack);
|
||||
$indent++;
|
||||
}
|
||||
|
||||
|
||||
foreach($tablestack AS $key => $val) {
|
||||
if ($key != 'pma_name' && $key != 'pma_list_item') {
|
||||
if ($headerOut) {
|
||||
PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val);
|
||||
}
|
||||
|
||||
|
||||
if (isset($val['pma_name']) && isset($val['pma_list_item']) && count($val) == 2) {
|
||||
PMA_nestedSet($baseid, $val, $key, $keyhistory . $key, false, ($indent + 1));
|
||||
} else {
|
||||
PMA_nestedSet($baseid, $val, $key, $keyhistory . $key, true, ($indent + 1));
|
||||
}
|
||||
|
||||
|
||||
if ($headerOut) {
|
||||
echo PMA_indent($indent * 5) . '</div><id class="PMA_nestedSetHeader">' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($firstGroup && $firstGroupClose) {
|
||||
echo PMA_indent($indent * 4) . '</div><id class="PMA_nestedSetHeader2">' . "\n";
|
||||
} elseif ($firstGroup) {
|
||||
@@ -133,13 +133,13 @@ function PMA_nestedSet($baseid, $tablestack, $key = '__protected__', $keyhistory
|
||||
if ($keyhistory == '' && $key != '__protected__') {
|
||||
$keyhistory = $key;
|
||||
}
|
||||
|
||||
|
||||
$indent_level = 9;
|
||||
|
||||
|
||||
if (isset($tablestack)
|
||||
&& isset($tablestack['pma_name'])
|
||||
&& isset($tablestack['pma_list_item'])) {
|
||||
|
||||
|
||||
if (count($tablestack) > 1 && !empty($key) && isset($tablestack['pma_name']) && isset($tablestack['pma_list_item']) && $indent == 1) {
|
||||
PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, ($indent+1), $indent_level, $headerOut, $key, false);
|
||||
$divClose = true;
|
||||
@@ -151,7 +151,7 @@ function PMA_nestedSet($baseid, $tablestack, $key = '__protected__', $keyhistory
|
||||
}
|
||||
|
||||
$on_mouse = (($GLOBALS['cfg']['LeftPointerColor'] == '') ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $keyhistory . $key . '\', \'' . $GLOBALS['cfg']['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $keyhistory . $key . '\', \'' . $GLOBALS['cfg']['LeftBgColor'] . '\')}"');
|
||||
|
||||
|
||||
$loops = 0;
|
||||
foreach($tablestack['pma_name'] AS $tkey => $tval) {
|
||||
|
||||
@@ -162,10 +162,10 @@ function PMA_nestedSet($baseid, $tablestack, $key = '__protected__', $keyhistory
|
||||
echo PMA_indent(($indent * 5)) . $ival;
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
|
||||
$loops++;
|
||||
}
|
||||
|
||||
|
||||
if ($divClose) {
|
||||
echo PMA_indent($indent * 5) . '</div><id space="putting omitted div" class="PMA_nestedSet2">';
|
||||
}
|
||||
@@ -173,7 +173,7 @@ function PMA_nestedSet($baseid, $tablestack, $key = '__protected__', $keyhistory
|
||||
} elseif (is_array($tablestack)) {
|
||||
PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, (($key == '__protected__' && $indent == 1 )? ($indent-1) : ($indent + 1)), $indent_level, $headerOut, (($key == '__protected__' && $indent == 1) || ($indent > 1) ? false : $key));
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
@@ -192,7 +192,7 @@ if ($server > 0) {
|
||||
// to a seperate file. It can now be included by header.inc.php,
|
||||
// queryframe.php, querywindow.php.
|
||||
|
||||
include('./libraries/header_http.inc.php');
|
||||
require_once('./libraries/header_http.inc.php');
|
||||
|
||||
/**
|
||||
* Displays the frame
|
||||
@@ -215,11 +215,11 @@ PMA_setFontSizes();
|
||||
if (isset($lightm_db) && !empty($lightm_db)) {
|
||||
?>
|
||||
window.parent.frames['phpmain<?php echo $hash; ?>'].location.replace('./<?php echo $cfg['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db, '', '&');?>');
|
||||
<?php
|
||||
<?php
|
||||
} elseif (isset($lightm_db)) {
|
||||
?>
|
||||
window.parent.frames['phpmain<?php echo $hash; ?>'].location.replace('./main.php?<?php echo PMA_generate_common_url('', '', '&');?>');
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
//-->
|
||||
@@ -479,7 +479,7 @@ if ($num_dbs > 1) {
|
||||
$list_item .= '<bdo dir="' . $text_dir . '"> </bdo>' . "\n";
|
||||
$list_item .= '<a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">';
|
||||
$list_item .= ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></nobr><br />' . "\n";
|
||||
|
||||
|
||||
// garvin: Check whether to display nested sets
|
||||
if (!empty($cfg['LeftFrameTableSeparator'])) {
|
||||
$_table = explode($cfg['LeftFrameTableSeparator'], str_replace('\'', '\\\'',$table));
|
||||
@@ -492,7 +492,7 @@ if ($num_dbs > 1) {
|
||||
|
||||
unset($_table[count($_table)-1]);
|
||||
$_table = PMA_reduceNest($_table);
|
||||
|
||||
|
||||
$eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . str_replace('\'', '\\\'', $table) . '\';';
|
||||
$eval_string .= '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_list_item\'][] = \'' . str_replace('\'', '\\\'', $list_item) . '\';';
|
||||
eval($eval_string);
|
||||
@@ -505,7 +505,7 @@ if ($num_dbs > 1) {
|
||||
$tablestack['']['pma_list_item'][] = $list_item;
|
||||
}
|
||||
} // end for $t (tables list)
|
||||
|
||||
|
||||
PMA_nestedSet($j, $tablestack);
|
||||
?>
|
||||
</div>
|
||||
@@ -708,7 +708,7 @@ else if ($num_dbs == 1) {
|
||||
$list_item .= '<bdo dir="' . $text_dir . '"> </bdo>' . "\n";
|
||||
$list_item .= '<a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">';
|
||||
$list_item .= ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></nobr><br />';
|
||||
|
||||
|
||||
// garvin: Check whether to display nested sets
|
||||
if (!empty($cfg['LeftFrameTableSeparator'])) {
|
||||
$_table = explode($cfg['LeftFrameTableSeparator'], $table);
|
||||
@@ -755,7 +755,7 @@ else if ($num_dbs == 1) {
|
||||
} else {
|
||||
echo ' </div>';
|
||||
}
|
||||
|
||||
|
||||
echo "\n";
|
||||
} // end if ($num_dbs == 1)
|
||||
|
||||
@@ -790,4 +790,4 @@ if (isset($cfg['OBGzip']) && $cfg['OBGzip']
|
||||
&& isset($ob_mode) && $ob_mode) {
|
||||
PMA_outBufferPost($ob_mode);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@@ -8,92 +8,89 @@
|
||||
// +--------------------------------------------------------------------------+
|
||||
|
||||
|
||||
if (!defined('PMA_CONFIG_AUTH_INCLUDED')) {
|
||||
define('PMA_CONFIG_AUTH_INCLUDED', 1);
|
||||
|
||||
/**
|
||||
* Displays authentication form
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth()
|
||||
{
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth()' function
|
||||
/**
|
||||
* Displays authentication form
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth()
|
||||
{
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth()' function
|
||||
|
||||
|
||||
/**
|
||||
* Gets advanced authentication settings
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth_check()
|
||||
{
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth_check()' function
|
||||
/**
|
||||
* Gets advanced authentication settings
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth_check()
|
||||
{
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth_check()' function
|
||||
|
||||
|
||||
/**
|
||||
* Set the user and password after last checkings if required
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth_set_user()
|
||||
{
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth_set_user()' function
|
||||
/**
|
||||
* Set the user and password after last checkings if required
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth_set_user()
|
||||
{
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth_set_user()' function
|
||||
|
||||
|
||||
/**
|
||||
* User is not allowed to login to MySQL -> authentication failed
|
||||
*
|
||||
* @global string the MySQL error message PHP returns
|
||||
* @global string the connection type (persistent or not)
|
||||
* @global string the MySQL server port to use
|
||||
* @global string the MySQL socket port to use
|
||||
* @global array the current server settings
|
||||
* @global string the font face to use in case of failure
|
||||
* @global string the default font size to use in case of failure
|
||||
* @global string the big font size to use in case of failure
|
||||
* @global boolean tell the "PMA_mysqlDie()" function headers have been
|
||||
* sent
|
||||
*
|
||||
* @return boolean always true (no return indeed)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth_fails()
|
||||
{
|
||||
global $php_errormsg;
|
||||
global $connect_func, $server_port, $server_socket, $cfg;
|
||||
global $right_font_family, $font_size, $font_bigger;
|
||||
global $is_header_sent;
|
||||
if (PMA_mysql_error()) {
|
||||
$conn_error = PMA_mysql_error();
|
||||
} else if (isset($php_errormsg)) {
|
||||
$conn_error = $php_errormsg;
|
||||
} else {
|
||||
$conn_error = 'Cannot connect: invalid settings.';
|
||||
}
|
||||
/**
|
||||
* User is not allowed to login to MySQL -> authentication failed
|
||||
*
|
||||
* @global string the MySQL error message PHP returns
|
||||
* @global string the connection type (persistent or not)
|
||||
* @global string the MySQL server port to use
|
||||
* @global string the MySQL socket port to use
|
||||
* @global array the current server settings
|
||||
* @global string the font face to use in case of failure
|
||||
* @global string the default font size to use in case of failure
|
||||
* @global string the big font size to use in case of failure
|
||||
* @global boolean tell the "PMA_mysqlDie()" function headers have been
|
||||
* sent
|
||||
*
|
||||
* @return boolean always true (no return indeed)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth_fails()
|
||||
{
|
||||
global $php_errormsg;
|
||||
global $connect_func, $server_port, $server_socket, $cfg;
|
||||
global $right_font_family, $font_size, $font_bigger;
|
||||
global $is_header_sent;
|
||||
if (PMA_mysql_error()) {
|
||||
$conn_error = PMA_mysql_error();
|
||||
} else if (isset($php_errormsg)) {
|
||||
$conn_error = $php_errormsg;
|
||||
} else {
|
||||
$conn_error = 'Cannot connect: invalid settings.';
|
||||
}
|
||||
/* Commented out by Nijel: This causes displaying login and password from
|
||||
* config when connection to MySQL server can't be established. (SQL parser
|
||||
* fails on this and then displays it as wrong SQL.
|
||||
*/
|
||||
/* $local_query = $connect_func . '('
|
||||
. $cfg['Server']['host'] . $server_port . $server_socket . ', '
|
||||
. $cfg['Server']['user'] . ', '
|
||||
. $cfg['Server']['password'] . ')';*/
|
||||
$local_query = '';
|
||||
. $cfg['Server']['host'] . $server_port . $server_socket . ', '
|
||||
. $cfg['Server']['user'] . ', '
|
||||
. $cfg['Server']['password'] . ')';*/
|
||||
$local_query = '';
|
||||
|
||||
// Defines the charset to be used
|
||||
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
|
||||
?>
|
||||
// Defines the charset to be used
|
||||
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" dir="<?php echo $GLOBALS['text_dir']; ?>">
|
||||
@@ -115,14 +112,13 @@ h1 {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo
|
||||
<h1><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION); ?></h1>
|
||||
</center>
|
||||
<br />
|
||||
<?php
|
||||
echo "\n";
|
||||
$is_header_sent = TRUE;
|
||||
echo '<p>' . $GLOBALS['strAccessDeniedExplanation'] . '</p>' . "\n";
|
||||
PMA_mysqlDie($conn_error, $local_query, FALSE);
|
||||
<?php
|
||||
echo "\n";
|
||||
$is_header_sent = TRUE;
|
||||
echo '<p>' . $GLOBALS['strAccessDeniedExplanation'] . '</p>' . "\n";
|
||||
PMA_mysqlDie($conn_error, $local_query, FALSE);
|
||||
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth_fails()' function
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth_fails()' function
|
||||
|
||||
} // $__PMA_CONFIG_AUTH_LIB__
|
||||
?>
|
||||
?>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -8,31 +8,28 @@
|
||||
// +--------------------------------------------------------------------------+
|
||||
|
||||
|
||||
if (!defined('PMA_HTTP_AUTH_INCLUDED')) {
|
||||
define('PMA_HTTP_AUTH_INCLUDED', 1);
|
||||
/**
|
||||
* Displays authentication form
|
||||
*
|
||||
* @global string the font face to use in case of failure
|
||||
* @global string the default font size to use in case of failure
|
||||
* @global string the big font size to use in case of failure
|
||||
*
|
||||
* @return boolean always true (no return indeed)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth()
|
||||
{
|
||||
global $right_font_family, $font_size, $font_bigger;
|
||||
|
||||
/**
|
||||
* Displays authentication form
|
||||
*
|
||||
* @global string the font face to use in case of failure
|
||||
* @global string the default font size to use in case of failure
|
||||
* @global string the big font size to use in case of failure
|
||||
*
|
||||
* @return boolean always true (no return indeed)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth()
|
||||
{
|
||||
global $right_font_family, $font_size, $font_bigger;
|
||||
header('WWW-Authenticate: Basic realm="phpMyAdmin ' . sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ? str_replace('\'', '\\\'',$GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['verbose']))) . '"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
header('status: 401 Unauthorized');
|
||||
|
||||
header('WWW-Authenticate: Basic realm="phpMyAdmin ' . sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ? str_replace('\'', '\\\'',$GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['verbose']))) . '"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
header('status: 401 Unauthorized');
|
||||
|
||||
// Defines the charset to be used
|
||||
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
|
||||
?>
|
||||
// Defines the charset to be used
|
||||
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" dir="<?php echo $GLOBALS['text_dir']; ?>">
|
||||
@@ -58,183 +55,182 @@ h1 {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<?php
|
||||
echo "\n";
|
||||
exit();
|
||||
<?php
|
||||
echo "\n";
|
||||
exit();
|
||||
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth()' function
|
||||
|
||||
|
||||
/**
|
||||
* Gets advanced authentication settings
|
||||
*
|
||||
* @global string the username if register_globals is on
|
||||
* @global string the password if register_globals is on
|
||||
* @global array the array of server variables if register_globals is
|
||||
* off
|
||||
* @global array the array of environment variables if register_globals
|
||||
* is off
|
||||
* @global string the username for the ? server
|
||||
* @global string the password for the ? server
|
||||
* @global string the username for the WebSite Professional server
|
||||
* @global string the password for the WebSite Professional server
|
||||
* @global string the username of the user who logs out
|
||||
*
|
||||
* @return boolean whether we get authentication settings or not
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth_check()
|
||||
{
|
||||
global $PHP_AUTH_USER, $PHP_AUTH_PW;
|
||||
global $REMOTE_USER, $AUTH_USER, $REMOTE_PASSWORD, $AUTH_PASSWORD;
|
||||
global $HTTP_AUTHORIZATION;
|
||||
global $old_usr;
|
||||
|
||||
// Grabs the $PHP_AUTH_USER variable whatever are the values of the
|
||||
// 'register_globals' and the 'variables_order' directives
|
||||
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
|
||||
if (empty($PHP_AUTH_USER)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
$PHP_AUTH_USER = $_SERVER['PHP_AUTH_USER'];
|
||||
}
|
||||
else if (isset($REMOTE_USER)) {
|
||||
$PHP_AUTH_USER = $REMOTE_USER;
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['REMOTE_USER'])) {
|
||||
$PHP_AUTH_USER = $_ENV['REMOTE_USER'];
|
||||
}
|
||||
else if (@getenv('REMOTE_USER')) {
|
||||
$PHP_AUTH_USER = getenv('REMOTE_USER');
|
||||
}
|
||||
// Fix from Matthias Fichtner for WebSite Professional - Part 1
|
||||
else if (isset($AUTH_USER)) {
|
||||
$PHP_AUTH_USER = $AUTH_USER;
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['AUTH_USER'])) {
|
||||
$PHP_AUTH_USER = $_ENV['AUTH_USER'];
|
||||
}
|
||||
else if (@getenv('AUTH_USER')) {
|
||||
$PHP_AUTH_USER = getenv('AUTH_USER');
|
||||
}
|
||||
}
|
||||
// Grabs the $PHP_AUTH_PW variable whatever are the values of the
|
||||
// 'register_globals' and the 'variables_order' directives
|
||||
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
|
||||
if (empty($PHP_AUTH_PW)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['PHP_AUTH_PW'])) {
|
||||
$PHP_AUTH_PW = $_SERVER['PHP_AUTH_PW'];
|
||||
}
|
||||
else if (isset($REMOTE_PASSWORD)) {
|
||||
$PHP_AUTH_PW = $REMOTE_PASSWORD;
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['REMOTE_PASSWORD'])) {
|
||||
$PHP_AUTH_PW = $_ENV['REMOTE_PASSWORD'];
|
||||
}
|
||||
else if (@getenv('REMOTE_PASSWORD')) {
|
||||
$PHP_AUTH_PW = getenv('REMOTE_PASSWORD');
|
||||
}
|
||||
// Fix from Matthias Fichtner for WebSite Professional - Part 2
|
||||
else if (isset($AUTH_PASSWORD)) {
|
||||
$PHP_AUTH_PW = $AUTH_PASSWORD;
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['AUTH_PASSWORD'])) {
|
||||
$PHP_AUTH_PW = $_ENV['AUTH_PASSWORD'];
|
||||
}
|
||||
else if (@getenv('AUTH_PASSWORD')) {
|
||||
$PHP_AUTH_PW = getenv('AUTH_PASSWORD');
|
||||
}
|
||||
}
|
||||
// Gets authenticated user settings with IIS
|
||||
if (empty($PHP_AUTH_USER) && empty($PHP_AUTH_PW)
|
||||
&& function_exists('base64_decode')) {
|
||||
if (!empty($HTTP_AUTHORIZATION)
|
||||
&& substr($HTTP_AUTHORIZATION, 0, 6) == 'Basic ') {
|
||||
list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr($HTTP_AUTHORIZATION, 6)));
|
||||
}
|
||||
else if (!empty($_ENV)
|
||||
&& isset($_ENV['HTTP_AUTHORIZATION'])
|
||||
&& substr($_ENV['HTTP_AUTHORIZATION'], 0, 6) == 'Basic ') {
|
||||
list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr($_ENV['HTTP_AUTHORIZATION'], 6)));
|
||||
}
|
||||
else if (@getenv('HTTP_AUTHORIZATION')
|
||||
&& substr(getenv('HTTP_AUTHORIZATION'), 0, 6) == 'Basic ') {
|
||||
list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr(getenv('HTTP_AUTHORIZATION'), 6)));
|
||||
}
|
||||
} // end IIS
|
||||
|
||||
// User logged out -> ensure the new username is not the same
|
||||
if (!empty($old_usr)
|
||||
&& (isset($PHP_AUTH_USER) && $old_usr == $PHP_AUTH_USER)) {
|
||||
$PHP_AUTH_USER = '';
|
||||
}
|
||||
|
||||
// Returns whether we get authentication settings or not
|
||||
if (empty($PHP_AUTH_USER)) {
|
||||
return FALSE;
|
||||
} else {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$PHP_AUTH_USER = stripslashes($PHP_AUTH_USER);
|
||||
$PHP_AUTH_PW = stripslashes($PHP_AUTH_PW);
|
||||
}
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth()' function
|
||||
}
|
||||
} // end of the 'PMA_auth_check()' function
|
||||
|
||||
|
||||
/**
|
||||
* Gets advanced authentication settings
|
||||
*
|
||||
* @global string the username if register_globals is on
|
||||
* @global string the password if register_globals is on
|
||||
* @global array the array of server variables if register_globals is
|
||||
* off
|
||||
* @global array the array of environment variables if register_globals
|
||||
* is off
|
||||
* @global string the username for the ? server
|
||||
* @global string the password for the ? server
|
||||
* @global string the username for the WebSite Professional server
|
||||
* @global string the password for the WebSite Professional server
|
||||
* @global string the username of the user who logs out
|
||||
*
|
||||
* @return boolean whether we get authentication settings or not
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth_check()
|
||||
{
|
||||
global $PHP_AUTH_USER, $PHP_AUTH_PW;
|
||||
global $REMOTE_USER, $AUTH_USER, $REMOTE_PASSWORD, $AUTH_PASSWORD;
|
||||
global $HTTP_AUTHORIZATION;
|
||||
global $old_usr;
|
||||
/**
|
||||
* Set the user and password after last checkings if required
|
||||
*
|
||||
* @global array the valid servers settings
|
||||
* @global integer the id of the current server
|
||||
* @global array the current server settings
|
||||
* @global string the current username
|
||||
* @global string the current password
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth_set_user()
|
||||
{
|
||||
global $cfg, $server;
|
||||
global $PHP_AUTH_USER, $PHP_AUTH_PW;
|
||||
|
||||
// Grabs the $PHP_AUTH_USER variable whatever are the values of the
|
||||
// 'register_globals' and the 'variables_order' directives
|
||||
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
|
||||
if (empty($PHP_AUTH_USER)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
$PHP_AUTH_USER = $_SERVER['PHP_AUTH_USER'];
|
||||
// Ensures valid authentication mode, 'only_db', bookmark database and
|
||||
// table names and relation table name are used
|
||||
if ($cfg['Server']['user'] != $PHP_AUTH_USER) {
|
||||
$servers_cnt = count($cfg['Servers']);
|
||||
for ($i = 1; $i <= $servers_cnt; $i++) {
|
||||
if (isset($cfg['Servers'][$i])
|
||||
&& ($cfg['Servers'][$i]['host'] == $cfg['Server']['host'] && $cfg['Servers'][$i]['user'] == $PHP_AUTH_USER)) {
|
||||
$server = $i;
|
||||
$cfg['Server'] = $cfg['Servers'][$i];
|
||||
break;
|
||||
}
|
||||
else if (isset($REMOTE_USER)) {
|
||||
$PHP_AUTH_USER = $REMOTE_USER;
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['REMOTE_USER'])) {
|
||||
$PHP_AUTH_USER = $_ENV['REMOTE_USER'];
|
||||
}
|
||||
else if (@getenv('REMOTE_USER')) {
|
||||
$PHP_AUTH_USER = getenv('REMOTE_USER');
|
||||
}
|
||||
// Fix from Matthias Fichtner for WebSite Professional - Part 1
|
||||
else if (isset($AUTH_USER)) {
|
||||
$PHP_AUTH_USER = $AUTH_USER;
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['AUTH_USER'])) {
|
||||
$PHP_AUTH_USER = $_ENV['AUTH_USER'];
|
||||
}
|
||||
else if (@getenv('AUTH_USER')) {
|
||||
$PHP_AUTH_USER = getenv('AUTH_USER');
|
||||
}
|
||||
}
|
||||
// Grabs the $PHP_AUTH_PW variable whatever are the values of the
|
||||
// 'register_globals' and the 'variables_order' directives
|
||||
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
|
||||
if (empty($PHP_AUTH_PW)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['PHP_AUTH_PW'])) {
|
||||
$PHP_AUTH_PW = $_SERVER['PHP_AUTH_PW'];
|
||||
}
|
||||
else if (isset($REMOTE_PASSWORD)) {
|
||||
$PHP_AUTH_PW = $REMOTE_PASSWORD;
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['REMOTE_PASSWORD'])) {
|
||||
$PHP_AUTH_PW = $_ENV['REMOTE_PASSWORD'];
|
||||
}
|
||||
else if (@getenv('REMOTE_PASSWORD')) {
|
||||
$PHP_AUTH_PW = getenv('REMOTE_PASSWORD');
|
||||
}
|
||||
// Fix from Matthias Fichtner for WebSite Professional - Part 2
|
||||
else if (isset($AUTH_PASSWORD)) {
|
||||
$PHP_AUTH_PW = $AUTH_PASSWORD;
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['AUTH_PASSWORD'])) {
|
||||
$PHP_AUTH_PW = $_ENV['AUTH_PASSWORD'];
|
||||
}
|
||||
else if (@getenv('AUTH_PASSWORD')) {
|
||||
$PHP_AUTH_PW = getenv('AUTH_PASSWORD');
|
||||
}
|
||||
}
|
||||
// Gets authenticated user settings with IIS
|
||||
if (empty($PHP_AUTH_USER) && empty($PHP_AUTH_PW)
|
||||
&& function_exists('base64_decode')) {
|
||||
if (!empty($HTTP_AUTHORIZATION)
|
||||
&& substr($HTTP_AUTHORIZATION, 0, 6) == 'Basic ') {
|
||||
list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr($HTTP_AUTHORIZATION, 6)));
|
||||
}
|
||||
else if (!empty($_ENV)
|
||||
&& isset($_ENV['HTTP_AUTHORIZATION'])
|
||||
&& substr($_ENV['HTTP_AUTHORIZATION'], 0, 6) == 'Basic ') {
|
||||
list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr($_ENV['HTTP_AUTHORIZATION'], 6)));
|
||||
}
|
||||
else if (@getenv('HTTP_AUTHORIZATION')
|
||||
&& substr(getenv('HTTP_AUTHORIZATION'), 0, 6) == 'Basic ') {
|
||||
list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr(getenv('HTTP_AUTHORIZATION'), 6)));
|
||||
}
|
||||
} // end IIS
|
||||
} // end for
|
||||
} // end if
|
||||
|
||||
// User logged out -> ensure the new username is not the same
|
||||
if (!empty($old_usr)
|
||||
&& (isset($PHP_AUTH_USER) && $old_usr == $PHP_AUTH_USER)) {
|
||||
$PHP_AUTH_USER = '';
|
||||
}
|
||||
$cfg['Server']['user'] = $PHP_AUTH_USER;
|
||||
$cfg['Server']['password'] = $PHP_AUTH_PW;
|
||||
|
||||
// Returns whether we get authentication settings or not
|
||||
if (empty($PHP_AUTH_USER)) {
|
||||
return FALSE;
|
||||
} else {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$PHP_AUTH_USER = stripslashes($PHP_AUTH_USER);
|
||||
$PHP_AUTH_PW = stripslashes($PHP_AUTH_PW);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
} // end of the 'PMA_auth_check()' function
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth_set_user()' function
|
||||
|
||||
|
||||
/**
|
||||
* Set the user and password after last checkings if required
|
||||
*
|
||||
* @global array the valid servers settings
|
||||
* @global integer the id of the current server
|
||||
* @global array the current server settings
|
||||
* @global string the current username
|
||||
* @global string the current password
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth_set_user()
|
||||
{
|
||||
global $cfg, $server;
|
||||
global $PHP_AUTH_USER, $PHP_AUTH_PW;
|
||||
/**
|
||||
* User is not allowed to login to MySQL -> authentication failed
|
||||
*
|
||||
* @return boolean always true (no return indeed)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth_fails()
|
||||
{
|
||||
PMA_auth();
|
||||
|
||||
// Ensures valid authentication mode, 'only_db', bookmark database and
|
||||
// table names and relation table name are used
|
||||
if ($cfg['Server']['user'] != $PHP_AUTH_USER) {
|
||||
$servers_cnt = count($cfg['Servers']);
|
||||
for ($i = 1; $i <= $servers_cnt; $i++) {
|
||||
if (isset($cfg['Servers'][$i])
|
||||
&& ($cfg['Servers'][$i]['host'] == $cfg['Server']['host'] && $cfg['Servers'][$i]['user'] == $PHP_AUTH_USER)) {
|
||||
$server = $i;
|
||||
$cfg['Server'] = $cfg['Servers'][$i];
|
||||
break;
|
||||
}
|
||||
} // end for
|
||||
} // end if
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth_fails()' function
|
||||
|
||||
$cfg['Server']['user'] = $PHP_AUTH_USER;
|
||||
$cfg['Server']['password'] = $PHP_AUTH_PW;
|
||||
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth_set_user()' function
|
||||
|
||||
|
||||
/**
|
||||
* User is not allowed to login to MySQL -> authentication failed
|
||||
*
|
||||
* @return boolean always true (no return indeed)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_auth_fails()
|
||||
{
|
||||
PMA_auth();
|
||||
|
||||
return TRUE;
|
||||
} // end of the 'PMA_auth_fails()' function
|
||||
|
||||
} // $__PMA_HTTP_AUTH_LIB__
|
||||
?>
|
||||
?>
|
||||
|
@@ -7,174 +7,168 @@
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Defines the bookmark parameters for the current user
|
||||
*
|
||||
* @return array the bookmark parameters for the current user
|
||||
*
|
||||
* @global integer the id of the current server
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_getBookmarksParam()
|
||||
{
|
||||
global $server;
|
||||
|
||||
if (!defined('PMA_BOOKMARK_LIB_INCLUDED')) {
|
||||
define('PMA_BOOKMARK_LIB_INCLUDED', 1);
|
||||
$cfgBookmark = '';
|
||||
|
||||
/**
|
||||
* Defines the bookmark parameters for the current user
|
||||
*
|
||||
* @return array the bookmark parameters for the current user
|
||||
*
|
||||
* @global integer the id of the current server
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_getBookmarksParam()
|
||||
{
|
||||
global $server;
|
||||
// No server selected -> no bookmark table
|
||||
if ($server == 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$cfgBookmark = '';
|
||||
$cfgBookmark['user'] = $GLOBALS['cfg']['Server']['user'];
|
||||
$cfgBookmark['db'] = $GLOBALS['cfg']['Server']['pmadb'];
|
||||
$cfgBookmark['table'] = $GLOBALS['cfg']['Server']['bookmarktable'];
|
||||
|
||||
// No server selected -> no bookmark table
|
||||
if ($server == 0) {
|
||||
return '';
|
||||
return $cfgBookmark;
|
||||
} // end of the 'PMA_getBookmarksParam()' function
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list of bookmarks defined for the current database
|
||||
*
|
||||
* @param string the current database name
|
||||
* @param array the bookmark parameters for the current user
|
||||
*
|
||||
* @return mixed the bookmarks list if defined, false else
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_listBookmarks($db, $cfgBookmark)
|
||||
{
|
||||
$query = 'SELECT label, id FROM '. PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
|
||||
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
|
||||
. ' OR user = \'\')';
|
||||
if (isset($GLOBALS['dbh'])) {
|
||||
$result = PMA_mysql_query($query, $GLOBALS['dbh']);
|
||||
} else {
|
||||
$result = PMA_mysql_query($query);
|
||||
}
|
||||
|
||||
// There is some bookmarks -> store them
|
||||
if ($result > 0 && mysql_num_rows($result) > 0) {
|
||||
$flag = 1;
|
||||
while ($row = PMA_mysql_fetch_row($result)) {
|
||||
$bookmark_list[$flag . ' - ' . $row[0]] = $row[1];
|
||||
$flag++;
|
||||
} // end while
|
||||
return $bookmark_list;
|
||||
}
|
||||
// No bookmarks for the current database
|
||||
else {
|
||||
return FALSE;
|
||||
}
|
||||
} // end of the 'PMA_listBookmarks()' function
|
||||
|
||||
|
||||
/**
|
||||
* Gets the sql command from a bookmark
|
||||
*
|
||||
* @param string the current database name
|
||||
* @param array the bookmark parameters for the current user
|
||||
* @param mixed the id of the bookmark to get
|
||||
* @param string which field to look up the $id
|
||||
*
|
||||
* @return string the sql query
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_queryBookmarks($db, $cfgBookmark, $id, $id_field = 'id')
|
||||
{
|
||||
|
||||
if (empty($cfgBookmark['db']) || empty($cfgBookmark['table'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
|
||||
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
|
||||
. ' OR user = \'\')'
|
||||
. ' AND ' . PMA_backquote($id_field) . ' = ' . $id;
|
||||
if (isset($GLOBALS['dbh'])) {
|
||||
$result = PMA_mysql_query($query, $GLOBALS['dbh']);
|
||||
} else {
|
||||
$result = PMA_mysql_query($query);
|
||||
}
|
||||
$bookmark_query = @PMA_mysql_result($result, 0, 'query') OR FALSE;
|
||||
|
||||
return $bookmark_query;
|
||||
} // end of the 'PMA_queryBookmarks()' function
|
||||
|
||||
|
||||
/**
|
||||
* Adds a bookmark
|
||||
*
|
||||
* @param array the properties of the bookmark to add
|
||||
* @param array the bookmark parameters for the current user
|
||||
* @param boolean whether to make the bookmark available for all users
|
||||
*
|
||||
* @return boolean whether the INSERT succeeds or not
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_addBookmarks($fields, $cfgBookmark, $all_users = false)
|
||||
{
|
||||
$query = 'INSERT INTO ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
|
||||
. ' (id, dbase, user, query, label) VALUES (\'\', \'' . PMA_sqlAddslashes($fields['dbase']) . '\', \'' . ($all_users ? '' : PMA_sqlAddslashes($fields['user'])) . '\', \'' . PMA_sqlAddslashes(urldecode($fields['query'])) . '\', \'' . PMA_sqlAddslashes($fields['label']) . '\')';
|
||||
if (isset($GLOBALS['dbh'])) {
|
||||
$result = PMA_mysql_query($query, $GLOBALS['dbh']);
|
||||
if (PMA_mysql_error($GLOBALS['dbh'])) {
|
||||
$error = PMA_mysql_error($GLOBALS['dbh']);
|
||||
require_once('./header.inc.php');
|
||||
PMA_mysqlDie($error);
|
||||
}
|
||||
|
||||
$cfgBookmark['user'] = $GLOBALS['cfg']['Server']['user'];
|
||||
$cfgBookmark['db'] = $GLOBALS['cfg']['Server']['pmadb'];
|
||||
$cfgBookmark['table'] = $GLOBALS['cfg']['Server']['bookmarktable'];
|
||||
|
||||
return $cfgBookmark;
|
||||
} // end of the 'PMA_getBookmarksParam()' function
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list of bookmarks defined for the current database
|
||||
*
|
||||
* @param string the current database name
|
||||
* @param array the bookmark parameters for the current user
|
||||
*
|
||||
* @return mixed the bookmarks list if defined, false else
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_listBookmarks($db, $cfgBookmark)
|
||||
{
|
||||
$query = 'SELECT label, id FROM '. PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
|
||||
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
|
||||
. ' OR user = \'\')';
|
||||
if (isset($GLOBALS['dbh'])) {
|
||||
$result = PMA_mysql_query($query, $GLOBALS['dbh']);
|
||||
} else {
|
||||
$result = PMA_mysql_query($query);
|
||||
} else {
|
||||
$result = PMA_mysql_query($query);
|
||||
if (PMA_mysql_error()) {
|
||||
$error = PMA_mysql_error();
|
||||
require_once('./header.inc.php');
|
||||
PMA_mysqlDie($error);
|
||||
}
|
||||
}
|
||||
|
||||
// There is some bookmarks -> store them
|
||||
if ($result > 0 && mysql_num_rows($result) > 0) {
|
||||
$flag = 1;
|
||||
while ($row = PMA_mysql_fetch_row($result)) {
|
||||
$bookmark_list[$flag . ' - ' . $row[0]] = $row[1];
|
||||
$flag++;
|
||||
} // end while
|
||||
return $bookmark_list;
|
||||
}
|
||||
// No bookmarks for the current database
|
||||
else {
|
||||
return FALSE;
|
||||
}
|
||||
} // end of the 'PMA_listBookmarks()' function
|
||||
return TRUE;
|
||||
} // end of the 'PMA_addBookmarks()' function
|
||||
|
||||
|
||||
/**
|
||||
* Gets the sql command from a bookmark
|
||||
*
|
||||
* @param string the current database name
|
||||
* @param array the bookmark parameters for the current user
|
||||
* @param mixed the id of the bookmark to get
|
||||
* @param string which field to look up the $id
|
||||
*
|
||||
* @return string the sql query
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_queryBookmarks($db, $cfgBookmark, $id, $id_field = 'id')
|
||||
{
|
||||
|
||||
if (empty($cfgBookmark['db']) || empty($cfgBookmark['table'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
|
||||
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
|
||||
. ' OR user = \'\')'
|
||||
. ' AND ' . PMA_backquote($id_field) . ' = ' . $id;
|
||||
if (isset($GLOBALS['dbh'])) {
|
||||
$result = PMA_mysql_query($query, $GLOBALS['dbh']);
|
||||
} else {
|
||||
$result = PMA_mysql_query($query);
|
||||
}
|
||||
$bookmark_query = @PMA_mysql_result($result, 0, 'query') OR FALSE;
|
||||
|
||||
return $bookmark_query;
|
||||
} // end of the 'PMA_queryBookmarks()' function
|
||||
/**
|
||||
* Deletes a bookmark
|
||||
*
|
||||
* @param string the current database name
|
||||
* @param array the bookmark parameters for the current user
|
||||
* @param integer the id of the bookmark to get
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_deleteBookmarks($db, $cfgBookmark, $id)
|
||||
{
|
||||
$query = 'DELETE FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
|
||||
. ' WHERE (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
|
||||
. ' OR user = \'\')'
|
||||
. ' AND id = ' . $id;
|
||||
if (isset($GLOBALS['dbh'])) {
|
||||
$result = PMA_mysql_query($query, $GLOBALS['dbh']);
|
||||
} else {
|
||||
$result = PMA_mysql_query($query);
|
||||
}
|
||||
} // end of the 'PMA_deleteBookmarks()' function
|
||||
|
||||
|
||||
/**
|
||||
* Adds a bookmark
|
||||
*
|
||||
* @param array the properties of the bookmark to add
|
||||
* @param array the bookmark parameters for the current user
|
||||
* @param boolean whether to make the bookmark available for all users
|
||||
*
|
||||
* @return boolean whether the INSERT succeeds or not
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_addBookmarks($fields, $cfgBookmark, $all_users = false)
|
||||
{
|
||||
$query = 'INSERT INTO ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
|
||||
. ' (id, dbase, user, query, label) VALUES (\'\', \'' . PMA_sqlAddslashes($fields['dbase']) . '\', \'' . ($all_users ? '' : PMA_sqlAddslashes($fields['user'])) . '\', \'' . PMA_sqlAddslashes(urldecode($fields['query'])) . '\', \'' . PMA_sqlAddslashes($fields['label']) . '\')';
|
||||
if (isset($GLOBALS['dbh'])) {
|
||||
$result = PMA_mysql_query($query, $GLOBALS['dbh']);
|
||||
if (PMA_mysql_error($GLOBALS['dbh'])) {
|
||||
$error = PMA_mysql_error($GLOBALS['dbh']);
|
||||
include('./header.inc.php');
|
||||
PMA_mysqlDie($error);
|
||||
}
|
||||
} else {
|
||||
$result = PMA_mysql_query($query);
|
||||
if (PMA_mysql_error()) {
|
||||
$error = PMA_mysql_error();
|
||||
include('./header.inc.php');
|
||||
PMA_mysqlDie($error);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Bookmark Support
|
||||
*/
|
||||
$cfg['Bookmark'] = PMA_getBookmarksParam();
|
||||
|
||||
return TRUE;
|
||||
} // end of the 'PMA_addBookmarks()' function
|
||||
|
||||
|
||||
/**
|
||||
* Deletes a bookmark
|
||||
*
|
||||
* @param string the current database name
|
||||
* @param array the bookmark parameters for the current user
|
||||
* @param integer the id of the bookmark to get
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_deleteBookmarks($db, $cfgBookmark, $id)
|
||||
{
|
||||
$query = 'DELETE FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
|
||||
. ' WHERE (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
|
||||
. ' OR user = \'\')'
|
||||
. ' AND id = ' . $id;
|
||||
if (isset($GLOBALS['dbh'])) {
|
||||
$result = PMA_mysql_query($query, $GLOBALS['dbh']);
|
||||
} else {
|
||||
$result = PMA_mysql_query($query);
|
||||
}
|
||||
} // end of the 'PMA_deleteBookmarks()' function
|
||||
|
||||
|
||||
/**
|
||||
* Bookmark Support
|
||||
*/
|
||||
$cfg['Bookmark'] = PMA_getBookmarksParam();
|
||||
|
||||
|
||||
} // $__PMA_BOOKMARK_LIB__
|
||||
?>
|
||||
?>
|
||||
|
@@ -8,316 +8,293 @@
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('PMA_CHARSET_CONVERSION_LIB_INCLUDED')){
|
||||
define('PMA_CHARSET_CONVERSION_LIB_INCLUDED', 1);
|
||||
/**
|
||||
* Loads the recode or iconv extensions if any of it is not loaded yet
|
||||
*/
|
||||
if (isset($cfg['AllowAnywhereRecoding'])
|
||||
&& $cfg['AllowAnywhereRecoding']
|
||||
&& $allow_recoding) {
|
||||
|
||||
/**
|
||||
* Loads the recode or iconv extensions if any of it is not loaded yet
|
||||
*/
|
||||
if (isset($cfg['AllowAnywhereRecoding'])
|
||||
&& $cfg['AllowAnywhereRecoding']
|
||||
&& $allow_recoding) {
|
||||
|
||||
// Initializes configuration for default, if not set:
|
||||
if (!isset($cfg['RecodingEngine'])) {
|
||||
$cfg['RecodingEngine'] = 'auto';
|
||||
}
|
||||
|
||||
if ($cfg['RecodingEngine'] == 'recode') {
|
||||
if ($cfg['RecodingEngine'] == 'recode') {
|
||||
if (!@extension_loaded('recode')) {
|
||||
PMA_dl('recode');
|
||||
if (!@extension_loaded('recode')) {
|
||||
echo $strCantLoadRecodeIconv;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$PMA_recoding_engine = 'recode';
|
||||
} else if ($cfg['RecodingEngine'] == 'iconv') {
|
||||
if (!@extension_loaded('iconv')) {
|
||||
PMA_dl('iconv');
|
||||
if (!@extension_loaded('iconv')) {
|
||||
echo $strCantLoadRecodeIconv;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$PMA_recoding_engine = 'iconv';
|
||||
} else {
|
||||
if (@extension_loaded('iconv')) {
|
||||
$PMA_recoding_engine = 'iconv';
|
||||
} else if (@extension_loaded('recode')) {
|
||||
$PMA_recoding_engine = 'recode';
|
||||
} else {
|
||||
PMA_dl('iconv');
|
||||
if (!@extension_loaded('iconv')) {
|
||||
PMA_dl('recode');
|
||||
if (!@extension_loaded('recode')) {
|
||||
echo $strCantLoadRecodeIconv;
|
||||
exit();
|
||||
}
|
||||
}
|
||||
$PMA_recoding_engine = 'recode';
|
||||
} else if ($cfg['RecodingEngine'] == 'iconv') {
|
||||
if (!@extension_loaded('iconv')) {
|
||||
PMA_dl('iconv');
|
||||
if (!@extension_loaded('iconv')) {
|
||||
echo $strCantLoadRecodeIconv;
|
||||
exit();
|
||||
}
|
||||
}
|
||||
$PMA_recoding_engine = 'iconv';
|
||||
} else {
|
||||
if (@extension_loaded('iconv')) {
|
||||
$PMA_recoding_engine = 'iconv';
|
||||
} else if (@extension_loaded('recode')) {
|
||||
$PMA_recoding_engine = 'recode';
|
||||
} else {
|
||||
PMA_dl('iconv');
|
||||
if (!@extension_loaded('iconv')) {
|
||||
PMA_dl('recode');
|
||||
if (!@extension_loaded('recode')) {
|
||||
echo $strCantLoadRecodeIconv;
|
||||
exit();
|
||||
} else {
|
||||
$PMA_recoding_engine = 'recode';
|
||||
}
|
||||
exit;
|
||||
} else {
|
||||
$PMA_recoding_engine = 'iconv';
|
||||
$PMA_recoding_engine = 'recode';
|
||||
}
|
||||
} else {
|
||||
$PMA_recoding_engine = 'iconv';
|
||||
}
|
||||
}
|
||||
} // end load recode/iconv extension
|
||||
|
||||
define('PMA_CHARSET_NONE', 0);
|
||||
define('PMA_CHARSET_ICONV', 1);
|
||||
define('PMA_CHARSET_LIBICONV', 2);
|
||||
define('PMA_CHARSET_RECODE', 3);
|
||||
|
||||
if (!isset($cfg['IconvExtraParams'])) {
|
||||
$cfg['IconvExtraParams'] = '';
|
||||
}
|
||||
} // end load recode/iconv extension
|
||||
|
||||
// Finally detects which function will we use:
|
||||
if (isset($cfg['AllowAnywhereRecoding'])
|
||||
&& $cfg['AllowAnywhereRecoding']
|
||||
&& $allow_recoding) {
|
||||
define('PMA_CHARSET_NONE', 0);
|
||||
define('PMA_CHARSET_ICONV', 1);
|
||||
define('PMA_CHARSET_LIBICONV', 2);
|
||||
define('PMA_CHARSET_RECODE', 3);
|
||||
|
||||
if (!isset($PMA_recoding_engine)) {
|
||||
$PMA_recoding_engine = $cfg['RecodingEngine'];
|
||||
}
|
||||
if ($PMA_recoding_engine == 'iconv') {
|
||||
if (@function_exists('iconv')) {
|
||||
$PMA_recoding_engine = PMA_CHARSET_ICONV;
|
||||
} else if (@function_exists('libiconv')) {
|
||||
$PMA_recoding_engine = PMA_CHARSET_LIBICONV;
|
||||
} else {
|
||||
$PMA_recoding_engine = PMA_CHARSET_NONE;
|
||||
if (!isset($cfg['IconvExtraParams'])) {
|
||||
$cfg['IconvExtraParams'] = '';
|
||||
}
|
||||
|
||||
if (!isset($GLOBALS['is_header_sent'])) {
|
||||
include('./header.inc.php');
|
||||
}
|
||||
echo $strCantUseRecodeIconv;
|
||||
include('./footer.inc.php');
|
||||
exit();
|
||||
}
|
||||
} else if ($PMA_recoding_engine == 'recode') {
|
||||
if (@function_exists('recode_string')) {
|
||||
$PMA_recoding_engine = PMA_CHARSET_RECODE;
|
||||
} else {
|
||||
$PMA_recoding_engine = PMA_CHARSET_NONE;
|
||||
// Finally detects which function will we use:
|
||||
if (isset($cfg['AllowAnywhereRecoding'])
|
||||
&& $cfg['AllowAnywhereRecoding']
|
||||
&& $allow_recoding) {
|
||||
|
||||
if (!isset($GLOBALS['is_header_sent'])) {
|
||||
include('./header.inc.php');
|
||||
}
|
||||
echo $strCantUseRecodeIconv;
|
||||
include('./footer.inc.php');
|
||||
exit();
|
||||
}
|
||||
if (!isset($PMA_recoding_engine)) {
|
||||
$PMA_recoding_engine = $cfg['RecodingEngine'];
|
||||
}
|
||||
if ($PMA_recoding_engine == 'iconv') {
|
||||
if (@function_exists('iconv')) {
|
||||
$PMA_recoding_engine = PMA_CHARSET_ICONV;
|
||||
} else if (@function_exists('libiconv')) {
|
||||
$PMA_recoding_engine = PMA_CHARSET_LIBICONV;
|
||||
} else {
|
||||
if (@function_exists('iconv')) {
|
||||
$PMA_recoding_engine = PMA_CHARSET_ICONV;
|
||||
} else if (@function_exists('libiconv')) {
|
||||
$PMA_recoding_engine = PMA_CHARSET_LIBICONV;
|
||||
} elseif (@function_exists('recode_string')) {
|
||||
$PMA_recoding_engine = PMA_CHARSET_RECODE;
|
||||
} else {
|
||||
$PMA_recoding_engine = PMA_CHARSET_NONE;
|
||||
$PMA_recoding_engine = PMA_CHARSET_NONE;
|
||||
|
||||
if (!isset($GLOBALS['is_header_sent'])) {
|
||||
include('./header.inc.php');
|
||||
}
|
||||
echo $strCantUseRecodeIconv;
|
||||
include('./footer.inc.php');
|
||||
exit();
|
||||
if (!isset($GLOBALS['is_header_sent'])) {
|
||||
include('./header.inc.php');
|
||||
}
|
||||
echo $strCantUseRecodeIconv;
|
||||
require_once('./footer.inc.php');
|
||||
exit();
|
||||
}
|
||||
} else if ($PMA_recoding_engine == 'recode') {
|
||||
if (@function_exists('recode_string')) {
|
||||
$PMA_recoding_engine = PMA_CHARSET_RECODE;
|
||||
} else {
|
||||
$PMA_recoding_engine = PMA_CHARSET_NONE;
|
||||
|
||||
require_once('./header.inc.php');
|
||||
echo $strCantUseRecodeIconv;
|
||||
require_once('./footer.inc.php');
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$PMA_recoding_engine = PMA_CHARSET_NONE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts encoding according to current settings.
|
||||
*
|
||||
* @param mixed what to convert (string or array of strings or object returned by mysql_fetch_field)
|
||||
*
|
||||
* @return string converted string or array of strings
|
||||
*
|
||||
* @global array the configuration array
|
||||
* @global boolean whether recoding is allowed or not
|
||||
* @global string the current charset
|
||||
* @global array the charset to convert to
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author nijel
|
||||
*/
|
||||
function PMA_convert_display_charset($what) {
|
||||
global $cfg, $allow_recoding, $charset, $convcharset;
|
||||
|
||||
if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)) {
|
||||
return $what;
|
||||
}
|
||||
else if (is_array($what)) {
|
||||
$result = array();
|
||||
foreach($what AS $key => $val) {
|
||||
if (is_string($val) || is_array($val)) {
|
||||
if (is_string($key)) {
|
||||
$result[PMA_convert_display_charset($key)] = PMA_convert_display_charset($val);
|
||||
} else {
|
||||
$result[$key] = PMA_convert_display_charset($val);
|
||||
}
|
||||
} else {
|
||||
$result[$key] = $val;
|
||||
}
|
||||
} // end while
|
||||
return $result;
|
||||
}
|
||||
else if (is_string($what)) {
|
||||
switch ($GLOBALS['PMA_recoding_engine']) {
|
||||
case PMA_CHARSET_RECODE:
|
||||
return recode_string($convcharset . '..' . $charset, $what);
|
||||
break;
|
||||
case PMA_CHARSET_ICONV:
|
||||
return iconv($convcharset, $charset . $cfg['IconvExtraParams'], $what);
|
||||
break;
|
||||
case PMA_CHARSET_LIBICONV:
|
||||
return libiconv($convcharset, $charset, $what);
|
||||
break;
|
||||
default:
|
||||
return $what;
|
||||
}
|
||||
}
|
||||
else if (is_object($what)) {
|
||||
// isn't it object returned from mysql_fetch_field ?
|
||||
if (@is_string($what->name)) {
|
||||
$what->name = PMA_convert_display_charset($what->name);
|
||||
}
|
||||
if (@is_string($what->table)) {
|
||||
$what->table = PMA_convert_display_charset($what->table);
|
||||
}
|
||||
if (@is_string($what->Database)) {
|
||||
$what->Database = PMA_convert_display_charset($what->Database);
|
||||
}
|
||||
return $what;
|
||||
}
|
||||
else {
|
||||
// when we don't know what it is we don't touch it...
|
||||
return $what;
|
||||
}
|
||||
} // end of the "PMA_convert_display_charset()" function
|
||||
|
||||
|
||||
/**
|
||||
* Converts encoding of text according to current settings.
|
||||
*
|
||||
* @param string what to convert
|
||||
*
|
||||
* @return string converted text
|
||||
*
|
||||
* @global array the configuration array
|
||||
* @global boolean whether recoding is allowed or not
|
||||
* @global string the current charset
|
||||
* @global array the charset to convert to
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author nijel
|
||||
*/
|
||||
function PMA_convert_charset($what) {
|
||||
global $cfg, $allow_recoding, $charset, $convcharset;
|
||||
|
||||
if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)) {
|
||||
return $what;
|
||||
if (@function_exists('iconv')) {
|
||||
$PMA_recoding_engine = PMA_CHARSET_ICONV;
|
||||
} else if (@function_exists('libiconv')) {
|
||||
$PMA_recoding_engine = PMA_CHARSET_LIBICONV;
|
||||
} elseif (@function_exists('recode_string')) {
|
||||
$PMA_recoding_engine = PMA_CHARSET_RECODE;
|
||||
} else {
|
||||
switch ($GLOBALS['PMA_recoding_engine']) {
|
||||
case PMA_CHARSET_RECODE:
|
||||
return recode_string($charset . '..' . $convcharset, $what);
|
||||
break;
|
||||
case PMA_CHARSET_ICONV:
|
||||
return iconv($charset, $convcharset . $cfg['IconvExtraParams'], $what);
|
||||
break;
|
||||
case PMA_CHARSET_LIBICONV:
|
||||
return libiconv($charset, $convcharset, $what);
|
||||
break;
|
||||
default:
|
||||
return $what;
|
||||
}
|
||||
}
|
||||
} // end of the "PMA_convert_charset()" function
|
||||
$PMA_recoding_engine = PMA_CHARSET_NONE;
|
||||
|
||||
/**
|
||||
* Converts encoding of text according to parameters with detected
|
||||
* conversion function.
|
||||
*
|
||||
* @param string source charset
|
||||
* @param string target charset
|
||||
* @param string what to convert
|
||||
*
|
||||
* @return string converted text
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author nijel
|
||||
*/
|
||||
function PMA_convert_string($src_charset, $dest_charset, $what) {
|
||||
require_once('./header.inc.php');
|
||||
echo $strCantUseRecodeIconv;
|
||||
require_once('./footer.inc.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$PMA_recoding_engine = PMA_CHARSET_NONE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts encoding according to current settings.
|
||||
*
|
||||
* @param mixed what to convert (string or array of strings or object returned by mysql_fetch_field)
|
||||
*
|
||||
* @return string converted string or array of strings
|
||||
*
|
||||
* @global array the configuration array
|
||||
* @global boolean whether recoding is allowed or not
|
||||
* @global string the current charset
|
||||
* @global array the charset to convert to
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author nijel
|
||||
*/
|
||||
function PMA_convert_display_charset($what) {
|
||||
global $cfg, $allow_recoding, $charset, $convcharset;
|
||||
|
||||
if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)) {
|
||||
return $what;
|
||||
}
|
||||
else if (is_array($what)) {
|
||||
$result = array();
|
||||
foreach($what AS $key => $val) {
|
||||
if (is_string($val) || is_array($val)) {
|
||||
if (is_string($key)) {
|
||||
$result[PMA_convert_display_charset($key)] = PMA_convert_display_charset($val);
|
||||
} else {
|
||||
$result[$key] = PMA_convert_display_charset($val);
|
||||
}
|
||||
} else {
|
||||
$result[$key] = $val;
|
||||
}
|
||||
} // end while
|
||||
return $result;
|
||||
}
|
||||
else if (is_string($what)) {
|
||||
switch ($GLOBALS['PMA_recoding_engine']) {
|
||||
case PMA_CHARSET_RECODE:
|
||||
return recode_string($src_charset . '..' . $dest_charset, $what);
|
||||
break;
|
||||
return recode_string($convcharset . '..' . $charset, $what);
|
||||
case PMA_CHARSET_ICONV:
|
||||
return iconv($src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $what);
|
||||
break;
|
||||
return iconv($convcharset, $charset . $cfg['IconvExtraParams'], $what);
|
||||
case PMA_CHARSET_LIBICONV:
|
||||
return libiconv($src_charset, $dest_charset, $what);
|
||||
break;
|
||||
return libiconv($convcharset, $charset, $what);
|
||||
default:
|
||||
return $what;
|
||||
}
|
||||
} // end of the "PMA_convert_string()" function
|
||||
}
|
||||
else if (is_object($what)) {
|
||||
// isn't it object returned from mysql_fetch_field ?
|
||||
if (@is_string($what->name)) {
|
||||
$what->name = PMA_convert_display_charset($what->name);
|
||||
}
|
||||
if (@is_string($what->table)) {
|
||||
$what->table = PMA_convert_display_charset($what->table);
|
||||
}
|
||||
if (@is_string($what->Database)) {
|
||||
$what->Database = PMA_convert_display_charset($what->Database);
|
||||
}
|
||||
return $what;
|
||||
}
|
||||
else {
|
||||
// when we don't know what it is we don't touch it...
|
||||
return $what;
|
||||
}
|
||||
} // end of the "PMA_convert_display_charset()" function
|
||||
|
||||
|
||||
/**
|
||||
* Converts encoding of file according to parameters with detected
|
||||
* conversion function. The old file will be unlinked and new created and
|
||||
* its file name is returned.
|
||||
*
|
||||
* @param string source charset
|
||||
* @param string target charset
|
||||
* @param string file to convert
|
||||
*
|
||||
* @return string new temporay file
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author nijel
|
||||
*/
|
||||
function PMA_convert_file($src_charset, $dest_charset, $file) {
|
||||
/**
|
||||
* Converts encoding of text according to current settings.
|
||||
*
|
||||
* @param string what to convert
|
||||
*
|
||||
* @return string converted text
|
||||
*
|
||||
* @global array the configuration array
|
||||
* @global boolean whether recoding is allowed or not
|
||||
* @global string the current charset
|
||||
* @global array the charset to convert to
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author nijel
|
||||
*/
|
||||
function PMA_convert_charset($what) {
|
||||
global $cfg, $allow_recoding, $charset, $convcharset;
|
||||
|
||||
if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)) {
|
||||
return $what;
|
||||
} else {
|
||||
switch ($GLOBALS['PMA_recoding_engine']) {
|
||||
case PMA_CHARSET_RECODE:
|
||||
return recode_string($charset . '..' . $convcharset, $what);
|
||||
case PMA_CHARSET_ICONV:
|
||||
return iconv($charset, $convcharset . $cfg['IconvExtraParams'], $what);
|
||||
case PMA_CHARSET_LIBICONV:
|
||||
$tmpfname = tempnam('', 'PMA_convert_file');
|
||||
$fin = fopen($file, 'r');
|
||||
$fout = fopen($tmpfname, 'w');
|
||||
if ($GLOBALS['PMA_recoding_engine'] == PMA_CHARSET_RECODE) {
|
||||
recode_file($src_charset . '..' . $dest_charset, $fin, $fout);
|
||||
} else {
|
||||
while (!feof($fin)) {
|
||||
$line = fgets($fin, 4096);
|
||||
if ($GLOBALS['PMA_recoding_engine'] == PMA_CHARSET_ICONV) {
|
||||
$dist = iconv($src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $line);
|
||||
} else {
|
||||
$dist = libiconv($src_charset, $dest_charset, $line);
|
||||
}
|
||||
fputs($fout, $dist);
|
||||
} // end while
|
||||
}
|
||||
fclose($fin);
|
||||
fclose($fout);
|
||||
unlink($file);
|
||||
|
||||
return $tmpfname;
|
||||
break;
|
||||
return libiconv($charset, $convcharset, $what);
|
||||
default:
|
||||
return $file;
|
||||
return $what;
|
||||
}
|
||||
} // end of the "PMA_convert_file()" function
|
||||
}
|
||||
} // end of the "PMA_convert_charset()" function
|
||||
|
||||
} // $__PMA_CHARSET_CONVERSION_LIB__
|
||||
?>
|
||||
/**
|
||||
* Converts encoding of text according to parameters with detected
|
||||
* conversion function.
|
||||
*
|
||||
* @param string source charset
|
||||
* @param string target charset
|
||||
* @param string what to convert
|
||||
*
|
||||
* @return string converted text
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author nijel
|
||||
*/
|
||||
function PMA_convert_string($src_charset, $dest_charset, $what) {
|
||||
switch ($GLOBALS['PMA_recoding_engine']) {
|
||||
case PMA_CHARSET_RECODE:
|
||||
return recode_string($src_charset . '..' . $dest_charset, $what);
|
||||
case PMA_CHARSET_ICONV:
|
||||
return iconv($src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $what);
|
||||
case PMA_CHARSET_LIBICONV:
|
||||
return libiconv($src_charset, $dest_charset, $what);
|
||||
default:
|
||||
return $what;
|
||||
}
|
||||
} // end of the "PMA_convert_string()" function
|
||||
|
||||
|
||||
/**
|
||||
* Converts encoding of file according to parameters with detected
|
||||
* conversion function. The old file will be unlinked and new created and
|
||||
* its file name is returned.
|
||||
*
|
||||
* @param string source charset
|
||||
* @param string target charset
|
||||
* @param string file to convert
|
||||
*
|
||||
* @return string new temporay file
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author nijel
|
||||
*/
|
||||
function PMA_convert_file($src_charset, $dest_charset, $file) {
|
||||
switch ($GLOBALS['PMA_recoding_engine']) {
|
||||
case PMA_CHARSET_RECODE:
|
||||
case PMA_CHARSET_ICONV:
|
||||
case PMA_CHARSET_LIBICONV:
|
||||
$tmpfname = tempnam('', 'PMA_convert_file');
|
||||
$fin = fopen($file, 'r');
|
||||
$fout = fopen($tmpfname, 'w');
|
||||
if ($GLOBALS['PMA_recoding_engine'] == PMA_CHARSET_RECODE) {
|
||||
recode_file($src_charset . '..' . $dest_charset, $fin, $fout);
|
||||
} else {
|
||||
while (!feof($fin)) {
|
||||
$line = fgets($fin, 4096);
|
||||
if ($GLOBALS['PMA_recoding_engine'] == PMA_CHARSET_ICONV) {
|
||||
$dist = iconv($src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $line);
|
||||
} else {
|
||||
$dist = libiconv($src_charset, $dest_charset, $line);
|
||||
}
|
||||
fputs($fout, $dist);
|
||||
} // end while
|
||||
}
|
||||
fclose($fin);
|
||||
fclose($fout);
|
||||
unlink($file);
|
||||
|
||||
return $tmpfname;
|
||||
default:
|
||||
return $file;
|
||||
}
|
||||
} // end of the "PMA_convert_file()" function
|
||||
|
||||
?>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -8,88 +8,85 @@
|
||||
* May 19, 2002
|
||||
*/
|
||||
|
||||
if (!defined('PMA_DB_CONFIG_LIB_INCLUDED')) {
|
||||
define('PMA_DB_CONFIG_LIB_INCLUDED', 1);
|
||||
/**
|
||||
* Converts attributes of an object to xml code
|
||||
*
|
||||
* Original obj2xml() function by <jgettys@gnuvox.com>
|
||||
* as found on http://www.php.net/manual/en/function.get-defined-vars.php
|
||||
* Fixed and improved by Robin Johnson <robbat2@users.sourceforge.net>
|
||||
*
|
||||
* @param object the source
|
||||
* @param string identication
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function obj2xml($v, $indent = '') {
|
||||
$attr = '';
|
||||
foreach($v AS $key => $val) {
|
||||
if (is_string($key) && ($key == '__attr')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts attributes of an object to xml code
|
||||
*
|
||||
* Original obj2xml() function by <jgettys@gnuvox.com>
|
||||
* as found on http://www.php.net/manual/en/function.get-defined-vars.php
|
||||
* Fixed and improved by Robin Johnson <robbat2@users.sourceforge.net>
|
||||
*
|
||||
* @param object the source
|
||||
* @param string identication
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function obj2xml($v, $indent = '') {
|
||||
$attr = '';
|
||||
foreach($v AS $key => $val) {
|
||||
if (is_string($key) && ($key == '__attr')) {
|
||||
continue;
|
||||
// Check for __attr
|
||||
if (is_object($val->__attr)) {
|
||||
foreach($val->__attr AS $key2 => $val2) {
|
||||
$attr .= " $key2=\"$val2\"";
|
||||
}
|
||||
} else {
|
||||
$attr = '';
|
||||
}
|
||||
|
||||
// Check for __attr
|
||||
if (is_object($val->__attr)) {
|
||||
foreach($val->__attr AS $key2 => $val2) {
|
||||
$attr .= " $key2=\"$val2\"";
|
||||
}
|
||||
// Preserve data type information
|
||||
$attr .= ' type="' . gettype($val) . '"';
|
||||
|
||||
if (is_array($val) || is_object($val)) {
|
||||
echo "$indent<$key$attr>\n";
|
||||
obj2xml($val, $indent . ' ');
|
||||
echo "$indent</$key>\n";
|
||||
} else {
|
||||
if (is_string($val) && ($val == '')) {
|
||||
echo "$indent<$key$attr />\n";
|
||||
} else {
|
||||
$attr = '';
|
||||
echo "$indent<$key$attr>$val</$key>\n";
|
||||
}
|
||||
|
||||
// Preserve data type information
|
||||
$attr .= ' type="' . gettype($val) . '"';
|
||||
|
||||
if (is_array($val) || is_object($val)) {
|
||||
echo "$indent<$key$attr>\n";
|
||||
obj2xml($val, $indent . ' ');
|
||||
echo "$indent</$key>\n";
|
||||
} else {
|
||||
if (is_string($val) && ($val == '')) {
|
||||
echo "$indent<$key$attr />\n";
|
||||
} else {
|
||||
echo "$indent<$key$attr>$val</$key>\n";
|
||||
}
|
||||
}
|
||||
} // end while
|
||||
} // end of the "obj2xml()" function
|
||||
}
|
||||
} // end while
|
||||
} // end of the "obj2xml()" function
|
||||
|
||||
|
||||
$cfg['DBConfig']['AllowUserOverride'] = array(
|
||||
'Servers/*/bookmarkdb',
|
||||
'Servers/*/bookmarktable',
|
||||
'Servers/*/relation',
|
||||
'Servers/*/pdf_table_position',
|
||||
'ShowSQL',
|
||||
'Confirm',
|
||||
'LeftFrameLight',
|
||||
'ShowTooltip',
|
||||
'ShowBlob',
|
||||
'NavigationBarIconic',
|
||||
'ShowAll',
|
||||
'MaxRows',
|
||||
'Order',
|
||||
'ProtectBinary',
|
||||
'ShowFunctionFields',
|
||||
'LeftWidth',
|
||||
'LeftBgColor',
|
||||
'LeftPointerColor',
|
||||
'RightBgColor',
|
||||
'Border',
|
||||
'ThBgcolor',
|
||||
'BgcolorOne',
|
||||
'BgcolorTwo',
|
||||
'BrowsePointerColor',
|
||||
'BrowseMarkerColor',
|
||||
'TextareaCols',
|
||||
'TextareaRows',
|
||||
'LimitChars',
|
||||
'ModifyDeleteAtLeft',
|
||||
'ModifyDeleteAtRight',
|
||||
'DefaultDisplay',
|
||||
'RepeatCells'
|
||||
);
|
||||
$cfg['DBConfig']['AllowUserOverride'] = array(
|
||||
'Servers/*/bookmarkdb',
|
||||
'Servers/*/bookmarktable',
|
||||
'Servers/*/relation',
|
||||
'Servers/*/pdf_table_position',
|
||||
'ShowSQL',
|
||||
'Confirm',
|
||||
'LeftFrameLight',
|
||||
'ShowTooltip',
|
||||
'ShowBlob',
|
||||
'NavigationBarIconic',
|
||||
'ShowAll',
|
||||
'MaxRows',
|
||||
'Order',
|
||||
'ProtectBinary',
|
||||
'ShowFunctionFields',
|
||||
'LeftWidth',
|
||||
'LeftBgColor',
|
||||
'LeftPointerColor',
|
||||
'RightBgColor',
|
||||
'Border',
|
||||
'ThBgcolor',
|
||||
'BgcolorOne',
|
||||
'BgcolorTwo',
|
||||
'BrowsePointerColor',
|
||||
'BrowseMarkerColor',
|
||||
'TextareaCols',
|
||||
'TextareaRows',
|
||||
'LimitChars',
|
||||
'ModifyDeleteAtLeft',
|
||||
'ModifyDeleteAtRight',
|
||||
'DefaultDisplay',
|
||||
'RepeatCells'
|
||||
);
|
||||
|
||||
} // $__PMA_DB_CONFIG_LIB__
|
||||
?>
|
||||
|
@@ -16,7 +16,7 @@ if (!isset($is_db) || !$is_db) {
|
||||
if (!isset($is_transformation_wrapper)) {
|
||||
header('Location: ' . $cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
|
||||
}
|
||||
exit();
|
||||
exit;
|
||||
}
|
||||
} // end if (ensures db exists)
|
||||
if (!isset($is_table) || !$is_table) {
|
||||
@@ -29,9 +29,9 @@ if (!isset($is_table) || !$is_table) {
|
||||
if (!isset($is_transformation_wrapper)) {
|
||||
header('Location: ' . $cfg['PmaAbsoluteUri'] . 'db_details.php?' . PMA_generate_common_url($db, '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
|
||||
}
|
||||
exit();
|
||||
exit;
|
||||
} else if (isset($is_table)) {
|
||||
mysql_free_result($is_table);
|
||||
}
|
||||
} // end if (ensures table exists)
|
||||
?>
|
||||
?>
|
||||
|
@@ -2,88 +2,84 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_DBG_PROFILING_INCLUDED')) {
|
||||
define('PMA_DBG_PROFILING_INCLUDED', 1);
|
||||
if (isset($GLOBALS['DBG']) && $GLOBALS['DBG']
|
||||
&& isset($GLOBALS['cfg']['DBG']['profile']['enable'])
|
||||
&& $GLOBALS['cfg']['DBG']['profile']['enable']) {
|
||||
|
||||
if (isset($GLOBALS['DBG']) && $GLOBALS['DBG']
|
||||
&& isset($GLOBALS['cfg']['DBG']['profile']['enable'])
|
||||
&& $GLOBALS['cfg']['DBG']['profile']['enable']) {
|
||||
|
||||
/**
|
||||
* Displays profiling results when called
|
||||
* WARNING: this function is SLOW
|
||||
/**
|
||||
* Displays profiling results when called
|
||||
* WARNING: this function is SLOW
|
||||
*/
|
||||
function dbg_dump_profiling_results() {
|
||||
/* Applies to the original 'dbg_dump_profiling_results' function,
|
||||
* sourced from http://dd.cron.ru/dbg/download.php?h=prof_sample2
|
||||
* Copyright (c) 2002. Dmitri Dmitrienko
|
||||
* LICENCE: This source file is subject to Mozilla Public License (MPL)
|
||||
* AUTHOR: Dmitri Dmitrienko <dd@cron.ru>
|
||||
*/
|
||||
function dbg_dump_profiling_results() {
|
||||
/* Applies to the original 'dbg_dump_profiling_results' function,
|
||||
* sourced from http://dd.cron.ru/dbg/download.php?h=prof_sample2
|
||||
* Copyright (c) 2002. Dmitri Dmitrienko
|
||||
* LICENCE: This source file is subject to Mozilla Public License (MPL)
|
||||
* AUTHOR: Dmitri Dmitrienko <dd@cron.ru>
|
||||
*/
|
||||
|
||||
dbg_get_profiler_results(&$dbg_prof_results);
|
||||
dbg_get_profiler_results(&$dbg_prof_results);
|
||||
|
||||
echo '<br><table width="1000" cellspacing="0" cellpadding="2" style="font:8pt courier">' . "\n" .
|
||||
'<thead>' . "\n" .
|
||||
'<tr style="background:#808080; color:#FFFFFF">' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGModule'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGLine'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGHits'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGTimePerHitMs'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGTotalTimeMs'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGMinTimeMs'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGMaxTimeMs'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGContextID'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGContext'] . '</td>' . "\n" .
|
||||
'</tr></thead>' . "\n" .
|
||||
'<tbody style="vertical-align: top">' . "\n";
|
||||
foreach($dbg_prof_results['line_no'] AS $idx => $line_no) {
|
||||
$mod_no = $dbg_prof_results['mod_no'][$idx];
|
||||
dbg_get_module_name($mod_no, &$mod_name);
|
||||
echo '<br><table width="1000" cellspacing="0" cellpadding="2" style="font:8pt courier">' . "\n" .
|
||||
'<thead>' . "\n" .
|
||||
'<tr style="background:#808080; color:#FFFFFF">' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGModule'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGLine'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGHits'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGTimePerHitMs'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGTotalTimeMs'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGMinTimeMs'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGMaxTimeMs'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGContextID'] . '</td>' . "\n" .
|
||||
'<td>' . $GLOBALS['strDBGContext'] . '</td>' . "\n" .
|
||||
'</tr></thead>' . "\n" .
|
||||
'<tbody style="vertical-align: top">' . "\n";
|
||||
foreach($dbg_prof_results['line_no'] AS $idx => $line_no) {
|
||||
$mod_no = $dbg_prof_results['mod_no'][$idx];
|
||||
dbg_get_module_name($mod_no, &$mod_name);
|
||||
|
||||
//if (strpos("!".$mod_name, 'dbg.php') > 0) continue;
|
||||
//if (strpos("!".$mod_name, 'dbg.php') > 0) continue;
|
||||
|
||||
$hit_cnt = $dbg_prof_results['hit_count'][$idx];
|
||||
$hit_cnt = $dbg_prof_results['hit_count'][$idx];
|
||||
|
||||
$time_sum = $dbg_prof_results['tm_sum'][$idx] * 1000;
|
||||
$time_avg_hit = $time_sum / $hit_cnt;
|
||||
$time_min = $dbg_prof_results['tm_min'][$idx] * 1000;
|
||||
$time_max = $dbg_prof_results['tm_max'][$idx] * 1000;
|
||||
$time_sum = $dbg_prof_results['tm_sum'][$idx] * 1000;
|
||||
$time_avg_hit = $time_sum / $hit_cnt;
|
||||
$time_min = $dbg_prof_results['tm_min'][$idx] * 1000;
|
||||
$time_max = $dbg_prof_results['tm_max'][$idx] * 1000;
|
||||
|
||||
$time_sum = sprintf('%.3f', $time_sum);
|
||||
$time_avg_hit = sprintf('%.3f', $time_avg_hit);
|
||||
$time_min = sprintf('%.3f', $time_min);
|
||||
$time_max = sprintf('%.3f', $time_max);
|
||||
$time_sum = sprintf('%.3f', $time_sum);
|
||||
$time_avg_hit = sprintf('%.3f', $time_avg_hit);
|
||||
$time_min = sprintf('%.3f', $time_min);
|
||||
$time_max = sprintf('%.3f', $time_max);
|
||||
|
||||
dbg_get_source_context($mod_no, $line_no, &$ctx_id);
|
||||
dbg_get_source_context($mod_no, $line_no, &$ctx_id);
|
||||
|
||||
//use a default context name if needed
|
||||
if (dbg_get_context_name($ctx_id, &$ctx_name)
|
||||
&& strcmp($ctx_name,'') == 0) {
|
||||
$ctx_name = "::main";
|
||||
}
|
||||
|
||||
$bk = "#ffffff";
|
||||
if (($idx & 1) == 0)
|
||||
$bk = "#e0e0e0";
|
||||
|
||||
if($time_avg_hit > $GLOBALS['cfg']['DBG']['profile']['threshold'] ) {
|
||||
echo '<tr style="background:' . $bk . '">' .
|
||||
'<td>' . $mod_name . '</td>' .
|
||||
'<td>' . $line_no . '</td>' .
|
||||
'<td>' . $hit_cnt . '</td>' .
|
||||
'<td>' . $time_avg_hit . '</td>' .
|
||||
'<td>' . $time_sum . '</td>' .
|
||||
'<td>' . $time_min . '</td>' .
|
||||
'<td>' . $time_max . '</td>' .
|
||||
'<td>' . $ctx_id . '</td>' .
|
||||
'<td>' . $ctx_name . '</td>' .
|
||||
'</tr>' . "\n";
|
||||
}
|
||||
//use a default context name if needed
|
||||
if (dbg_get_context_name($ctx_id, &$ctx_name)
|
||||
&& strcmp($ctx_name,'') == 0) {
|
||||
$ctx_name = "::main";
|
||||
}
|
||||
|
||||
$bk = "#ffffff";
|
||||
if (($idx & 1) == 0)
|
||||
$bk = "#e0e0e0";
|
||||
|
||||
if($time_avg_hit > $GLOBALS['cfg']['DBG']['profile']['threshold'] ) {
|
||||
echo '<tr style="background:' . $bk . '">' .
|
||||
'<td>' . $mod_name . '</td>' .
|
||||
'<td>' . $line_no . '</td>' .
|
||||
'<td>' . $hit_cnt . '</td>' .
|
||||
'<td>' . $time_avg_hit . '</td>' .
|
||||
'<td>' . $time_sum . '</td>' .
|
||||
'<td>' . $time_min . '</td>' .
|
||||
'<td>' . $time_max . '</td>' .
|
||||
'<td>' . $ctx_id . '</td>' .
|
||||
'<td>' . $ctx_name . '</td>' .
|
||||
'</tr>' . "\n";
|
||||
}
|
||||
echo "</tbody></table>";
|
||||
}
|
||||
echo "</tbody></table>";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -2,23 +2,19 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_DBG_SETUP_INCLUDED')) {
|
||||
define('PMA_DBG_SETUP_INCLUDED', 1);
|
||||
|
||||
if (isset($GLOBALS['cfg']['DBG']['enable']) && $GLOBALS['cfg']['DBG']['enable']) {
|
||||
/**
|
||||
* Loads the DBG extension if needed
|
||||
*/
|
||||
if (!@extension_loaded('dbg')) {
|
||||
PMA_dl('dbg');
|
||||
}
|
||||
if (!@extension_loaded('dbg')) {
|
||||
echo sprintf($strCantLoad, 'DBG') . '<br />' . "\n"
|
||||
. '<a href="./Documentation.html#faqdbg" target="documentation">' . $GLOBALS['strDocu'] . '</a>' . "\n";
|
||||
exit();
|
||||
}
|
||||
$GLOBALS['DBG'] = true;
|
||||
if (isset($GLOBALS['cfg']['DBG']['enable']) && $GLOBALS['cfg']['DBG']['enable']) {
|
||||
/**
|
||||
* Loads the DBG extension if needed
|
||||
*/
|
||||
if (!@extension_loaded('dbg')) {
|
||||
PMA_dl('dbg');
|
||||
}
|
||||
if (!@extension_loaded('dbg')) {
|
||||
echo sprintf($strCantLoad, 'DBG') . '<br />' . "\n"
|
||||
. '<a href="./Documentation.html#faqdbg" target="documentation">' . $GLOBALS['strDocu'] . '</a>' . "\n";
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
$GLOBALS['DBG'] = true;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -5,54 +5,137 @@
|
||||
/**
|
||||
* DEFINES VARIABLES & CONSTANTS
|
||||
* Overview:
|
||||
* PMA_MYSQL_INT_VERSION (int) - eg: 32339 instead of 3.23.39
|
||||
* PMA_VERSION (string) - phpMyAdmin version string
|
||||
* PMA_PHP_INT_VERSION (int) - eg: 30017 instead of 3.0.17 or
|
||||
* 40006 instead of 4.0.6RC3
|
||||
* PMA_MYSQL_CLIENT_API (int) - the version number of the MySQL client
|
||||
* API which php is built against.
|
||||
* PMA_IS_WINDOWS (bool) - mark if phpMyAdmin running on windows
|
||||
* server
|
||||
* PMA_IS_GD2 (bool) - true is GD2 is present
|
||||
* PMA_USR_OS (string) - the plateform (os) of the user
|
||||
* PMA_USR_BROWSER_AGENT (string) - the browser of the user
|
||||
* PMA_USR_BROWSER_VER (double) - the version of this browser
|
||||
*/
|
||||
|
||||
// MySQL Version
|
||||
if (!defined('PMA_MYSQL_INT_VERSION') && isset($userlink)) {
|
||||
if (!empty($server)) {
|
||||
$result = PMA_mysql_query('SELECT VERSION() AS version');
|
||||
if ($result != FALSE && @mysql_num_rows($result) > 0) {
|
||||
$row = PMA_mysql_fetch_array($result);
|
||||
$match = explode('.', $row['version']);
|
||||
} else {
|
||||
$result = @PMA_mysql_query('SHOW VARIABLES LIKE \'version\'');
|
||||
if ($result != FALSE && @mysql_num_rows($result) > 0){
|
||||
$row = PMA_mysql_fetch_row($result);
|
||||
$match = explode('.', $row[1]);
|
||||
}
|
||||
}
|
||||
} // end server id is defined case
|
||||
|
||||
if (!isset($match) || !isset($match[0])) {
|
||||
$match[0] = 3;
|
||||
}
|
||||
if (!isset($match[1])) {
|
||||
$match[1] = 21;
|
||||
}
|
||||
if (!isset($match[2])) {
|
||||
$match[2] = 0;
|
||||
}
|
||||
|
||||
if(!isset($row)) {
|
||||
$row['version'] = '3.21.0';
|
||||
}
|
||||
|
||||
define('PMA_MYSQL_INT_VERSION', (int)sprintf('%d%02d%02d', $match[0], $match[1], intval($match[2])));
|
||||
define('PMA_MYSQL_STR_VERSION', $row['version']);
|
||||
unset($match);
|
||||
// phpMyAdmin release
|
||||
if (!defined('PMA_VERSION')) {
|
||||
define('PMA_VERSION', '2.5.5-dev');
|
||||
}
|
||||
|
||||
// php version
|
||||
if (!defined('PMA_PHP_INT_VERSION')) {
|
||||
if (!preg_match('@([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})@', phpversion(), $match)) {
|
||||
$result = preg_match('@([0-9]{1,2}).([0-9]{1,2})@', phpversion(), $match);
|
||||
}
|
||||
if (isset($match) && !empty($match[1])) {
|
||||
if (!isset($match[2])) {
|
||||
$match[2] = 0;
|
||||
}
|
||||
if (!isset($match[3])) {
|
||||
$match[3] = 0;
|
||||
}
|
||||
define('PMA_PHP_INT_VERSION', (int)sprintf('%d%02d%02d', $match[1], $match[2], $match[3]));
|
||||
unset($match);
|
||||
} else {
|
||||
define('PMA_PHP_INT_VERSION', 0);
|
||||
}
|
||||
define('PMA_PHP_STR_VERSION', phpversion());
|
||||
}
|
||||
|
||||
// MySQL client API
|
||||
if (!defined('PMA_MYSQL_CLIENT_API')) {
|
||||
$client_api = explode('.', mysql_get_client_info());
|
||||
define('PMA_MYSQL_CLIENT_API', (int)sprintf('%d%02d%02d', $client_api[0], $client_api[1], intval($client_api[2])));
|
||||
unset($client_api);
|
||||
}
|
||||
|
||||
// Whether the os php is running on is windows or not
|
||||
if (!defined('PMA_IS_WINDOWS')) {
|
||||
if (defined('PHP_OS') && stristr(PHP_OS, 'win')) {
|
||||
define('PMA_IS_WINDOWS', 1);
|
||||
} else {
|
||||
define('PMA_IS_WINDOWS', 0);
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_dl($module) {
|
||||
if (!isset($GLOBALS['PMA_dl_allowed'])) {
|
||||
if (!@ini_get('safe_mode') && @ini_get('enable_dl') && @function_exists('dl')) {
|
||||
ob_start();
|
||||
phpinfo(INFO_GENERAL); /* Only general info */
|
||||
$a = strip_tags(ob_get_contents());
|
||||
ob_end_clean();
|
||||
/* Get GD version string from phpinfo output */
|
||||
if (preg_match('@Thread Safety[[:space:]]*enabled@', $a)) {
|
||||
if (preg_match('@Server API[[:space:]]*\(CGI\|CLI\)@', $a)) {
|
||||
$GLOBALS['PMA_dl_allowed'] = TRUE;
|
||||
} else {
|
||||
$GLOBALS['PMA_dl_allowed'] = FALSE;
|
||||
}
|
||||
} else {
|
||||
$GLOBALS['PMA_dl_allowed'] = TRUE;
|
||||
}
|
||||
} else {
|
||||
$GLOBALS['PMA_dl_allowed'] = FALSE;
|
||||
}
|
||||
}
|
||||
if (PMA_IS_WINDOWS) {
|
||||
$suffix = '.dll';
|
||||
} else {
|
||||
$suffix = '.so';
|
||||
}
|
||||
if ($GLOBALS['PMA_dl_allowed']) {
|
||||
return @dl($module . $suffix);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Whether GD2 is present
|
||||
if (!defined('PMA_IS_GD2')) {
|
||||
if ($cfg['GD2Available'] == 'yes') {
|
||||
define('PMA_IS_GD2', 1);
|
||||
} elseif ($cfg['GD2Available'] == 'no') {
|
||||
define('PMA_IS_GD2', 0);
|
||||
} else {
|
||||
if (!@extension_loaded('gd')) {
|
||||
PMA_dl('gd');
|
||||
}
|
||||
if (!@function_exists('imagecreatetruecolor')) {
|
||||
define('PMA_IS_GD2', 0);
|
||||
} else {
|
||||
if (@function_exists('gd_info')) {
|
||||
$gd_nfo = gd_info();
|
||||
if (strstr($gd_nfo["GD Version"], '2.')) {
|
||||
define('PMA_IS_GD2', 1);
|
||||
} else {
|
||||
define('PMA_IS_GD2', 0);
|
||||
}
|
||||
} else {
|
||||
/* We must do hard way... */
|
||||
ob_start();
|
||||
phpinfo(INFO_MODULES); /* Only modules */
|
||||
$a = strip_tags(ob_get_contents());
|
||||
ob_end_clean();
|
||||
/* Get GD version string from phpinfo output */
|
||||
if (preg_match('@GD Version[[:space:]]*\(.*\)@', $a, $v)) {
|
||||
if (strstr($v, '2.')) {
|
||||
define('PMA_IS_GD2', 1);
|
||||
} else {
|
||||
define('PMA_IS_GD2', 0);
|
||||
}
|
||||
} else {
|
||||
define('PMA_IS_GD2', 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Determines platform (OS), browser and version of the user
|
||||
// Based on a phpBuilder article:
|
||||
// see http://www.phpbuilder.net/columns/tim20000821.php
|
||||
if (!defined('PMA_USR_OS')) {
|
||||
// loic1 - 2001/25/11: use the new globals arrays defined with
|
||||
// php 4.1+
|
||||
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
|
||||
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
|
||||
} else if (!isset($HTTP_USER_AGENT)) {
|
||||
@@ -103,5 +186,6 @@ if (!defined('PMA_USR_OS')) {
|
||||
define('PMA_USR_BROWSER_VER', 0);
|
||||
define('PMA_USR_BROWSER_AGENT', 'OTHER');
|
||||
}
|
||||
} // $__PMA_DEFINES_LIB__
|
||||
?>
|
||||
}
|
||||
|
||||
?>
|
||||
|
40
libraries/defines_mysql.lib.php
Normal file
40
libraries/defines_mysql.lib.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
/**
|
||||
* DEFINES MYSQL RELATED VARIABLES & CONSTANTS
|
||||
* Overview:
|
||||
* PMA_MYSQL_INT_VERSION (int) - eg: 32339 instead of 3.23.39
|
||||
*/
|
||||
|
||||
if (!defined('PMA_MYSQL_INT_VERSION') && isset($userlink)) {
|
||||
if (!empty($server)) {
|
||||
$result = PMA_mysql_query('SELECT VERSION() AS version', $userlink);
|
||||
if ($result != FALSE && @mysql_num_rows($result) > 0) {
|
||||
$row = PMA_mysql_fetch_array($result);
|
||||
$match = explode('.', $row['version']);
|
||||
mysql_free_result($result);
|
||||
}
|
||||
} // end server id is defined case
|
||||
|
||||
if (!isset($match) || !isset($match[0])) {
|
||||
$match[0] = 3;
|
||||
}
|
||||
if (!isset($match[1])) {
|
||||
$match[1] = 23;
|
||||
}
|
||||
if (!isset($match[2])) {
|
||||
$match[2] = 32;
|
||||
}
|
||||
|
||||
if(!isset($row)) {
|
||||
$row['version'] = '3.23.32';
|
||||
}
|
||||
|
||||
define('PMA_MYSQL_INT_VERSION', (int)sprintf('%d%02d%02d', $match[0], $match[1], intval($match[2])));
|
||||
define('PMA_MYSQL_STR_VERSION', $row['version']);
|
||||
unset($result, $row, $match);
|
||||
}
|
||||
|
||||
?>
|
@@ -1,132 +0,0 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
/**
|
||||
* DEFINES VARIABLES & CONSTANTS
|
||||
* Overview:
|
||||
* PMA_VERSION (string) - phpMyAdmin version string
|
||||
* PMA_PHP_INT_VERSION (int) - eg: 30017 instead of 3.0.17 or
|
||||
* 40006 instead of 4.0.6RC3
|
||||
* PMA_MYSQL_CLIENT_API (int) - the version number of the MySQL client
|
||||
* API which php is built against.
|
||||
* PMA_IS_WINDOWS (bool) - mark if phpMyAdmin running on windows
|
||||
* server
|
||||
* PMA_IS_GD2 (bool) - true is GD2 is present
|
||||
*/
|
||||
// phpMyAdmin release
|
||||
if (!defined('PMA_VERSION')) {
|
||||
define('PMA_VERSION', '2.5.5-dev');
|
||||
}
|
||||
|
||||
// php version
|
||||
if (!defined('PMA_PHP_INT_VERSION')) {
|
||||
if (!preg_match('@([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})@', phpversion(), $match)) {
|
||||
$result = preg_match('@([0-9]{1,2}).([0-9]{1,2})@', phpversion(), $match);
|
||||
}
|
||||
if (isset($match) && !empty($match[1])) {
|
||||
if (!isset($match[2])) {
|
||||
$match[2] = 0;
|
||||
}
|
||||
if (!isset($match[3])) {
|
||||
$match[3] = 0;
|
||||
}
|
||||
define('PMA_PHP_INT_VERSION', (int)sprintf('%d%02d%02d', $match[1], $match[2], $match[3]));
|
||||
unset($match);
|
||||
} else {
|
||||
define('PMA_PHP_INT_VERSION', 0);
|
||||
}
|
||||
define('PMA_PHP_STR_VERSION', phpversion());
|
||||
}
|
||||
|
||||
// MySQL client API
|
||||
if (!defined('PMA_MYSQL_CLIENT_API')) {
|
||||
$client_api = explode('.', mysql_get_client_info());
|
||||
define('PMA_MYSQL_CLIENT_API', (int)sprintf('%d%02d%02d', $client_api[0], $client_api[1], intval($client_api[2])));
|
||||
unset($client_api);
|
||||
}
|
||||
|
||||
// Whether the os php is running on is windows or not
|
||||
if (!defined('PMA_IS_WINDOWS')) {
|
||||
if (defined('PHP_OS') && stristr(PHP_OS, 'win')) {
|
||||
define('PMA_IS_WINDOWS', 1);
|
||||
} else {
|
||||
define('PMA_IS_WINDOWS', 0);
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_dl($module) {
|
||||
if (!isset($GLOBALS['PMA_dl_allowed'])) {
|
||||
if (!@ini_get('safe_mode') && @ini_get('enable_dl') && @function_exists('dl')) {
|
||||
ob_start();
|
||||
phpinfo(INFO_GENERAL); /* Only general info */
|
||||
$a = strip_tags(ob_get_contents());
|
||||
ob_end_clean();
|
||||
/* Get GD version string from phpinfo output */
|
||||
if (preg_match('@Thread Safety[[:space:]]*enabled@', $a)) {
|
||||
if (preg_match('@Server API[[:space:]]*\(CGI\|CLI\)@', $a)) {
|
||||
$GLOBALS['PMA_dl_allowed'] = TRUE;
|
||||
} else {
|
||||
$GLOBALS['PMA_dl_allowed'] = FALSE;
|
||||
}
|
||||
} else {
|
||||
$GLOBALS['PMA_dl_allowed'] = TRUE;
|
||||
}
|
||||
} else {
|
||||
$GLOBALS['PMA_dl_allowed'] = FALSE;
|
||||
}
|
||||
}
|
||||
if (PMA_IS_WINDOWS) {
|
||||
$suffix = '.dll';
|
||||
} else {
|
||||
$suffix = '.so';
|
||||
}
|
||||
if ($GLOBALS['PMA_dl_allowed']) {
|
||||
return @dl($module . $suffix);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Whether GD2 is present
|
||||
if (!defined('PMA_IS_GD2')) {
|
||||
if ($cfg['GD2Available'] == 'yes') {
|
||||
define('PMA_IS_GD2', 1);
|
||||
} elseif ($cfg['GD2Available'] == 'no') {
|
||||
define('PMA_IS_GD2', 0);
|
||||
} else {
|
||||
if (!@extension_loaded('gd')) {
|
||||
PMA_dl('gd');
|
||||
}
|
||||
if (!@function_exists('imagecreatetruecolor')) {
|
||||
define('PMA_IS_GD2', 0);
|
||||
} else {
|
||||
if (@function_exists('gd_info')) {
|
||||
$gd_nfo = gd_info();
|
||||
if (strstr($gd_nfo["GD Version"], '2.')) {
|
||||
define('PMA_IS_GD2', 1);
|
||||
} else {
|
||||
define('PMA_IS_GD2', 0);
|
||||
}
|
||||
} else {
|
||||
/* We must do hard way... */
|
||||
ob_start();
|
||||
phpinfo(INFO_MODULES); /* Only modules */
|
||||
$a = strip_tags(ob_get_contents());
|
||||
ob_end_clean();
|
||||
/* Get GD version string from phpinfo output */
|
||||
if (preg_match('@GD Version[[:space:]]*\(.*\)@', $a, $v)) {
|
||||
if (strstr($v, '2.')) {
|
||||
define('PMA_IS_GD2', 1);
|
||||
} else {
|
||||
define('PMA_IS_GD2', 0);
|
||||
}
|
||||
} else {
|
||||
define('PMA_IS_GD2', 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// $__PMA_DEFINES_PHP_LIB__
|
||||
?>
|
@@ -3,7 +3,7 @@
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
// Get relations & co. status
|
||||
require('./libraries/relation.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
function PMA_exportCheckboxCheck($str) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -2,20 +2,20 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!empty($del_url)) {
|
||||
echo ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '">' . "\n";
|
||||
echo ' <input type="checkbox" name="rows_to_delete[]" value="' . $del_query . '" />' . "\n";
|
||||
echo ' </td>' . "\n";
|
||||
}
|
||||
if (!empty($edit_url)) {
|
||||
echo ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '">' . "\n";
|
||||
echo PMA_linkOrButton($edit_url, $edit_str, '');
|
||||
echo $bookmark_go;
|
||||
echo ' </td>' . "\n";
|
||||
}
|
||||
if (!empty($del_url)) {
|
||||
echo ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '">' . "\n";
|
||||
echo PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : ''));
|
||||
echo ' </td>' . "\n";
|
||||
}
|
||||
?>
|
||||
if (!empty($del_url)) {
|
||||
echo ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '">' . "\n"
|
||||
. ' <input type="checkbox" name="rows_to_delete[]" value="' . $del_query . '" />' . "\n"
|
||||
. ' </td>' . "\n";
|
||||
}
|
||||
if (!empty($edit_url)) {
|
||||
echo ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '">' . "\n"
|
||||
. PMA_linkOrButton($edit_url, $edit_str, '')
|
||||
. $bookmark_go
|
||||
. ' </td>' . "\n";
|
||||
}
|
||||
if (!empty($del_url)) {
|
||||
echo ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '">' . "\n"
|
||||
. PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : ''))
|
||||
. ' </td>' . "\n";
|
||||
}
|
||||
?>
|
||||
|
@@ -8,44 +8,40 @@
|
||||
* Thanks to <markus@noga.de>
|
||||
*/
|
||||
|
||||
// lem9
|
||||
//if (!defined('PMA_GET_FOREIGN_LIB_INCLUDED')) {
|
||||
// define('PMA_GET_FOREIGN_LIB_INCLUDED', 1);
|
||||
|
||||
// lem9: we always show the foreign field in the drop-down; if a display
|
||||
// field is defined, we show it besides the foreign field
|
||||
$foreign_link = false;
|
||||
if ($foreigners && isset($foreigners[$field])) {
|
||||
$foreigner = $foreigners[$field];
|
||||
$foreign_db = $foreigner['foreign_db'];
|
||||
$foreign_table = $foreigner['foreign_table'];
|
||||
$foreign_field = $foreigner['foreign_field'];
|
||||
// lem9: we always show the foreign field in the drop-down; if a display
|
||||
// field is defined, we show it besides the foreign field
|
||||
$foreign_link = false;
|
||||
if ($foreigners && isset($foreigners[$field])) {
|
||||
$foreigner = $foreigners[$field];
|
||||
$foreign_db = $foreigner['foreign_db'];
|
||||
$foreign_table = $foreigner['foreign_table'];
|
||||
$foreign_field = $foreigner['foreign_field'];
|
||||
|
||||
// Count number of rows in the foreign table. Currently we do
|
||||
// not use a drop-down if more than 200 rows in the foreign table,
|
||||
// for speed reasons and because we need a better interface for this.
|
||||
//
|
||||
// We could also do the SELECT anyway, with a LIMIT, and ensure that
|
||||
// the current value of the field is one of the choices.
|
||||
// Count number of rows in the foreign table. Currently we do
|
||||
// not use a drop-down if more than 200 rows in the foreign table,
|
||||
// for speed reasons and because we need a better interface for this.
|
||||
//
|
||||
// We could also do the SELECT anyway, with a LIMIT, and ensure that
|
||||
// the current value of the field is one of the choices.
|
||||
|
||||
$the_total = PMA_countRecords($foreign_db, $foreign_table, TRUE);
|
||||
$the_total = PMA_countRecords($foreign_db, $foreign_table, TRUE);
|
||||
|
||||
if ((isset($override_total) && $override_total == true) || $the_total < 200) {
|
||||
// foreign_display can be FALSE if no display field defined:
|
||||
if ((isset($override_total) && $override_total == true) || $the_total < 200) {
|
||||
// foreign_display can be FALSE if no display field defined:
|
||||
|
||||
$foreign_display = PMA_getDisplayField($foreign_db, $foreign_table);
|
||||
$dispsql = 'SELECT ' . PMA_backquote($foreign_field)
|
||||
. (($foreign_display == FALSE) ? '' : ', ' . PMA_backquote($foreign_display))
|
||||
. ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table)
|
||||
. (($foreign_display == FALSE) ? '' :' ORDER BY ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($foreign_display))
|
||||
. (isset($foreign_limit) ? $foreign_limit : '');
|
||||
$disp = PMA_mysql_query($dispsql);
|
||||
}
|
||||
else {
|
||||
unset($disp);
|
||||
$foreign_link = true;
|
||||
}
|
||||
} // end if $foreigners
|
||||
$foreign_display = PMA_getDisplayField($foreign_db, $foreign_table);
|
||||
$dispsql = 'SELECT ' . PMA_backquote($foreign_field)
|
||||
. (($foreign_display == FALSE) ? '' : ', ' . PMA_backquote($foreign_display))
|
||||
. ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table)
|
||||
. (($foreign_display == FALSE) ? '' :' ORDER BY ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($foreign_display))
|
||||
. (isset($foreign_limit) ? $foreign_limit : '');
|
||||
$disp = PMA_mysql_query($dispsql);
|
||||
}
|
||||
else {
|
||||
unset($disp);
|
||||
$foreign_link = true;
|
||||
}
|
||||
} // end if $foreigners
|
||||
|
||||
//} // $__PMA_GET_FOREIGN_LIB_INCLUDED__
|
||||
?>
|
||||
?>
|
||||
|
@@ -5,66 +5,64 @@
|
||||
|
||||
/**
|
||||
* This library grabs the names and values of the variables sent or posted to a
|
||||
* script in the '$HTTP_*_VARS' / $_* arrays and sets simple globals variables
|
||||
* from them. It does the same work for the $PHP_SELF variable.
|
||||
* script in the $_* arrays and sets simple globals variables from them. It does
|
||||
* the same work for the $PHP_SELF, $HTTP_ACCEPT_LANGUAGE and
|
||||
* $HTTP_AUTHORIZATION variables.
|
||||
*
|
||||
* loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
|
||||
*/
|
||||
if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
|
||||
define('PMA_GRAB_GLOBALS_INCLUDED', 1);
|
||||
|
||||
function PMA_gpc_extract($array, &$target) {
|
||||
if (!is_array($array)) {
|
||||
return FALSE;
|
||||
}
|
||||
$is_magic_quotes = get_magic_quotes_gpc();
|
||||
foreach($array AS $key => $value) {
|
||||
if (is_array($value)) {
|
||||
// there could be a variable coming from a cookie of
|
||||
// another application, with the same name as this array
|
||||
unset($target[$key]);
|
||||
|
||||
PMA_gpc_extract($value, $target[$key]);
|
||||
} else if ($is_magic_quotes) {
|
||||
$target[$key] = stripslashes($value);
|
||||
} else {
|
||||
$target[$key] = $value;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
function PMA_gpc_extract($array, &$target) {
|
||||
if (!is_array($array)) {
|
||||
return FALSE;
|
||||
}
|
||||
$is_magic_quotes = get_magic_quotes_gpc();
|
||||
foreach($array AS $key => $value) {
|
||||
if (is_array($value)) {
|
||||
// there could be a variable coming from a cookie of
|
||||
// another application, with the same name as this array
|
||||
unset($target[$key]);
|
||||
|
||||
if (!empty($_GET)) {
|
||||
PMA_gpc_extract($_GET, $GLOBALS);
|
||||
} // end if
|
||||
|
||||
if (!empty($_POST)) {
|
||||
PMA_gpc_extract($_POST, $GLOBALS);
|
||||
} // end if
|
||||
|
||||
if (!empty($_FILES)) {
|
||||
foreach($_FILES AS $name => $value) {
|
||||
$$name = $value['tmp_name'];
|
||||
${$name . '_name'} = $value['name'];
|
||||
PMA_gpc_extract($value, $target[$key]);
|
||||
} else if ($is_magic_quotes) {
|
||||
$target[$key] = stripslashes($value);
|
||||
} else {
|
||||
$target[$key] = $value;
|
||||
}
|
||||
} // end if
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!empty($_SERVER)) {
|
||||
if (isset($_SERVER['PHP_SELF'])) {
|
||||
$PHP_SELF = $_SERVER['PHP_SELF'];
|
||||
}
|
||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
$HTTP_ACCEPT_LANGUAGE = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
||||
}
|
||||
if (isset($_SERVER['HTTP_AUTHORIZATION'])) {
|
||||
$HTTP_AUTHORIZATION = $_SERVER['HTTP_AUTHORIZATION'];
|
||||
}
|
||||
} // end if
|
||||
if (!empty($_GET)) {
|
||||
PMA_gpc_extract($_GET, $GLOBALS);
|
||||
} // end if
|
||||
|
||||
// Security fix: disallow accessing serious server files via "?goto="
|
||||
if (isset($goto) && strpos(' ' . $goto, '/') > 0 && substr($goto, 0, 2) != './') {
|
||||
unset($goto);
|
||||
} // end if
|
||||
if (!empty($_POST)) {
|
||||
PMA_gpc_extract($_POST, $GLOBALS);
|
||||
} // end if
|
||||
|
||||
} // $__PMA_GRAB_GLOBALS_LIB__
|
||||
?>
|
||||
if (!empty($_FILES)) {
|
||||
foreach($_FILES AS $name => $value) {
|
||||
$$name = $value['tmp_name'];
|
||||
${$name . '_name'} = $value['name'];
|
||||
}
|
||||
} // end if
|
||||
|
||||
if (!empty($_SERVER)) {
|
||||
$server_vars = array('PHP_SELF', 'HTTP_ACCEPT_LANGUAGE', 'HTTP_AUTHORIZATION');
|
||||
foreach ($server_vars as $current) {
|
||||
if (isset($_SERVER[$current])) {
|
||||
$$current = $_SERVER[$current];
|
||||
} elseif (!isset($$current)) {
|
||||
$$current = '';
|
||||
}
|
||||
}
|
||||
unset($server_vars, $current);
|
||||
} // end if
|
||||
|
||||
// Security fix: disallow accessing serious server files via "?goto="
|
||||
if (isset($goto) && strpos(' ' . $goto, '/') > 0 && substr($goto, 0, 2) != './') {
|
||||
unset($goto);
|
||||
} // end if
|
||||
|
||||
?>
|
||||
|
@@ -8,291 +8,287 @@
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
|
||||
define('PMA_ALLOW_DENY_LIB_INCLUDED', 1);
|
||||
/**
|
||||
* Gets the "true" IP address of the current user
|
||||
*
|
||||
* @return string the ip of the user
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function PMA_getIp()
|
||||
{
|
||||
global $REMOTE_ADDR;
|
||||
global $HTTP_X_FORWARDED_FOR, $HTTP_X_FORWARDED, $HTTP_FORWARDED_FOR, $HTTP_FORWARDED;
|
||||
global $HTTP_VIA, $HTTP_X_COMING_FROM, $HTTP_COMING_FROM;
|
||||
|
||||
/**
|
||||
* Gets the "true" IP address of the current user
|
||||
*
|
||||
* @return string the ip of the user
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function PMA_getIp()
|
||||
{
|
||||
global $REMOTE_ADDR;
|
||||
global $HTTP_X_FORWARDED_FOR, $HTTP_X_FORWARDED, $HTTP_FORWARDED_FOR, $HTTP_FORWARDED;
|
||||
global $HTTP_VIA, $HTTP_X_COMING_FROM, $HTTP_COMING_FROM;
|
||||
|
||||
// Get some server/environment variables values
|
||||
if (empty($REMOTE_ADDR)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['REMOTE_ADDR'])) {
|
||||
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['REMOTE_ADDR'])) {
|
||||
$REMOTE_ADDR = $_ENV['REMOTE_ADDR'];
|
||||
}
|
||||
else if (@getenv('REMOTE_ADDR')) {
|
||||
$REMOTE_ADDR = getenv('REMOTE_ADDR');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_X_FORWARDED_FOR)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$HTTP_X_FORWARDED_FOR = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED_FOR'])) {
|
||||
$HTTP_X_FORWARDED_FOR = $_ENV['HTTP_X_FORWARDED_FOR'];
|
||||
}
|
||||
else if (@getenv('HTTP_X_FORWARDED_FOR')) {
|
||||
$HTTP_X_FORWARDED_FOR = getenv('HTTP_X_FORWARDED_FOR');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_X_FORWARDED)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_X_FORWARDED'])) {
|
||||
$HTTP_X_FORWARDED = $_SERVER['HTTP_X_FORWARDED'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED'])) {
|
||||
$HTTP_X_FORWARDED = $_ENV['HTTP_X_FORWARDED'];
|
||||
}
|
||||
else if (@getenv('HTTP_X_FORWARDED')) {
|
||||
$HTTP_X_FORWARDED = getenv('HTTP_X_FORWARDED');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_FORWARDED_FOR)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_FORWARDED_FOR'])) {
|
||||
$HTTP_FORWARDED_FOR = $_SERVER['HTTP_FORWARDED_FOR'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED_FOR'])) {
|
||||
$HTTP_FORWARDED_FOR = $_ENV['HTTP_FORWARDED_FOR'];
|
||||
}
|
||||
else if (@getenv('HTTP_FORWARDED_FOR')) {
|
||||
$HTTP_FORWARDED_FOR = getenv('HTTP_FORWARDED_FOR');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_FORWARDED)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_FORWARDED'])) {
|
||||
$HTTP_FORWARDED = $_SERVER['HTTP_FORWARDED'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED'])) {
|
||||
$HTTP_FORWARDED = $_ENV['HTTP_FORWARDED'];
|
||||
}
|
||||
else if (@getenv('HTTP_FORWARDED')) {
|
||||
$HTTP_FORWARDED = getenv('HTTP_FORWARDED');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_VIA)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_VIA'])) {
|
||||
$HTTP_VIA = $_SERVER['HTTP_VIA'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_VIA'])) {
|
||||
$HTTP_VIA = $_ENV['HTTP_VIA'];
|
||||
}
|
||||
else if (@getenv('HTTP_VIA')) {
|
||||
$HTTP_VIA = getenv('HTTP_VIA');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_X_COMING_FROM)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_X_COMING_FROM'])) {
|
||||
$HTTP_X_COMING_FROM = $_SERVER['HTTP_X_COMING_FROM'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_X_COMING_FROM'])) {
|
||||
$HTTP_X_COMING_FROM = $_ENV['HTTP_X_COMING_FROM'];
|
||||
}
|
||||
else if (@getenv('HTTP_X_COMING_FROM')) {
|
||||
$HTTP_X_COMING_FROM = getenv('HTTP_X_COMING_FROM');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_COMING_FROM)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_COMING_FROM'])) {
|
||||
$HTTP_COMING_FROM = $_SERVER['HTTP_COMING_FROM'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_COMING_FROM'])) {
|
||||
$HTTP_COMING_FROM = $_ENV['HTTP_COMING_FROM'];
|
||||
}
|
||||
else if (@getenv('HTTP_COMING_FROM')) {
|
||||
$HTTP_COMING_FROM = getenv('HTTP_COMING_FROM');
|
||||
}
|
||||
} // end if
|
||||
|
||||
// Gets the default ip sent by the user
|
||||
if (!empty($REMOTE_ADDR)) {
|
||||
$direct_ip = $REMOTE_ADDR;
|
||||
// Get some server/environment variables values
|
||||
if (empty($REMOTE_ADDR)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['REMOTE_ADDR'])) {
|
||||
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['REMOTE_ADDR'])) {
|
||||
$REMOTE_ADDR = $_ENV['REMOTE_ADDR'];
|
||||
}
|
||||
else if (@getenv('REMOTE_ADDR')) {
|
||||
$REMOTE_ADDR = getenv('REMOTE_ADDR');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_X_FORWARDED_FOR)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$HTTP_X_FORWARDED_FOR = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED_FOR'])) {
|
||||
$HTTP_X_FORWARDED_FOR = $_ENV['HTTP_X_FORWARDED_FOR'];
|
||||
}
|
||||
else if (@getenv('HTTP_X_FORWARDED_FOR')) {
|
||||
$HTTP_X_FORWARDED_FOR = getenv('HTTP_X_FORWARDED_FOR');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_X_FORWARDED)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_X_FORWARDED'])) {
|
||||
$HTTP_X_FORWARDED = $_SERVER['HTTP_X_FORWARDED'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED'])) {
|
||||
$HTTP_X_FORWARDED = $_ENV['HTTP_X_FORWARDED'];
|
||||
}
|
||||
else if (@getenv('HTTP_X_FORWARDED')) {
|
||||
$HTTP_X_FORWARDED = getenv('HTTP_X_FORWARDED');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_FORWARDED_FOR)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_FORWARDED_FOR'])) {
|
||||
$HTTP_FORWARDED_FOR = $_SERVER['HTTP_FORWARDED_FOR'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED_FOR'])) {
|
||||
$HTTP_FORWARDED_FOR = $_ENV['HTTP_FORWARDED_FOR'];
|
||||
}
|
||||
else if (@getenv('HTTP_FORWARDED_FOR')) {
|
||||
$HTTP_FORWARDED_FOR = getenv('HTTP_FORWARDED_FOR');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_FORWARDED)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_FORWARDED'])) {
|
||||
$HTTP_FORWARDED = $_SERVER['HTTP_FORWARDED'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED'])) {
|
||||
$HTTP_FORWARDED = $_ENV['HTTP_FORWARDED'];
|
||||
}
|
||||
else if (@getenv('HTTP_FORWARDED')) {
|
||||
$HTTP_FORWARDED = getenv('HTTP_FORWARDED');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_VIA)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_VIA'])) {
|
||||
$HTTP_VIA = $_SERVER['HTTP_VIA'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_VIA'])) {
|
||||
$HTTP_VIA = $_ENV['HTTP_VIA'];
|
||||
}
|
||||
else if (@getenv('HTTP_VIA')) {
|
||||
$HTTP_VIA = getenv('HTTP_VIA');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_X_COMING_FROM)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_X_COMING_FROM'])) {
|
||||
$HTTP_X_COMING_FROM = $_SERVER['HTTP_X_COMING_FROM'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_X_COMING_FROM'])) {
|
||||
$HTTP_X_COMING_FROM = $_ENV['HTTP_X_COMING_FROM'];
|
||||
}
|
||||
else if (@getenv('HTTP_X_COMING_FROM')) {
|
||||
$HTTP_X_COMING_FROM = getenv('HTTP_X_COMING_FROM');
|
||||
}
|
||||
} // end if
|
||||
if (empty($HTTP_COMING_FROM)) {
|
||||
if (!empty($_SERVER) && isset($_SERVER['HTTP_COMING_FROM'])) {
|
||||
$HTTP_COMING_FROM = $_SERVER['HTTP_COMING_FROM'];
|
||||
}
|
||||
else if (!empty($_ENV) && isset($_ENV['HTTP_COMING_FROM'])) {
|
||||
$HTTP_COMING_FROM = $_ENV['HTTP_COMING_FROM'];
|
||||
}
|
||||
else if (@getenv('HTTP_COMING_FROM')) {
|
||||
$HTTP_COMING_FROM = getenv('HTTP_COMING_FROM');
|
||||
}
|
||||
} // end if
|
||||
|
||||
// Gets the proxy ip sent by the user
|
||||
$proxy_ip = '';
|
||||
if (!empty($HTTP_X_FORWARDED_FOR)) {
|
||||
$proxy_ip = $HTTP_X_FORWARDED_FOR;
|
||||
} else if (!empty($HTTP_X_FORWARDED)) {
|
||||
$proxy_ip = $HTTP_X_FORWARDED;
|
||||
} else if (!empty($HTTP_FORWARDED_FOR)) {
|
||||
$proxy_ip = $HTTP_FORWARDED_FOR;
|
||||
} else if (!empty($HTTP_FORWARDED)) {
|
||||
$proxy_ip = $HTTP_FORWARDED;
|
||||
} else if (!empty($HTTP_VIA)) {
|
||||
$proxy_ip = $HTTP_VIA;
|
||||
} else if (!empty($HTTP_X_COMING_FROM)) {
|
||||
$proxy_ip = $HTTP_X_COMING_FROM;
|
||||
} else if (!empty($HTTP_COMING_FROM)) {
|
||||
$proxy_ip = $HTTP_COMING_FROM;
|
||||
} // end if... else if...
|
||||
// Gets the default ip sent by the user
|
||||
if (!empty($REMOTE_ADDR)) {
|
||||
$direct_ip = $REMOTE_ADDR;
|
||||
}
|
||||
|
||||
// Returns the true IP if it has been found, else FALSE
|
||||
if (empty($proxy_ip)) {
|
||||
// True IP without proxy
|
||||
return $direct_ip;
|
||||
// Gets the proxy ip sent by the user
|
||||
$proxy_ip = '';
|
||||
if (!empty($HTTP_X_FORWARDED_FOR)) {
|
||||
$proxy_ip = $HTTP_X_FORWARDED_FOR;
|
||||
} else if (!empty($HTTP_X_FORWARDED)) {
|
||||
$proxy_ip = $HTTP_X_FORWARDED;
|
||||
} else if (!empty($HTTP_FORWARDED_FOR)) {
|
||||
$proxy_ip = $HTTP_FORWARDED_FOR;
|
||||
} else if (!empty($HTTP_FORWARDED)) {
|
||||
$proxy_ip = $HTTP_FORWARDED;
|
||||
} else if (!empty($HTTP_VIA)) {
|
||||
$proxy_ip = $HTTP_VIA;
|
||||
} else if (!empty($HTTP_X_COMING_FROM)) {
|
||||
$proxy_ip = $HTTP_X_COMING_FROM;
|
||||
} else if (!empty($HTTP_COMING_FROM)) {
|
||||
$proxy_ip = $HTTP_COMING_FROM;
|
||||
} // end if... else if...
|
||||
|
||||
// Returns the true IP if it has been found, else FALSE
|
||||
if (empty($proxy_ip)) {
|
||||
// True IP without proxy
|
||||
return $direct_ip;
|
||||
} else {
|
||||
$is_ip = preg_match('|^([0-9]{1,3}\.){3,3}[0-9]{1,3}|', $proxy_ip, $regs);
|
||||
if ($is_ip && (count($regs) > 0)) {
|
||||
// True IP behind a proxy
|
||||
return $regs[0];
|
||||
} else {
|
||||
$is_ip = preg_match('|^([0-9]{1,3}\.){3,3}[0-9]{1,3}|', $proxy_ip, $regs);
|
||||
if ($is_ip && (count($regs) > 0)) {
|
||||
// True IP behind a proxy
|
||||
return $regs[0];
|
||||
} else {
|
||||
// Can't define IP: there is a proxy but we don't have
|
||||
// information about the true IP
|
||||
return FALSE;
|
||||
}
|
||||
} // end if... else...
|
||||
} // end of the 'PMA_getIp()' function
|
||||
|
||||
|
||||
/**
|
||||
* Based on IP Pattern Matcher
|
||||
* Originally by J.Adams <jna@retina.net>
|
||||
* Found on <http://www.php.net/manual/en/function.ip2long.php>
|
||||
* Modified by Robbat2 <robbat2@users.sourceforge.net>
|
||||
*
|
||||
* Matches:
|
||||
* xxx.xxx.xxx.xxx (exact)
|
||||
* xxx.xxx.xxx.[yyy-zzz] (range)
|
||||
* xxx.xxx.xxx.xxx/nn (CIDR)
|
||||
*
|
||||
* Does not match:
|
||||
* xxx.xxx.xxx.xx[yyy-zzz] (range, partial octets not supported)
|
||||
*
|
||||
* @param string string of IP range to match
|
||||
* @param string string of IP to test against range
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_ipMaskTest($testRange, $ipToTest)
|
||||
{
|
||||
$result = TRUE;
|
||||
|
||||
if (preg_match('|([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/([0-9]+)|', $testRange, $regs)) {
|
||||
// performs a mask match
|
||||
$ipl = ip2long($ipToTest);
|
||||
$rangel = ip2long($regs[1] . '.' . $regs[2] . '.' . $regs[3] . '.' . $regs[4]);
|
||||
|
||||
$maskl = 0;
|
||||
|
||||
for ($i = 0; $i < 31; $i++) {
|
||||
if ($i < $regs[5] - 1) {
|
||||
$maskl = $maskl + pow(2, (30 - $i));
|
||||
} // end if
|
||||
} // end for
|
||||
|
||||
if (($maskl & $rangel) == ($maskl & $ipl)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
// range based
|
||||
$maskocts = explode('.', $testRange);
|
||||
$ipocts = explode('.', $ipToTest);
|
||||
|
||||
// perform a range match
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
if (preg_match('|\[([0-9]+)\-([0-9]+)\]|', $maskocts[$i], $regs)) {
|
||||
if (($ipocts[$i] > $regs[2])
|
||||
|| ($ipocts[$i] < $regs[1])) {
|
||||
$result = FALSE;
|
||||
} // end if
|
||||
} else {
|
||||
if ($maskocts[$i] <> $ipocts[$i]) {
|
||||
$result = FALSE;
|
||||
} // end if
|
||||
} // end if/else
|
||||
} //end for
|
||||
} //end if/else
|
||||
|
||||
return $result;
|
||||
} // end of the "PMA_IPMaskTest()" function
|
||||
|
||||
|
||||
/**
|
||||
* Runs through IP Allow/Deny rules the use of it below for more information
|
||||
*
|
||||
* @param string 'allow' | 'deny' type of rule to match
|
||||
*
|
||||
* @return bool Matched a rule ?
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @see PMA_getIp()
|
||||
*/
|
||||
function PMA_allowDeny($type)
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
// Grabs true IP of the user and returns if it can't be found
|
||||
$remote_ip = PMA_getIp();
|
||||
if (empty($remote_ip)) {
|
||||
// Can't define IP: there is a proxy but we don't have
|
||||
// information about the true IP
|
||||
return FALSE;
|
||||
}
|
||||
} // end if... else...
|
||||
} // end of the 'PMA_getIp()' function
|
||||
|
||||
// copy username
|
||||
$username = $cfg['Server']['user'];
|
||||
|
||||
// copy rule database
|
||||
$rules = $cfg['Server']['AllowDeny']['rules'];
|
||||
/**
|
||||
* Based on IP Pattern Matcher
|
||||
* Originally by J.Adams <jna@retina.net>
|
||||
* Found on <http://www.php.net/manual/en/function.ip2long.php>
|
||||
* Modified by Robbat2 <robbat2@users.sourceforge.net>
|
||||
*
|
||||
* Matches:
|
||||
* xxx.xxx.xxx.xxx (exact)
|
||||
* xxx.xxx.xxx.[yyy-zzz] (range)
|
||||
* xxx.xxx.xxx.xxx/nn (CIDR)
|
||||
*
|
||||
* Does not match:
|
||||
* xxx.xxx.xxx.xx[yyy-zzz] (range, partial octets not supported)
|
||||
*
|
||||
* @param string string of IP range to match
|
||||
* @param string string of IP to test against range
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_ipMaskTest($testRange, $ipToTest)
|
||||
{
|
||||
$result = TRUE;
|
||||
|
||||
// lookup table for some name shortcuts
|
||||
$shortcuts = array(
|
||||
'all' => '0.0.0.0/0',
|
||||
'localhost' => '127.0.0.1/8'
|
||||
);
|
||||
if (preg_match('|([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/([0-9]+)|', $testRange, $regs)) {
|
||||
// performs a mask match
|
||||
$ipl = ip2long($ipToTest);
|
||||
$rangel = ip2long($regs[1] . '.' . $regs[2] . '.' . $regs[3] . '.' . $regs[4]);
|
||||
|
||||
foreach($rules AS $rule) {
|
||||
// extract rule data
|
||||
$rule_data = explode(' ', $rule);
|
||||
$maskl = 0;
|
||||
|
||||
// check for rule type
|
||||
if ($rule_data[0] != $type) {
|
||||
continue;
|
||||
}
|
||||
for ($i = 0; $i < 31; $i++) {
|
||||
if ($i < $regs[5] - 1) {
|
||||
$maskl = $maskl + pow(2, (30 - $i));
|
||||
} // end if
|
||||
} // end for
|
||||
|
||||
// check for username
|
||||
if (($rule_data[1] != '%') //wildcarded first
|
||||
&& ($rule_data[1] != $username)) {
|
||||
continue;
|
||||
}
|
||||
if (($maskl & $rangel) == ($maskl & $ipl)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
// range based
|
||||
$maskocts = explode('.', $testRange);
|
||||
$ipocts = explode('.', $ipToTest);
|
||||
|
||||
// check if the config file has the full string with an extra
|
||||
// 'from' in it and if it does, just discard it
|
||||
if ($rule_data[2] == 'from') {
|
||||
$rule_data[2] = $rule_data[3];
|
||||
}
|
||||
// perform a range match
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
if (preg_match('|\[([0-9]+)\-([0-9]+)\]|', $maskocts[$i], $regs)) {
|
||||
if (($ipocts[$i] > $regs[2])
|
||||
|| ($ipocts[$i] < $regs[1])) {
|
||||
$result = FALSE;
|
||||
} // end if
|
||||
} else {
|
||||
if ($maskocts[$i] <> $ipocts[$i]) {
|
||||
$result = FALSE;
|
||||
} // end if
|
||||
} // end if/else
|
||||
} //end for
|
||||
} //end if/else
|
||||
|
||||
// Handle shortcuts with above array
|
||||
// DON'T use "array_key_exists" as it's only PHP 4.1 and newer.
|
||||
if (isset($shortcuts[$rule_data[2]])) {
|
||||
$rule_data[2] = $shortcuts[$rule_data[2]];
|
||||
}
|
||||
return $result;
|
||||
} // end of the "PMA_IPMaskTest()" function
|
||||
|
||||
// Add code for host lookups here
|
||||
// Excluded for the moment
|
||||
|
||||
// Do the actual matching now
|
||||
if (PMA_ipMaskTest($rule_data[2], $remote_ip)) {
|
||||
return TRUE;
|
||||
}
|
||||
} // end while
|
||||
/**
|
||||
* Runs through IP Allow/Deny rules the use of it below for more information
|
||||
*
|
||||
* @param string 'allow' | 'deny' type of rule to match
|
||||
*
|
||||
* @return bool Matched a rule ?
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @see PMA_getIp()
|
||||
*/
|
||||
function PMA_allowDeny($type)
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
// Grabs true IP of the user and returns if it can't be found
|
||||
$remote_ip = PMA_getIp();
|
||||
if (empty($remote_ip)) {
|
||||
return FALSE;
|
||||
} // end of the "PMA_AllowDeny()" function
|
||||
}
|
||||
|
||||
} // $__PMA_ALLOW_DENY_LIB__
|
||||
?>
|
||||
// copy username
|
||||
$username = $cfg['Server']['user'];
|
||||
|
||||
// copy rule database
|
||||
$rules = $cfg['Server']['AllowDeny']['rules'];
|
||||
|
||||
// lookup table for some name shortcuts
|
||||
$shortcuts = array(
|
||||
'all' => '0.0.0.0/0',
|
||||
'localhost' => '127.0.0.1/8'
|
||||
);
|
||||
|
||||
foreach($rules AS $rule) {
|
||||
// extract rule data
|
||||
$rule_data = explode(' ', $rule);
|
||||
|
||||
// check for rule type
|
||||
if ($rule_data[0] != $type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check for username
|
||||
if (($rule_data[1] != '%') //wildcarded first
|
||||
&& ($rule_data[1] != $username)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check if the config file has the full string with an extra
|
||||
// 'from' in it and if it does, just discard it
|
||||
if ($rule_data[2] == 'from') {
|
||||
$rule_data[2] = $rule_data[3];
|
||||
}
|
||||
|
||||
// Handle shortcuts with above array
|
||||
// DON'T use "array_key_exists" as it's only PHP 4.1 and newer.
|
||||
if (isset($shortcuts[$rule_data[2]])) {
|
||||
$rule_data[2] = $shortcuts[$rule_data[2]];
|
||||
}
|
||||
|
||||
// Add code for host lookups here
|
||||
// Excluded for the moment
|
||||
|
||||
// Do the actual matching now
|
||||
if (PMA_ipMaskTest($rule_data[2], $remote_ip)) {
|
||||
return TRUE;
|
||||
}
|
||||
} // end while
|
||||
|
||||
return FALSE;
|
||||
} // end of the "PMA_AllowDeny()" function
|
||||
|
||||
?>
|
||||
|
@@ -12,141 +12,138 @@
|
||||
*
|
||||
* 2002/2/22 - by Yukihiro Kawada <kawada@den.fujifilm.co.jp>
|
||||
*/
|
||||
if (!defined('PMA_ENCODING_LIB_INCLUDED')) {
|
||||
define('PMA_ENCODING_LIB_INCLUDED', 1);
|
||||
|
||||
/**
|
||||
* Gets the php internal encoding codes and sets the available encoding
|
||||
* codes list
|
||||
* 2002/1/4 by Y.Kawada
|
||||
*
|
||||
* @global string the current encoding code
|
||||
* @global string the available encoding codes list
|
||||
*
|
||||
* @return boolean always true
|
||||
*/
|
||||
function PMA_internal_enc_check() {
|
||||
global $internal_enc, $enc_list;
|
||||
/**
|
||||
* Gets the php internal encoding codes and sets the available encoding
|
||||
* codes list
|
||||
* 2002/1/4 by Y.Kawada
|
||||
*
|
||||
* @global string the current encoding code
|
||||
* @global string the available encoding codes list
|
||||
*
|
||||
* @return boolean always true
|
||||
*/
|
||||
function PMA_internal_enc_check() {
|
||||
global $internal_enc, $enc_list;
|
||||
|
||||
$internal_enc = mb_internal_encoding();
|
||||
if ($internal_enc == 'EUC-JP') {
|
||||
$enc_list = 'ASCII,EUC-JP,SJIS,JIS';
|
||||
} else {
|
||||
$enc_list = 'ASCII,SJIS,EUC-JP,JIS';
|
||||
}
|
||||
$internal_enc = mb_internal_encoding();
|
||||
if ($internal_enc == 'EUC-JP') {
|
||||
$enc_list = 'ASCII,EUC-JP,SJIS,JIS';
|
||||
} else {
|
||||
$enc_list = 'ASCII,SJIS,EUC-JP,JIS';
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} // end of the 'PMA_internal_enc_check' function
|
||||
return TRUE;
|
||||
} // end of the 'PMA_internal_enc_check' function
|
||||
|
||||
|
||||
/**
|
||||
* Reverses SJIS & EUC-JP position in the encoding codes list
|
||||
* 2002/1/4 by Y.Kawada
|
||||
*
|
||||
* @global string the available encoding codes list
|
||||
*
|
||||
* @return boolean always true
|
||||
*/
|
||||
function PMA_change_enc_order() {
|
||||
global $enc_list;
|
||||
/**
|
||||
* Reverses SJIS & EUC-JP position in the encoding codes list
|
||||
* 2002/1/4 by Y.Kawada
|
||||
*
|
||||
* @global string the available encoding codes list
|
||||
*
|
||||
* @return boolean always true
|
||||
*/
|
||||
function PMA_change_enc_order() {
|
||||
global $enc_list;
|
||||
|
||||
$p = explode(',', $enc_list);
|
||||
if ($p[1] == 'EUC-JP') {
|
||||
$enc_list = 'ASCII,SJIS,EUC-JP,JIS';
|
||||
} else {
|
||||
$enc_list = 'ASCII,EUC-JP,SJIS,JIS';
|
||||
}
|
||||
$p = explode(',', $enc_list);
|
||||
if ($p[1] == 'EUC-JP') {
|
||||
$enc_list = 'ASCII,SJIS,EUC-JP,JIS';
|
||||
} else {
|
||||
$enc_list = 'ASCII,EUC-JP,SJIS,JIS';
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} // end of the 'PMA_change_enc_order' function
|
||||
return TRUE;
|
||||
} // end of the 'PMA_change_enc_order' function
|
||||
|
||||
|
||||
/**
|
||||
* Kanji string encoding convert
|
||||
* 2002/1/4 by Y.Kawada
|
||||
*
|
||||
* @param string the string to convert
|
||||
* @param string the destinasion encoding code
|
||||
* @param string set 'kana' convert to JIS-X208-kana
|
||||
*
|
||||
* @global string the available encoding codes list
|
||||
*
|
||||
* @return string the converted string
|
||||
*/
|
||||
function PMA_kanji_str_conv($str, $enc, $kana) {
|
||||
global $enc_list;
|
||||
/**
|
||||
* Kanji string encoding convert
|
||||
* 2002/1/4 by Y.Kawada
|
||||
*
|
||||
* @param string the string to convert
|
||||
* @param string the destinasion encoding code
|
||||
* @param string set 'kana' convert to JIS-X208-kana
|
||||
*
|
||||
* @global string the available encoding codes list
|
||||
*
|
||||
* @return string the converted string
|
||||
*/
|
||||
function PMA_kanji_str_conv($str, $enc, $kana) {
|
||||
global $enc_list;
|
||||
|
||||
if ($enc == '' && $kana == '') {
|
||||
return $str;
|
||||
}
|
||||
$nw = mb_detect_encoding($str, $enc_list);
|
||||
if ($enc == '' && $kana == '') {
|
||||
return $str;
|
||||
}
|
||||
$nw = mb_detect_encoding($str, $enc_list);
|
||||
|
||||
if ($kana == 'kana') {
|
||||
$dist = mb_convert_kana($str, 'KV', $nw);
|
||||
$str = $dist;
|
||||
}
|
||||
if ($nw != $enc && $enc != '') {
|
||||
$dist = mb_convert_encoding($str, $enc, $nw);
|
||||
} else {
|
||||
$dist = $str;
|
||||
}
|
||||
return $dist;
|
||||
} // end of the 'PMA_kanji_str_conv' function
|
||||
if ($kana == 'kana') {
|
||||
$dist = mb_convert_kana($str, 'KV', $nw);
|
||||
$str = $dist;
|
||||
}
|
||||
if ($nw != $enc && $enc != '') {
|
||||
$dist = mb_convert_encoding($str, $enc, $nw);
|
||||
} else {
|
||||
$dist = $str;
|
||||
}
|
||||
return $dist;
|
||||
} // end of the 'PMA_kanji_str_conv' function
|
||||
|
||||
|
||||
/**
|
||||
* Kanji file encoding convert
|
||||
* 2002/1/4 by Y.Kawada
|
||||
*
|
||||
* @param string the name of the file to convert
|
||||
* @param string the destinasion encoding code
|
||||
* @param string set 'kana' convert to JIS-X208-kana
|
||||
*
|
||||
* @return string the name of the converted file
|
||||
*/
|
||||
function PMA_kanji_file_conv($file, $enc, $kana) {
|
||||
if ($enc == '' && $kana == '') {
|
||||
return $file;
|
||||
}
|
||||
/**
|
||||
* Kanji file encoding convert
|
||||
* 2002/1/4 by Y.Kawada
|
||||
*
|
||||
* @param string the name of the file to convert
|
||||
* @param string the destinasion encoding code
|
||||
* @param string set 'kana' convert to JIS-X208-kana
|
||||
*
|
||||
* @return string the name of the converted file
|
||||
*/
|
||||
function PMA_kanji_file_conv($file, $enc, $kana) {
|
||||
if ($enc == '' && $kana == '') {
|
||||
return $file;
|
||||
}
|
||||
|
||||
$tmpfname = tempnam('', $enc);
|
||||
$fpd = fopen($tmpfname, 'wb');
|
||||
$fps = fopen($file, 'r');
|
||||
PMA_change_enc_order();
|
||||
while (!feof($fps)) {
|
||||
$line = fgets($fps, 4096);
|
||||
$dist = PMA_kanji_str_conv($line, $enc, $kana);
|
||||
fputs($fpd, $dist);
|
||||
} // end while
|
||||
PMA_change_enc_order();
|
||||
fclose($fps);
|
||||
fclose($fpd);
|
||||
unlink($file);
|
||||
$tmpfname = tempnam('', $enc);
|
||||
$fpd = fopen($tmpfname, 'wb');
|
||||
$fps = fopen($file, 'r');
|
||||
PMA_change_enc_order();
|
||||
while (!feof($fps)) {
|
||||
$line = fgets($fps, 4096);
|
||||
$dist = PMA_kanji_str_conv($line, $enc, $kana);
|
||||
fputs($fpd, $dist);
|
||||
} // end while
|
||||
PMA_change_enc_order();
|
||||
fclose($fps);
|
||||
fclose($fpd);
|
||||
unlink($file);
|
||||
|
||||
return $tmpfname;
|
||||
} // end of the 'PMA_kanji_file_conv' function
|
||||
return $tmpfname;
|
||||
} // end of the 'PMA_kanji_file_conv' function
|
||||
|
||||
|
||||
/**
|
||||
* Defines radio form fields to switch between encoding modes
|
||||
* 2002/1/4 by Y.Kawada
|
||||
*
|
||||
* @param string spaces character to prepend the output with
|
||||
*
|
||||
* @return string xhtml code for the radio controls
|
||||
*/
|
||||
function PMA_set_enc_form($spaces) {
|
||||
return "\n"
|
||||
. $spaces . '<input type="radio" name="knjenc" value="" checked="checked" />non' . "\n"
|
||||
. $spaces . '<input type="radio" name="knjenc" value="EUC-JP" />EUC' . "\n"
|
||||
. $spaces . '<input type="radio" name="knjenc" value="SJIS" />SJIS' . "\n"
|
||||
. $spaces . ' ' . $GLOBALS['strEncto'] . '<br />' . "\n"
|
||||
. $spaces . '<input type="checkbox" name="xkana" value="kana" />' . "\n"
|
||||
. $spaces . ' ' . $GLOBALS['strXkana'] . '<br />' . "\n";
|
||||
} // end of the 'PMA_set_enc_form' function
|
||||
/**
|
||||
* Defines radio form fields to switch between encoding modes
|
||||
* 2002/1/4 by Y.Kawada
|
||||
*
|
||||
* @param string spaces character to prepend the output with
|
||||
*
|
||||
* @return string xhtml code for the radio controls
|
||||
*/
|
||||
function PMA_set_enc_form($spaces) {
|
||||
return "\n"
|
||||
. $spaces . '<input type="radio" name="knjenc" value="" checked="checked" />non' . "\n"
|
||||
. $spaces . '<input type="radio" name="knjenc" value="EUC-JP" />EUC' . "\n"
|
||||
. $spaces . '<input type="radio" name="knjenc" value="SJIS" />SJIS' . "\n"
|
||||
. $spaces . ' ' . $GLOBALS['strEncto'] . '<br />' . "\n"
|
||||
. $spaces . '<input type="checkbox" name="xkana" value="kana" />' . "\n"
|
||||
. $spaces . ' ' . $GLOBALS['strXkana'] . '<br />' . "\n";
|
||||
} // end of the 'PMA_set_enc_form' function
|
||||
|
||||
|
||||
PMA_internal_enc_check();
|
||||
PMA_internal_enc_check();
|
||||
|
||||
} // $__PMA_ENCODING_LIB_INCLUDED
|
||||
?>
|
||||
?>
|
||||
|
@@ -2,8 +2,7 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_MYSQL_CHARSETS_LIB_INCLUDED')){
|
||||
define('PMA_MYSQL_CHARSETS_LIB_INCLUDED', 1);
|
||||
if (PMA_MYSQL_INT_VERSION >= 40100){
|
||||
|
||||
$res = PMA_mysql_query('SHOW CHARACTER SET;', $userlink)
|
||||
or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW CHARACTER SET;');
|
||||
@@ -15,8 +14,7 @@ if (!defined('PMA_MYSQL_CHARSETS_LIB_INCLUDED')){
|
||||
$mysql_charsets_descriptions[$row['Charset']] = $row['Description'];
|
||||
}
|
||||
@mysql_free_result($res);
|
||||
unset($res);
|
||||
unset($row);
|
||||
unset($res, $row);
|
||||
|
||||
$res = PMA_mysql_query('SHOW COLLATION;', $userlink)
|
||||
or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW COLLATION;');
|
||||
@@ -44,8 +42,7 @@ if (!defined('PMA_MYSQL_CHARSETS_LIB_INCLUDED')){
|
||||
}
|
||||
|
||||
@mysql_free_result($res);
|
||||
unset($res);
|
||||
unset($row);
|
||||
unset($res, $row);
|
||||
|
||||
function PMA_getCollationDescr($collation) {
|
||||
if ($collation == 'binary') {
|
||||
@@ -205,6 +202,6 @@ if (!defined('PMA_MYSQL_CHARSETS_LIB_INCLUDED')){
|
||||
return $descr;
|
||||
}
|
||||
|
||||
} // $__PMA_MYSQL_CHARSETS_LIB__
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -9,116 +9,112 @@
|
||||
*/
|
||||
|
||||
|
||||
function PMA_mysql_dbname($result, $row, $field = FALSE) {
|
||||
if ($field != FALSE) {
|
||||
return PMA_convert_display_charset(mysql_dbname($result, $row, $field));
|
||||
} else {
|
||||
return PMA_convert_display_charset(mysql_dbname($result, $row));
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined('PMA_MYSQL_WRAPPERS_LIB_INCLUDED')){
|
||||
define('PMA_MYSQL_WRAPPERS_LIB_INCLUDED', 1);
|
||||
|
||||
function PMA_mysql_dbname($result, $row, $field = FALSE) {
|
||||
if ($field != FALSE) {
|
||||
return PMA_convert_display_charset(mysql_dbname($result, $row, $field));
|
||||
} else {
|
||||
return PMA_convert_display_charset(mysql_dbname($result, $row));
|
||||
function PMA_mysql_error($id = FALSE) {
|
||||
if ($id != FALSE) {
|
||||
if (mysql_errno($id) != 0) {
|
||||
return PMA_convert_display_charset('#' . mysql_errno($id) . ' - ' . mysql_error($id));
|
||||
}
|
||||
} elseif (mysql_errno() != 0) {
|
||||
return PMA_convert_display_charset('#' . mysql_errno() . ' - ' . mysql_error());
|
||||
}
|
||||
|
||||
function PMA_mysql_error($id = FALSE) {
|
||||
if ($id != FALSE) {
|
||||
if (mysql_errno($id) != 0) {
|
||||
return PMA_convert_display_charset('#' . mysql_errno($id) . ' - ' . mysql_error($id));
|
||||
}
|
||||
} elseif (mysql_errno() != 0) {
|
||||
return PMA_convert_display_charset('#' . mysql_errno() . ' - ' . mysql_error());
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
function PMA_mysql_fetch_array($result, $type = FALSE) {
|
||||
global $cfg, $allow_recoding, $charset, $convcharset;
|
||||
|
||||
if ($type != FALSE) {
|
||||
$data = mysql_fetch_array($result, $type);
|
||||
} else {
|
||||
$data = mysql_fetch_array($result);
|
||||
}
|
||||
|
||||
function PMA_mysql_fetch_array($result, $type = FALSE) {
|
||||
global $cfg, $allow_recoding, $charset, $convcharset;
|
||||
|
||||
if ($type != FALSE) {
|
||||
$data = mysql_fetch_array($result, $type);
|
||||
} else {
|
||||
$data = mysql_fetch_array($result);
|
||||
}
|
||||
if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)) {
|
||||
/* No recoding -> return data as we got them */
|
||||
return $data;
|
||||
} else {
|
||||
$ret = array();
|
||||
$num = mysql_num_fields($result);
|
||||
$i = 0;
|
||||
for($i = 0; $i < $num; $i++) {
|
||||
$meta = mysql_fetch_field($result);
|
||||
$name = mysql_field_name($result, $i);
|
||||
if (!$meta) {
|
||||
/* No meta information available -> we guess that it should be converted */
|
||||
if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)) {
|
||||
/* No recoding -> return data as we got them */
|
||||
return $data;
|
||||
} else {
|
||||
$ret = array();
|
||||
$num = mysql_num_fields($result);
|
||||
$i = 0;
|
||||
for($i = 0; $i < $num; $i++) {
|
||||
$meta = mysql_fetch_field($result);
|
||||
$name = mysql_field_name($result, $i);
|
||||
if (!$meta) {
|
||||
/* No meta information available -> we guess that it should be converted */
|
||||
if (isset($data[$i])) $ret[$i] = PMA_convert_display_charset($data[$i]);
|
||||
if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = PMA_convert_display_charset($data[$name]);
|
||||
} else {
|
||||
/* Meta information available -> check type of field and convert it according to the type */
|
||||
if ($meta->blob || stristr($meta->type, 'BINARY')) {
|
||||
if (isset($data[$i])) $ret[$i] = $data[$i];
|
||||
if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = $data[$name];
|
||||
} else {
|
||||
if (isset($data[$i])) $ret[$i] = PMA_convert_display_charset($data[$i]);
|
||||
if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = PMA_convert_display_charset($data[$name]);
|
||||
} else {
|
||||
/* Meta information available -> check type of field and convert it according to the type */
|
||||
if ($meta->blob || stristr($meta->type, 'BINARY')) {
|
||||
if (isset($data[$i])) $ret[$i] = $data[$i];
|
||||
if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = $data[$name];
|
||||
} else {
|
||||
if (isset($data[$i])) $ret[$i] = PMA_convert_display_charset($data[$i]);
|
||||
if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = PMA_convert_display_charset($data[$name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_mysql_fetch_field($result , $field_offset = FALSE) {
|
||||
if ($field_offset != FALSE) {
|
||||
return PMA_convert_display_charset(mysql_fetch_field($result, $field_offset));
|
||||
function PMA_mysql_fetch_field($result , $field_offset = FALSE) {
|
||||
if ($field_offset != FALSE) {
|
||||
return PMA_convert_display_charset(mysql_fetch_field($result, $field_offset));
|
||||
} else {
|
||||
return PMA_convert_display_charset(mysql_fetch_field($result));
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_mysql_fetch_row($result) {
|
||||
/* nijel: This is not optimal, but keeps us from duplicating code, if
|
||||
* speed really matters, duplicate here code from PMA_mysql_fetch_array
|
||||
* with removing rows working with associative array. */
|
||||
return PMA_mysql_fetch_array($result, MYSQL_NUM);
|
||||
}
|
||||
|
||||
function PMA_mysql_field_flags($result, $field_offset) {
|
||||
return PMA_convert_display_charset(mysql_field_flags($result, $field_offset));
|
||||
}
|
||||
|
||||
function PMA_mysql_field_name($result, $field_index) {
|
||||
return PMA_convert_display_charset(mysql_field_name($result, $field_index));
|
||||
}
|
||||
|
||||
function PMA_mysql_field_type($result, $field_index) {
|
||||
return PMA_convert_display_charset(mysql_field_type($result, $field_index));
|
||||
}
|
||||
|
||||
function PMA_mysql_query($query, $link_identifier = FALSE, $result_mode = FALSE) {
|
||||
if ($link_identifier != FALSE) {
|
||||
if ($result_mode != FALSE) {
|
||||
return mysql_query(PMA_convert_charset($query), $link_identifier, $result_mode);
|
||||
} else {
|
||||
return PMA_convert_display_charset(mysql_fetch_field($result));
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_mysql_fetch_row($result) {
|
||||
/* nijel: This is not optimal, but keeps us from duplicating code, if
|
||||
* speed really matters, duplicate here code from PMA_mysql_fetch_array
|
||||
* with removing rows working with associative array. */
|
||||
return PMA_mysql_fetch_array($result, MYSQL_NUM);
|
||||
}
|
||||
|
||||
function PMA_mysql_field_flags($result, $field_offset) {
|
||||
return PMA_convert_display_charset(mysql_field_flags($result, $field_offset));
|
||||
}
|
||||
|
||||
function PMA_mysql_field_name($result, $field_index) {
|
||||
return PMA_convert_display_charset(mysql_field_name($result, $field_index));
|
||||
}
|
||||
|
||||
function PMA_mysql_field_type($result, $field_index) {
|
||||
return PMA_convert_display_charset(mysql_field_type($result, $field_index));
|
||||
}
|
||||
|
||||
function PMA_mysql_query($query, $link_identifier = FALSE, $result_mode = FALSE) {
|
||||
if ($link_identifier != FALSE) {
|
||||
if ($result_mode != FALSE) {
|
||||
return mysql_query(PMA_convert_charset($query), $link_identifier, $result_mode);
|
||||
} else {
|
||||
return mysql_query(PMA_convert_charset($query), $link_identifier);
|
||||
}
|
||||
} else {
|
||||
return mysql_query(PMA_convert_charset($query));
|
||||
return mysql_query(PMA_convert_charset($query), $link_identifier);
|
||||
}
|
||||
} else {
|
||||
return mysql_query(PMA_convert_charset($query));
|
||||
}
|
||||
}
|
||||
|
||||
// mysql_list_tables() is deprecated, also we got report about weird results
|
||||
// under some circumstances
|
||||
|
||||
function PMA_mysql_list_tables($database_name, $link_identifier = FALSE) {
|
||||
if ($link_identifier != FALSE) {
|
||||
return PMA_mysql_query('SHOW TABLES FROM ' . PMA_backquote(PMA_convert_charset($database_name)), $link_identifier);
|
||||
} else {
|
||||
return PMA_mysql_query('SHOW TABLES FROM ' . PMA_backquote(PMA_convert_charset($database_name)));
|
||||
}
|
||||
function PMA_mysql_list_tables($database_name, $link_identifier = FALSE) {
|
||||
if ($link_identifier != FALSE) {
|
||||
return PMA_mysql_query('SHOW TABLES FROM ' . PMA_backquote(PMA_convert_charset($database_name)), $link_identifier);
|
||||
} else {
|
||||
return PMA_mysql_query('SHOW TABLES FROM ' . PMA_backquote(PMA_convert_charset($database_name)));
|
||||
}
|
||||
}
|
||||
|
||||
// mysql_list_fields() is deprecated, also we got report about weird results
|
||||
// under some circumstances
|
||||
@@ -126,53 +122,51 @@ if (!defined('PMA_MYSQL_WRAPPERS_LIB_INCLUDED')){
|
||||
// using SELECT * FROM db.table
|
||||
// lets us use functions like mysql_field_name() on the result set
|
||||
|
||||
function PMA_mysql_list_fields_alternate($database_name, $table_name, $link_identifier = FALSE) {
|
||||
if ($link_identifier != FALSE) {
|
||||
$result = PMA_mysql_query('SHOW FIELDS FROM '
|
||||
. PMA_backquote(PMA_convert_charset($database_name)) . '.'
|
||||
. PMA_backquote(PMA_convert_charset($table_name)), $link_identifier);
|
||||
} else {
|
||||
$result = PMA_mysql_query('SHOW FIELDS FROM '
|
||||
. PMA_backquote(PMA_convert_charset($database_name)) . '.'
|
||||
. PMA_backquote(PMA_convert_charset($table_name)));
|
||||
}
|
||||
|
||||
$fields = array();
|
||||
while ($row = PMA_mysql_fetch_array($result)) {
|
||||
$fields[] = $row;
|
||||
}
|
||||
|
||||
return $fields;
|
||||
function PMA_mysql_list_fields_alternate($database_name, $table_name, $link_identifier = FALSE) {
|
||||
if ($link_identifier != FALSE) {
|
||||
$result = PMA_mysql_query('SHOW FIELDS FROM '
|
||||
. PMA_backquote(PMA_convert_charset($database_name)) . '.'
|
||||
. PMA_backquote(PMA_convert_charset($table_name)), $link_identifier);
|
||||
} else {
|
||||
$result = PMA_mysql_query('SHOW FIELDS FROM '
|
||||
. PMA_backquote(PMA_convert_charset($database_name)) . '.'
|
||||
. PMA_backquote(PMA_convert_charset($table_name)));
|
||||
}
|
||||
|
||||
function PMA_mysql_list_fields($database_name, $table_name, $link_identifier = FALSE) {
|
||||
if ($link_identifier != FALSE) {
|
||||
return mysql_list_fields(PMA_convert_charset($database_name), PMA_convert_charset($table_name), $link_identifier);
|
||||
} else {
|
||||
return mysql_list_fields(PMA_convert_charset($database_name), PMA_convert_charset($table_name));
|
||||
}
|
||||
$fields = array();
|
||||
while ($row = PMA_mysql_fetch_array($result)) {
|
||||
$fields[] = $row;
|
||||
}
|
||||
|
||||
function PMA_mysql_result($result, $row, $field = FALSE) {
|
||||
if ($field != FALSE) {
|
||||
return PMA_convert_display_charset(mysql_result($result, $row, PMA_convert_charset($field)));
|
||||
} else {
|
||||
return PMA_convert_display_charset(mysql_result($result, $row));
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
function PMA_mysql_list_fields($database_name, $table_name, $link_identifier = FALSE) {
|
||||
if ($link_identifier != FALSE) {
|
||||
return mysql_list_fields(PMA_convert_charset($database_name), PMA_convert_charset($table_name), $link_identifier);
|
||||
} else {
|
||||
return mysql_list_fields(PMA_convert_charset($database_name), PMA_convert_charset($table_name));
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_mysql_select_db($database_name, $link_identifier = FALSE) {
|
||||
if ($link_identifier != FALSE) {
|
||||
return mysql_select_db(PMA_convert_charset($database_name), $link_identifier);
|
||||
} else {
|
||||
return mysql_select_db(PMA_convert_charset($database_name));
|
||||
}
|
||||
function PMA_mysql_result($result, $row, $field = FALSE) {
|
||||
if ($field != FALSE) {
|
||||
return PMA_convert_display_charset(mysql_result($result, $row, PMA_convert_charset($field)));
|
||||
} else {
|
||||
return PMA_convert_display_charset(mysql_result($result, $row));
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_mysql_tablename($result, $i) {
|
||||
return PMA_convert_display_charset(mysql_tablename($result, $i));
|
||||
function PMA_mysql_select_db($database_name, $link_identifier = FALSE) {
|
||||
if ($link_identifier != FALSE) {
|
||||
return mysql_select_db(PMA_convert_charset($database_name), $link_identifier);
|
||||
} else {
|
||||
return mysql_select_db(PMA_convert_charset($database_name));
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_mysql_tablename($result, $i) {
|
||||
return PMA_convert_display_charset(mysql_tablename($result, $i));
|
||||
}
|
||||
|
||||
} // PMA_MYSQL_WRAPPERS_LIB_INCLUDED
|
||||
?>
|
||||
?>
|
||||
|
@@ -3,131 +3,128 @@
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
|
||||
if (!defined('PMA_OB_LIB_INCLUDED')) {
|
||||
define('PMA_OB_LIB_INCLUDED', 1);
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
# 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.
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @return integer the output buffer mode
|
||||
*/
|
||||
function PMA_outBufferModeGet()
|
||||
{
|
||||
if (@function_exists('ob_start')) {
|
||||
$mode = 1;
|
||||
} else {
|
||||
$mode = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @return integer the output buffer mode
|
||||
*/
|
||||
function PMA_outBufferModeGet()
|
||||
{
|
||||
if (@function_exists('ob_start')) {
|
||||
$mode = 1;
|
||||
} else {
|
||||
// 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.
|
||||
//
|
||||
// (Patch by Garth Gillespie, modified by Marc Delisle)
|
||||
if (@ini_get('output_handler') == 'ob_gzhandler') {
|
||||
$mode = 0;
|
||||
}
|
||||
if (@get_cfg_var('output_handler') == 'ob_gzhandler') {
|
||||
$mode = 0;
|
||||
}
|
||||
// End patch
|
||||
|
||||
// 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.
|
||||
//
|
||||
if (@function_exists('ob_get_level')) {
|
||||
if (ob_get_level() > 0) {
|
||||
$mode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
//
|
||||
// (Patch by Garth Gillespie, modified by Marc Delisle)
|
||||
if (@ini_get('output_handler') == 'ob_gzhandler') {
|
||||
$mode = 0;
|
||||
}
|
||||
if (@get_cfg_var('output_handler') == 'ob_gzhandler') {
|
||||
$mode = 0;
|
||||
}
|
||||
// End patch
|
||||
// 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.
|
||||
|
||||
// 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.
|
||||
//
|
||||
if (@function_exists('ob_get_level')) {
|
||||
if (ob_get_level() > 0) {
|
||||
$mode = 0;
|
||||
}
|
||||
}
|
||||
header('X-ob_mode: ' . $mode);
|
||||
|
||||
// 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.
|
||||
|
||||
header('X-ob_mode: ' . $mode);
|
||||
|
||||
return $mode;
|
||||
} // end of the 'PMA_outBufferModeGet()' function
|
||||
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.
|
||||
*
|
||||
* @param integer the output buffer mode
|
||||
*
|
||||
* @return boolean whether output buffering is enabled or not
|
||||
*/
|
||||
function PMA_outBufferPre($mode)
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param integer the output buffer mode
|
||||
*
|
||||
* @return boolean whether output buffering is enabled or not
|
||||
*/
|
||||
function PMA_outBufferPre($mode)
|
||||
{
|
||||
switch($mode)
|
||||
{
|
||||
switch($mode)
|
||||
{
|
||||
case 1:
|
||||
ob_start('ob_gzhandler');
|
||||
$retval = TRUE;
|
||||
break;
|
||||
case 1:
|
||||
ob_start('ob_gzhandler');
|
||||
$retval = TRUE;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
$retval = FALSE;
|
||||
break;
|
||||
case 0:
|
||||
$retval = FALSE;
|
||||
break;
|
||||
|
||||
// loic1: php3 fix
|
||||
default:
|
||||
$retval = FALSE;
|
||||
break;
|
||||
} // end switch
|
||||
// loic1: php3 fix
|
||||
default:
|
||||
$retval = FALSE;
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
return $retval;
|
||||
} // end of the 'PMA_outBufferPre()' function
|
||||
return $retval;
|
||||
} // 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.
|
||||
*
|
||||
* @param integer the output buffer mode
|
||||
*
|
||||
* @return boolean whether data has been send from the buffer or not
|
||||
*/
|
||||
function PMA_outBufferPost($mode)
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param integer the output buffer mode
|
||||
*
|
||||
* @return boolean whether data has been send from the buffer or not
|
||||
*/
|
||||
function PMA_outBufferPost($mode)
|
||||
{
|
||||
switch($mode)
|
||||
{
|
||||
switch($mode)
|
||||
{
|
||||
case 1:
|
||||
# This output buffer doesn't need a footer.
|
||||
$retval = TRUE;
|
||||
break;
|
||||
case 1:
|
||||
# This output buffer doesn't need a footer.
|
||||
$retval = TRUE;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
$retval = FALSE;
|
||||
break;
|
||||
case 0:
|
||||
$retval = FALSE;
|
||||
break;
|
||||
|
||||
// loic1: php3 fix
|
||||
default:
|
||||
$retval = FALSE;
|
||||
break;
|
||||
} // end switch
|
||||
// loic1: php3 fix
|
||||
default:
|
||||
$retval = FALSE;
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
return $retval;
|
||||
} // end of the 'PMA_outBufferPost()' function
|
||||
return $retval;
|
||||
} // end of the 'PMA_outBufferPost()' function
|
||||
|
||||
} // $__PMA_OB_LIB__
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -2,214 +2,210 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_READ_DUMP_INCLUDED')) {
|
||||
define('PMA_READ_DUMP_INCLUDED', 1);
|
||||
/**
|
||||
* Removes comment lines and splits up large sql files into individual queries
|
||||
*
|
||||
* Last revision: September 23, 2001 - gandon
|
||||
*
|
||||
* @param array the splitted sql commands
|
||||
* @param string the sql commands
|
||||
* @param integer the MySQL release number (because certains php3 versions
|
||||
* can't get the value of a constant from within a function)
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_splitSqlFile(&$ret, $sql, $release)
|
||||
{
|
||||
$sql = trim($sql);
|
||||
$sql_len = strlen($sql);
|
||||
$char = '';
|
||||
$string_start = '';
|
||||
$in_string = FALSE;
|
||||
$time0 = time();
|
||||
|
||||
/**
|
||||
* Removes comment lines and splits up large sql files into individual queries
|
||||
*
|
||||
* Last revision: September 23, 2001 - gandon
|
||||
*
|
||||
* @param array the splitted sql commands
|
||||
* @param string the sql commands
|
||||
* @param integer the MySQL release number (because certains php3 versions
|
||||
* can't get the value of a constant from within a function)
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_splitSqlFile(&$ret, $sql, $release)
|
||||
{
|
||||
$sql = trim($sql);
|
||||
$sql_len = strlen($sql);
|
||||
$char = '';
|
||||
$string_start = '';
|
||||
$in_string = FALSE;
|
||||
$time0 = time();
|
||||
for ($i = 0; $i < $sql_len; ++$i) {
|
||||
$char = $sql[$i];
|
||||
|
||||
for ($i = 0; $i < $sql_len; ++$i) {
|
||||
$char = $sql[$i];
|
||||
|
||||
// We are in a string, check for not escaped end of strings except for
|
||||
// backquotes that can't be escaped
|
||||
if ($in_string) {
|
||||
for (;;) {
|
||||
$i = strpos($sql, $string_start, $i);
|
||||
// No end of string found -> add the current substring to the
|
||||
// returned array
|
||||
if (!$i) {
|
||||
$ret[] = $sql;
|
||||
return TRUE;
|
||||
}
|
||||
// Backquotes or no backslashes before quotes: it's indeed the
|
||||
// end of the string -> exit the loop
|
||||
else if ($string_start == '`' || $sql[$i-1] != '\\') {
|
||||
$string_start = '';
|
||||
$in_string = FALSE;
|
||||
break;
|
||||
}
|
||||
// one or more Backslashes before the presumed end of string...
|
||||
else {
|
||||
// ... first checks for escaped backslashes
|
||||
$j = 2;
|
||||
$escaped_backslash = FALSE;
|
||||
while ($i-$j > 0 && $sql[$i-$j] == '\\') {
|
||||
$escaped_backslash = !$escaped_backslash;
|
||||
$j++;
|
||||
}
|
||||
// ... if escaped backslashes: it's really the end of the
|
||||
// string -> exit the loop
|
||||
if ($escaped_backslash) {
|
||||
$string_start = '';
|
||||
$in_string = FALSE;
|
||||
break;
|
||||
}
|
||||
// ... else loop
|
||||
else {
|
||||
$i++;
|
||||
}
|
||||
} // end if...elseif...else
|
||||
} // end for
|
||||
} // end if (in string)
|
||||
|
||||
// We are not in a string, first check for delimiter...
|
||||
else if ($char == ';') {
|
||||
// if delimiter found, add the parsed part to the returned array
|
||||
$ret[] = substr($sql, 0, $i);
|
||||
$sql = ltrim(substr($sql, min($i + 1, $sql_len)));
|
||||
$sql_len = strlen($sql);
|
||||
if ($sql_len) {
|
||||
$i = -1;
|
||||
} else {
|
||||
// The submited statement(s) end(s) here
|
||||
// We are in a string, check for not escaped end of strings except for
|
||||
// backquotes that can't be escaped
|
||||
if ($in_string) {
|
||||
for (;;) {
|
||||
$i = strpos($sql, $string_start, $i);
|
||||
// No end of string found -> add the current substring to the
|
||||
// returned array
|
||||
if (!$i) {
|
||||
$ret[] = $sql;
|
||||
return TRUE;
|
||||
}
|
||||
} // end else if (is delimiter)
|
||||
|
||||
// ... then check for start of a string,...
|
||||
else if (($char == '"') || ($char == '\'') || ($char == '`')) {
|
||||
$in_string = TRUE;
|
||||
$string_start = $char;
|
||||
} // end else if (is start of string)
|
||||
|
||||
// ... for start of a comment (and remove this comment if found)...
|
||||
else if ($char == '#'
|
||||
|| ($char == ' ' && $i > 1 && $sql[$i-2] . $sql[$i-1] == '--')) {
|
||||
// starting position of the comment depends on the comment type
|
||||
$start_of_comment = (($sql[$i] == '#') ? $i : $i-2);
|
||||
// if no "\n" exits in the remaining string, checks for "\r"
|
||||
// (Mac eol style)
|
||||
$end_of_comment = (strpos(' ' . $sql, "\012", $i+2))
|
||||
? strpos(' ' . $sql, "\012", $i+2)
|
||||
: strpos(' ' . $sql, "\015", $i+2);
|
||||
if (!$end_of_comment) {
|
||||
// no eol found after '#', add the parsed part to the returned
|
||||
// array if required and exit
|
||||
if ($start_of_comment > 0) {
|
||||
$ret[] = trim(substr($sql, 0, $start_of_comment));
|
||||
// Backquotes or no backslashes before quotes: it's indeed the
|
||||
// end of the string -> exit the loop
|
||||
else if ($string_start == '`' || $sql[$i-1] != '\\') {
|
||||
$string_start = '';
|
||||
$in_string = FALSE;
|
||||
break;
|
||||
}
|
||||
// one or more Backslashes before the presumed end of string...
|
||||
else {
|
||||
// ... first checks for escaped backslashes
|
||||
$j = 2;
|
||||
$escaped_backslash = FALSE;
|
||||
while ($i-$j > 0 && $sql[$i-$j] == '\\') {
|
||||
$escaped_backslash = !$escaped_backslash;
|
||||
$j++;
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
$sql = substr($sql, 0, $start_of_comment)
|
||||
. ltrim(substr($sql, $end_of_comment));
|
||||
$sql_len = strlen($sql);
|
||||
$i--;
|
||||
} // end if...else
|
||||
} // end else if (is comment)
|
||||
// ... if escaped backslashes: it's really the end of the
|
||||
// string -> exit the loop
|
||||
if ($escaped_backslash) {
|
||||
$string_start = '';
|
||||
$in_string = FALSE;
|
||||
break;
|
||||
}
|
||||
// ... else loop
|
||||
else {
|
||||
$i++;
|
||||
}
|
||||
} // end if...elseif...else
|
||||
} // end for
|
||||
} // end if (in string)
|
||||
|
||||
// ... and finally disactivate the "/*!...*/" syntax if MySQL < 3.22.07
|
||||
else if ($release < 32270
|
||||
&& ($char == '!' && $i > 1 && $sql[$i-2] . $sql[$i-1] == '/*')) {
|
||||
$sql[$i] = ' ';
|
||||
} // end else if
|
||||
// We are not in a string, first check for delimiter...
|
||||
else if ($char == ';') {
|
||||
// if delimiter found, add the parsed part to the returned array
|
||||
$ret[] = substr($sql, 0, $i);
|
||||
$sql = ltrim(substr($sql, min($i + 1, $sql_len)));
|
||||
$sql_len = strlen($sql);
|
||||
if ($sql_len) {
|
||||
$i = -1;
|
||||
} else {
|
||||
// The submited statement(s) end(s) here
|
||||
return TRUE;
|
||||
}
|
||||
} // end else if (is delimiter)
|
||||
|
||||
// loic1: send a fake header each 30 sec. to bypass browser timeout
|
||||
$time1 = time();
|
||||
if ($time1 >= $time0 + 30) {
|
||||
$time0 = $time1;
|
||||
header('X-pmaPing: Pong');
|
||||
} // end if
|
||||
} // end for
|
||||
// ... then check for start of a string,...
|
||||
else if (($char == '"') || ($char == '\'') || ($char == '`')) {
|
||||
$in_string = TRUE;
|
||||
$string_start = $char;
|
||||
} // end else if (is start of string)
|
||||
|
||||
// add any rest to the returned array
|
||||
if (!empty($sql) && preg_match('@[^[:space:]]+@', $sql)) {
|
||||
$ret[] = $sql;
|
||||
}
|
||||
// ... for start of a comment (and remove this comment if found)...
|
||||
else if ($char == '#'
|
||||
|| ($char == ' ' && $i > 1 && $sql[$i-2] . $sql[$i-1] == '--')) {
|
||||
// starting position of the comment depends on the comment type
|
||||
$start_of_comment = (($sql[$i] == '#') ? $i : $i-2);
|
||||
// if no "\n" exits in the remaining string, checks for "\r"
|
||||
// (Mac eol style)
|
||||
$end_of_comment = (strpos(' ' . $sql, "\012", $i+2))
|
||||
? strpos(' ' . $sql, "\012", $i+2)
|
||||
: strpos(' ' . $sql, "\015", $i+2);
|
||||
if (!$end_of_comment) {
|
||||
// no eol found after '#', add the parsed part to the returned
|
||||
// array if required and exit
|
||||
if ($start_of_comment > 0) {
|
||||
$ret[] = trim(substr($sql, 0, $start_of_comment));
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
$sql = substr($sql, 0, $start_of_comment)
|
||||
. ltrim(substr($sql, $end_of_comment));
|
||||
$sql_len = strlen($sql);
|
||||
$i--;
|
||||
} // end if...else
|
||||
} // end else if (is comment)
|
||||
|
||||
return TRUE;
|
||||
} // end of the 'PMA_splitSqlFile()' function
|
||||
// ... and finally disactivate the "/*!...*/" syntax if MySQL < 3.22.07
|
||||
else if ($release < 32270
|
||||
&& ($char == '!' && $i > 1 && $sql[$i-2] . $sql[$i-1] == '/*')) {
|
||||
$sql[$i] = ' ';
|
||||
} // end else if
|
||||
|
||||
// loic1: send a fake header each 30 sec. to bypass browser timeout
|
||||
$time1 = time();
|
||||
if ($time1 >= $time0 + 30) {
|
||||
$time0 = $time1;
|
||||
header('X-pmaPing: Pong');
|
||||
} // end if
|
||||
} // end for
|
||||
|
||||
// add any rest to the returned array
|
||||
if (!empty($sql) && preg_match('@[^[:space:]]+@', $sql)) {
|
||||
$ret[] = $sql;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} // end of the 'PMA_splitSqlFile()' function
|
||||
|
||||
|
||||
/**
|
||||
* Reads (and decompresses) a (compressed) file into a string
|
||||
*
|
||||
* @param string the path to the file
|
||||
* @param string the MIME type of the file, if empty MIME type is autodetected
|
||||
*
|
||||
* @global array the phpMyAdmin configuration
|
||||
*
|
||||
* @return string the content of the file or
|
||||
* boolean FALSE in case of an error.
|
||||
*/
|
||||
function PMA_readFile($path, $mime = '') {
|
||||
global $cfg;
|
||||
/**
|
||||
* Reads (and decompresses) a (compressed) file into a string
|
||||
*
|
||||
* @param string the path to the file
|
||||
* @param string the MIME type of the file, if empty MIME type is autodetected
|
||||
*
|
||||
* @global array the phpMyAdmin configuration
|
||||
*
|
||||
* @return string the content of the file or
|
||||
* boolean FALSE in case of an error.
|
||||
*/
|
||||
function PMA_readFile($path, $mime = '') {
|
||||
global $cfg;
|
||||
|
||||
if (!file_exists($path)) {
|
||||
return FALSE;
|
||||
}
|
||||
switch ($mime) {
|
||||
case '':
|
||||
$file = @fopen($path, 'rb');
|
||||
if (!file_exists($path)) {
|
||||
return FALSE;
|
||||
}
|
||||
switch ($mime) {
|
||||
case '':
|
||||
$file = @fopen($path, 'rb');
|
||||
if (!$file) {
|
||||
return FALSE;
|
||||
}
|
||||
$test = fread($file, 3);
|
||||
fclose($file);
|
||||
if ($test[0] == chr(31) && $test[1] == chr(139)) return PMA_readFile($path, 'application/x-gzip');
|
||||
if ($test == 'BZh') return PMA_readFile($path, 'application/x-bzip');
|
||||
return PMA_readFile($path, 'text/plain');
|
||||
case 'text/plain':
|
||||
$file = @fopen($path, 'rb');
|
||||
if (!$file) {
|
||||
return FALSE;
|
||||
}
|
||||
$content = fread($file, filesize($path));
|
||||
fclose($file);
|
||||
break;
|
||||
case 'application/x-gzip':
|
||||
if ($cfg['GZipDump'] && @function_exists('gzopen')) {
|
||||
$file = @gzopen($path, 'rb');
|
||||
if (!$file) {
|
||||
return FALSE;
|
||||
}
|
||||
$test = fread($file, 3);
|
||||
fclose($file);
|
||||
if ($test[0] == chr(31) && $test[1] == chr(139)) return PMA_readFile($path, 'application/x-gzip');
|
||||
if ($test == 'BZh') return PMA_readFile($path, 'application/x-bzip');
|
||||
return PMA_readFile($path, 'text/plain');
|
||||
case 'text/plain':
|
||||
$content = '';
|
||||
while (!gzeof($file)) {
|
||||
$content .= gzgetc($file);
|
||||
}
|
||||
gzclose($file);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case 'application/x-bzip':
|
||||
if ($cfg['BZipDump'] && @function_exists('bzdecompress')) {
|
||||
$file = @fopen($path, 'rb');
|
||||
if (!$file) {
|
||||
return FALSE;
|
||||
}
|
||||
$content = fread($file, filesize($path));
|
||||
fclose($file);
|
||||
break;
|
||||
case 'application/x-gzip':
|
||||
if ($cfg['GZipDump'] && @function_exists('gzopen')) {
|
||||
$file = @gzopen($path, 'rb');
|
||||
if (!$file) {
|
||||
return FALSE;
|
||||
}
|
||||
$content = '';
|
||||
while (!gzeof($file)) {
|
||||
$content .= gzgetc($file);
|
||||
}
|
||||
gzclose($file);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case 'application/x-bzip':
|
||||
if ($cfg['BZipDump'] && @function_exists('bzdecompress')) {
|
||||
$file = @fopen($path, 'rb');
|
||||
if (!$file) {
|
||||
return FALSE;
|
||||
}
|
||||
$content = fread($file, filesize($path));
|
||||
fclose($file);
|
||||
$content = bzdecompress($content);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return $content;
|
||||
$content = bzdecompress($content);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
} // $__PMA_READ_DUMP_LIB__
|
||||
return $content;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -7,139 +7,135 @@
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('PMA_RELATION_CLEANUP_LIB_INCLUDED')){
|
||||
define('PMA_RELATION_CLEANUP_LIB_INCLUDED', 1);
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
include('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
function PMA_relationsCleanupColumn($db, $table, $column) {
|
||||
global $cfgRelation;
|
||||
if ($cfgRelation['commwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND column_name = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['displaywork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND display_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['relwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND master_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND foreign_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
function PMA_relationsCleanupColumn($db, $table, $column) {
|
||||
global $cfgRelation;
|
||||
if ($cfgRelation['commwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND column_name = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
function PMA_relationsCleanupTable($db, $table) {
|
||||
global $cfgRelation;
|
||||
if ($cfgRelation['displaywork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND display_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['commwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
if ($cfgRelation['relwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND master_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
|
||||
if ($cfgRelation['displaywork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info'])
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND foreign_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_relationsCleanupTable($db, $table) {
|
||||
global $cfgRelation;
|
||||
|
||||
if ($cfgRelation['commwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['pdfwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['relwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_relationsCleanupDatabase($db) {
|
||||
global $cfgRelation;
|
||||
|
||||
if ($cfgRelation['commwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['bookmarkwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['bookmark'])
|
||||
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['displaywork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['pdfwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['relwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
}
|
||||
|
||||
} // $__PMA_RELATION_CLEANUP_LIB__
|
||||
?>
|
||||
if ($cfgRelation['displaywork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['pdfwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['relwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_relationsCleanupDatabase($db) {
|
||||
global $cfgRelation;
|
||||
|
||||
if ($cfgRelation['commwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['bookmarkwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['bookmark'])
|
||||
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['displaywork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['pdfwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['relwork']) {
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
|
||||
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -8,275 +8,257 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if (!defined('PMA_SELECT_LANG_LIB_INCLUDED')) {
|
||||
define('PMA_SELECT_LANG_LIB_INCLUDED', 1);
|
||||
|
||||
/**
|
||||
* Define the path to the translations directory and get some variables
|
||||
* from system arrays if 'register_globals' is set to 'off'
|
||||
*/
|
||||
$lang_path = 'lang/';
|
||||
/**
|
||||
* We need some elements of the superglobal $_SERVER array.
|
||||
*/
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
* All the supported languages have to be listed in the array below.
|
||||
* 1. The key must be the "official" ISO 639 language code and, if required,
|
||||
* the dialect code. It can also contain some informations about the
|
||||
* charset (see the Russian case).
|
||||
* 2. The first of the values associated to the key is used in a regular
|
||||
* expression to find some keywords corresponding to the language inside two
|
||||
* environment variables.
|
||||
* These values contains:
|
||||
* - the "official" ISO language code and, if required, the dialect code
|
||||
* also ('bu' for Bulgarian, 'fr([-_][[:alpha:]]{2})?' for all French
|
||||
* dialects, 'zh[-_]tw' for Chinese traditional...);
|
||||
* - the '|' character (it means 'OR');
|
||||
* - the full language name.
|
||||
* 3. The second values associated to the key is the name of the file to load
|
||||
* without the 'inc.php' extension.
|
||||
* 4. The last values associated to the key is the language code as defined by
|
||||
* the RFC1766.
|
||||
*
|
||||
* Beware that the sorting order (first values associated to keys by
|
||||
* alphabetical reverse order in the array) is important: 'zh-tw' (chinese
|
||||
* traditional) must be detected before 'zh' (chinese simplified) for
|
||||
* example.
|
||||
*
|
||||
* When there are more than one charset for a language, we put the -utf-8
|
||||
* first.
|
||||
*
|
||||
* For Russian, we put 1251 first, because MSIE does not accept 866
|
||||
* and users would not see anything.
|
||||
*/
|
||||
$available_languages = array(
|
||||
'af-utf-8' => array('af|afrikaans', 'afrikaans-utf-8', 'af'),
|
||||
'af-iso-8859-1'=> array('af|afrikaans', 'afrikaans-iso-8859-1', 'af'),
|
||||
'ar-utf-8' => array('ar([-_][[:alpha:]]{2})?|arabic', 'arabic-utf-8', 'ar'),
|
||||
'ar-win1256' => array('ar([-_][[:alpha:]]{2})?|arabic', 'arabic-windows-1256', 'ar'),
|
||||
'az-utf-8' => array('az|azerbaijani', 'azerbaijani-utf-8', 'az'),
|
||||
'az-iso-8859-9'=> array('az|azerbaijani', 'azerbaijani-iso-8859-9', 'az'),
|
||||
'bg-utf-8' => array('bg|bulgarian', 'bulgarian-utf-8', 'bg'),
|
||||
'bg-win1251' => array('bg|bulgarian', 'bulgarian-windows-1251', 'bg'),
|
||||
'bg-koi8-r' => array('bg|bulgarian', 'bulgarian-koi8-r', 'bg'),
|
||||
'bs-utf-8' => array('bs|bosnian', 'bosnian-utf-8', 'bs'),
|
||||
'bs-win1250' => array('bs|bosnian', 'bosnian-windows-1250', 'bs'),
|
||||
'ca-utf-8' => array('ca|catalan', 'catalan-utf-8', 'ca'),
|
||||
'ca-iso-8859-1'=> array('ca|catalan', 'catalan-iso-8859-1', 'ca'),
|
||||
'cs-utf-8' => array('cs|czech', 'czech-utf-8', 'cs'),
|
||||
'cs-iso-8859-2'=> array('cs|czech', 'czech-iso-8859-2', 'cs'),
|
||||
'cs-win1250' => array('cs|czech', 'czech-windows-1250', 'cs'),
|
||||
'da-utf-8' => array('da|danish', 'danish-utf-8', 'da'),
|
||||
'da-iso-8859-1'=> array('da|danish', 'danish-iso-8859-1', 'da'),
|
||||
'de-utf-8' => array('de([-_][[:alpha:]]{2})?|german', 'german-utf-8', 'de'),
|
||||
'de-iso-8859-1'=> array('de([-_][[:alpha:]]{2})?|german', 'german-iso-8859-1', 'de'),
|
||||
'el-utf-8' => array('el|greek', 'greek-utf-8', 'el'),
|
||||
'el-iso-8859-7'=> array('el|greek', 'greek-iso-8859-7', 'el'),
|
||||
'en-utf-8' => array('en([-_][[:alpha:]]{2})?|english', 'english-utf-8', 'en'),
|
||||
'en-iso-8859-1'=> array('en([-_][[:alpha:]]{2})?|english', 'english-iso-8859-1', 'en'),
|
||||
'es-utf-8' => array('es([-_][[:alpha:]]{2})?|spanish', 'spanish-utf-8', 'es'),
|
||||
'es-iso-8859-1'=> array('es([-_][[:alpha:]]{2})?|spanish', 'spanish-iso-8859-1', 'es'),
|
||||
'et-utf-8' => array('et|estonian', 'estonian-utf-8', 'et'),
|
||||
'et-iso-8859-1'=> array('et|estonian', 'estonian-iso-8859-1', 'et'),
|
||||
'fa-utf-8' => array('fa|persian', 'persian-utf-8', 'fa'),
|
||||
'fa-win1256' => array('fa|persian', 'persian-windows-1256', 'fa'),
|
||||
'fi-utf-8' => array('fi|finnish', 'finnish-utf-8', 'fi'),
|
||||
'fi-iso-8859-1'=> array('fi|finnish', 'finnish-iso-8859-1', 'fi'),
|
||||
'fr-utf-8' => array('fr([-_][[:alpha:]]{2})?|french', 'french-utf-8', 'fr'),
|
||||
'fr-iso-8859-1'=> array('fr([-_][[:alpha:]]{2})?|french', 'french-iso-8859-1', 'fr'),
|
||||
'gl-utf-8' => array('gl|galician', 'galician-utf-8', 'gl'),
|
||||
'gl-iso-8859-1'=> array('gl|galician', 'galician-iso-8859-1', 'gl'),
|
||||
'he-iso-8859-8-i'=> array('he|hebrew', 'hebrew-iso-8859-8-i', 'he'),
|
||||
'hi-utf-8' => array('hi|hindi', 'hindi-utf-8', 'hi'),
|
||||
'hr-utf-8' => array('hr|croatian', 'croatian-utf-8', 'hr'),
|
||||
'hr-win1250' => array('hr|croatian', 'croatian-windows-1250', 'hr'),
|
||||
'hr-iso-8859-2'=> array('hr|croatian', 'croatian-iso-8859-2', 'hr'),
|
||||
'hu-utf-8' => array('hu|hungarian', 'hungarian-utf-8', 'hu'),
|
||||
'hu-iso-8859-2'=> array('hu|hungarian', 'hungarian-iso-8859-2', 'hu'),
|
||||
'id-utf-8' => array('id|indonesian', 'indonesian-utf-8', 'id'),
|
||||
'id-iso-8859-1'=> array('id|indonesian', 'indonesian-iso-8859-1', 'id'),
|
||||
'it-utf-8' => array('it|italian', 'italian-utf-8', 'it'),
|
||||
'it-iso-8859-1'=> array('it|italian', 'italian-iso-8859-1', 'it'),
|
||||
'ja-utf-8' => array('ja|japanese', 'japanese-utf-8', 'ja'),
|
||||
'ja-euc' => array('ja|japanese', 'japanese-euc', 'ja'),
|
||||
'ja-sjis' => array('ja|japanese', 'japanese-sjis', 'ja'),
|
||||
'ko-ks_c_5601-1987'=> array('ko|korean', 'korean-ks_c_5601-1987', 'ko'),
|
||||
'ka-utf-8' => array('ka|georgian', 'georgian-utf-8', 'ka'),
|
||||
'lt-utf-8' => array('lt|lithuanian', 'lithuanian-utf-8', 'lt'),
|
||||
'lt-win1257' => array('lt|lithuanian', 'lithuanian-windows-1257', 'lt'),
|
||||
'lv-utf-8' => array('lv|latvian', 'latvian-utf-8', 'lv'),
|
||||
'lv-win1257' => array('lv|latvian', 'latvian-windows-1257', 'lv'),
|
||||
'ms-utf-8' => array('ms|malay', 'malay-utf-8', 'ms'),
|
||||
'ms-iso-8859-1'=> array('ms|malay', 'malay-iso-8859-1', 'ms'),
|
||||
'nl-utf-8' => array('nl([-_][[:alpha:]]{2})?|dutch', 'dutch-utf-8', 'nl'),
|
||||
'nl-iso-8859-1'=> array('nl([-_][[:alpha:]]{2})?|dutch', 'dutch-iso-8859-1', 'nl'),
|
||||
'no-utf-8' => array('no|norwegian', 'norwegian-utf-8', 'no'),
|
||||
'no-iso-8859-1'=> array('no|norwegian', 'norwegian-iso-8859-1', 'no'),
|
||||
'pl-utf-8' => array('pl|polish', 'polish-utf-8', 'pl'),
|
||||
'pl-iso-8859-2'=> array('pl|polish', 'polish-iso-8859-2', 'pl'),
|
||||
'pt-br-utf-8' => array('pt[-_]br|brazilian portuguese', 'brazilian_portuguese-utf-8', 'pt-BR'),
|
||||
'pt-br-iso-8859-1' => array('pt[-_]br|brazilian portuguese', 'brazilian_portuguese-iso-8859-1', 'pt-BR'),
|
||||
'pt-utf-8' => array('pt([-_][[:alpha:]]{2})?|portuguese', 'portuguese-utf-8', 'pt'),
|
||||
'pt-iso-8859-1'=> array('pt([-_][[:alpha:]]{2})?|portuguese', 'portuguese-iso-8859-1', 'pt'),
|
||||
'ro-utf-8' => array('ro|romanian', 'romanian-utf-8', 'ro'),
|
||||
'ro-iso-8859-1'=> array('ro|romanian', 'romanian-iso-8859-1', 'ro'),
|
||||
'ru-win1251' => array('ru|russian', 'russian-windows-1251', 'ru'),
|
||||
'ru-utf-8' => array('ru|russian', 'russian-utf-8', 'ru'),
|
||||
'ru-dos-866' => array('ru|russian', 'russian-dos-866', 'ru'),
|
||||
'ru-koi8-r' => array('ru|russian', 'russian-koi8-r', 'ru'),
|
||||
'sk-utf-8' => array('sk|slovak', 'slovak-utf-8', 'sk'),
|
||||
'sk-iso-8859-2'=> array('sk|slovak', 'slovak-iso-8859-2', 'sk'),
|
||||
'sk-win1250' => array('sk|slovak', 'slovak-windows-1250', 'sk'),
|
||||
'sl-utf-8' => array('sl|slovenian', 'slovenian-utf-8', 'sl'),
|
||||
'sl-iso-8859-2'=> array('sl|slovenian', 'slovenian-iso-8859-2', 'sl'),
|
||||
'sl-win1250' => array('sl|slovenian', 'slovenian-windows-1250', 'sl'),
|
||||
'sq-utf-8' => array('sq|albanian', 'albanian-utf-8', 'sq'),
|
||||
'sq-iso-8859-1'=> array('sq|albanian', 'albanian-iso-8859-1', 'sq'),
|
||||
'sr-utf-8' => array('sr|serbian', 'serbian_cyrillic-utf-8', 'sr'),
|
||||
'sr-win1251' => array('sr|serbian', 'serbian_cyrillic-windows-1251', 'sr'),
|
||||
'sr-lat-utf-8' => array('sr[-_]lat|serbian latin', 'serbian_latin-utf-8', 'sr-lat'),
|
||||
'sr-lat-win1250'=> array('sr[-_]lat|serbian latin', 'serbian_latin-windows-1250', 'sr-lat'),
|
||||
'sv-utf-8' => array('sv|swedish', 'swedish-utf-8', 'sv'),
|
||||
'sv-iso-8859-1'=> array('sv|swedish', 'swedish-iso-8859-1', 'sv'),
|
||||
'th-utf-8' => array('th|thai', 'thai-utf-8', 'th'),
|
||||
'th-tis-620' => array('th|thai', 'thai-tis-620', 'th'),
|
||||
'tr-utf-8' => array('tr|turkish', 'turkish-utf-8', 'tr'),
|
||||
'tr-iso-8859-9'=> array('tr|turkish', 'turkish-iso-8859-9', 'tr'),
|
||||
'uk-utf-8' => array('uk|ukrainian', 'ukrainian-utf-8', 'uk'),
|
||||
'uk-win1251' => array('uk|ukrainian', 'ukrainian-windows-1251', 'uk'),
|
||||
'zh-tw-utf-8' => array('zh[-_]tw|chinese traditional', 'chinese_big5-utf-8', 'zh-TW'),
|
||||
'zh-tw' => array('zh[-_]tw|chinese traditional', 'chinese_big5', 'zh-TW'),
|
||||
'zh-utf-8' => array('zh|chinese simplified', 'chinese_gb-utf-8', 'zh'),
|
||||
'zh' => array('zh|chinese simplified', 'chinese_gb', 'zh')
|
||||
);
|
||||
/**
|
||||
* Define the path to the translations directory and get some variables
|
||||
* from system arrays if 'register_globals' is set to 'off'
|
||||
*/
|
||||
$lang_path = 'lang/';
|
||||
|
||||
|
||||
if (!defined('PMA_IS_LANG_DETECT_FUNCTION')) {
|
||||
define('PMA_IS_LANG_DETECT_FUNCTION', 1);
|
||||
|
||||
/**
|
||||
* Analyzes some PHP environment variables to find the most probable language
|
||||
* that should be used
|
||||
*
|
||||
* @param string string to analyze
|
||||
* @param integer type of the PHP environment variable which value is $str
|
||||
*
|
||||
* @global array the list of available translations
|
||||
* @global string the retained translation keyword
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function PMA_langDetect($str = '', $envType = '')
|
||||
{
|
||||
global $available_languages;
|
||||
global $lang;
|
||||
|
||||
foreach($available_languages AS $key => $value) {
|
||||
// $envType = 1 for the 'HTTP_ACCEPT_LANGUAGE' environment variable,
|
||||
// 2 for the 'HTTP_USER_AGENT' one
|
||||
if (($envType == 1 && eregi('^(' . $value[0] . ')(;q=[0-9]\\.[0-9])?$', $str))
|
||||
|| ($envType == 2 && eregi('(\(|\[|;[[:space:]])(' . $value[0] . ')(;|\]|\))', $str))) {
|
||||
$lang = $key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // end of the 'PMA_langDetect()' function
|
||||
|
||||
} // end if
|
||||
/**
|
||||
* All the supported languages have to be listed in the array below.
|
||||
* 1. The key must be the "official" ISO 639 language code and, if required,
|
||||
* the dialect code. It can also contain some informations about the
|
||||
* charset (see the Russian case).
|
||||
* 2. The first of the values associated to the key is used in a regular
|
||||
* expression to find some keywords corresponding to the language inside two
|
||||
* environment variables.
|
||||
* These values contains:
|
||||
* - the "official" ISO language code and, if required, the dialect code
|
||||
* also ('bu' for Bulgarian, 'fr([-_][[:alpha:]]{2})?' for all French
|
||||
* dialects, 'zh[-_]tw' for Chinese traditional...);
|
||||
* - the '|' character (it means 'OR');
|
||||
* - the full language name.
|
||||
* 3. The second values associated to the key is the name of the file to load
|
||||
* without the 'inc.php' extension.
|
||||
* 4. The last values associated to the key is the language code as defined by
|
||||
* the RFC1766.
|
||||
*
|
||||
* Beware that the sorting order (first values associated to keys by
|
||||
* alphabetical reverse order in the array) is important: 'zh-tw' (chinese
|
||||
* traditional) must be detected before 'zh' (chinese simplified) for
|
||||
* example.
|
||||
*
|
||||
* When there are more than one charset for a language, we put the -utf-8
|
||||
* first.
|
||||
*
|
||||
* For Russian, we put 1251 first, because MSIE does not accept 866
|
||||
* and users would not see anything.
|
||||
*/
|
||||
$available_languages = array(
|
||||
'af-utf-8' => array('af|afrikaans', 'afrikaans-utf-8', 'af'),
|
||||
'af-iso-8859-1'=> array('af|afrikaans', 'afrikaans-iso-8859-1', 'af'),
|
||||
'ar-utf-8' => array('ar([-_][[:alpha:]]{2})?|arabic', 'arabic-utf-8', 'ar'),
|
||||
'ar-win1256' => array('ar([-_][[:alpha:]]{2})?|arabic', 'arabic-windows-1256', 'ar'),
|
||||
'az-utf-8' => array('az|azerbaijani', 'azerbaijani-utf-8', 'az'),
|
||||
'az-iso-8859-9'=> array('az|azerbaijani', 'azerbaijani-iso-8859-9', 'az'),
|
||||
'bg-utf-8' => array('bg|bulgarian', 'bulgarian-utf-8', 'bg'),
|
||||
'bg-win1251' => array('bg|bulgarian', 'bulgarian-windows-1251', 'bg'),
|
||||
'bg-koi8-r' => array('bg|bulgarian', 'bulgarian-koi8-r', 'bg'),
|
||||
'bs-utf-8' => array('bs|bosnian', 'bosnian-utf-8', 'bs'),
|
||||
'bs-win1250' => array('bs|bosnian', 'bosnian-windows-1250', 'bs'),
|
||||
'ca-utf-8' => array('ca|catalan', 'catalan-utf-8', 'ca'),
|
||||
'ca-iso-8859-1'=> array('ca|catalan', 'catalan-iso-8859-1', 'ca'),
|
||||
'cs-utf-8' => array('cs|czech', 'czech-utf-8', 'cs'),
|
||||
'cs-iso-8859-2'=> array('cs|czech', 'czech-iso-8859-2', 'cs'),
|
||||
'cs-win1250' => array('cs|czech', 'czech-windows-1250', 'cs'),
|
||||
'da-utf-8' => array('da|danish', 'danish-utf-8', 'da'),
|
||||
'da-iso-8859-1'=> array('da|danish', 'danish-iso-8859-1', 'da'),
|
||||
'de-utf-8' => array('de([-_][[:alpha:]]{2})?|german', 'german-utf-8', 'de'),
|
||||
'de-iso-8859-1'=> array('de([-_][[:alpha:]]{2})?|german', 'german-iso-8859-1', 'de'),
|
||||
'el-utf-8' => array('el|greek', 'greek-utf-8', 'el'),
|
||||
'el-iso-8859-7'=> array('el|greek', 'greek-iso-8859-7', 'el'),
|
||||
'en-utf-8' => array('en([-_][[:alpha:]]{2})?|english', 'english-utf-8', 'en'),
|
||||
'en-iso-8859-1'=> array('en([-_][[:alpha:]]{2})?|english', 'english-iso-8859-1', 'en'),
|
||||
'es-utf-8' => array('es([-_][[:alpha:]]{2})?|spanish', 'spanish-utf-8', 'es'),
|
||||
'es-iso-8859-1'=> array('es([-_][[:alpha:]]{2})?|spanish', 'spanish-iso-8859-1', 'es'),
|
||||
'et-utf-8' => array('et|estonian', 'estonian-utf-8', 'et'),
|
||||
'et-iso-8859-1'=> array('et|estonian', 'estonian-iso-8859-1', 'et'),
|
||||
'fa-utf-8' => array('fa|persian', 'persian-utf-8', 'fa'),
|
||||
'fa-win1256' => array('fa|persian', 'persian-windows-1256', 'fa'),
|
||||
'fi-utf-8' => array('fi|finnish', 'finnish-utf-8', 'fi'),
|
||||
'fi-iso-8859-1'=> array('fi|finnish', 'finnish-iso-8859-1', 'fi'),
|
||||
'fr-utf-8' => array('fr([-_][[:alpha:]]{2})?|french', 'french-utf-8', 'fr'),
|
||||
'fr-iso-8859-1'=> array('fr([-_][[:alpha:]]{2})?|french', 'french-iso-8859-1', 'fr'),
|
||||
'gl-utf-8' => array('gl|galician', 'galician-utf-8', 'gl'),
|
||||
'gl-iso-8859-1'=> array('gl|galician', 'galician-iso-8859-1', 'gl'),
|
||||
'he-iso-8859-8-i'=> array('he|hebrew', 'hebrew-iso-8859-8-i', 'he'),
|
||||
'hi-utf-8' => array('hi|hindi', 'hindi-utf-8', 'hi'),
|
||||
'hr-utf-8' => array('hr|croatian', 'croatian-utf-8', 'hr'),
|
||||
'hr-win1250' => array('hr|croatian', 'croatian-windows-1250', 'hr'),
|
||||
'hr-iso-8859-2'=> array('hr|croatian', 'croatian-iso-8859-2', 'hr'),
|
||||
'hu-utf-8' => array('hu|hungarian', 'hungarian-utf-8', 'hu'),
|
||||
'hu-iso-8859-2'=> array('hu|hungarian', 'hungarian-iso-8859-2', 'hu'),
|
||||
'id-utf-8' => array('id|indonesian', 'indonesian-utf-8', 'id'),
|
||||
'id-iso-8859-1'=> array('id|indonesian', 'indonesian-iso-8859-1', 'id'),
|
||||
'it-utf-8' => array('it|italian', 'italian-utf-8', 'it'),
|
||||
'it-iso-8859-1'=> array('it|italian', 'italian-iso-8859-1', 'it'),
|
||||
'ja-utf-8' => array('ja|japanese', 'japanese-utf-8', 'ja'),
|
||||
'ja-euc' => array('ja|japanese', 'japanese-euc', 'ja'),
|
||||
'ja-sjis' => array('ja|japanese', 'japanese-sjis', 'ja'),
|
||||
'ko-ks_c_5601-1987'=> array('ko|korean', 'korean-ks_c_5601-1987', 'ko'),
|
||||
'ka-utf-8' => array('ka|georgian', 'georgian-utf-8', 'ka'),
|
||||
'lt-utf-8' => array('lt|lithuanian', 'lithuanian-utf-8', 'lt'),
|
||||
'lt-win1257' => array('lt|lithuanian', 'lithuanian-windows-1257', 'lt'),
|
||||
'lv-utf-8' => array('lv|latvian', 'latvian-utf-8', 'lv'),
|
||||
'lv-win1257' => array('lv|latvian', 'latvian-windows-1257', 'lv'),
|
||||
'ms-utf-8' => array('ms|malay', 'malay-utf-8', 'ms'),
|
||||
'ms-iso-8859-1'=> array('ms|malay', 'malay-iso-8859-1', 'ms'),
|
||||
'nl-utf-8' => array('nl([-_][[:alpha:]]{2})?|dutch', 'dutch-utf-8', 'nl'),
|
||||
'nl-iso-8859-1'=> array('nl([-_][[:alpha:]]{2})?|dutch', 'dutch-iso-8859-1', 'nl'),
|
||||
'no-utf-8' => array('no|norwegian', 'norwegian-utf-8', 'no'),
|
||||
'no-iso-8859-1'=> array('no|norwegian', 'norwegian-iso-8859-1', 'no'),
|
||||
'pl-utf-8' => array('pl|polish', 'polish-utf-8', 'pl'),
|
||||
'pl-iso-8859-2'=> array('pl|polish', 'polish-iso-8859-2', 'pl'),
|
||||
'pt-br-utf-8' => array('pt[-_]br|brazilian portuguese', 'brazilian_portuguese-utf-8', 'pt-BR'),
|
||||
'pt-br-iso-8859-1' => array('pt[-_]br|brazilian portuguese', 'brazilian_portuguese-iso-8859-1', 'pt-BR'),
|
||||
'pt-utf-8' => array('pt([-_][[:alpha:]]{2})?|portuguese', 'portuguese-utf-8', 'pt'),
|
||||
'pt-iso-8859-1'=> array('pt([-_][[:alpha:]]{2})?|portuguese', 'portuguese-iso-8859-1', 'pt'),
|
||||
'ro-utf-8' => array('ro|romanian', 'romanian-utf-8', 'ro'),
|
||||
'ro-iso-8859-1'=> array('ro|romanian', 'romanian-iso-8859-1', 'ro'),
|
||||
'ru-win1251' => array('ru|russian', 'russian-windows-1251', 'ru'),
|
||||
'ru-utf-8' => array('ru|russian', 'russian-utf-8', 'ru'),
|
||||
'ru-dos-866' => array('ru|russian', 'russian-dos-866', 'ru'),
|
||||
'ru-koi8-r' => array('ru|russian', 'russian-koi8-r', 'ru'),
|
||||
'sk-utf-8' => array('sk|slovak', 'slovak-utf-8', 'sk'),
|
||||
'sk-iso-8859-2'=> array('sk|slovak', 'slovak-iso-8859-2', 'sk'),
|
||||
'sk-win1250' => array('sk|slovak', 'slovak-windows-1250', 'sk'),
|
||||
'sl-utf-8' => array('sl|slovenian', 'slovenian-utf-8', 'sl'),
|
||||
'sl-iso-8859-2'=> array('sl|slovenian', 'slovenian-iso-8859-2', 'sl'),
|
||||
'sl-win1250' => array('sl|slovenian', 'slovenian-windows-1250', 'sl'),
|
||||
'sq-utf-8' => array('sq|albanian', 'albanian-utf-8', 'sq'),
|
||||
'sq-iso-8859-1'=> array('sq|albanian', 'albanian-iso-8859-1', 'sq'),
|
||||
'sr-utf-8' => array('sr|serbian', 'serbian_cyrillic-utf-8', 'sr'),
|
||||
'sr-win1251' => array('sr|serbian', 'serbian_cyrillic-windows-1251', 'sr'),
|
||||
'sr-lat-utf-8' => array('sr[-_]lat|serbian latin', 'serbian_latin-utf-8', 'sr-lat'),
|
||||
'sr-lat-win1250'=> array('sr[-_]lat|serbian latin', 'serbian_latin-windows-1250', 'sr-lat'),
|
||||
'sv-utf-8' => array('sv|swedish', 'swedish-utf-8', 'sv'),
|
||||
'sv-iso-8859-1'=> array('sv|swedish', 'swedish-iso-8859-1', 'sv'),
|
||||
'th-utf-8' => array('th|thai', 'thai-utf-8', 'th'),
|
||||
'th-tis-620' => array('th|thai', 'thai-tis-620', 'th'),
|
||||
'tr-utf-8' => array('tr|turkish', 'turkish-utf-8', 'tr'),
|
||||
'tr-iso-8859-9'=> array('tr|turkish', 'turkish-iso-8859-9', 'tr'),
|
||||
'uk-utf-8' => array('uk|ukrainian', 'ukrainian-utf-8', 'uk'),
|
||||
'uk-win1251' => array('uk|ukrainian', 'ukrainian-windows-1251', 'uk'),
|
||||
'zh-tw-utf-8' => array('zh[-_]tw|chinese traditional', 'chinese_big5-utf-8', 'zh-TW'),
|
||||
'zh-tw' => array('zh[-_]tw|chinese traditional', 'chinese_big5', 'zh-TW'),
|
||||
'zh-utf-8' => array('zh|chinese simplified', 'chinese_gb-utf-8', 'zh'),
|
||||
'zh' => array('zh|chinese simplified', 'chinese_gb', 'zh')
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Get some global variables if 'register_globals' is set to 'off'
|
||||
* loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
|
||||
*/
|
||||
if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
$HTTP_ACCEPT_LANGUAGE = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
||||
}
|
||||
/**
|
||||
* Analyzes some PHP environment variables to find the most probable language
|
||||
* that should be used
|
||||
*
|
||||
* @param string string to analyze
|
||||
* @param integer type of the PHP environment variable which value is $str
|
||||
*
|
||||
* @global array the list of available translations
|
||||
* @global string the retained translation keyword
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function PMA_langDetect($str = '', $envType = '')
|
||||
{
|
||||
global $available_languages;
|
||||
global $lang;
|
||||
|
||||
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
|
||||
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
|
||||
}
|
||||
|
||||
if (!isset($lang)) {
|
||||
if (isset($_GET) && !empty($_GET['lang'])) {
|
||||
$lang = $_GET['lang'];
|
||||
}
|
||||
else if (isset($_POST) && !empty($_POST['lang'])) {
|
||||
$lang = $_POST['lang'];
|
||||
}
|
||||
else if (isset($_COOKIE) && !empty($_COOKIE['lang'])) {
|
||||
$lang = $_COOKIE['lang'];
|
||||
foreach($available_languages AS $key => $value) {
|
||||
// $envType = 1 for the 'HTTP_ACCEPT_LANGUAGE' environment variable,
|
||||
// 2 for the 'HTTP_USER_AGENT' one
|
||||
if (($envType == 1 && eregi('^(' . $value[0] . ')(;q=[0-9]\\.[0-9])?$', $str))
|
||||
|| ($envType == 2 && eregi('(\(|\[|;[[:space:]])(' . $value[0] . ')(;|\]|\))', $str))) {
|
||||
$lang = $key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // end of the 'PMA_langDetect()' function
|
||||
|
||||
|
||||
/**
|
||||
* Do the work!
|
||||
*/
|
||||
|
||||
// compatibility with config.inc.php <= v1.80
|
||||
if (!isset($cfg['Lang']) && isset($cfgLang)) {
|
||||
$cfg['Lang'] = $cfgLang;
|
||||
unset($cfgLang);
|
||||
if (!isset($lang)) {
|
||||
if (isset($_GET) && !empty($_GET['lang'])) {
|
||||
$lang = $_GET['lang'];
|
||||
}
|
||||
if (!isset($cfg['DefaultLang']) && isset($cfgDefaultLang)) {
|
||||
$cfg['DefaultLang'] = $cfgDefaultLang;
|
||||
unset($cfgLang);
|
||||
else if (isset($_POST) && !empty($_POST['lang'])) {
|
||||
$lang = $_POST['lang'];
|
||||
}
|
||||
|
||||
// Disable UTF-8 if $cfg['AllowAnywhereRecoding'] has been set to FALSE.
|
||||
if (!isset($cfg['AllowAnywhereRecoding']) || !$cfg['AllowAnywhereRecoding']) {
|
||||
$available_language_files = $available_languages;
|
||||
$available_languages = array();
|
||||
foreach($available_language_files AS $tmp_lang => $tmp_lang_data) {
|
||||
if (substr($tmp_lang, -5) != 'utf-8') {
|
||||
$available_languages[$tmp_lang] = $tmp_lang_data;
|
||||
}
|
||||
} // end while
|
||||
unset($tmp_lang);
|
||||
unset($tmp_lang_data);
|
||||
unset($available_language_files);
|
||||
} // end if
|
||||
|
||||
// Lang forced
|
||||
if (!empty($cfg['Lang'])) {
|
||||
$lang = $cfg['Lang'];
|
||||
else if (isset($_COOKIE) && !empty($_COOKIE['lang'])) {
|
||||
$lang = $_COOKIE['lang'];
|
||||
}
|
||||
}
|
||||
|
||||
// If '$lang' is defined, ensure this is a valid translation
|
||||
if (!empty($lang) && empty($available_languages[$lang])) {
|
||||
$lang = '';
|
||||
}
|
||||
|
||||
// Language is not defined yet :
|
||||
// 1. try to findout user's language by checking its HTTP_ACCEPT_LANGUAGE
|
||||
// variable
|
||||
if (empty($lang) && !empty($HTTP_ACCEPT_LANGUAGE)) {
|
||||
$accepted = explode(',', $HTTP_ACCEPT_LANGUAGE);
|
||||
$acceptedCnt = count($accepted);
|
||||
for ($i = 0; $i < $acceptedCnt && empty($lang); $i++) {
|
||||
PMA_langDetect($accepted[$i], 1);
|
||||
/**
|
||||
* Do the work!
|
||||
*/
|
||||
|
||||
// compatibility with config.inc.php <= v1.80
|
||||
if (!isset($cfg['Lang']) && isset($cfgLang)) {
|
||||
$cfg['Lang'] = $cfgLang;
|
||||
unset($cfgLang);
|
||||
}
|
||||
if (!isset($cfg['DefaultLang']) && isset($cfgDefaultLang)) {
|
||||
$cfg['DefaultLang'] = $cfgDefaultLang;
|
||||
unset($cfgLang);
|
||||
}
|
||||
|
||||
// Disable UTF-8 if $cfg['AllowAnywhereRecoding'] has been set to FALSE.
|
||||
if (!isset($cfg['AllowAnywhereRecoding']) || !$cfg['AllowAnywhereRecoding']) {
|
||||
$available_language_files = $available_languages;
|
||||
$available_languages = array();
|
||||
foreach($available_language_files AS $tmp_lang => $tmp_lang_data) {
|
||||
if (substr($tmp_lang, -5) != 'utf-8') {
|
||||
$available_languages[$tmp_lang] = $tmp_lang_data;
|
||||
}
|
||||
}
|
||||
// 2. try to findout user's language by checking its HTTP_USER_AGENT variable
|
||||
if (empty($lang) && !empty($HTTP_USER_AGENT)) {
|
||||
PMA_langDetect($HTTP_USER_AGENT, 2);
|
||||
}
|
||||
} // end while
|
||||
unset($tmp_lang, $tmp_lang_data, $available_language_files);
|
||||
} // end if
|
||||
|
||||
// 3. Didn't catch any valid lang : we use the default settings
|
||||
if (empty($lang)) {
|
||||
$lang = $cfg['DefaultLang'];
|
||||
// Lang forced
|
||||
if (!empty($cfg['Lang'])) {
|
||||
$lang = $cfg['Lang'];
|
||||
}
|
||||
|
||||
// If '$lang' is defined, ensure this is a valid translation
|
||||
if (!empty($lang) && empty($available_languages[$lang])) {
|
||||
$lang = '';
|
||||
}
|
||||
|
||||
// Language is not defined yet :
|
||||
// 1. try to findout user's language by checking its HTTP_ACCEPT_LANGUAGE
|
||||
// variable
|
||||
if (empty($lang) && !empty($HTTP_ACCEPT_LANGUAGE)) {
|
||||
$accepted = explode(',', $HTTP_ACCEPT_LANGUAGE);
|
||||
$acceptedCnt = count($accepted);
|
||||
for ($i = 0; $i < $acceptedCnt && empty($lang); $i++) {
|
||||
PMA_langDetect($accepted[$i], 1);
|
||||
}
|
||||
}
|
||||
// 2. try to findout user's language by checking its HTTP_USER_AGENT variable
|
||||
if (empty($lang) && !empty($HTTP_USER_AGENT)) {
|
||||
PMA_langDetect($HTTP_USER_AGENT, 2);
|
||||
}
|
||||
|
||||
// 4. Checks whether charset recoding should be allowed or not
|
||||
$allow_recoding = FALSE; // Default fallback value
|
||||
if (!isset($convcharset) || empty($convcharset)) {
|
||||
$convcharset = $cfg['DefaultCharset'];
|
||||
}
|
||||
// 3. Didn't catch any valid lang : we use the default settings
|
||||
if (empty($lang)) {
|
||||
$lang = $cfg['DefaultLang'];
|
||||
}
|
||||
|
||||
// 5. Defines the associated filename and load the translation
|
||||
$lang_file = $lang_path . $available_languages[$lang][1] . '.inc.php';
|
||||
include('./' . $lang_file);
|
||||
// 4. Checks whether charset recoding should be allowed or not
|
||||
$allow_recoding = FALSE; // Default fallback value
|
||||
if (!isset($convcharset) || empty($convcharset)) {
|
||||
$convcharset = $cfg['DefaultCharset'];
|
||||
}
|
||||
|
||||
} // $__PMA_SELECT_LANG_LIB__
|
||||
?>
|
||||
// 5. Defines the associated filename and load the translation
|
||||
$lang_file = $lang_path . $available_languages[$lang][1] . '.inc.php';
|
||||
require_once('./' . $lang_file);
|
||||
|
||||
?>
|
||||
|
@@ -14,494 +14,490 @@
|
||||
* (around 4.0.2) as well as the MySQL documentation.
|
||||
*/
|
||||
|
||||
if (!defined('PMA_SQP_DATA_INCLUDED')) {
|
||||
define('PMA_SQP_DATA_INCLUDED', 1);
|
||||
$PMA_SQPdata_function_name = array (
|
||||
'ABS',
|
||||
'ACOS',
|
||||
'ADDDATE',
|
||||
'AES_ENCRYPT',
|
||||
'AES_DECRYPT',
|
||||
'ASCII',
|
||||
'ASIN',
|
||||
'ATAN',
|
||||
'ATAN2',
|
||||
'AVG',
|
||||
'BENCHMARK',
|
||||
'BIN',
|
||||
'BIT_AND',
|
||||
'BIT_COUNT',
|
||||
'BIT_LENGTH',
|
||||
'BIT_OR',
|
||||
'CAST',
|
||||
'CEIL',
|
||||
'CEILING',
|
||||
'CHAR_LENGTH',
|
||||
'CHARACTER_LENGTH',
|
||||
'COALESCE',
|
||||
'CONCAT',
|
||||
'CONCAT_WS',
|
||||
'CONNECTION_ID',
|
||||
'CONV',
|
||||
'CONVERT',
|
||||
'COS',
|
||||
'COT',
|
||||
'COUNT',
|
||||
'CURDATE',
|
||||
'CURRENT_DATE',
|
||||
'CURRENT_TIME',
|
||||
'CURRENT_TIMESTAMP',
|
||||
'CURRENT_USER',
|
||||
'CURTIME',
|
||||
'DATABASE',
|
||||
'DATE_ADD',
|
||||
'DATE_FORMAT',
|
||||
'DATE_SUB',
|
||||
'DAYNAME',
|
||||
'DAYOFMONTH',
|
||||
'DAYOFWEEK',
|
||||
'DAYOFYEAR',
|
||||
'DECODE',
|
||||
'DEGREES',
|
||||
'DES_ENCRYPT',
|
||||
'DES_DECRYPT',
|
||||
'ELT',
|
||||
'ENCODE',
|
||||
'ENCRYPT',
|
||||
'EXP',
|
||||
'EXPORT_SET',
|
||||
'EXTRACT',
|
||||
'FIELD',
|
||||
'FIND_IN_SET',
|
||||
'FLOOR',
|
||||
'FORMAT',
|
||||
'FOUND_ROWS',
|
||||
'FROM_DAYS',
|
||||
'FROM_UNIXTIME',
|
||||
'GET_LOCK',
|
||||
'GREATEST',
|
||||
'GROUP_UNIQUE_USERS',
|
||||
'HEX',
|
||||
'IFNULL',
|
||||
'INET_ATON',
|
||||
'INET_NTOA',
|
||||
'INSTR',
|
||||
'INTERVAL',
|
||||
'IS_FREE_LOCK',
|
||||
'ISNULL',
|
||||
'LAST_INSERT_ID',
|
||||
'LCASE',
|
||||
'LEAST',
|
||||
'LEFT',
|
||||
'LENGTH',
|
||||
'LN',
|
||||
'LOAD_FILE',
|
||||
'LOCATE',
|
||||
'LOG',
|
||||
'LOG2',
|
||||
'LOG10',
|
||||
'LOWER',
|
||||
'LPAD',
|
||||
'LTRIM',
|
||||
'MAKE_SET',
|
||||
'MASTER_POS_WAIT',
|
||||
'MAX',
|
||||
'MD5',
|
||||
'MID',
|
||||
'MIN',
|
||||
'MOD',
|
||||
'MONTH',
|
||||
'MONTHNAME',
|
||||
'NOW',
|
||||
'NULLIF',
|
||||
'OCT',
|
||||
'OCTET_LENGTH',
|
||||
'ORD',
|
||||
'PASSWORD',
|
||||
'PERIOD_ADD',
|
||||
'PERIOD_DIFF',
|
||||
'PI',
|
||||
'POSITION',
|
||||
'POW',
|
||||
'POWER',
|
||||
'QUARTER',
|
||||
'QUOTE',
|
||||
'RADIANS',
|
||||
'RAND',
|
||||
'RELEASE_LOCK',
|
||||
'REPEAT',
|
||||
'REVERSE',
|
||||
'RIGHT',
|
||||
'ROUND',
|
||||
'RPAD',
|
||||
'RTRIM',
|
||||
'SEC_TO_TIME',
|
||||
'SESSION_USER',
|
||||
'SHA',
|
||||
'SHA1',
|
||||
'SIGN',
|
||||
'SIN',
|
||||
'SOUNDEX',
|
||||
'SPACE',
|
||||
'SQRT',
|
||||
'STD',
|
||||
'STDDEV',
|
||||
'STRCMP',
|
||||
'SUBDATE',
|
||||
'SUBSTRING',
|
||||
'SUBSTRING_INDEX',
|
||||
'SUM',
|
||||
'SYSDATE',
|
||||
'SYSTEM_USER',
|
||||
'TAN',
|
||||
'TIME_FORMAT',
|
||||
'TIME_TO_SEC',
|
||||
'TO_DAYS',
|
||||
'TRIM',
|
||||
'UCASE',
|
||||
'UNIQUE_USERS',
|
||||
'UNIX_TIMESTAMP',
|
||||
'UPPER',
|
||||
'USER',
|
||||
'VERSION',
|
||||
'WEEK',
|
||||
'WEEKDAY',
|
||||
'YEAR',
|
||||
'YEARWEEK'
|
||||
);
|
||||
//$PMA_SQPdata_function_name_cnt = count($PMA_SQPdata_function_name);
|
||||
$PMA_SQPdata_function_name_cnt = 151;
|
||||
|
||||
$PMA_SQPdata_function_name = array (
|
||||
'ABS',
|
||||
'ACOS',
|
||||
'ADDDATE',
|
||||
'AES_ENCRYPT',
|
||||
'AES_DECRYPT',
|
||||
'ASCII',
|
||||
'ASIN',
|
||||
'ATAN',
|
||||
'ATAN2',
|
||||
'AVG',
|
||||
'BENCHMARK',
|
||||
'BIN',
|
||||
'BIT_AND',
|
||||
'BIT_COUNT',
|
||||
'BIT_LENGTH',
|
||||
'BIT_OR',
|
||||
'CAST',
|
||||
'CEIL',
|
||||
'CEILING',
|
||||
'CHAR_LENGTH',
|
||||
'CHARACTER_LENGTH',
|
||||
'COALESCE',
|
||||
'CONCAT',
|
||||
'CONCAT_WS',
|
||||
'CONNECTION_ID',
|
||||
'CONV',
|
||||
'CONVERT',
|
||||
'COS',
|
||||
'COT',
|
||||
'COUNT',
|
||||
'CURDATE',
|
||||
'CURRENT_DATE',
|
||||
'CURRENT_TIME',
|
||||
'CURRENT_TIMESTAMP',
|
||||
'CURRENT_USER',
|
||||
'CURTIME',
|
||||
'DATABASE',
|
||||
'DATE_ADD',
|
||||
'DATE_FORMAT',
|
||||
'DATE_SUB',
|
||||
'DAYNAME',
|
||||
'DAYOFMONTH',
|
||||
'DAYOFWEEK',
|
||||
'DAYOFYEAR',
|
||||
'DECODE',
|
||||
'DEGREES',
|
||||
'DES_ENCRYPT',
|
||||
'DES_DECRYPT',
|
||||
'ELT',
|
||||
'ENCODE',
|
||||
'ENCRYPT',
|
||||
'EXP',
|
||||
'EXPORT_SET',
|
||||
'EXTRACT',
|
||||
'FIELD',
|
||||
'FIND_IN_SET',
|
||||
'FLOOR',
|
||||
'FORMAT',
|
||||
'FOUND_ROWS',
|
||||
'FROM_DAYS',
|
||||
'FROM_UNIXTIME',
|
||||
'GET_LOCK',
|
||||
'GREATEST',
|
||||
'GROUP_UNIQUE_USERS',
|
||||
'HEX',
|
||||
'IFNULL',
|
||||
'INET_ATON',
|
||||
'INET_NTOA',
|
||||
'INSTR',
|
||||
'INTERVAL',
|
||||
'IS_FREE_LOCK',
|
||||
'ISNULL',
|
||||
'LAST_INSERT_ID',
|
||||
'LCASE',
|
||||
'LEAST',
|
||||
'LEFT',
|
||||
'LENGTH',
|
||||
'LN',
|
||||
'LOAD_FILE',
|
||||
'LOCATE',
|
||||
'LOG',
|
||||
'LOG2',
|
||||
'LOG10',
|
||||
'LOWER',
|
||||
'LPAD',
|
||||
'LTRIM',
|
||||
'MAKE_SET',
|
||||
'MASTER_POS_WAIT',
|
||||
'MAX',
|
||||
'MD5',
|
||||
'MID',
|
||||
'MIN',
|
||||
'MOD',
|
||||
'MONTH',
|
||||
'MONTHNAME',
|
||||
'NOW',
|
||||
'NULLIF',
|
||||
'OCT',
|
||||
'OCTET_LENGTH',
|
||||
'ORD',
|
||||
'PASSWORD',
|
||||
'PERIOD_ADD',
|
||||
'PERIOD_DIFF',
|
||||
'PI',
|
||||
'POSITION',
|
||||
'POW',
|
||||
'POWER',
|
||||
'QUARTER',
|
||||
'QUOTE',
|
||||
'RADIANS',
|
||||
'RAND',
|
||||
'RELEASE_LOCK',
|
||||
'REPEAT',
|
||||
'REVERSE',
|
||||
'RIGHT',
|
||||
'ROUND',
|
||||
'RPAD',
|
||||
'RTRIM',
|
||||
'SEC_TO_TIME',
|
||||
'SESSION_USER',
|
||||
'SHA',
|
||||
'SHA1',
|
||||
'SIGN',
|
||||
'SIN',
|
||||
'SOUNDEX',
|
||||
'SPACE',
|
||||
'SQRT',
|
||||
'STD',
|
||||
'STDDEV',
|
||||
'STRCMP',
|
||||
'SUBDATE',
|
||||
'SUBSTRING',
|
||||
'SUBSTRING_INDEX',
|
||||
'SUM',
|
||||
'SYSDATE',
|
||||
'SYSTEM_USER',
|
||||
'TAN',
|
||||
'TIME_FORMAT',
|
||||
'TIME_TO_SEC',
|
||||
'TO_DAYS',
|
||||
'TRIM',
|
||||
'UCASE',
|
||||
'UNIQUE_USERS',
|
||||
'UNIX_TIMESTAMP',
|
||||
'UPPER',
|
||||
'USER',
|
||||
'VERSION',
|
||||
'WEEK',
|
||||
'WEEKDAY',
|
||||
'YEAR',
|
||||
'YEARWEEK'
|
||||
);
|
||||
//$PMA_SQPdata_function_name_cnt = count($PMA_SQPdata_function_name);
|
||||
$PMA_SQPdata_function_name_cnt = 151;
|
||||
$PMA_SQPdata_column_attrib = array (
|
||||
'AUTO_INCREMENT',
|
||||
'BDB',
|
||||
'BERKELEYDB',
|
||||
'BINARY',
|
||||
'DEFAULT',
|
||||
'INNOBASE',
|
||||
'INNODB',
|
||||
'ISAM',
|
||||
'MRG_MYISAM',
|
||||
'MYISAM',
|
||||
'NATIONAL',
|
||||
'PRECISION',
|
||||
'UNSIGNED',
|
||||
'VARYING',
|
||||
'ZEROFILL'
|
||||
);
|
||||
//$PMA_SQPdata_column_attrib_cnt = count($PMA_SQPdata_column_attrib);
|
||||
$PMA_SQPdata_column_attrib_cnt = 15;
|
||||
|
||||
$PMA_SQPdata_column_attrib = array (
|
||||
'AUTO_INCREMENT',
|
||||
'BDB',
|
||||
'BERKELEYDB',
|
||||
'BINARY',
|
||||
'DEFAULT',
|
||||
'INNOBASE',
|
||||
'INNODB',
|
||||
'ISAM',
|
||||
'MRG_MYISAM',
|
||||
'MYISAM',
|
||||
'NATIONAL',
|
||||
'PRECISION',
|
||||
'UNSIGNED',
|
||||
'VARYING',
|
||||
'ZEROFILL'
|
||||
);
|
||||
//$PMA_SQPdata_column_attrib_cnt = count($PMA_SQPdata_column_attrib);
|
||||
$PMA_SQPdata_column_attrib_cnt = 15;
|
||||
$PMA_SQPdata_reserved_word = array (
|
||||
'ACTION',
|
||||
'ADD',
|
||||
'AFTER',
|
||||
'AGAINST',
|
||||
'AGGREGATE',
|
||||
'ALL',
|
||||
'ALTER',
|
||||
'ANALYSE',
|
||||
'ANALYZE',
|
||||
'AND',
|
||||
'AS',
|
||||
'ASC',
|
||||
'AUTOCOMMIT',
|
||||
'AUTO_INCREMENT',
|
||||
'AVG_ROW_LENGTH',
|
||||
'BACKUP',
|
||||
'BEGIN',
|
||||
'BETWEEN',
|
||||
'BINLOG',
|
||||
'BOTH',
|
||||
'BY',
|
||||
'CASCADE',
|
||||
'CASE',
|
||||
'CHANGE',
|
||||
'CHANGED',
|
||||
'CHARSET',
|
||||
'CHECK',
|
||||
'CHECKSUM',
|
||||
'CLIENT',
|
||||
'COLLATION',
|
||||
'COLUMN',
|
||||
'COLUMNS',
|
||||
'COMMENT',
|
||||
'COMMIT',
|
||||
'COMMITTED',
|
||||
'COMPRESSED',
|
||||
'CONCURRENT',
|
||||
'CONSTRAINT',
|
||||
'CREATE',
|
||||
'CROSS',
|
||||
'DATA',
|
||||
'DATABASE',
|
||||
'DATABASES',
|
||||
'DAY',
|
||||
'DAY_HOUR',
|
||||
'DAY_MINUTE',
|
||||
'DAY_SECOND',
|
||||
'DELAYED',
|
||||
'DELAY_KEY_WRITE',
|
||||
'DELETE',
|
||||
'DESC',
|
||||
'DESCRIBE',
|
||||
'DISTINCT',
|
||||
'DISTINCTROW',
|
||||
'DIV',
|
||||
'DO',
|
||||
'DROP',
|
||||
'DUMPFILE',
|
||||
'DYNAMIC',
|
||||
'ELSE',
|
||||
'ENCLOSED',
|
||||
'END',
|
||||
'ESCAPE',
|
||||
'ESCAPED',
|
||||
'EVENTS',
|
||||
'EXECUTE',
|
||||
'EXISTS',
|
||||
'EXPLAIN',
|
||||
'EXTENDED',
|
||||
'FAST',
|
||||
'FIELDS',
|
||||
'FILE',
|
||||
'FIRST',
|
||||
'FIXED',
|
||||
'FLUSH',
|
||||
'FOR',
|
||||
'FOREIGN',
|
||||
'FROM',
|
||||
'FULL',
|
||||
'FULLTEXT',
|
||||
'FUNCTION',
|
||||
'GEMINI',
|
||||
'GEMINI_SPIN_RETRIES',
|
||||
'GLOBAL',
|
||||
'GRANT',
|
||||
'GRANTS',
|
||||
'GROUP',
|
||||
'HAVING',
|
||||
'HEAP',
|
||||
'HIGH_PRIORITY',
|
||||
'HOSTS',
|
||||
'HOUR',
|
||||
'HOUR_MINUTE',
|
||||
'HOUR_SECOND',
|
||||
'IDENTIFIED',
|
||||
'IF',
|
||||
'IGNORE',
|
||||
'IN',
|
||||
'INDEX',
|
||||
'INDEXES',
|
||||
'INFILE',
|
||||
'INNER',
|
||||
'INSERT',
|
||||
'INSERT_ID',
|
||||
'INSERT_METHOD',
|
||||
'INTERVAL',
|
||||
'INTO',
|
||||
'IS',
|
||||
'ISOLATION',
|
||||
'JOIN',
|
||||
'KEY',
|
||||
'KEYS',
|
||||
'KILL',
|
||||
'LAST_INSERT_ID',
|
||||
'LEADING',
|
||||
'LEFT',
|
||||
'LEVEL',
|
||||
'LIKE',
|
||||
'LIMIT',
|
||||
'LINES',
|
||||
'LOAD',
|
||||
'LOCAL',
|
||||
'LOCK',
|
||||
'LOCKS',
|
||||
'LOGS',
|
||||
'LOW_PRIORITY',
|
||||
'MASTER',
|
||||
'MASTER_CONNECT_RETRY',
|
||||
'MASTER_HOST',
|
||||
'MASTER_LOG_FILE',
|
||||
'MASTER_LOG_POS',
|
||||
'MASTER_PASSWORD',
|
||||
'MASTER_PORT',
|
||||
'MASTER_USER',
|
||||
'MATCH',
|
||||
'MAX_CONNECTIONS_PER_HOUR',
|
||||
'MAX_QUERIES_PER_HOUR',
|
||||
'MAX_ROWS',
|
||||
'MAX_UPDATES_PER_HOUR',
|
||||
'MEDIUM',
|
||||
'MERGE',
|
||||
'MIN_ROWS',
|
||||
'MINUTE',
|
||||
'MINUTE_SECOND',
|
||||
'MODE',
|
||||
'MODIFY',
|
||||
'MONTH',
|
||||
'MRG_MYISAM',
|
||||
'MYISAM',
|
||||
'NATURAL',
|
||||
// 'NO' is not allowed in SQL-99 but is allowed in MySQL
|
||||
//'NO',
|
||||
'NOT',
|
||||
'NULL',
|
||||
'ON',
|
||||
'OPEN',
|
||||
'OPTIMIZE',
|
||||
'OPTION',
|
||||
'OPTIONALLY',
|
||||
'OR',
|
||||
'ORDER',
|
||||
'OUTER',
|
||||
'OUTFILE',
|
||||
'PACK_KEYS',
|
||||
'PARTIAL',
|
||||
'PASSWORD',
|
||||
'PRIMARY',
|
||||
'PRIVILEGES',
|
||||
'PROCEDURE',
|
||||
'PROCESS',
|
||||
'PROCESSLIST',
|
||||
'PURGE',
|
||||
'QUICK',
|
||||
'RAID0',
|
||||
'RAID_CHUNKS',
|
||||
'RAID_CHUNKSIZE',
|
||||
'RAID_TYPE',
|
||||
'READ',
|
||||
'REFERENCES',
|
||||
'REGEXP',
|
||||
'RELOAD',
|
||||
'RENAME',
|
||||
'REPAIR',
|
||||
'REPEATABLE',
|
||||
'REPLACE',
|
||||
'REPLICATION',
|
||||
'RESET',
|
||||
'RESTORE',
|
||||
'RESTRICT',
|
||||
'RETURNS',
|
||||
'REVOKE',
|
||||
'RIGHT',
|
||||
'RLIKE',
|
||||
'ROLLBACK',
|
||||
'ROW',
|
||||
'ROW_FORMAT',
|
||||
'ROWS',
|
||||
'SECOND',
|
||||
'SELECT',
|
||||
'SERIALIZABLE',
|
||||
'SHARE',
|
||||
'SHOW',
|
||||
'SHUTDOWN',
|
||||
'SLAVE',
|
||||
'SONAME',
|
||||
'SQL_AUTO_IS_NULL',
|
||||
'SQL_BIG_RESULT',
|
||||
'SQL_BIG_SELECTS',
|
||||
'SQL_BIG_TABLES',
|
||||
'SQL_BUFFER_RESULT',
|
||||
'SQL_CACHE',
|
||||
'SQL_LOG_BIN',
|
||||
'SQL_LOG_OFF',
|
||||
'SQL_LOG_UPDATE',
|
||||
'SQL_LOW_PRIORITY_UPDATES',
|
||||
'SQL_MAX_JOIN_SIZE',
|
||||
'SQL_NO_CACHE',
|
||||
'SQL_QUOTE_SHOW_CREATE',
|
||||
'SQL_SAFE_UPDATES',
|
||||
'SQL_SELECT_LIMIT',
|
||||
'SQL_SLAVE_SKIP_COUNTER',
|
||||
'SQL_SMALL_RESULT',
|
||||
'SQL_WARNINGS',
|
||||
'START',
|
||||
'STARTING',
|
||||
'STATUS',
|
||||
'STOP',
|
||||
'STRAIGHT_JOIN',
|
||||
'STRING',
|
||||
'STRIPED',
|
||||
'SUPER',
|
||||
'TABLE',
|
||||
'TABLES',
|
||||
'TEMPORARY',
|
||||
'TERMINATED',
|
||||
'THEN',
|
||||
'TO',
|
||||
'TRAILING',
|
||||
'TRUNCATE',
|
||||
'TYPE',
|
||||
'UNCOMMITTED',
|
||||
'UNION',
|
||||
'UNIQUE',
|
||||
'UNLOCK',
|
||||
'UPDATE',
|
||||
'USAGE',
|
||||
'USE',
|
||||
'USING',
|
||||
'VALUES',
|
||||
'VARIABLES',
|
||||
'WHEN',
|
||||
'WHERE',
|
||||
'WITH',
|
||||
'WORK',
|
||||
'WRITE',
|
||||
'XOR',
|
||||
'YEAR_MONTH'
|
||||
);
|
||||
//$PMA_SQPdata_reserved_word_cnt = count($PMA_SQPdata_reserved_word);
|
||||
$PMA_SQPdata_reserved_word_cnt = 255;
|
||||
|
||||
$PMA_SQPdata_reserved_word = array (
|
||||
'ACTION',
|
||||
'ADD',
|
||||
'AFTER',
|
||||
'AGAINST',
|
||||
'AGGREGATE',
|
||||
'ALL',
|
||||
'ALTER',
|
||||
'ANALYSE',
|
||||
'ANALYZE',
|
||||
'AND',
|
||||
'AS',
|
||||
'ASC',
|
||||
'AUTOCOMMIT',
|
||||
'AUTO_INCREMENT',
|
||||
'AVG_ROW_LENGTH',
|
||||
'BACKUP',
|
||||
'BEGIN',
|
||||
'BETWEEN',
|
||||
'BINLOG',
|
||||
'BOTH',
|
||||
'BY',
|
||||
'CASCADE',
|
||||
'CASE',
|
||||
'CHANGE',
|
||||
'CHANGED',
|
||||
'CHARSET',
|
||||
'CHECK',
|
||||
'CHECKSUM',
|
||||
'CLIENT',
|
||||
'COLLATION',
|
||||
'COLUMN',
|
||||
'COLUMNS',
|
||||
'COMMENT',
|
||||
'COMMIT',
|
||||
'COMMITTED',
|
||||
'COMPRESSED',
|
||||
'CONCURRENT',
|
||||
'CONSTRAINT',
|
||||
'CREATE',
|
||||
'CROSS',
|
||||
'DATA',
|
||||
'DATABASE',
|
||||
'DATABASES',
|
||||
'DAY',
|
||||
'DAY_HOUR',
|
||||
'DAY_MINUTE',
|
||||
'DAY_SECOND',
|
||||
'DELAYED',
|
||||
'DELAY_KEY_WRITE',
|
||||
'DELETE',
|
||||
'DESC',
|
||||
'DESCRIBE',
|
||||
'DISTINCT',
|
||||
'DISTINCTROW',
|
||||
'DIV',
|
||||
'DO',
|
||||
'DROP',
|
||||
'DUMPFILE',
|
||||
'DYNAMIC',
|
||||
'ELSE',
|
||||
'ENCLOSED',
|
||||
'END',
|
||||
'ESCAPE',
|
||||
'ESCAPED',
|
||||
'EVENTS',
|
||||
'EXECUTE',
|
||||
'EXISTS',
|
||||
'EXPLAIN',
|
||||
'EXTENDED',
|
||||
'FAST',
|
||||
'FIELDS',
|
||||
'FILE',
|
||||
'FIRST',
|
||||
'FIXED',
|
||||
'FLUSH',
|
||||
'FOR',
|
||||
'FOREIGN',
|
||||
'FROM',
|
||||
'FULL',
|
||||
'FULLTEXT',
|
||||
'FUNCTION',
|
||||
'GEMINI',
|
||||
'GEMINI_SPIN_RETRIES',
|
||||
'GLOBAL',
|
||||
'GRANT',
|
||||
'GRANTS',
|
||||
'GROUP',
|
||||
'HAVING',
|
||||
'HEAP',
|
||||
'HIGH_PRIORITY',
|
||||
'HOSTS',
|
||||
'HOUR',
|
||||
'HOUR_MINUTE',
|
||||
'HOUR_SECOND',
|
||||
'IDENTIFIED',
|
||||
'IF',
|
||||
'IGNORE',
|
||||
'IN',
|
||||
'INDEX',
|
||||
'INDEXES',
|
||||
'INFILE',
|
||||
'INNER',
|
||||
'INSERT',
|
||||
'INSERT_ID',
|
||||
'INSERT_METHOD',
|
||||
'INTERVAL',
|
||||
'INTO',
|
||||
'IS',
|
||||
'ISOLATION',
|
||||
'JOIN',
|
||||
'KEY',
|
||||
'KEYS',
|
||||
'KILL',
|
||||
'LAST_INSERT_ID',
|
||||
'LEADING',
|
||||
'LEFT',
|
||||
'LEVEL',
|
||||
'LIKE',
|
||||
'LIMIT',
|
||||
'LINES',
|
||||
'LOAD',
|
||||
'LOCAL',
|
||||
'LOCK',
|
||||
'LOCKS',
|
||||
'LOGS',
|
||||
'LOW_PRIORITY',
|
||||
'MASTER',
|
||||
'MASTER_CONNECT_RETRY',
|
||||
'MASTER_HOST',
|
||||
'MASTER_LOG_FILE',
|
||||
'MASTER_LOG_POS',
|
||||
'MASTER_PASSWORD',
|
||||
'MASTER_PORT',
|
||||
'MASTER_USER',
|
||||
'MATCH',
|
||||
'MAX_CONNECTIONS_PER_HOUR',
|
||||
'MAX_QUERIES_PER_HOUR',
|
||||
'MAX_ROWS',
|
||||
'MAX_UPDATES_PER_HOUR',
|
||||
'MEDIUM',
|
||||
'MERGE',
|
||||
'MIN_ROWS',
|
||||
'MINUTE',
|
||||
'MINUTE_SECOND',
|
||||
'MODE',
|
||||
'MODIFY',
|
||||
'MONTH',
|
||||
'MRG_MYISAM',
|
||||
'MYISAM',
|
||||
'NATURAL',
|
||||
// 'NO' is not allowed in SQL-99 but is allowed in MySQL
|
||||
//'NO',
|
||||
'NOT',
|
||||
'NULL',
|
||||
'ON',
|
||||
'OPEN',
|
||||
'OPTIMIZE',
|
||||
'OPTION',
|
||||
'OPTIONALLY',
|
||||
'OR',
|
||||
'ORDER',
|
||||
'OUTER',
|
||||
'OUTFILE',
|
||||
'PACK_KEYS',
|
||||
'PARTIAL',
|
||||
'PASSWORD',
|
||||
'PRIMARY',
|
||||
'PRIVILEGES',
|
||||
'PROCEDURE',
|
||||
'PROCESS',
|
||||
'PROCESSLIST',
|
||||
'PURGE',
|
||||
'QUICK',
|
||||
'RAID0',
|
||||
'RAID_CHUNKS',
|
||||
'RAID_CHUNKSIZE',
|
||||
'RAID_TYPE',
|
||||
'READ',
|
||||
'REFERENCES',
|
||||
'REGEXP',
|
||||
'RELOAD',
|
||||
'RENAME',
|
||||
'REPAIR',
|
||||
'REPEATABLE',
|
||||
'REPLACE',
|
||||
'REPLICATION',
|
||||
'RESET',
|
||||
'RESTORE',
|
||||
'RESTRICT',
|
||||
'RETURNS',
|
||||
'REVOKE',
|
||||
'RIGHT',
|
||||
'RLIKE',
|
||||
'ROLLBACK',
|
||||
'ROW',
|
||||
'ROW_FORMAT',
|
||||
'ROWS',
|
||||
'SECOND',
|
||||
'SELECT',
|
||||
'SERIALIZABLE',
|
||||
'SHARE',
|
||||
'SHOW',
|
||||
'SHUTDOWN',
|
||||
'SLAVE',
|
||||
'SONAME',
|
||||
'SQL_AUTO_IS_NULL',
|
||||
'SQL_BIG_RESULT',
|
||||
'SQL_BIG_SELECTS',
|
||||
'SQL_BIG_TABLES',
|
||||
'SQL_BUFFER_RESULT',
|
||||
'SQL_CACHE',
|
||||
'SQL_LOG_BIN',
|
||||
'SQL_LOG_OFF',
|
||||
'SQL_LOG_UPDATE',
|
||||
'SQL_LOW_PRIORITY_UPDATES',
|
||||
'SQL_MAX_JOIN_SIZE',
|
||||
'SQL_NO_CACHE',
|
||||
'SQL_QUOTE_SHOW_CREATE',
|
||||
'SQL_SAFE_UPDATES',
|
||||
'SQL_SELECT_LIMIT',
|
||||
'SQL_SLAVE_SKIP_COUNTER',
|
||||
'SQL_SMALL_RESULT',
|
||||
'SQL_WARNINGS',
|
||||
'START',
|
||||
'STARTING',
|
||||
'STATUS',
|
||||
'STOP',
|
||||
'STRAIGHT_JOIN',
|
||||
'STRING',
|
||||
'STRIPED',
|
||||
'SUPER',
|
||||
'TABLE',
|
||||
'TABLES',
|
||||
'TEMPORARY',
|
||||
'TERMINATED',
|
||||
'THEN',
|
||||
'TO',
|
||||
'TRAILING',
|
||||
'TRUNCATE',
|
||||
'TYPE',
|
||||
'UNCOMMITTED',
|
||||
'UNION',
|
||||
'UNIQUE',
|
||||
'UNLOCK',
|
||||
'UPDATE',
|
||||
'USAGE',
|
||||
'USE',
|
||||
'USING',
|
||||
'VALUES',
|
||||
'VARIABLES',
|
||||
'WHEN',
|
||||
'WHERE',
|
||||
'WITH',
|
||||
'WORK',
|
||||
'WRITE',
|
||||
'XOR',
|
||||
'YEAR_MONTH'
|
||||
);
|
||||
//$PMA_SQPdata_reserved_word_cnt = count($PMA_SQPdata_reserved_word);
|
||||
$PMA_SQPdata_reserved_word_cnt = 255;
|
||||
$PMA_SQPdata_column_type = array (
|
||||
'BIGINT',
|
||||
'BIT',
|
||||
'BLOB',
|
||||
'BOOL',
|
||||
'CHAR',
|
||||
'CHARACTER',
|
||||
'DATE',
|
||||
'DATETIME',
|
||||
'DEC',
|
||||
'DECIMAL',
|
||||
'DOUBLE',
|
||||
'ENUM',
|
||||
'FLOAT',
|
||||
'FLOAT4',
|
||||
'FLOAT8',
|
||||
'INT',
|
||||
'INT1',
|
||||
'INT2',
|
||||
'INT3',
|
||||
'INT4',
|
||||
'INT8',
|
||||
'INTEGER',
|
||||
'LONG',
|
||||
'LONGBLOB',
|
||||
'LONGTEXT',
|
||||
'MEDIUMBLOB',
|
||||
'MEDIUMINT',
|
||||
'MEDIUMTEXT',
|
||||
'MIDDLEINT',
|
||||
'NCHAR',
|
||||
'NUMERIC',
|
||||
'REAL',
|
||||
'SET',
|
||||
'SMALLINT',
|
||||
'TEXT',
|
||||
'TIME',
|
||||
'TIMESTAMP',
|
||||
'TINYBLOB',
|
||||
'TINYINT',
|
||||
'TINYTEXT',
|
||||
'VARBINARY',
|
||||
'VARCHAR',
|
||||
'YEAR'
|
||||
);
|
||||
//$PMA_SQPdata_column_type_cnt = count($PMA_SQPdata_column_type);
|
||||
$PMA_SQPdata_column_type_cnt = 43;
|
||||
|
||||
$PMA_SQPdata_column_type = array (
|
||||
'BIGINT',
|
||||
'BIT',
|
||||
'BLOB',
|
||||
'BOOL',
|
||||
'CHAR',
|
||||
'CHARACTER',
|
||||
'DATE',
|
||||
'DATETIME',
|
||||
'DEC',
|
||||
'DECIMAL',
|
||||
'DOUBLE',
|
||||
'ENUM',
|
||||
'FLOAT',
|
||||
'FLOAT4',
|
||||
'FLOAT8',
|
||||
'INT',
|
||||
'INT1',
|
||||
'INT2',
|
||||
'INT3',
|
||||
'INT4',
|
||||
'INT8',
|
||||
'INTEGER',
|
||||
'LONG',
|
||||
'LONGBLOB',
|
||||
'LONGTEXT',
|
||||
'MEDIUMBLOB',
|
||||
'MEDIUMINT',
|
||||
'MEDIUMTEXT',
|
||||
'MIDDLEINT',
|
||||
'NCHAR',
|
||||
'NUMERIC',
|
||||
'REAL',
|
||||
'SET',
|
||||
'SMALLINT',
|
||||
'TEXT',
|
||||
'TIME',
|
||||
'TIMESTAMP',
|
||||
'TINYBLOB',
|
||||
'TINYINT',
|
||||
'TINYTEXT',
|
||||
'VARBINARY',
|
||||
'VARCHAR',
|
||||
'YEAR'
|
||||
);
|
||||
//$PMA_SQPdata_column_type_cnt = count($PMA_SQPdata_column_type);
|
||||
$PMA_SQPdata_column_type_cnt = 43;
|
||||
|
||||
} // $__PMA_SQP_DATA__
|
||||
?>
|
||||
?>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -16,8 +16,8 @@
|
||||
* run this: "pear install Mail_Mime Net_DIME SOAP"
|
||||
*
|
||||
* If you got this file from somewhere other than phpMyAdmin
|
||||
* please be aware that the latest copy will always be in the
|
||||
* phpMyAdmin CVS tree as
|
||||
* please be aware that the latest copy will always be in the
|
||||
* phpMyAdmin CVS tree as
|
||||
* $Source$
|
||||
*
|
||||
* This code that also used to depend on the PHP overload module, but that has been
|
||||
@@ -30,387 +30,382 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
if (!defined('PMA_SQL_VALIDATOR_CLASS_INCLUDED')) {
|
||||
define('PMA_SQL_VALIDATOR_CLASS_INCLUDED', 1);
|
||||
@include_once('SOAP/Client.php');
|
||||
|
||||
@include('SOAP/Client.php');
|
||||
if (!function_exists('class_exists') || !class_exists('SOAP_Client')) {
|
||||
$GLOBALS['sqlvalidator_error'] = TRUE;
|
||||
} else {
|
||||
// Ok, we have SOAP Support, so let's use it!
|
||||
|
||||
if (!function_exists('class_exists') || !class_exists('SOAP_Client')) {
|
||||
$GLOBALS['sqlvalidator_error'] = TRUE;
|
||||
} else {
|
||||
// Ok, we have SOAP Support, so let's use it!
|
||||
class PMA_SQLValidator {
|
||||
|
||||
class PMA_SQLValidator {
|
||||
var $url;
|
||||
var $service_name;
|
||||
var $wsdl;
|
||||
var $output_type;
|
||||
|
||||
var $url;
|
||||
var $service_name;
|
||||
var $wsdl;
|
||||
var $output_type;
|
||||
var $username;
|
||||
var $password;
|
||||
var $calling_program;
|
||||
var $calling_program_version;
|
||||
var $target_dbms;
|
||||
var $target_dbms_version;
|
||||
var $connectionTechnology;
|
||||
var $connection_technology_version;
|
||||
var $interactive;
|
||||
|
||||
var $username;
|
||||
var $password;
|
||||
var $calling_program;
|
||||
var $calling_program_version;
|
||||
var $target_dbms;
|
||||
var $target_dbms_version;
|
||||
var $connectionTechnology;
|
||||
var $connection_technology_version;
|
||||
var $interactive;
|
||||
|
||||
var $service_link = NULL;
|
||||
var $session_data = NULL;
|
||||
var $service_link = NULL;
|
||||
var $session_data = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* Private functions - You don't need to mess with these
|
||||
*/
|
||||
/**
|
||||
* Private functions - You don't need to mess with these
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service opening
|
||||
*
|
||||
* @param string URL of Mimer SQL Validator WSDL file
|
||||
*
|
||||
* @return object Object to use
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function _openService($url)
|
||||
{
|
||||
$obj = new SOAP_Client($url, TRUE);
|
||||
return $obj;
|
||||
} // end of the "openService()" function
|
||||
/**
|
||||
* Service opening
|
||||
*
|
||||
* @param string URL of Mimer SQL Validator WSDL file
|
||||
*
|
||||
* @return object Object to use
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function _openService($url)
|
||||
{
|
||||
$obj = new SOAP_Client($url, TRUE);
|
||||
return $obj;
|
||||
} // end of the "openService()" function
|
||||
|
||||
|
||||
/**
|
||||
* Service initializer to connect to server
|
||||
*
|
||||
* @param object Service object
|
||||
* @param string Username
|
||||
* @param string Password
|
||||
* @param string Name of calling program
|
||||
* @param string Version of calling program
|
||||
* @param string Target DBMS
|
||||
* @param string Version of target DBMS
|
||||
* @param string Connection Technology
|
||||
* @param string version of Connection Technology
|
||||
* @param integer boolean of 1/0 to specify if we are an interactive system
|
||||
*
|
||||
* @return object stdClass return object with data
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function _openSession($obj, $username, $password,
|
||||
$calling_program, $calling_program_version,
|
||||
$target_dbms, $target_dbms_version,
|
||||
$connection_technology, $connection_technology_version,
|
||||
$interactive)
|
||||
{
|
||||
$use_array = array( "a_userName" => $username, "a_password" => $password, "a_callingProgram" => $calling_program, "a_callingProgramVersion" => $calling_program_version, "a_targetDbms" => $target_dbms, "a_targetDbmsVersion" => $target_dbms_version, "a_connectionTechnology" => $connection_technology, "a_connectionTechnologyVersion" => $connection_technology_version, "a_interactive" => $interactive);
|
||||
$ret = $obj->call("openSession",$use_array);
|
||||
|
||||
// This is the old version that needed the overload extension
|
||||
/* $ret = $obj->openSession($username, $password,
|
||||
$calling_program, $calling_program_version,
|
||||
$target_dbms, $target_dbms_version,
|
||||
$connection_technology, $connection_technology_version,
|
||||
$interactive); */
|
||||
/**
|
||||
* Service initializer to connect to server
|
||||
*
|
||||
* @param object Service object
|
||||
* @param string Username
|
||||
* @param string Password
|
||||
* @param string Name of calling program
|
||||
* @param string Version of calling program
|
||||
* @param string Target DBMS
|
||||
* @param string Version of target DBMS
|
||||
* @param string Connection Technology
|
||||
* @param string version of Connection Technology
|
||||
* @param integer boolean of 1/0 to specify if we are an interactive system
|
||||
*
|
||||
* @return object stdClass return object with data
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function _openSession($obj, $username, $password,
|
||||
$calling_program, $calling_program_version,
|
||||
$target_dbms, $target_dbms_version,
|
||||
$connection_technology, $connection_technology_version,
|
||||
$interactive)
|
||||
{
|
||||
$use_array = array( "a_userName" => $username, "a_password" => $password, "a_callingProgram" => $calling_program, "a_callingProgramVersion" => $calling_program_version, "a_targetDbms" => $target_dbms, "a_targetDbmsVersion" => $target_dbms_version, "a_connectionTechnology" => $connection_technology, "a_connectionTechnologyVersion" => $connection_technology_version, "a_interactive" => $interactive);
|
||||
$ret = $obj->call("openSession",$use_array);
|
||||
|
||||
return $ret;
|
||||
} // end of the "_openSession()" function
|
||||
// This is the old version that needed the overload extension
|
||||
/* $ret = $obj->openSession($username, $password,
|
||||
$calling_program, $calling_program_version,
|
||||
$target_dbms, $target_dbms_version,
|
||||
$connection_technology, $connection_technology_version,
|
||||
$interactive); */
|
||||
|
||||
return $ret;
|
||||
} // end of the "_openSession()" function
|
||||
|
||||
|
||||
/**
|
||||
* Validator sytem call
|
||||
*
|
||||
* @param object Service object
|
||||
* @param object Session object
|
||||
* @param string SQL Query to validate
|
||||
* @param string Data return type
|
||||
*
|
||||
* @return object stClass return with data
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function _validateSQL($obj, $session, $sql, $method)
|
||||
{
|
||||
$use_array = array("a_sessionId" => $session->sessionId, "a_sessionKey" => $session->sessionKey, "a_SQL" => $sql, "a_resultType" => $this->output_type);
|
||||
$res = $obj->call("validateSQL",$use_array);
|
||||
/**
|
||||
* Validator sytem call
|
||||
*
|
||||
* @param object Service object
|
||||
* @param object Session object
|
||||
* @param string SQL Query to validate
|
||||
* @param string Data return type
|
||||
*
|
||||
* @return object stClass return with data
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function _validateSQL($obj, $session, $sql, $method)
|
||||
{
|
||||
$use_array = array("a_sessionId" => $session->sessionId, "a_sessionKey" => $session->sessionKey, "a_SQL" => $sql, "a_resultType" => $this->output_type);
|
||||
$res = $obj->call("validateSQL",$use_array);
|
||||
|
||||
// This is the old version that needed the overload extension
|
||||
// $res = $obj->validateSQL($session->sessionId, $session->sessionKey, $sql, $this->output_type);
|
||||
return $res;
|
||||
} // end of the "validateSQL()" function
|
||||
// This is the old version that needed the overload extension
|
||||
// $res = $obj->validateSQL($session->sessionId, $session->sessionKey, $sql, $this->output_type);
|
||||
return $res;
|
||||
} // end of the "validateSQL()" function
|
||||
|
||||
|
||||
/**
|
||||
* Validator sytem call
|
||||
*
|
||||
* @param string SQL Query to validate
|
||||
*
|
||||
* @return object stdClass return with data
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @see validateSQL()
|
||||
*/
|
||||
function _validate($sql)
|
||||
{
|
||||
$ret = $this->_validateSQL($this->service_link, $this->session_data,
|
||||
$sql, $this->output_type);
|
||||
return $ret;
|
||||
} // end of the "validate()" function
|
||||
/**
|
||||
* Validator sytem call
|
||||
*
|
||||
* @param string SQL Query to validate
|
||||
*
|
||||
* @return object stdClass return with data
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @see validateSQL()
|
||||
*/
|
||||
function _validate($sql)
|
||||
{
|
||||
$ret = $this->_validateSQL($this->service_link, $this->session_data,
|
||||
$sql, $this->output_type);
|
||||
return $ret;
|
||||
} // end of the "validate()" function
|
||||
|
||||
|
||||
/**
|
||||
* Public functions
|
||||
*/
|
||||
/**
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_SQLValidator()
|
||||
{
|
||||
$this->url = 'http://sqlvalidator.mimer.com/v1/services';
|
||||
$this->service_name = 'SQL99Validator';
|
||||
$this->wsdl = '?wsdl';
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_SQLValidator()
|
||||
{
|
||||
$this->url = 'http://sqlvalidator.mimer.com/v1/services';
|
||||
$this->service_name = 'SQL99Validator';
|
||||
$this->wsdl = '?wsdl';
|
||||
|
||||
$this->output_type = 'html';
|
||||
$this->output_type = 'html';
|
||||
|
||||
$this->username = 'anonymous';
|
||||
$this->password = '';
|
||||
$this->calling_program = 'PHP_SQLValidator';
|
||||
$this->calling_program_version = '$Revision$';
|
||||
$this->target_dbms = 'N/A';
|
||||
$this->target_dbms_version = 'N/A';
|
||||
$this->connection_technology = 'PHP';
|
||||
$this->connection_technology_version = phpversion();
|
||||
$this->interactive = 1;
|
||||
$this->username = 'anonymous';
|
||||
$this->password = '';
|
||||
$this->calling_program = 'PHP_SQLValidator';
|
||||
$this->calling_program_version = '$Revision$';
|
||||
$this->target_dbms = 'N/A';
|
||||
$this->target_dbms_version = 'N/A';
|
||||
$this->connection_technology = 'PHP';
|
||||
$this->connection_technology_version = phpversion();
|
||||
$this->interactive = 1;
|
||||
|
||||
$this->service_link = NULL;
|
||||
$this->session_data = NULL;
|
||||
} // end of the "PMA_SQLValidator()" function
|
||||
$this->service_link = NULL;
|
||||
$this->session_data = NULL;
|
||||
} // end of the "PMA_SQLValidator()" function
|
||||
|
||||
|
||||
/**
|
||||
* Sets credentials
|
||||
*
|
||||
* @param string the username
|
||||
* @param string the password
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setCredentials($username, $password)
|
||||
{
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
} // end of the "setCredentials()" function
|
||||
/**
|
||||
* Sets credentials
|
||||
*
|
||||
* @param string the username
|
||||
* @param string the password
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setCredentials($username, $password)
|
||||
{
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
} // end of the "setCredentials()" function
|
||||
|
||||
|
||||
/**
|
||||
* Sets the calling program
|
||||
*
|
||||
* @param string the calling program name
|
||||
* @param string the calling program revision
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setCallingProgram($calling_program, $calling_program_version)
|
||||
{
|
||||
$this->calling_program = $calling_program;
|
||||
$this->calling_program_version = $calling_program_version;
|
||||
} // end of the "setCallingProgram()" function
|
||||
/**
|
||||
* Sets the calling program
|
||||
*
|
||||
* @param string the calling program name
|
||||
* @param string the calling program revision
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setCallingProgram($calling_program, $calling_program_version)
|
||||
{
|
||||
$this->calling_program = $calling_program;
|
||||
$this->calling_program_version = $calling_program_version;
|
||||
} // end of the "setCallingProgram()" function
|
||||
|
||||
|
||||
/**
|
||||
* Appends the calling program
|
||||
*
|
||||
* @param string the calling program name
|
||||
* @param string the calling program revision
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function appendCallingProgram($calling_program, $calling_program_version)
|
||||
{
|
||||
$this->calling_program .= ' - ' . $calling_program;
|
||||
$this->calling_program_version .= ' - ' . $calling_program_version;
|
||||
} // end of the "appendCallingProgram()" function
|
||||
/**
|
||||
* Appends the calling program
|
||||
*
|
||||
* @param string the calling program name
|
||||
* @param string the calling program revision
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function appendCallingProgram($calling_program, $calling_program_version)
|
||||
{
|
||||
$this->calling_program .= ' - ' . $calling_program;
|
||||
$this->calling_program_version .= ' - ' . $calling_program_version;
|
||||
} // end of the "appendCallingProgram()" function
|
||||
|
||||
|
||||
/**
|
||||
* Sets the target DBMS
|
||||
*
|
||||
* @param string the target DBMS name
|
||||
* @param string the target DBMS revision
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setTargetDbms($target_dbms, $target_dbms_version)
|
||||
{
|
||||
$this->target_dbms = $target_dbms;
|
||||
$this->target_dbms_version = $target_dbms_version;
|
||||
} // end of the "setTargetDbms()" function
|
||||
/**
|
||||
* Sets the target DBMS
|
||||
*
|
||||
* @param string the target DBMS name
|
||||
* @param string the target DBMS revision
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setTargetDbms($target_dbms, $target_dbms_version)
|
||||
{
|
||||
$this->target_dbms = $target_dbms;
|
||||
$this->target_dbms_version = $target_dbms_version;
|
||||
} // end of the "setTargetDbms()" function
|
||||
|
||||
|
||||
/**
|
||||
* Appends the target DBMS
|
||||
*
|
||||
* @param string the target DBMS name
|
||||
* @param string the target DBMS revision
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function appendTargetDbms($target_dbms, $target_dbms_version)
|
||||
{
|
||||
$this->target_dbms .= ' - ' . $target_dbms;
|
||||
$this->target_dbms_version .= ' - ' . $target_dbms_version;
|
||||
} // end of the "appendTargetDbms()" function
|
||||
/**
|
||||
* Appends the target DBMS
|
||||
*
|
||||
* @param string the target DBMS name
|
||||
* @param string the target DBMS revision
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function appendTargetDbms($target_dbms, $target_dbms_version)
|
||||
{
|
||||
$this->target_dbms .= ' - ' . $target_dbms;
|
||||
$this->target_dbms_version .= ' - ' . $target_dbms_version;
|
||||
} // end of the "appendTargetDbms()" function
|
||||
|
||||
|
||||
/**
|
||||
* Sets the connection technology used
|
||||
*
|
||||
* @param string the connection technology name
|
||||
* @param string the connection technology revision
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setConnectionTechnology($connection_technology, $connection_technology_version)
|
||||
{
|
||||
$this->connection_technology = $connection_technology;
|
||||
$this->connection_technology_version = $connection_technology_version;
|
||||
} // end of the "setConnectionTechnology()" function
|
||||
/**
|
||||
* Sets the connection technology used
|
||||
*
|
||||
* @param string the connection technology name
|
||||
* @param string the connection technology revision
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setConnectionTechnology($connection_technology, $connection_technology_version)
|
||||
{
|
||||
$this->connection_technology = $connection_technology;
|
||||
$this->connection_technology_version = $connection_technology_version;
|
||||
} // end of the "setConnectionTechnology()" function
|
||||
|
||||
|
||||
/**
|
||||
* Appends the connection technology used
|
||||
*
|
||||
* @param string the connection technology name
|
||||
* @param string the connection technology revision
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function appendConnectionTechnology($connection_technology, $connection_technology_version)
|
||||
{
|
||||
$this->connection_technology .= ' - ' . $connection_technology;
|
||||
$this->connection_technology_version .= ' - ' . $connection_technology_version;
|
||||
} // end of the "appendConnectionTechnology()" function
|
||||
/**
|
||||
* Appends the connection technology used
|
||||
*
|
||||
* @param string the connection technology name
|
||||
* @param string the connection technology revision
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function appendConnectionTechnology($connection_technology, $connection_technology_version)
|
||||
{
|
||||
$this->connection_technology .= ' - ' . $connection_technology;
|
||||
$this->connection_technology_version .= ' - ' . $connection_technology_version;
|
||||
} // end of the "appendConnectionTechnology()" function
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether interactive mode should be used or not
|
||||
*
|
||||
* @param integer whether interactive mode should be used or not
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setInteractive($interactive)
|
||||
{
|
||||
$this->interactive = $interactive;
|
||||
} // end of the "setInteractive()" function
|
||||
/**
|
||||
* Sets whether interactive mode should be used or not
|
||||
*
|
||||
* @param integer whether interactive mode should be used or not
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setInteractive($interactive)
|
||||
{
|
||||
$this->interactive = $interactive;
|
||||
} // end of the "setInteractive()" function
|
||||
|
||||
|
||||
/**
|
||||
* Sets the output type to use
|
||||
*
|
||||
* @param string the output type to use
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setOutputType($output_type)
|
||||
{
|
||||
$this->output_type = $output_type;
|
||||
} // end of the "setOutputType()" function
|
||||
/**
|
||||
* Sets the output type to use
|
||||
*
|
||||
* @param string the output type to use
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setOutputType($output_type)
|
||||
{
|
||||
$this->output_type = $output_type;
|
||||
} // end of the "setOutputType()" function
|
||||
|
||||
|
||||
/**
|
||||
* Starts service
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function startService()
|
||||
{
|
||||
/**
|
||||
* Starts service
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function startService()
|
||||
{
|
||||
|
||||
$this->service_link = $this->_openService($this->url . '/' . $this->service_name . $this->wsdl);
|
||||
$this->service_link = $this->_openService($this->url . '/' . $this->service_name . $this->wsdl);
|
||||
|
||||
} // end of the "startService()" function
|
||||
} // end of the "startService()" function
|
||||
|
||||
|
||||
/**
|
||||
* Starts session
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function startSession()
|
||||
{
|
||||
$this->session_data = $this->_openSession($this->service_link, $this->username, $this->password,
|
||||
$this->calling_program, $this->calling_program_version,
|
||||
$this->target_dbms, $this->target_dbms_version,
|
||||
$this->connection_technology, $this->connection_technology_version,
|
||||
$this->interactive);
|
||||
/**
|
||||
* Starts session
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function startSession()
|
||||
{
|
||||
$this->session_data = $this->_openSession($this->service_link, $this->username, $this->password,
|
||||
$this->calling_program, $this->calling_program_version,
|
||||
$this->target_dbms, $this->target_dbms_version,
|
||||
$this->connection_technology, $this->connection_technology_version,
|
||||
$this->interactive);
|
||||
|
||||
if (isset($this->session_data) && ($this->session_data != NULL)
|
||||
&& ($this->session_data->target != $this->url)) {
|
||||
// Reopens the service on the new URL that was provided
|
||||
$url = $this->session_data->target;
|
||||
$this->startService();
|
||||
}
|
||||
} // end of the "startSession()" function
|
||||
|
||||
|
||||
/**
|
||||
* Do start service and session
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function start()
|
||||
{
|
||||
if (isset($this->session_data) && ($this->session_data != NULL)
|
||||
&& ($this->session_data->target != $this->url)) {
|
||||
// Reopens the service on the new URL that was provided
|
||||
$url = $this->session_data->target;
|
||||
$this->startService();
|
||||
$this->startSession();
|
||||
} // end of the "start()" function
|
||||
}
|
||||
} // end of the "startSession()" function
|
||||
|
||||
|
||||
/**
|
||||
* Call to determine just if a query is valid or not.
|
||||
*
|
||||
* @param string SQL statement to validate
|
||||
*
|
||||
* @return string Validator string from Mimer
|
||||
*
|
||||
* @see _validate
|
||||
*/
|
||||
function isValid($sql)
|
||||
{
|
||||
$res = $this->_validate($sql);
|
||||
return $res->standard;
|
||||
} // end of the "isValid()" function
|
||||
/**
|
||||
* Do start service and session
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function start()
|
||||
{
|
||||
$this->startService();
|
||||
$this->startSession();
|
||||
} // end of the "start()" function
|
||||
|
||||
|
||||
/**
|
||||
* Call for complete validator response
|
||||
*
|
||||
* @param string SQL statement to validate
|
||||
*
|
||||
* @return string Validator string from Mimer
|
||||
*
|
||||
* @see _validate
|
||||
*/
|
||||
function validationString($sql)
|
||||
{
|
||||
$res = $this->_validate($sql);
|
||||
return $res->data;
|
||||
/**
|
||||
* Call to determine just if a query is valid or not.
|
||||
*
|
||||
* @param string SQL statement to validate
|
||||
*
|
||||
* @return string Validator string from Mimer
|
||||
*
|
||||
* @see _validate
|
||||
*/
|
||||
function isValid($sql)
|
||||
{
|
||||
$res = $this->_validate($sql);
|
||||
return $res->standard;
|
||||
} // end of the "isValid()" function
|
||||
|
||||
} // end of the "validationString()" function
|
||||
} // end class PMA_SQLValidator
|
||||
|
||||
//add an extra check to ensure that the class was defined without errors
|
||||
if (!class_exists('PMA_SQLValidator')) {
|
||||
$GLOBALS['sqlvalidator_error'] = TRUE;
|
||||
}
|
||||
/**
|
||||
* Call for complete validator response
|
||||
*
|
||||
* @param string SQL statement to validate
|
||||
*
|
||||
* @return string Validator string from Mimer
|
||||
*
|
||||
* @see _validate
|
||||
*/
|
||||
function validationString($sql)
|
||||
{
|
||||
$res = $this->_validate($sql);
|
||||
return $res->data;
|
||||
|
||||
} // end else
|
||||
} // end of the "validationString()" function
|
||||
} // end class PMA_SQLValidator
|
||||
|
||||
} // $__PMA_SQL_VALIDATOR_CLASS__
|
||||
//add an extra check to ensure that the class was defined without errors
|
||||
if (!class_exists('PMA_SQLValidator')) {
|
||||
$GLOBALS['sqlvalidator_error'] = TRUE;
|
||||
}
|
||||
|
||||
?>
|
||||
} // end else
|
||||
|
||||
?>
|
||||
|
@@ -32,78 +32,71 @@
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('PMA_SQL_VALIDATOR_INCLUDED')) {
|
||||
define('PMA_SQL_VALIDATOR_INCLUDED', 1);
|
||||
|
||||
// We need the PEAR libraries, so do a minimum version check first
|
||||
// I'm not sure if PEAR was available before this point
|
||||
// For now we actually use a configuration flag
|
||||
if ($cfg['SQLValidator']['use'] == TRUE) {
|
||||
// We cannot check && !defined(PMA_SQL_VALIDATOR_CLASS_INCLUDED))
|
||||
// as it will produce a nasty warning message
|
||||
include('./libraries/sqlvalidator.class.php');
|
||||
} // if ($cfg['SQLValidator']['use'] == TRUE)
|
||||
// We need the PEAR libraries, so do a minimum version check first
|
||||
// I'm not sure if PEAR was available before this point
|
||||
// For now we actually use a configuration flag
|
||||
if ($cfg['SQLValidator']['use'] == TRUE) {
|
||||
require_once('./libraries/sqlvalidator.class.php');
|
||||
} // if ($cfg['SQLValidator']['use'] == TRUE)
|
||||
|
||||
|
||||
/**
|
||||
* This function utilizes the Mimer SQL Validator service
|
||||
* to validate an SQL query
|
||||
*
|
||||
* <http://developer.mimer.com/validator/index.htm>
|
||||
*
|
||||
* @param string SQL query to validate
|
||||
*
|
||||
* @return string Validator result string
|
||||
*
|
||||
* @global array The PMA configuration array
|
||||
*/
|
||||
function PMA_validateSQL($sql)
|
||||
{
|
||||
global $cfg;
|
||||
/**
|
||||
* This function utilizes the Mimer SQL Validator service
|
||||
* to validate an SQL query
|
||||
*
|
||||
* <http://developer.mimer.com/validator/index.htm>
|
||||
*
|
||||
* @param string SQL query to validate
|
||||
*
|
||||
* @return string Validator result string
|
||||
*
|
||||
* @global array The PMA configuration array
|
||||
*/
|
||||
function PMA_validateSQL($sql)
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
$str = '';
|
||||
$str = '';
|
||||
|
||||
if ($cfg['SQLValidator']['use']) {
|
||||
if (isset($GLOBALS['sqlvalidator_error'])
|
||||
&& $GLOBALS['sqlvalidator_error']) {
|
||||
$str = sprintf($GLOBALS['strValidatorError'], '<a href="./Documentation.html#faqsqlvalidator" target="documentation">', '</a>');
|
||||
} else {
|
||||
// create new class instance
|
||||
$srv = new PMA_SQLValidator();
|
||||
if ($cfg['SQLValidator']['use']) {
|
||||
if (isset($GLOBALS['sqlvalidator_error'])
|
||||
&& $GLOBALS['sqlvalidator_error']) {
|
||||
$str = sprintf($GLOBALS['strValidatorError'], '<a href="./Documentation.html#faqsqlvalidator" target="documentation">', '</a>');
|
||||
} else {
|
||||
// create new class instance
|
||||
$srv = new PMA_SQLValidator();
|
||||
|
||||
// Checks for username settings
|
||||
// The class defaults to anonymous with an empty password
|
||||
// automatically
|
||||
if ($cfg['SQLValidator']['username'] != '') {
|
||||
$srv->setCredentials($cfg['SQLValidator']['username'], $cfg['SQLValidator']['password']);
|
||||
}
|
||||
|
||||
// Identify ourselves to the server properly...
|
||||
$srv->appendCallingProgram('phpMyAdmin', PMA_VERSION);
|
||||
|
||||
// ... and specify what database system we are using
|
||||
$srv->setTargetDbms('MySQL', PMA_MYSQL_STR_VERSION);
|
||||
|
||||
// Log on to service
|
||||
$srv->start();
|
||||
|
||||
// Do service validation
|
||||
$str = $srv->validationString($sql);
|
||||
// Checks for username settings
|
||||
// The class defaults to anonymous with an empty password
|
||||
// automatically
|
||||
if ($cfg['SQLValidator']['username'] != '') {
|
||||
$srv->setCredentials($cfg['SQLValidator']['username'], $cfg['SQLValidator']['password']);
|
||||
}
|
||||
|
||||
} // end if
|
||||
// Identify ourselves to the server properly...
|
||||
$srv->appendCallingProgram('phpMyAdmin', PMA_VERSION);
|
||||
|
||||
/*
|
||||
else {
|
||||
// The service is not available so note that properly
|
||||
$str = $GLOBALS['strValidatorDisabled'];
|
||||
} // end if... else...
|
||||
*/
|
||||
// ... and specify what database system we are using
|
||||
$srv->setTargetDbms('MySQL', PMA_MYSQL_STR_VERSION);
|
||||
|
||||
// Gives string back to caller
|
||||
return $str;
|
||||
} // end of the "PMA_validateSQL()" function
|
||||
// Log on to service
|
||||
$srv->start();
|
||||
|
||||
} // $__PMA_SQL_VALIDATOR__
|
||||
// Do service validation
|
||||
$str = $srv->validationString($sql);
|
||||
}
|
||||
|
||||
?>
|
||||
} // end if
|
||||
|
||||
/*
|
||||
else {
|
||||
// The service is not available so note that properly
|
||||
$str = $GLOBALS['strValidatorDisabled'];
|
||||
} // end if... else...
|
||||
*/
|
||||
|
||||
// Gives string back to caller
|
||||
return $str;
|
||||
} // end of the "PMA_validateSQL()" function
|
||||
|
||||
?>
|
||||
|
@@ -16,310 +16,305 @@
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('PMA_STR_LIB_INCLUDED')) {
|
||||
define('PMA_STR_LIB_INCLUDED', 1);
|
||||
// This is for handling input better
|
||||
if (defined('PMA_MULTIBYTE_ENCODING')) {
|
||||
$GLOBALS['PMA_strlen'] = 'mb_strlen';
|
||||
$GLOBALS['PMA_strpos'] = 'mb_strpos';
|
||||
$GLOBALS['PMA_strrpos'] = 'mb_strrpos';
|
||||
$GLOBALS['PMA_substr'] = 'mb_substr';
|
||||
} else {
|
||||
$GLOBALS['PMA_strlen'] = 'strlen';
|
||||
$GLOBALS['PMA_strpos'] = 'strpos';
|
||||
$GLOBALS['PMA_strrpos'] = 'strrpos';
|
||||
$GLOBALS['PMA_substr'] = 'substr';
|
||||
}
|
||||
|
||||
// This is for handling input better
|
||||
if (defined('PMA_MULTIBYTE_ENCODING')) {
|
||||
$GLOBALS['PMA_strlen'] = 'mb_strlen';
|
||||
$GLOBALS['PMA_strpos'] = 'mb_strpos';
|
||||
$GLOBALS['PMA_strrpos'] = 'mb_strrpos';
|
||||
$GLOBALS['PMA_substr'] = 'mb_substr';
|
||||
} else {
|
||||
$GLOBALS['PMA_strlen'] = 'strlen';
|
||||
$GLOBALS['PMA_strpos'] = 'strpos';
|
||||
$GLOBALS['PMA_strrpos'] = 'strrpos';
|
||||
$GLOBALS['PMA_substr'] = 'substr';
|
||||
|
||||
/**
|
||||
* This checks if a string actually exists inside another string
|
||||
* We try to do it in a PHP3-portable way.
|
||||
* We don't care about the position it is in.
|
||||
*
|
||||
* @param string string to search for
|
||||
* @param string string to search in
|
||||
*
|
||||
* @return boolean whether the needle is in the haystack or not
|
||||
*/
|
||||
function PMA_STR_strInStr($needle, $haystack)
|
||||
{
|
||||
// $GLOBALS['PMA_strpos']($haystack, $needle) !== FALSE
|
||||
// return (is_integer($GLOBALS['PMA_strpos']($haystack, $needle)));
|
||||
return $GLOBALS['PMA_strpos'](' ' . $haystack, $needle);
|
||||
} // end of the "PMA_STR_strInStr()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a given character position in the string is escaped or not
|
||||
*
|
||||
* @param string string to check for
|
||||
* @param integer the character to check for
|
||||
* @param integer starting position in the string
|
||||
*
|
||||
* @return boolean whether the character is escaped or not
|
||||
*/
|
||||
function PMA_STR_charIsEscaped($string, $pos, $start = 0)
|
||||
{
|
||||
$len = $GLOBALS['PMA_strlen']($string);
|
||||
// Base case:
|
||||
// Check for string length or invalid input or special case of input
|
||||
// (pos == $start)
|
||||
if (($pos == $start) || ($len <= $pos)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$p = $pos - 1;
|
||||
$escaped = FALSE;
|
||||
while (($p >= $start) && ($string[$p] == '\\')) {
|
||||
$escaped = !$escaped;
|
||||
$p--;
|
||||
} // end while
|
||||
|
||||
/**
|
||||
* This checks if a string actually exists inside another string
|
||||
* We try to do it in a PHP3-portable way.
|
||||
* We don't care about the position it is in.
|
||||
*
|
||||
* @param string string to search for
|
||||
* @param string string to search in
|
||||
*
|
||||
* @return boolean whether the needle is in the haystack or not
|
||||
*/
|
||||
function PMA_STR_strInStr($needle, $haystack)
|
||||
{
|
||||
// $GLOBALS['PMA_strpos']($haystack, $needle) !== FALSE
|
||||
// return (is_integer($GLOBALS['PMA_strpos']($haystack, $needle)));
|
||||
return $GLOBALS['PMA_strpos'](' ' . $haystack, $needle);
|
||||
} // end of the "PMA_STR_strInStr()" function
|
||||
if ($pos < $start) {
|
||||
// throw error about strings
|
||||
}
|
||||
|
||||
return $escaped;
|
||||
} // end of the "PMA_STR_charIsEscaped()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a given character position in the string is escaped or not
|
||||
*
|
||||
* @param string string to check for
|
||||
* @param integer the character to check for
|
||||
* @param integer starting position in the string
|
||||
*
|
||||
* @return boolean whether the character is escaped or not
|
||||
*/
|
||||
function PMA_STR_charIsEscaped($string, $pos, $start = 0)
|
||||
{
|
||||
$len = $GLOBALS['PMA_strlen']($string);
|
||||
// Base case:
|
||||
// Check for string length or invalid input or special case of input
|
||||
// (pos == $start)
|
||||
if (($pos == $start) || ($len <= $pos)) {
|
||||
return FALSE;
|
||||
/**
|
||||
* Checks if a number is in a range
|
||||
*
|
||||
* @param integer number to check for
|
||||
* @param integer lower bound
|
||||
* @param integer upper bound
|
||||
*
|
||||
* @return boolean whether the number is in the range or not
|
||||
*/
|
||||
function PMA_STR_numberInRangeInclusive($num, $lower, $upper)
|
||||
{
|
||||
return (($num >= $lower) && ($num <= $upper));
|
||||
} // end of the "PMA_STR_numberInRangeInclusive()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is a digit
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is a digit or not
|
||||
*
|
||||
* @see PMA_STR_numberInRangeInclusive()
|
||||
*/
|
||||
function PMA_STR_isDigit($c)
|
||||
{
|
||||
$ord_zero = 48; //ord('0');
|
||||
$ord_nine = 57; //ord('9');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
|
||||
} // end of the "PMA_STR_isDigit()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is an hexadecimal digit
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is an hexadecimal digit or not
|
||||
*
|
||||
* @see PMA_STR_numberInRangeInclusive()
|
||||
*/
|
||||
function PMA_STR_isHexDigit($c)
|
||||
{
|
||||
$ord_Aupper = 65; //ord('A');
|
||||
$ord_Fupper = 70; //ord('F');
|
||||
$ord_Alower = 97; //ord('a');
|
||||
$ord_Flower = 102; //ord('f');
|
||||
$ord_zero = 48; //ord('0');
|
||||
$ord_nine = 57; //ord('9');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return (PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Aupper, $ord_Fupper)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Alower, $ord_Flower));
|
||||
} // end of the "PMA_STR_isHexDigit()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is an upper alphabetic one
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is an upper alphabetic one or
|
||||
* not
|
||||
*
|
||||
* @see PMA_STR_numberInRangeInclusive()
|
||||
*/
|
||||
function PMA_STR_isUpper($c)
|
||||
{
|
||||
$ord_zero = 65; //ord('A');
|
||||
$ord_nine = 90; //ord('Z');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
|
||||
} // end of the "PMA_STR_isUpper()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is a lower alphabetic one
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is a lower alphabetic one or
|
||||
* not
|
||||
*
|
||||
* @see PMA_STR_numberInRangeInclusive()
|
||||
*/
|
||||
function PMA_STR_isLower($c)
|
||||
{
|
||||
$ord_zero = 97; //ord('a');
|
||||
$ord_nine = 122; //ord('z');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
|
||||
} // end of the "PMA_STR_isLower()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is an alphabetic one
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is an alphabetic one or not
|
||||
*
|
||||
* @see PMA_STR_isUpper()
|
||||
* @see PMA_STR_isLower()
|
||||
*/
|
||||
function PMA_STR_isAlpha($c)
|
||||
{
|
||||
return (PMA_STR_isUpper($c) || PMA_STR_isLower($c));
|
||||
} // end of the "PMA_STR_isAlpha()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is an alphanumeric one
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is an alphanumeric one or not
|
||||
*
|
||||
* @see PMA_STR_isUpper()
|
||||
* @see PMA_STR_isLower()
|
||||
* @see PMA_STR_isDigit()
|
||||
*/
|
||||
function PMA_STR_isAlnum($c)
|
||||
{
|
||||
return (PMA_STR_isUpper($c) || PMA_STR_isLower($c) || PMA_STR_isDigit($c));
|
||||
} // end of the "PMA_STR_isAlnum()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is a space one
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is a space one or not
|
||||
*
|
||||
* @see PMA_STR_numberInRangeInclusive()
|
||||
*/
|
||||
function PMA_STR_isSpace($c)
|
||||
{
|
||||
$ord_space = 32; //ord(' ')
|
||||
$ord_tab = 9; //ord('\t')
|
||||
$ord_CR = 13; //ord('\n')
|
||||
$ord_NOBR = 160; //ord('U+00A0);
|
||||
$ord_c = ord($c);
|
||||
|
||||
return (($ord_c == $ord_space)
|
||||
|| ($ord_c == $ord_NOBR)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_tab, $ord_CR));
|
||||
} // end of the "PMA_STR_isSpace()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is an accented character
|
||||
*
|
||||
* @note Presently this only works for some character sets. More work
|
||||
* may be needed to fix it.
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is an upper alphabetic one or
|
||||
* not
|
||||
*
|
||||
* @see PMA_STR_numberInRangeInclusive()
|
||||
*/
|
||||
function PMA_STR_isAccented($c)
|
||||
{
|
||||
$ord_min1 = 192; //ord('A');
|
||||
$ord_max1 = 214; //ord('Z');
|
||||
$ord_min2 = 216; //ord('A');
|
||||
$ord_max2 = 246; //ord('Z');
|
||||
$ord_min3 = 248; //ord('A');
|
||||
$ord_max3 = 255; //ord('Z');
|
||||
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_min1, $ord_max1)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_min2, $ord_max2)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_min2, $ord_max2);
|
||||
} // end of the "PMA_STR_isAccented()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is an SQL identifier
|
||||
*
|
||||
* @param string character to check for
|
||||
* @param boolean whether the dot character is valid or not
|
||||
*
|
||||
* @return boolean whether the character is an SQL identifier or not
|
||||
*
|
||||
* @see PMA_STR_isAlnum()
|
||||
*/
|
||||
function PMA_STR_isSqlIdentifier($c, $dot_is_valid = FALSE)
|
||||
{
|
||||
return (PMA_STR_isAlnum($c)
|
||||
|| PMA_STR_isAccented($c)
|
||||
|| ($c == '_') || ($c == '$')
|
||||
|| (($dot_is_valid != FALSE) && ($c == '.')));
|
||||
} // end of the "PMA_STR_isSqlIdentifier()" function
|
||||
|
||||
|
||||
/**
|
||||
* Binary search of a value in a sorted array
|
||||
*
|
||||
* @param string string to search for
|
||||
* @param array sorted array to search into
|
||||
* @param integer size of sorted array to search into
|
||||
*
|
||||
* @return boolean whether the string has been found or not
|
||||
*/
|
||||
function PMA_STR_binarySearchInArr($str, $arr, $arrsize)
|
||||
{
|
||||
// $arr NUST be sorted, due to binary search
|
||||
$top = $arrsize - 1;
|
||||
$bottom = 0;
|
||||
$found = FALSE;
|
||||
|
||||
while (($top >= $bottom) && ($found == FALSE)) {
|
||||
$mid = intval(($top + $bottom) / 2);
|
||||
$res = strcmp($str, $arr[$mid]);
|
||||
if ($res == 0) {
|
||||
$found = TRUE;
|
||||
} else if ($res < 0) {
|
||||
$top = $mid - 1;
|
||||
} else {
|
||||
$bottom = $mid + 1;
|
||||
}
|
||||
} // end while
|
||||
|
||||
$p = $pos - 1;
|
||||
$escaped = FALSE;
|
||||
while (($p >= $start) && ($string[$p] == '\\')) {
|
||||
$escaped = !$escaped;
|
||||
$p--;
|
||||
} // end while
|
||||
return $found;
|
||||
} // end of the "PMA_STR_binarySearchInArr()" function
|
||||
|
||||
if ($pos < $start) {
|
||||
// throw error about strings
|
||||
}
|
||||
|
||||
return $escaped;
|
||||
} // end of the "PMA_STR_charIsEscaped()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a number is in a range
|
||||
*
|
||||
* @param integer number to check for
|
||||
* @param integer lower bound
|
||||
* @param integer upper bound
|
||||
*
|
||||
* @return boolean whether the number is in the range or not
|
||||
*/
|
||||
function PMA_STR_numberInRangeInclusive($num, $lower, $upper)
|
||||
{
|
||||
return (($num >= $lower) && ($num <= $upper));
|
||||
} // end of the "PMA_STR_numberInRangeInclusive()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is a digit
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is a digit or not
|
||||
*
|
||||
* @see PMA_STR_numberInRangeInclusive()
|
||||
*/
|
||||
function PMA_STR_isDigit($c)
|
||||
{
|
||||
$ord_zero = 48; //ord('0');
|
||||
$ord_nine = 57; //ord('9');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
|
||||
} // end of the "PMA_STR_isDigit()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is an hexadecimal digit
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is an hexadecimal digit or not
|
||||
*
|
||||
* @see PMA_STR_numberInRangeInclusive()
|
||||
*/
|
||||
function PMA_STR_isHexDigit($c)
|
||||
{
|
||||
$ord_Aupper = 65; //ord('A');
|
||||
$ord_Fupper = 70; //ord('F');
|
||||
$ord_Alower = 97; //ord('a');
|
||||
$ord_Flower = 102; //ord('f');
|
||||
$ord_zero = 48; //ord('0');
|
||||
$ord_nine = 57; //ord('9');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return (PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Aupper, $ord_Fupper)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Alower, $ord_Flower));
|
||||
} // end of the "PMA_STR_isHexDigit()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is an upper alphabetic one
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is an upper alphabetic one or
|
||||
* not
|
||||
*
|
||||
* @see PMA_STR_numberInRangeInclusive()
|
||||
*/
|
||||
function PMA_STR_isUpper($c)
|
||||
{
|
||||
$ord_zero = 65; //ord('A');
|
||||
$ord_nine = 90; //ord('Z');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
|
||||
} // end of the "PMA_STR_isUpper()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is a lower alphabetic one
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is a lower alphabetic one or
|
||||
* not
|
||||
*
|
||||
* @see PMA_STR_numberInRangeInclusive()
|
||||
*/
|
||||
function PMA_STR_isLower($c)
|
||||
{
|
||||
$ord_zero = 97; //ord('a');
|
||||
$ord_nine = 122; //ord('z');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
|
||||
} // end of the "PMA_STR_isLower()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is an alphabetic one
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is an alphabetic one or not
|
||||
*
|
||||
* @see PMA_STR_isUpper()
|
||||
* @see PMA_STR_isLower()
|
||||
*/
|
||||
function PMA_STR_isAlpha($c)
|
||||
{
|
||||
return (PMA_STR_isUpper($c) || PMA_STR_isLower($c));
|
||||
} // end of the "PMA_STR_isAlpha()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is an alphanumeric one
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is an alphanumeric one or not
|
||||
*
|
||||
* @see PMA_STR_isUpper()
|
||||
* @see PMA_STR_isLower()
|
||||
* @see PMA_STR_isDigit()
|
||||
*/
|
||||
function PMA_STR_isAlnum($c)
|
||||
{
|
||||
return (PMA_STR_isUpper($c) || PMA_STR_isLower($c) || PMA_STR_isDigit($c));
|
||||
} // end of the "PMA_STR_isAlnum()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is a space one
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is a space one or not
|
||||
*
|
||||
* @see PMA_STR_numberInRangeInclusive()
|
||||
*/
|
||||
function PMA_STR_isSpace($c)
|
||||
{
|
||||
$ord_space = 32; //ord(' ')
|
||||
$ord_tab = 9; //ord('\t')
|
||||
$ord_CR = 13; //ord('\n')
|
||||
$ord_NOBR = 160; //ord('U+00A0);
|
||||
$ord_c = ord($c);
|
||||
|
||||
return (($ord_c == $ord_space)
|
||||
|| ($ord_c == $ord_NOBR)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_tab, $ord_CR));
|
||||
} // end of the "PMA_STR_isSpace()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is an accented character
|
||||
*
|
||||
* @note Presently this only works for some character sets. More work
|
||||
* may be needed to fix it.
|
||||
*
|
||||
* @param string character to check for
|
||||
*
|
||||
* @return boolean whether the character is an upper alphabetic one or
|
||||
* not
|
||||
*
|
||||
* @see PMA_STR_numberInRangeInclusive()
|
||||
*/
|
||||
function PMA_STR_isAccented($c)
|
||||
{
|
||||
$ord_min1 = 192; //ord('A');
|
||||
$ord_max1 = 214; //ord('Z');
|
||||
$ord_min2 = 216; //ord('A');
|
||||
$ord_max2 = 246; //ord('Z');
|
||||
$ord_min3 = 248; //ord('A');
|
||||
$ord_max3 = 255; //ord('Z');
|
||||
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_min1, $ord_max1)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_min2, $ord_max2)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_min2, $ord_max2);
|
||||
} // end of the "PMA_STR_isAccented()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is an SQL identifier
|
||||
*
|
||||
* @param string character to check for
|
||||
* @param boolean whether the dot character is valid or not
|
||||
*
|
||||
* @return boolean whether the character is an SQL identifier or not
|
||||
*
|
||||
* @see PMA_STR_isAlnum()
|
||||
*/
|
||||
function PMA_STR_isSqlIdentifier($c, $dot_is_valid = FALSE)
|
||||
{
|
||||
return (PMA_STR_isAlnum($c)
|
||||
|| PMA_STR_isAccented($c)
|
||||
|| ($c == '_') || ($c == '$')
|
||||
|| (($dot_is_valid != FALSE) && ($c == '.')));
|
||||
} // end of the "PMA_STR_isSqlIdentifier()" function
|
||||
|
||||
|
||||
/**
|
||||
* Binary search of a value in a sorted array
|
||||
*
|
||||
* @param string string to search for
|
||||
* @param array sorted array to search into
|
||||
* @param integer size of sorted array to search into
|
||||
*
|
||||
* @return boolean whether the string has been found or not
|
||||
*/
|
||||
function PMA_STR_binarySearchInArr($str, $arr, $arrsize)
|
||||
{
|
||||
// $arr NUST be sorted, due to binary search
|
||||
$top = $arrsize - 1;
|
||||
$bottom = 0;
|
||||
$found = FALSE;
|
||||
|
||||
while (($top >= $bottom) && ($found == FALSE)) {
|
||||
$mid = intval(($top + $bottom) / 2);
|
||||
$res = strcmp($str, $arr[$mid]);
|
||||
if ($res == 0) {
|
||||
$found = TRUE;
|
||||
} else if ($res < 0) {
|
||||
$top = $mid - 1;
|
||||
} else {
|
||||
$bottom = $mid + 1;
|
||||
}
|
||||
} // end while
|
||||
|
||||
return $found;
|
||||
} // end of the "PMA_STR_binarySearchInArr()" function
|
||||
|
||||
} // $__PMA_STR_LIB__
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -6,200 +6,195 @@
|
||||
* Set of functions used with the relation and pdf feature
|
||||
*/
|
||||
|
||||
function PMA_transformation_getOptions($string) {
|
||||
$transform_options = array();
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_LIB_INCLUDED')){
|
||||
define('PMA_TRANSFORMATION_LIB_INCLUDED', 1);
|
||||
|
||||
function PMA_transformation_getOptions($string) {
|
||||
$transform_options = array();
|
||||
|
||||
if ($string != '') {
|
||||
if ($string{0} == "'" && $string{strlen($string)-1} == "'") {
|
||||
$transform_options = explode('\',\'', substr($string, 1, strlen($string)-2));
|
||||
} else {
|
||||
$transform_options = array(0 => $string);
|
||||
}
|
||||
}
|
||||
|
||||
return $transform_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all available MIME-types
|
||||
*
|
||||
* @return array array[mimetype], array[transformation]
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author Garvin Hicking <me@supergarv.de>
|
||||
*/
|
||||
function PMA_getAvailableMIMEtypes() {
|
||||
$handle = opendir('./libraries/transformations');
|
||||
|
||||
$stack = array();
|
||||
$filestack = array();
|
||||
|
||||
while (($file = readdir($handle)) != false) {
|
||||
$filestack[$file] = $file;
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
|
||||
if (is_array($filestack)) {
|
||||
@ksort($filestack);
|
||||
foreach($filestack AS $key => $file) {
|
||||
|
||||
if (preg_match('|^.*__.*\.inc\.php(3?)$|', trim($file), $match)) {
|
||||
// File contains transformation functions.
|
||||
$base = explode('__', str_replace('.inc.php' . $match[1], '', $file));
|
||||
|
||||
$mimetype = str_replace('_', '/', $base[0]);
|
||||
$stack['mimetype'][$mimetype] = $mimetype;
|
||||
|
||||
$stack['transformation'][] = $mimetype . ': ' . $base[1];
|
||||
$stack['transformation_file'][] = $file;
|
||||
|
||||
} else if (preg_match('|^.*\.inc\.php(3?)$|', trim($file), $match)) {
|
||||
// File is a plain mimetype, no functions.
|
||||
$base = str_replace('.inc.php' . $match[1], '', $file);
|
||||
|
||||
if ($base != 'global') {
|
||||
$mimetype = str_replace('_', '/', $base);
|
||||
$stack['mimetype'][$mimetype] = $mimetype;
|
||||
$stack['empty_mimetype'][$mimetype] = $mimetype;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mimetypes for all rows of a table
|
||||
*
|
||||
* @param string the name of the db to check for
|
||||
* @param string the name of the table to check for
|
||||
* @param string whether to include only results having a mimetype set
|
||||
*
|
||||
* @return array [field_name][field_key] = field_value
|
||||
*
|
||||
* @global array the list of relations settings
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author Mike Beck <mikebeck@users.sourceforge.net> / Garvin Hicking <me@supergarv.de>
|
||||
*/
|
||||
function PMA_getMIME($db, $table, $strict = false) {
|
||||
global $cfgRelation;
|
||||
|
||||
$com_qry = 'SELECT column_name, mimetype, transformation, transformation_options FROM ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND (mimetype != \'\'' . (!$strict ? ' OR transformation != \'\' OR transformation_options != \'\'' : '') . ')';
|
||||
$com_rs = PMA_query_as_cu($com_qry);
|
||||
|
||||
while ($row = @PMA_mysql_fetch_array($com_rs)) {
|
||||
$col = $row['column_name'];
|
||||
$mime[$col]['mimetype'] = $row['mimetype'];
|
||||
$mime[$col]['transformation'] = $row['transformation'];
|
||||
$mime[$col]['transformation_options'] = $row['transformation_options'];
|
||||
} // end while
|
||||
|
||||
if (isset($mime) && is_array($mime)) {
|
||||
return $mime;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
} // end of the 'PMA_getMIME()' function
|
||||
|
||||
/**
|
||||
* Set a single mimetype to a certain value.
|
||||
*
|
||||
* @param string the name of the db
|
||||
* @param string the name of the table
|
||||
* @param string the name of the column
|
||||
* @param string the mimetype of the column
|
||||
* @param string the transformation of the column
|
||||
* @param string the transformation options of the column
|
||||
* @param string (optional) force delete, will erase any existing comments for this column
|
||||
*
|
||||
* @return boolean true, if comment-query was made.
|
||||
*
|
||||
* @global array the list of relations settings
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformation_options, $forcedelete = false) {
|
||||
global $cfgRelation;
|
||||
|
||||
$test_qry = 'SELECT mimetype, ' . PMA_backquote('comment') . ' FROM ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
|
||||
$test_rs = PMA_query_as_cu($test_qry);
|
||||
|
||||
if ($test_rs && mysql_num_rows($test_rs) > 0) {
|
||||
$row = @PMA_mysql_fetch_array($test_rs);
|
||||
|
||||
if (!$forcedelete && (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0 || strlen($row['comment']) > 0)) {
|
||||
$upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' SET mimetype = \'' . PMA_sqlAddslashes($mimetype) . '\','
|
||||
. ' transformation = \'' . PMA_sqlAddslashes($transformation) . '\','
|
||||
. ' transformation_options = \'' . PMA_sqlAddslashes($transformation_options) . '\''
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
|
||||
} else {
|
||||
$upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
|
||||
}
|
||||
} else if (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0) {
|
||||
$upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' (db_name, table_name, column_name, mimetype, transformation, transformation_options) '
|
||||
. ' VALUES('
|
||||
. '\'' . PMA_sqlAddslashes($db) . '\','
|
||||
. '\'' . PMA_sqlAddslashes($table) . '\','
|
||||
. '\'' . PMA_sqlAddslashes($key) . '\','
|
||||
. '\'' . PMA_sqlAddslashes($mimetype) . '\','
|
||||
. '\'' . PMA_sqlAddslashes($transformation) . '\','
|
||||
. '\'' . PMA_sqlAddslashes($transformation_options) . '\')';
|
||||
}
|
||||
|
||||
if (isset($upd_query)){
|
||||
$upd_rs = PMA_query_as_cu($upd_query);
|
||||
unset($upd_query);
|
||||
return true;
|
||||
if ($string != '') {
|
||||
if ($string{0} == "'" && $string{strlen($string)-1} == "'") {
|
||||
$transform_options = explode('\',\'', substr($string, 1, strlen($string)-2));
|
||||
} else {
|
||||
return false;
|
||||
$transform_options = array(0 => $string);
|
||||
}
|
||||
} // end of 'PMA_setMIME()' function
|
||||
|
||||
/**
|
||||
* Returns the real filename of a configured transformation
|
||||
*
|
||||
* @param string the current filename
|
||||
*
|
||||
* @return string the new filename
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_sanitizeTransformationFile(&$filename) {
|
||||
// garvin: for security, never allow to break out from transformations directory
|
||||
|
||||
$include_file = preg_replace('@\.\.*@', '.', $filename);
|
||||
}
|
||||
|
||||
return $transform_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all available MIME-types
|
||||
*
|
||||
* @return array array[mimetype], array[transformation]
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author Garvin Hicking <me@supergarv.de>
|
||||
*/
|
||||
function PMA_getAvailableMIMEtypes() {
|
||||
$handle = opendir('./libraries/transformations');
|
||||
|
||||
$stack = array();
|
||||
$filestack = array();
|
||||
|
||||
while (($file = readdir($handle)) != false) {
|
||||
$filestack[$file] = $file;
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
|
||||
if (is_array($filestack)) {
|
||||
@ksort($filestack);
|
||||
foreach($filestack AS $key => $file) {
|
||||
|
||||
if (preg_match('|^.*__.*\.inc\.php(3?)$|', trim($file), $match)) {
|
||||
// File contains transformation functions.
|
||||
$base = explode('__', str_replace('.inc.php' . $match[1], '', $file));
|
||||
|
||||
$mimetype = str_replace('_', '/', $base[0]);
|
||||
$stack['mimetype'][$mimetype] = $mimetype;
|
||||
|
||||
$stack['transformation'][] = $mimetype . ': ' . $base[1];
|
||||
$stack['transformation_file'][] = $file;
|
||||
|
||||
} else if (preg_match('|^.*\.inc\.php(3?)$|', trim($file), $match)) {
|
||||
// File is a plain mimetype, no functions.
|
||||
$base = str_replace('.inc.php' . $match[1], '', $file);
|
||||
|
||||
if ($base != 'global') {
|
||||
$mimetype = str_replace('_', '/', $base);
|
||||
$stack['mimetype'][$mimetype] = $mimetype;
|
||||
$stack['empty_mimetype'][$mimetype] = $mimetype;
|
||||
}
|
||||
}
|
||||
|
||||
// This value can also contain a 'php3' value, in which case we map this filename to our new 'php' variant
|
||||
$testfile = preg_replace('@\.inc\.php3$@', '.inc.php', $include_file);
|
||||
if ($include_file{strlen($include_file)-1} == '3' && file_exists('./libraries/transformations/' . $testfile)) {
|
||||
$include_file = $testfile;
|
||||
$filename = $testfile; // Corrects the referenced variable for further actions on the filename;
|
||||
}
|
||||
|
||||
return $include_file;
|
||||
} // end of 'PMA_sanitizeTransformationFile()' function
|
||||
} // $__PMA_TRANSFORMATION_LIB__
|
||||
?>
|
||||
}
|
||||
|
||||
return $stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mimetypes for all rows of a table
|
||||
*
|
||||
* @param string the name of the db to check for
|
||||
* @param string the name of the table to check for
|
||||
* @param string whether to include only results having a mimetype set
|
||||
*
|
||||
* @return array [field_name][field_key] = field_value
|
||||
*
|
||||
* @global array the list of relations settings
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author Mike Beck <mikebeck@users.sourceforge.net> / Garvin Hicking <me@supergarv.de>
|
||||
*/
|
||||
function PMA_getMIME($db, $table, $strict = false) {
|
||||
global $cfgRelation;
|
||||
|
||||
$com_qry = 'SELECT column_name, mimetype, transformation, transformation_options FROM ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND (mimetype != \'\'' . (!$strict ? ' OR transformation != \'\' OR transformation_options != \'\'' : '') . ')';
|
||||
$com_rs = PMA_query_as_cu($com_qry);
|
||||
|
||||
while ($row = @PMA_mysql_fetch_array($com_rs)) {
|
||||
$col = $row['column_name'];
|
||||
$mime[$col]['mimetype'] = $row['mimetype'];
|
||||
$mime[$col]['transformation'] = $row['transformation'];
|
||||
$mime[$col]['transformation_options'] = $row['transformation_options'];
|
||||
} // end while
|
||||
|
||||
if (isset($mime) && is_array($mime)) {
|
||||
return $mime;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
} // end of the 'PMA_getMIME()' function
|
||||
|
||||
/**
|
||||
* Set a single mimetype to a certain value.
|
||||
*
|
||||
* @param string the name of the db
|
||||
* @param string the name of the table
|
||||
* @param string the name of the column
|
||||
* @param string the mimetype of the column
|
||||
* @param string the transformation of the column
|
||||
* @param string the transformation options of the column
|
||||
* @param string (optional) force delete, will erase any existing comments for this column
|
||||
*
|
||||
* @return boolean true, if comment-query was made.
|
||||
*
|
||||
* @global array the list of relations settings
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformation_options, $forcedelete = false) {
|
||||
global $cfgRelation;
|
||||
|
||||
$test_qry = 'SELECT mimetype, ' . PMA_backquote('comment') . ' FROM ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
|
||||
$test_rs = PMA_query_as_cu($test_qry);
|
||||
|
||||
if ($test_rs && mysql_num_rows($test_rs) > 0) {
|
||||
$row = @PMA_mysql_fetch_array($test_rs);
|
||||
|
||||
if (!$forcedelete && (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0 || strlen($row['comment']) > 0)) {
|
||||
$upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' SET mimetype = \'' . PMA_sqlAddslashes($mimetype) . '\','
|
||||
. ' transformation = \'' . PMA_sqlAddslashes($transformation) . '\','
|
||||
. ' transformation_options = \'' . PMA_sqlAddslashes($transformation_options) . '\''
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
|
||||
} else {
|
||||
$upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
|
||||
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
|
||||
}
|
||||
} else if (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0) {
|
||||
$upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' (db_name, table_name, column_name, mimetype, transformation, transformation_options) '
|
||||
. ' VALUES('
|
||||
. '\'' . PMA_sqlAddslashes($db) . '\','
|
||||
. '\'' . PMA_sqlAddslashes($table) . '\','
|
||||
. '\'' . PMA_sqlAddslashes($key) . '\','
|
||||
. '\'' . PMA_sqlAddslashes($mimetype) . '\','
|
||||
. '\'' . PMA_sqlAddslashes($transformation) . '\','
|
||||
. '\'' . PMA_sqlAddslashes($transformation_options) . '\')';
|
||||
}
|
||||
|
||||
if (isset($upd_query)){
|
||||
$upd_rs = PMA_query_as_cu($upd_query);
|
||||
unset($upd_query);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} // end of 'PMA_setMIME()' function
|
||||
|
||||
/**
|
||||
* Returns the real filename of a configured transformation
|
||||
*
|
||||
* @param string the current filename
|
||||
*
|
||||
* @return string the new filename
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_sanitizeTransformationFile(&$filename) {
|
||||
// garvin: for security, never allow to break out from transformations directory
|
||||
|
||||
$include_file = preg_replace('@\.\.*@', '.', $filename);
|
||||
|
||||
// This value can also contain a 'php3' value, in which case we map this filename to our new 'php' variant
|
||||
$testfile = preg_replace('@\.inc\.php3$@', '.inc.php', $include_file);
|
||||
if ($include_file{strlen($include_file)-1} == '3' && file_exists('./libraries/transformations/' . $testfile)) {
|
||||
$include_file = $testfile;
|
||||
$filename = $testfile; // Corrects the referenced variable for further actions on the filename;
|
||||
}
|
||||
|
||||
return $include_file;
|
||||
} // end of 'PMA_sanitizeTransformationFile()' function
|
||||
?>
|
||||
|
@@ -8,23 +8,21 @@
|
||||
*
|
||||
* For instructions, read the /Documentation.html file.
|
||||
*
|
||||
* The string ENTER_FILENAME_HERE shall be substituted with the filename without the '.inc.php'
|
||||
* The string [ENTER_FILENAME_HERE] shall be substituted with the filename without the '.inc.php'
|
||||
* extension. For further information regarding naming conventions see the /Documentation.html file.
|
||||
*/
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_[ENTER_FILENAME_HERE]')){
|
||||
define('PMA_TRANSFORMATION_[ENTER_FILENAME_HERE]', 1);
|
||||
function PMA_transformation_[ENTER_FILENAME_HERE]($buffer, $options = array(), $meta = '') {
|
||||
// possibly use a global transform and feed it with special options:
|
||||
// include('./libraries/transformations/global.inc.php');
|
||||
|
||||
function PMA_transformation_[enter_filename_here]($buffer, $options = array(), $meta = '') {
|
||||
// possibly use a global transform and feed it with special options:
|
||||
// include('./libraries/transformations/global.inc.php');
|
||||
// further operations on $buffer using the $options[] array.
|
||||
|
||||
// further operations on $buffer using the $options[] array.
|
||||
// You can evaluate the propagated $meta Object. It's contained fields are described in http://www.php.net/mysql_fetch_field.
|
||||
// This stored information can be used to get the field information about the transformed field.
|
||||
// $meta->mimetype contains the original MimeType of the field (i.e. 'text/plain', 'image/jpeg' etc.)
|
||||
|
||||
// You can evaluate the propagated $meta Object. It's contained fields are described in http://www.php.net/mysql_fetch_field.
|
||||
// This stored information can be used to get the field information about the transformed field.
|
||||
// $meta->mimetype contains the original MimeType of the field (i.e. 'text/plain', 'image/jpeg' etc.)
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -10,4 +10,4 @@
|
||||
* You can still use global or other mimetype's transforms with this mimetype.
|
||||
*/
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -23,28 +23,26 @@
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_LIB_GLOBAL')){
|
||||
define('PMA_TRANSFORMATION_LIB_GLOBAL', 1);
|
||||
|
||||
function PMA_transformation_global_plain($buffer, $options = array(), $meta = '') {
|
||||
return htmlspecialchars($buffer);
|
||||
}
|
||||
|
||||
function PMA_transformation_global_html($buffer, $options = array(), $meta = '') {
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
function PMA_transformation_global_html_replace($buffer, $options = array(), $meta = '') {
|
||||
if (!isset($options['string'])) {
|
||||
$options['string'] = '';
|
||||
}
|
||||
|
||||
if (isset($options['regex']) && isset($options['regex_replace'])) {
|
||||
$buffer = preg_replace('@' . str_replace('@', '\@', $options['regex']) . '@si', $options['regex_replace'], $buffer);
|
||||
}
|
||||
|
||||
// Replace occurences of [__BUFFER__] with actual text
|
||||
$return = str_replace("[__BUFFER__]", $buffer, $options['string']);
|
||||
return $return;
|
||||
}
|
||||
function PMA_transformation_global_plain($buffer, $options = array(), $meta = '') {
|
||||
return htmlspecialchars($buffer);
|
||||
}
|
||||
|
||||
function PMA_transformation_global_html($buffer, $options = array(), $meta = '') {
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
function PMA_transformation_global_html_replace($buffer, $options = array(), $meta = '') {
|
||||
if (!isset($options['string'])) {
|
||||
$options['string'] = '';
|
||||
}
|
||||
|
||||
if (isset($options['regex']) && isset($options['regex_replace'])) {
|
||||
$buffer = preg_replace('@' . str_replace('@', '\@', $options['regex']) . '@si', $options['regex_replace'], $buffer);
|
||||
}
|
||||
|
||||
// Replace occurences of [__BUFFER__] with actual text
|
||||
$return = str_replace("[__BUFFER__]", $buffer, $options['string']);
|
||||
return $return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -2,19 +2,17 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_IMAGE_JPEG__INLINE')){
|
||||
define('PMA_TRANSFORMATION_IMAGE_JPEG__INLINE', 1);
|
||||
function PMA_transformation_image_jpeg__inline($buffer, $options = array(), $meta = '') {
|
||||
include('./libraries/transformations/global.inc.php');
|
||||
|
||||
function PMA_transformation_image_jpeg__inline($buffer, $options = array(), $meta = '') {
|
||||
include('./libraries/transformations/global.inc.php');
|
||||
|
||||
if (PMA_IS_GD2) {
|
||||
$transform_options = array ('string' => '<a href="transformation_wrapper.php' . $options['wrapper_link'] . '" target="_blank"><img src="transformation_wrapper.php' . $options['wrapper_link'] . '&resize=jpeg&newWidth=' . (isset($options[0]) ? $options[0] : '100') . '&newHeight=' . (isset($options[1]) ? $options[1] : 100) . '" alt="[__BUFFER__]" border="0"></a>');
|
||||
} else {
|
||||
$transform_options = array ('string' => '<img src="transformation_wrapper.php' . $options['wrapper_link'] . '" alt="[__BUFFER__]" width="320" height="240">');
|
||||
}
|
||||
$buffer = PMA_transformation_global_html_replace($buffer, $transform_options);
|
||||
|
||||
return $buffer;
|
||||
if (PMA_IS_GD2) {
|
||||
$transform_options = array ('string' => '<a href="transformation_wrapper.php' . $options['wrapper_link'] . '" target="_blank"><img src="transformation_wrapper.php' . $options['wrapper_link'] . '&resize=jpeg&newWidth=' . (isset($options[0]) ? $options[0] : '100') . '&newHeight=' . (isset($options[1]) ? $options[1] : 100) . '" alt="[__BUFFER__]" border="0"></a>');
|
||||
} else {
|
||||
$transform_options = array ('string' => '<img src="transformation_wrapper.php' . $options['wrapper_link'] . '" alt="[__BUFFER__]" width="320" height="240">');
|
||||
}
|
||||
$buffer = PMA_transformation_global_html_replace($buffer, $transform_options);
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -2,15 +2,13 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_IMAGE_JPEG__LINK')){
|
||||
define('PMA_TRANSFORMATION_IMAGE_JPEG__LINK', 1);
|
||||
function PMA_transformation_image_jpeg__link($buffer, $options = array(), $meta = '') {
|
||||
include('./libraries/transformations/global.inc.php');
|
||||
|
||||
function PMA_transformation_image_jpeg__link($buffer, $options = array(), $meta = '') {
|
||||
include('./libraries/transformations/global.inc.php');
|
||||
$transform_options = array ('string' => '<a href="transformation_wrapper.php' . $options['wrapper_link'] . '" alt="[__BUFFER__]">[BLOB]</a>');
|
||||
$buffer = PMA_transformation_global_html_replace($buffer, $transform_options);
|
||||
|
||||
$transform_options = array ('string' => '<a href="transformation_wrapper.php' . $options['wrapper_link'] . '" alt="[__BUFFER__]">[BLOB]</a>');
|
||||
$buffer = PMA_transformation_global_html_replace($buffer, $transform_options);
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -2,19 +2,17 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_IMAGE_PNG__INLINE')){
|
||||
define('PMA_TRANSFORMATION_IMAGE_PNG__INLINE', 1);
|
||||
function PMA_transformation_image_png__inline($buffer, $options = array(), $meta = '') {
|
||||
include('./libraries/transformations/global.inc.php');
|
||||
|
||||
function PMA_transformation_image_png__inline($buffer, $options = array(), $meta = '') {
|
||||
include('./libraries/transformations/global.inc.php');
|
||||
|
||||
if (PMA_IS_GD2) {
|
||||
$transform_options = array ('string' => '<a href="transformation_wrapper.php' . $options['wrapper_link'] . '" target="_blank"><img src="transformation_wrapper.php' . $options['wrapper_link'] . '&resize=png&newWidth=' . (isset($options[0]) ? $options[0] : '100') . '&newHeight=' . (isset($options[1]) ? $options[1] : 100) . '" alt="[__BUFFER__]" border="0"></a>');
|
||||
} else {
|
||||
$transform_options = array ('string' => '<img src="transformation_wrapper.php' . $options['wrapper_link'] . '" alt="[__BUFFER__]" width="320" height="240">');
|
||||
}
|
||||
$buffer = PMA_transformation_global_html_replace($buffer, $transform_options);
|
||||
|
||||
return $buffer;
|
||||
if (PMA_IS_GD2) {
|
||||
$transform_options = array ('string' => '<a href="transformation_wrapper.php' . $options['wrapper_link'] . '" target="_blank"><img src="transformation_wrapper.php' . $options['wrapper_link'] . '&resize=png&newWidth=' . (isset($options[0]) ? $options[0] : '100') . '&newHeight=' . (isset($options[1]) ? $options[1] : 100) . '" alt="[__BUFFER__]" border="0"></a>');
|
||||
} else {
|
||||
$transform_options = array ('string' => '<img src="transformation_wrapper.php' . $options['wrapper_link'] . '" alt="[__BUFFER__]" width="320" height="240">');
|
||||
}
|
||||
$buffer = PMA_transformation_global_html_replace($buffer, $transform_options);
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -16,17 +16,11 @@ define('PMA_DISPLAY_HEADING', 0);
|
||||
/**
|
||||
* Gets some core libraries and displays a top message if required
|
||||
*/
|
||||
if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
|
||||
include('./libraries/grab_globals.lib.php');
|
||||
}
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
|
||||
require('./header.inc.php');
|
||||
|
||||
require('./libraries/relation.lib.php');
|
||||
require('./libraries/transformations.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./header.inc.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
require_once('./libraries/transformations.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
$types = PMA_getAvailableMIMEtypes();
|
||||
@@ -78,5 +72,6 @@ foreach($types['transformation'] AS $key => $transform) {
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
|
||||
?>
|
||||
|
@@ -2,62 +2,58 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_TEXT_PLAIN__DATEFORMAT')){
|
||||
define('PMA_TRANSFORMATION_TEXT_PLAIN__DATEFORMAT', 1);
|
||||
function PMA_transformation_text_plain__dateformat($buffer, $options = array(), $meta = '') {
|
||||
// possibly use a global transform and feed it with special options:
|
||||
// include('./libraries/transformations/global.inc.php');
|
||||
|
||||
function PMA_transformation_text_plain__dateformat($buffer, $options = array(), $meta = '') {
|
||||
// possibly use a global transform and feed it with special options:
|
||||
// include('./libraries/transformations/global.inc.php');
|
||||
|
||||
// further operations on $buffer using the $options[] array.
|
||||
if (!isset($options[0]) || $options[0] == '') {
|
||||
$options[0] = 0;
|
||||
}
|
||||
|
||||
if (!isset($options[1]) || $options[1] == '') {
|
||||
$options[1] = $GLOBALS['datefmt'];
|
||||
}
|
||||
|
||||
$timestamp = -1;
|
||||
|
||||
// Detect TIMESTAMP(6 | 8 | 10 | 12 | 14), (2 | 4) not supported here.
|
||||
if (preg_match('/^(\d{2}){3,7}$/', $buffer)) {
|
||||
|
||||
if (strlen($buffer) == 14 || strlen($buffer) == 8) {
|
||||
$offset = 4;
|
||||
} else {
|
||||
$offset = 2;
|
||||
}
|
||||
|
||||
$d = array();
|
||||
$d['year'] = substr($buffer, 0, $offset);
|
||||
$d['month'] = substr($buffer, $offset, 2);
|
||||
$d['day'] = substr($buffer, $offset + 2, 2);
|
||||
$d['hour'] = substr($buffer, $offset + 4, 2);
|
||||
$d['minute'] = substr($buffer, $offset + 6, 2);
|
||||
$d['second'] = substr($buffer, $offset + 8, 2);
|
||||
|
||||
if (checkdate($d['month'], $d['day'], $d['year'])) {
|
||||
$timestamp = mktime($d['hour'], $d['minute'], $d['second'], $d['month'], $d['day'], $d['year']);
|
||||
}
|
||||
// If all fails, assume one of the dozens of valid strtime() syntaxes (http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html)
|
||||
} else {
|
||||
$timestamp = strtotime($buffer);
|
||||
}
|
||||
|
||||
// If all above failed, maybe it's a Unix timestamp already?
|
||||
if ($timestamp < 0 && preg_match('/^[1-9]\d{1,9}$/', $buffer)) {
|
||||
$timestamp = $buffer;
|
||||
}
|
||||
|
||||
// Reformat a valid timestamp
|
||||
if ($timestamp >= 0) {
|
||||
$timestamp -= $options[0] * 60 * 60;
|
||||
$buffer = PMA_localisedDate($timestamp, $options[1]);
|
||||
}
|
||||
|
||||
return $buffer;
|
||||
// further operations on $buffer using the $options[] array.
|
||||
if (!isset($options[0]) || $options[0] == '') {
|
||||
$options[0] = 0;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
if (!isset($options[1]) || $options[1] == '') {
|
||||
$options[1] = $GLOBALS['datefmt'];
|
||||
}
|
||||
|
||||
$timestamp = -1;
|
||||
|
||||
// Detect TIMESTAMP(6 | 8 | 10 | 12 | 14), (2 | 4) not supported here.
|
||||
if (preg_match('/^(\d{2}){3,7}$/', $buffer)) {
|
||||
|
||||
if (strlen($buffer) == 14 || strlen($buffer) == 8) {
|
||||
$offset = 4;
|
||||
} else {
|
||||
$offset = 2;
|
||||
}
|
||||
|
||||
$d = array();
|
||||
$d['year'] = substr($buffer, 0, $offset);
|
||||
$d['month'] = substr($buffer, $offset, 2);
|
||||
$d['day'] = substr($buffer, $offset + 2, 2);
|
||||
$d['hour'] = substr($buffer, $offset + 4, 2);
|
||||
$d['minute'] = substr($buffer, $offset + 6, 2);
|
||||
$d['second'] = substr($buffer, $offset + 8, 2);
|
||||
|
||||
if (checkdate($d['month'], $d['day'], $d['year'])) {
|
||||
$timestamp = mktime($d['hour'], $d['minute'], $d['second'], $d['month'], $d['day'], $d['year']);
|
||||
}
|
||||
// If all fails, assume one of the dozens of valid strtime() syntaxes (http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html)
|
||||
} else {
|
||||
$timestamp = strtotime($buffer);
|
||||
}
|
||||
|
||||
// If all above failed, maybe it's a Unix timestamp already?
|
||||
if ($timestamp < 0 && preg_match('/^[1-9]\d{1,9}$/', $buffer)) {
|
||||
$timestamp = $buffer;
|
||||
}
|
||||
|
||||
// Reformat a valid timestamp
|
||||
if ($timestamp >= 0) {
|
||||
$timestamp -= $options[0] * 60 * 60;
|
||||
$buffer = PMA_localisedDate($timestamp, $options[1]);
|
||||
}
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -2,64 +2,62 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_TEXT_PLAIN__EXTERNAL')){
|
||||
define('PMA_TRANSFORMATION_TEXT_PLAIN__EXTERNAL', 1);
|
||||
|
||||
function PMA_EscapeShellArg($string, $prepend = '\'') {
|
||||
return $prepend . ereg_replace("'", "'\\''", $string) . $prepend;
|
||||
}
|
||||
|
||||
function PMA_transformation_text_plain__external_nowrap($options = array()) {
|
||||
if (!isset($options[3]) || $options[3] == '') {
|
||||
$nowrap = true;
|
||||
} elseif ($options[3] == '1' || $options[3] == 1) {
|
||||
$nowrap = true;
|
||||
} else {
|
||||
$nowrap = false;
|
||||
}
|
||||
|
||||
return $nowrap;
|
||||
}
|
||||
|
||||
function PMA_transformation_text_plain__external($buffer, $options = array(), $meta = '') {
|
||||
// possibly use a global transform and feed it with special options:
|
||||
// include('./libraries/transformations/global.inc.php');
|
||||
|
||||
// further operations on $buffer using the $options[] array.
|
||||
|
||||
$allowed_programs = array();
|
||||
$allowed_programs[0] = '/usr/local/bin/tidy';
|
||||
$allowed_programs[1] = '/usr/local/bin/validate';
|
||||
|
||||
if (!isset($options[0]) || $options[0] == '') {
|
||||
$program = $allowed_programs[0];
|
||||
} else {
|
||||
$program = $allowed_programs[$options[0]];
|
||||
}
|
||||
|
||||
if (!isset($options[1]) || $options[1] == '') {
|
||||
$poptions = '-f /dev/null -i -wrap -q';
|
||||
} else {
|
||||
$poptions = $options[1];
|
||||
}
|
||||
|
||||
if (!isset($options[2]) || $options[2] == '') {
|
||||
$options[2] = 1;
|
||||
}
|
||||
|
||||
if (!isset($options[3]) || $options[3] == '') {
|
||||
$options[3] = 1;
|
||||
}
|
||||
|
||||
$cmdline = 'echo ' . PMA_EscapeShellArg($buffer) . ' | ' . $program . ' ' . PMA_EscapeShellArg($poptions, '');
|
||||
$newstring = `$cmdline`;
|
||||
|
||||
if ($options[2] == 1 || $options[2] == '2') {
|
||||
$retstring = htmlspecialchars($newstring);
|
||||
} else {
|
||||
$retstring = $newstring;
|
||||
}
|
||||
|
||||
return $retstring;
|
||||
}
|
||||
function PMA_EscapeShellArg($string, $prepend = '\'') {
|
||||
return $prepend . ereg_replace("'", "'\\''", $string) . $prepend;
|
||||
}
|
||||
|
||||
function PMA_transformation_text_plain__external_nowrap($options = array()) {
|
||||
if (!isset($options[3]) || $options[3] == '') {
|
||||
$nowrap = true;
|
||||
} elseif ($options[3] == '1' || $options[3] == 1) {
|
||||
$nowrap = true;
|
||||
} else {
|
||||
$nowrap = false;
|
||||
}
|
||||
|
||||
return $nowrap;
|
||||
}
|
||||
|
||||
function PMA_transformation_text_plain__external($buffer, $options = array(), $meta = '') {
|
||||
// possibly use a global transform and feed it with special options:
|
||||
// include('./libraries/transformations/global.inc.php');
|
||||
|
||||
// further operations on $buffer using the $options[] array.
|
||||
|
||||
$allowed_programs = array();
|
||||
$allowed_programs[0] = '/usr/local/bin/tidy';
|
||||
$allowed_programs[1] = '/usr/local/bin/validate';
|
||||
|
||||
if (!isset($options[0]) || $options[0] == '') {
|
||||
$program = $allowed_programs[0];
|
||||
} else {
|
||||
$program = $allowed_programs[$options[0]];
|
||||
}
|
||||
|
||||
if (!isset($options[1]) || $options[1] == '') {
|
||||
$poptions = '-f /dev/null -i -wrap -q';
|
||||
} else {
|
||||
$poptions = $options[1];
|
||||
}
|
||||
|
||||
if (!isset($options[2]) || $options[2] == '') {
|
||||
$options[2] = 1;
|
||||
}
|
||||
|
||||
if (!isset($options[3]) || $options[3] == '') {
|
||||
$options[3] = 1;
|
||||
}
|
||||
|
||||
$cmdline = 'echo ' . PMA_EscapeShellArg($buffer) . ' | ' . $program . ' ' . PMA_EscapeShellArg($poptions, '');
|
||||
$newstring = `$cmdline`;
|
||||
|
||||
if ($options[2] == 1 || $options[2] == '2') {
|
||||
$retstring = htmlspecialchars($newstring);
|
||||
} else {
|
||||
$retstring = $newstring;
|
||||
}
|
||||
|
||||
return $retstring;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -2,10 +2,8 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_TEXT_PLAIN__FORMATTED')){
|
||||
define('PMA_TRANSFORMATION_TEXT_PLAIN__FORMATTED', 1);
|
||||
|
||||
function PMA_transformation_text_plain__formatted($buffer, $options = array(), $meta = '') {
|
||||
return $buffer;
|
||||
}
|
||||
function PMA_transformation_text_plain__formatted($buffer, $options = array(), $meta = '') {
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -2,14 +2,12 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_TEXT_PLAIN__IMAGELINK')){
|
||||
define('PMA_TRANSFORMATION_TEXT_PLAIN__IMAGELINK', 1);
|
||||
function PMA_transformation_text_plain__imagelink($buffer, $options = array(), $meta = '') {
|
||||
include('./libraries/transformations/global.inc.php');
|
||||
|
||||
function PMA_transformation_text_plain__imagelink($buffer, $options = array(), $meta = '') {
|
||||
include('./libraries/transformations/global.inc.php');
|
||||
|
||||
$transform_options = array ('string' => '<a href="' . (isset($options[0]) ? $options[0] : '') . $buffer . '" target="_blank"><img src="' . (isset($options[0]) ? $options[0] : '') . $buffer . '" border="0" width="' . (isset($options[1]) ? $options[1] : 100) . '" height="' . (isset($options[2]) ? $options[2] : 50) . '">' . $buffer . '</a>');
|
||||
$buffer = PMA_transformation_global_html_replace($buffer, $transform_options);
|
||||
return $buffer;
|
||||
}
|
||||
$transform_options = array ('string' => '<a href="' . (isset($options[0]) ? $options[0] : '') . $buffer . '" target="_blank"><img src="' . (isset($options[0]) ? $options[0] : '') . $buffer . '" border="0" width="' . (isset($options[1]) ? $options[1] : 100) . '" height="' . (isset($options[2]) ? $options[2] : 50) . '">' . $buffer . '</a>');
|
||||
$buffer = PMA_transformation_global_html_replace($buffer, $transform_options);
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -2,19 +2,17 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_TEXT_PLAIN__LINK')){
|
||||
define('PMA_TRANSFORMATION_TEXT_PLAIN__LINK', 1);
|
||||
function PMA_transformation_text_plain__link($buffer, $options = array(), $meta = '') {
|
||||
require_once('./libraries/transformations/global.inc.php');
|
||||
|
||||
function PMA_transformation_text_plain__link($buffer, $options = array(), $meta = '') {
|
||||
include('./libraries/transformations/global.inc.php');
|
||||
// $transform_options = array ('string' => '<a href="' . (isset($options[0]) ? $options[0] : '') . '%1$s" title="' . (isset($options[1]) ? $options[1] : '%1$s') . '">' . (isset($options[1]) ? $options[1] : '%1$s') . '</a>');
|
||||
|
||||
// $transform_options = array ('string' => '<a href="' . (isset($options[0]) ? $options[0] : '') . '%1$s" title="' . (isset($options[1]) ? $options[1] : '%1$s') . '">' . (isset($options[1]) ? $options[1] : '%1$s') . '</a>');
|
||||
$transform_options = array ('string' => '<a href="' . (isset($options[0]) ? $options[0] : '') . $buffer . '" title="' . (isset($options[1]) ? $options[1] : '') . '">' . (isset($options[1]) ? $options[1] : $buffer) . '</a>');
|
||||
|
||||
$transform_options = array ('string' => '<a href="' . (isset($options[0]) ? $options[0] : '') . $buffer . '" title="' . (isset($options[1]) ? $options[1] : '') . '">' . (isset($options[1]) ? $options[1] : $buffer) . '</a>');
|
||||
$buffer = PMA_transformation_global_html_replace($buffer, $transform_options);
|
||||
|
||||
$buffer = PMA_transformation_global_html_replace($buffer, $transform_options);
|
||||
return $buffer;
|
||||
|
||||
return $buffer;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -2,45 +2,43 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_TEXT_PLAIN__SUBSTR')){
|
||||
define('PMA_TRANSFORMATION_TEXT_PLAIN__SUBSTR', 1);
|
||||
function PMA_transformation_text_plain__substr($buffer, $options = array(), $meta = '') {
|
||||
// possibly use a global transform and feed it with special options:
|
||||
// include('./libraries/transformations/global.inc.php');
|
||||
|
||||
function PMA_transformation_text_plain__substr($buffer, $options = array(), $meta = '') {
|
||||
// possibly use a global transform and feed it with special options:
|
||||
// include('./libraries/transformations/global.inc.php');
|
||||
|
||||
// further operations on $buffer using the $options[] array.
|
||||
if (!isset($options[0]) || $options[0] == '') {
|
||||
$options[0] = 0;
|
||||
}
|
||||
|
||||
if (!isset($options[1]) || $options[1] == '') {
|
||||
$options[1] = 'all';
|
||||
}
|
||||
|
||||
if (!isset($options[2]) || $options[2] == '') {
|
||||
$options[2] = '...';
|
||||
}
|
||||
|
||||
$newtext = '';
|
||||
if ($options[1] != 'all') {
|
||||
$newtext = substr($buffer, $options[0], $options[1]);
|
||||
} else {
|
||||
$newtext = substr($buffer, $options[0]);
|
||||
}
|
||||
|
||||
$length = strlen($newtext);
|
||||
$baselength = strlen($buffer);
|
||||
if ($length != $baselength) {
|
||||
if ($options[0] != 0) {
|
||||
$newtext = $options[2] . $newtext;
|
||||
}
|
||||
|
||||
if (($length + $options[0]) != $baselength) {
|
||||
$newtext .= $options[2];
|
||||
}
|
||||
}
|
||||
|
||||
return $newtext;
|
||||
// further operations on $buffer using the $options[] array.
|
||||
if (!isset($options[0]) || $options[0] == '') {
|
||||
$options[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($options[1]) || $options[1] == '') {
|
||||
$options[1] = 'all';
|
||||
}
|
||||
|
||||
if (!isset($options[2]) || $options[2] == '') {
|
||||
$options[2] = '...';
|
||||
}
|
||||
|
||||
$newtext = '';
|
||||
if ($options[1] != 'all') {
|
||||
$newtext = substr($buffer, $options[0], $options[1]);
|
||||
} else {
|
||||
$newtext = substr($buffer, $options[0]);
|
||||
}
|
||||
|
||||
$length = strlen($newtext);
|
||||
$baselength = strlen($buffer);
|
||||
if ($length != $baselength) {
|
||||
if ($options[0] != 0) {
|
||||
$newtext = $options[2] . $newtext;
|
||||
}
|
||||
|
||||
if (($length + $options[0]) != $baselength) {
|
||||
$newtext .= $options[2];
|
||||
}
|
||||
}
|
||||
|
||||
return $newtext;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -8,83 +8,80 @@
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('PMA_URL_GENERATION_LIB_INCLUDED')){
|
||||
define('PMA_URL_GENERATION_LIB_INCLUDED', 1);
|
||||
/**
|
||||
* Generates text with hidden inputs.
|
||||
*
|
||||
* @param string optional database name
|
||||
* @param string optional table name
|
||||
* @param int indenting level
|
||||
*
|
||||
* @return string string with input fields
|
||||
*
|
||||
* @global string the current language
|
||||
* @global string the current conversion charset
|
||||
* @global string the current server
|
||||
* @global array the configuration array
|
||||
* @global boolean whether recoding is allowed or not
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author nijel
|
||||
*/
|
||||
function PMA_generate_common_hidden_inputs ($db = '', $table = '', $indent = 0)
|
||||
{
|
||||
global $lang, $convcharset, $server;
|
||||
global $cfg, $allow_recoding;
|
||||
|
||||
/**
|
||||
* Generates text with hidden inputs.
|
||||
*
|
||||
* @param string optional database name
|
||||
* @param string optional table name
|
||||
* @param int indenting level
|
||||
*
|
||||
* @return string string with input fields
|
||||
*
|
||||
* @global string the current language
|
||||
* @global string the current conversion charset
|
||||
* @global string the current server
|
||||
* @global array the configuration array
|
||||
* @global boolean whether recoding is allowed or not
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author nijel
|
||||
*/
|
||||
function PMA_generate_common_hidden_inputs ($db = '', $table = '', $indent = 0)
|
||||
{
|
||||
global $lang, $convcharset, $server;
|
||||
global $cfg, $allow_recoding;
|
||||
|
||||
$spaces = '';
|
||||
for ($i = 0; $i < $indent; $i++) {
|
||||
$spaces .= ' ';
|
||||
}
|
||||
|
||||
$result = $spaces . '<input type="hidden" name="lang" value="' . $lang . '" />' . "\n"
|
||||
. $spaces . '<input type="hidden" name="server" value="' . $server . '" />' . "\n";
|
||||
if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)
|
||||
$result .= $spaces . '<input type="hidden" name="convcharset" value="' . $convcharset . '" />' . "\n";
|
||||
if (!empty($db))
|
||||
$result .= $spaces . '<input type="hidden" name="db" value="'.htmlspecialchars($db).'" />' . "\n";
|
||||
if (!empty($table))
|
||||
$result .= $spaces . '<input type="hidden" name="table" value="'.htmlspecialchars($table).'" />' . "\n";
|
||||
return $result;
|
||||
$spaces = '';
|
||||
for ($i = 0; $i < $indent; $i++) {
|
||||
$spaces .= ' ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates text with URL parameters.
|
||||
*
|
||||
* @param string optional database name
|
||||
* @param string optional table name
|
||||
* @param string character to use instead of '&' for deviding
|
||||
* multiple URL parameters from each other
|
||||
*
|
||||
* @return string string with URL parameters
|
||||
*
|
||||
* @global string the current language
|
||||
* @global string the current conversion charset
|
||||
* @global string the current server
|
||||
* @global array the configuration array
|
||||
* @global boolean whether recoding is allowed or not
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author nijel
|
||||
*/
|
||||
function PMA_generate_common_url ($db = '', $table = '', $amp = '&')
|
||||
{
|
||||
global $lang, $convcharset, $server;
|
||||
global $cfg, $allow_recoding;
|
||||
|
||||
$result = 'lang=' . $lang
|
||||
. $amp . 'server=' . $server;
|
||||
if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)
|
||||
$result .= $amp . 'convcharset=' . $convcharset;
|
||||
if (!empty($db))
|
||||
$result .= $amp . 'db='.urlencode($db);
|
||||
if (!empty($table))
|
||||
$result .= $amp . 'table='.urlencode($table);
|
||||
return $result;
|
||||
}
|
||||
$result = $spaces . '<input type="hidden" name="lang" value="' . $lang . '" />' . "\n"
|
||||
. $spaces . '<input type="hidden" name="server" value="' . $server . '" />' . "\n";
|
||||
if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)
|
||||
$result .= $spaces . '<input type="hidden" name="convcharset" value="' . $convcharset . '" />' . "\n";
|
||||
if (!empty($db))
|
||||
$result .= $spaces . '<input type="hidden" name="db" value="'.htmlspecialchars($db).'" />' . "\n";
|
||||
if (!empty($table))
|
||||
$result .= $spaces . '<input type="hidden" name="table" value="'.htmlspecialchars($table).'" />' . "\n";
|
||||
return $result;
|
||||
}
|
||||
?>
|
||||
|
||||
/**
|
||||
* Generates text with URL parameters.
|
||||
*
|
||||
* @param string optional database name
|
||||
* @param string optional table name
|
||||
* @param string character to use instead of '&' for deviding
|
||||
* multiple URL parameters from each other
|
||||
*
|
||||
* @return string string with URL parameters
|
||||
*
|
||||
* @global string the current language
|
||||
* @global string the current conversion charset
|
||||
* @global string the current server
|
||||
* @global array the configuration array
|
||||
* @global boolean whether recoding is allowed or not
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author nijel
|
||||
*/
|
||||
function PMA_generate_common_url ($db = '', $table = '', $amp = '&')
|
||||
{
|
||||
global $lang, $convcharset, $server;
|
||||
global $cfg, $allow_recoding;
|
||||
|
||||
$result = 'lang=' . $lang
|
||||
. $amp . 'server=' . $server;
|
||||
if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)
|
||||
$result .= $amp . 'convcharset=' . $convcharset;
|
||||
if (!empty($db))
|
||||
$result .= $amp . 'db='.urlencode($db);
|
||||
if (!empty($table))
|
||||
$result .= $amp . 'table='.urlencode($table);
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
|
25
main.php
25
main.php
@@ -10,12 +10,8 @@ define('PMA_DISPLAY_HEADING', 0);
|
||||
/**
|
||||
* Gets some core libraries and displays a top message if required
|
||||
*/
|
||||
if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
|
||||
include('./libraries/grab_globals.lib.php');
|
||||
}
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
// Puts the language to use in a cookie that will expire in 30 days
|
||||
if (!isset($pma_uri_parts)) {
|
||||
$pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
|
||||
@@ -33,7 +29,7 @@ if (isset($table)) {
|
||||
unset($table);
|
||||
}
|
||||
$show_query = '1';
|
||||
require('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
if (isset($message)) {
|
||||
PMA_showMessage($message);
|
||||
}
|
||||
@@ -254,8 +250,7 @@ if ($server > 0) {
|
||||
} // end elseif
|
||||
} // end if
|
||||
} // end while
|
||||
unset($show_grants_dbname);
|
||||
unset($show_grants_str);
|
||||
unset($show_grants_dbname, $show_grants_str);
|
||||
mysql_free_result($rs_usr);
|
||||
} // end if
|
||||
} // end elseif
|
||||
@@ -550,8 +545,8 @@ if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding']
|
||||
} else {
|
||||
$selected = '';
|
||||
}
|
||||
echo ' ';
|
||||
echo '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
|
||||
echo ' '
|
||||
. '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
@@ -634,20 +629,20 @@ if (PMA_PHP_INT_VERSION == 40203 && @extension_loaded('mbstring')) {
|
||||
*/
|
||||
|
||||
if (PMA_PHP_INT_VERSION < 40100) {
|
||||
echo '<p class="warning">' . sprintf($strUpgrade, 'PHP', '4.1.x') . '</p>' . "\n";
|
||||
echo '<p class="warning">' . sprintf($strUpgrade, 'PHP', '4.1.0') . '</p>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Warning for old MySQL version
|
||||
*/
|
||||
|
||||
if (PMA_MYSQL_INT_VERSION < 32336) {
|
||||
echo '<p class="warning">' . sprintf($strUpgrade, 'MySQL', '3.23.36') . '</p>' . "\n";
|
||||
if (PMA_MYSQL_INT_VERSION < 32332) {
|
||||
echo '<p class="warning">' . sprintf($strUpgrade, 'MySQL', '3.23.32') . '</p>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
if (!empty($submit_mult)
|
||||
&& ($submit_mult != $strWithChecked)
|
||||
&& ( !empty($selected_db)
|
||||
&& ( !empty($selected_db)
|
||||
|| !empty($selected_tbl)
|
||||
|| !empty($selected_fld)
|
||||
|| !empty($rows_to_delete)
|
||||
@@ -19,8 +19,7 @@ if (!empty($submit_mult)
|
||||
$what = 'drop_db';
|
||||
} else if (!empty($selected_tbl)) {
|
||||
if ($submit_mult == $strPrintView) {
|
||||
include('./tbl_printview.php');
|
||||
exit();
|
||||
require('./tbl_printview.php');
|
||||
} else {
|
||||
$selected = $selected_tbl;
|
||||
switch ($submit_mult) {
|
||||
@@ -60,8 +59,7 @@ if (!empty($submit_mult)
|
||||
if ($submit_mult == $strDrop) {
|
||||
$what = 'drop_fld';
|
||||
} else {
|
||||
include('./tbl_alter.php');
|
||||
exit();
|
||||
require('./tbl_alter.php');
|
||||
}
|
||||
} else {
|
||||
$what = 'row_delete';
|
||||
@@ -77,13 +75,13 @@ if (!empty($submit_mult) && !empty($what)) {
|
||||
$js_to_run = 'functions.js';
|
||||
unset($message);
|
||||
if (!empty($table)) {
|
||||
include('./tbl_properties_common.php');
|
||||
require('./tbl_properties_common.php');
|
||||
$url_query .= '&goto=tbl_properties.php&back=tbl_properties.php';
|
||||
include('./tbl_properties_table_info.php');
|
||||
require('./tbl_properties_table_info.php');
|
||||
}
|
||||
elseif (!empty($db)) {
|
||||
include('./db_details_common.php');
|
||||
include('./db_details_db_info.php');
|
||||
require('./db_details_common.php');
|
||||
require('./db_details_db_info.php');
|
||||
}
|
||||
// Builds the query
|
||||
$full_query = '';
|
||||
@@ -144,7 +142,7 @@ if (!empty($submit_mult) && !empty($what)) {
|
||||
echo "\n";
|
||||
if (strpos(' ' . $action, 'db_details') == 1) {
|
||||
echo PMA_generate_common_hidden_inputs($db);
|
||||
} else if (strpos(' ' . $action, 'tbl_properties') == 1
|
||||
} else if (strpos(' ' . $action, 'tbl_properties') == 1
|
||||
|| $what == 'row_delete') {
|
||||
echo PMA_generate_common_hidden_inputs($db,$table);
|
||||
} else {
|
||||
@@ -168,8 +166,7 @@ if (!empty($submit_mult) && !empty($what)) {
|
||||
<?php
|
||||
echo"\n";
|
||||
|
||||
include('./footer.inc.php');
|
||||
exit();
|
||||
require_once('./footer.inc.php');
|
||||
} // end if
|
||||
|
||||
|
||||
@@ -179,7 +176,7 @@ if (!empty($submit_mult) && !empty($what)) {
|
||||
else if ($mult_btn == $strYes) {
|
||||
|
||||
if ($query_type == 'drop_db' || $query_type == 'drop_tbl' || $query_type == 'drop_fld') {
|
||||
include('./libraries/relation_cleanup.lib.php');
|
||||
require_once('./libraries/relation_cleanup.lib.php');
|
||||
}
|
||||
|
||||
$sql_query = '';
|
||||
@@ -268,10 +265,9 @@ else if ($mult_btn == $strYes) {
|
||||
|| $query_type == 'analyze_tbl'
|
||||
|| $query_type == 'check_tbl'
|
||||
|| $query_type == 'optimize_tbl') {
|
||||
include('./sql.php');
|
||||
exit();
|
||||
require('./sql.php');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -6,15 +6,15 @@
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./libraries/common.lib.php');
|
||||
require('./db_details_common.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./db_details_common.php');
|
||||
|
||||
|
||||
/**
|
||||
* Settings for relation stuff
|
||||
*/
|
||||
require('./libraries/relation.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ $cfgRelation = PMA_getRelationsParam();
|
||||
if (!$cfgRelation['relwork']) {
|
||||
echo sprintf($strNotSet, 'relation', 'config.inc.php') . '<br />' . "\n"
|
||||
. '<a href="./Documentation.html#relation" target="documentation">' . $strDocu . '</a>' . "\n";
|
||||
exit();
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
|
||||
if (!$cfgRelation['displaywork']) {
|
||||
echo sprintf($strNotSet, 'table_info', 'config.inc.php') . '<br />' . "\n"
|
||||
. '<a href="./Documentation.html#table_info" target="documentation">' . $strDocu . '</a>' . "\n";
|
||||
exit();
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
|
||||
if (!isset($cfgRelation['table_coords'])){
|
||||
@@ -83,7 +83,7 @@ if ($cfgRelation['pdfwork']) {
|
||||
// save the page number
|
||||
$pdf_page_number = mysql_insert_id((isset($dbh)?$dbh:''));
|
||||
|
||||
// get the tables that have relations, by descending
|
||||
// get the tables that have relations, by descending
|
||||
// number of links
|
||||
$master_tables = 'SELECT COUNT(master_table), master_table'
|
||||
. ' FROM ' . PMA_backquote($cfgRelation['relation'])
|
||||
@@ -110,20 +110,20 @@ if ($cfgRelation['pdfwork']) {
|
||||
foreach($foreigners AS $foreigner) {
|
||||
if (!in_array($foreigner['foreign_table'], $foreign_tables)) {
|
||||
$foreign_tables[] = $foreigner['foreign_table'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// then merge the arrays
|
||||
foreach($foreign_tables AS $foreign_table) {
|
||||
if (!in_array($foreign_table, $all_tables)) {
|
||||
$all_tables[] = $foreign_table;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// now generate the coordinates for the schema,
|
||||
// in a clockwise spiral
|
||||
|
||||
|
||||
$pos_x = 300;
|
||||
$pos_y = 300;
|
||||
$delta = 50;
|
||||
@@ -309,7 +309,7 @@ if ($cfg['WYSIWYG-PDF']) {
|
||||
foreach($array_sh_page AS $key => $temp_sh_page) {
|
||||
$drag_x = $temp_sh_page['x'];
|
||||
$drag_y = $temp_sh_page['y'];
|
||||
|
||||
|
||||
$draginit .= ' Drag.init(getElement("table_' . $i . '"), null, 0, parseInt(myid.style.width)-2, 0, parseInt(myid.style.height)-5);' . "\n";
|
||||
$draginit .= ' getElement("table_' . $i . '").onDrag = function (x, y) { document.edcoord.elements["c_table_' . $i . '[x]"].value = parseInt(x); document.edcoord.elements["c_table_' . $i . '[y]"].value = parseInt(y) }' . "\n";
|
||||
$draginit .= ' getElement("table_' . $i . '").style.left = "' . $drag_x . 'px";' . "\n";
|
||||
@@ -319,7 +319,7 @@ foreach($array_sh_page AS $key => $temp_sh_page) {
|
||||
$reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[x]"].value = "2"' . "\n";
|
||||
$reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . (15 * $i) . '"' . "\n";
|
||||
|
||||
$local_query = 'SHOW FIELDS FROM '
|
||||
$local_query = 'SHOW FIELDS FROM '
|
||||
. PMA_backquote($temp_sh_page['table_name'] )
|
||||
. ' FROM ' . PMA_backquote($db);
|
||||
$fields_rs = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
|
||||
@@ -469,8 +469,8 @@ function resetDrag() {
|
||||
// d i s p l a y p d f s c h e m a
|
||||
// ------------------------------------
|
||||
|
||||
if (isset($do)
|
||||
&& ($do == 'edcoord'
|
||||
if (isset($do)
|
||||
&& ($do == 'edcoord'
|
||||
|| ($do == 'choosepage' && isset($chpage))
|
||||
|| ($do == 'createpage' && isset($chpage)))) {
|
||||
?>
|
||||
@@ -512,7 +512,7 @@ function resetDrag() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
ToggleDragDrop('pdflayout');
|
||||
ToggleDragDrop('pdflayout');
|
||||
// -->
|
||||
</script>
|
||||
<?php
|
||||
@@ -525,5 +525,5 @@ ToggleDragDrop('pdflayout');
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -11,15 +11,15 @@
|
||||
/**
|
||||
* Gets some core scripts
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./libraries/common.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
* Settings for relation stuff
|
||||
*/
|
||||
require('./libraries/relation.lib.php');
|
||||
require('./libraries/transformations.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
require_once('./libraries/transformations.lib.php');
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
@@ -42,7 +42,7 @@ if (!$cfgRelation['pdfwork']) {
|
||||
/**
|
||||
* Gets the "fpdf" libraries and defines the pdf font path
|
||||
*/
|
||||
require('./libraries/fpdf/fpdf.php');
|
||||
require_once('./libraries/fpdf/fpdf.php');
|
||||
$FPDF_font_path = './libraries/fpdf/font/';
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ class PMA_PDF extends FPDF
|
||||
global $server, $lang, $convcharset, $db;
|
||||
global $charset, $text_dir, $strRunning, $strDatabase;
|
||||
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
|
||||
echo '<p><b>PDF - '. $GLOBALS['strError'] . '</b></p>' . "\n";
|
||||
if (!empty($error_message)) {
|
||||
@@ -281,8 +281,7 @@ class PMA_PDF extends FPDF
|
||||
. '">' . $GLOBALS['strBack'] . '</a>';
|
||||
echo "\n";
|
||||
|
||||
include('./footer.inc.php');
|
||||
exit();
|
||||
require_once('./footer.inc.php');
|
||||
} // end of the "PMA_PDF_die()" function
|
||||
|
||||
|
||||
@@ -603,7 +602,7 @@ class PMA_RT_Table
|
||||
*
|
||||
* @param boolean Whether to display table position or not
|
||||
* @param integer The font size
|
||||
* @param boolean Whether to display color
|
||||
* @param boolean Whether to display color
|
||||
* @param integer The max. with among tables
|
||||
*
|
||||
* @global object The current PDF document
|
||||
@@ -1063,8 +1062,8 @@ class PMA_RT
|
||||
* @param integer The page number to draw (from the
|
||||
* $cfg['Servers'][$i]['table_coords'] table)
|
||||
* @param boolean Whether to display table position or not
|
||||
* @param boolean Was originally whether to use one color per
|
||||
* relation or not, now enables/disables color
|
||||
* @param boolean Was originally whether to use one color per
|
||||
* relation or not, now enables/disables color
|
||||
* everywhere, due to some problems printing with color
|
||||
* @param boolean Whether to draw grids or not
|
||||
* @param boolean Whether all tables should have the same width or not
|
||||
@@ -1172,7 +1171,7 @@ class PMA_RT
|
||||
// . ' AND foreign_table IN (' . $intable . ')';
|
||||
// $result = PMA_query_as_cu($sql);
|
||||
//
|
||||
// lem9:
|
||||
// lem9:
|
||||
// previous logic was checking master tables and foreign tables
|
||||
// but I think that looping on every table of the pdf page as a master
|
||||
// and finding its foreigns is OK (then we can support innodb)
|
||||
@@ -1185,7 +1184,7 @@ class PMA_RT
|
||||
$seen_a_relation = TRUE;
|
||||
foreach($exist_rel AS $master_field => $rel) {
|
||||
// put the foreign table on the schema only if selected
|
||||
// by the user
|
||||
// by the user
|
||||
// (do not use array_search() because we would have to
|
||||
// to do a === FALSE and this is not PHP3 compatible)
|
||||
|
||||
@@ -1522,4 +1521,4 @@ $paper = isset($paper) ? $paper : 'A4';
|
||||
PMA_mysql_select_db($db);
|
||||
|
||||
$rt = new PMA_RT($pdf_page_number, $show_table_dimension, $show_color, $show_grid, $all_tab_same_wide, $orientation, $paper);
|
||||
?>
|
||||
?>
|
||||
|
@@ -6,8 +6,8 @@
|
||||
/**
|
||||
* Gets core libraries and defines some variables
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./libraries/common.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
@@ -17,4 +17,4 @@ $is_superuser = @PMA_mysql_query('USE mysql', $userlink);
|
||||
if ($is_superuser || $cfg['ShowPhpInfo']) {
|
||||
phpinfo();
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* Gets the variables sent to this script, retains the db name that may have
|
||||
* been defined as startup option and include a core library
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
if (!empty($db)) {
|
||||
$db_start = $db;
|
||||
}
|
||||
@@ -16,8 +16,8 @@ if (!empty($db)) {
|
||||
/**
|
||||
* Gets a core script and starts output buffering work
|
||||
*/
|
||||
require('./libraries/common.lib.php');
|
||||
require('./libraries/ob.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/ob.lib.php');
|
||||
if ($cfg['OBGzip']) {
|
||||
$ob_mode = PMA_outBufferModeGet();
|
||||
if ($ob_mode) {
|
||||
@@ -29,7 +29,7 @@ if ($cfg['OBGzip']) {
|
||||
// to a seperate file. It can now be included by header.inc.php,
|
||||
// queryframe.php, querywindow.php.
|
||||
|
||||
include('./libraries/header_http.inc.php');
|
||||
require_once('./libraries/header_http.inc.php');
|
||||
|
||||
/**
|
||||
* Displays the frame
|
||||
@@ -129,4 +129,4 @@ if (isset($cfg['OBGzip']) && $cfg['OBGzip']
|
||||
&& isset($ob_mode) && $ob_mode) {
|
||||
PMA_outBufferPost($ob_mode);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* Gets the variables sent to this script, retains the db name that may have
|
||||
* been defined as startup option and include a core library
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
if (!empty($db)) {
|
||||
$db_start = $db;
|
||||
}
|
||||
@@ -16,8 +16,8 @@ if (!empty($db)) {
|
||||
/**
|
||||
* Gets a core script and starts output buffering work
|
||||
*/
|
||||
require('./libraries/common.lib.php');
|
||||
require('./libraries/ob.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/ob.lib.php');
|
||||
if ($cfg['OBGzip']) {
|
||||
$ob_mode = PMA_outBufferModeGet();
|
||||
if ($ob_mode) {
|
||||
@@ -25,7 +25,7 @@ if ($cfg['OBGzip']) {
|
||||
}
|
||||
}
|
||||
|
||||
require('./libraries/relation.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
/**
|
||||
@@ -43,11 +43,11 @@ if ($server > 0) {
|
||||
// to a seperate file. It can now be included by header.inc.php,
|
||||
// queryframe.php, querywindow.php.
|
||||
|
||||
include('./libraries/header_http.inc.php');
|
||||
include('./libraries/header_meta_style.inc.php');
|
||||
require_once('./libraries/header_http.inc.php');
|
||||
require_once('./libraries/header_meta_style.inc.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
<script type="text/javascript" language="javascript">
|
||||
<?php
|
||||
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && $cfg['QueryFrameDebug']) {
|
||||
$js_db = (isset($db) ? $db : 'FALSE');
|
||||
@@ -57,7 +57,7 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && $cfg['QueryFrameDebug']) {
|
||||
$js_true_db = '\' + document.querywindow.db.value + \'';
|
||||
$js_true_table = '\' + document.querywindow.table.value + \'';
|
||||
$js_true_server = '\' + document.querywindow.server.value + \'';
|
||||
|
||||
|
||||
$js_parent = '\' + opener.location.href + \'';
|
||||
$js_frame = '\' + opener.parent.location.href + \'';
|
||||
?>
|
||||
@@ -94,7 +94,7 @@ var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '
|
||||
<?php
|
||||
if ($cfg['QueryFrameJS'] && !isset($no_js)) {
|
||||
$querydisplay_tab = (isset($querydisplay_tab) ? $querydisplay_tab : $cfg['QueryWindowDefTab']);
|
||||
|
||||
|
||||
if ($cfg['LightTabs']) {
|
||||
echo ' ';
|
||||
} else {
|
||||
@@ -154,7 +154,7 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||
if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
|
||||
PMA_setHistory((isset($query_history_latest_db) ? $query_history_latest_db : ''), (isset($query_history_latest_table) ? $query_history_latest_table : ''), $cfg['Server']['user'], $query_history_latest);
|
||||
}
|
||||
|
||||
|
||||
$input_query_history[] = '<input type="hidden" name="query_history[]" value="' . $query_history_latest . '" />';
|
||||
$input_query_history[] = '<input type="hidden" name="query_history_db[]" value="' . htmlspecialchars($query_history_latest_db) . '" />';
|
||||
$input_query_history[] = '<input type="hidden" name="query_history_table[]" value="' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '" />';
|
||||
@@ -171,7 +171,7 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||
} elseif (isset($query_history_latest) && $query_history_latest != '') {
|
||||
$sql_query = urldecode($query_history_latest);
|
||||
}
|
||||
|
||||
|
||||
if (isset($sql_query)) {
|
||||
$show_query = 1;
|
||||
}
|
||||
@@ -192,16 +192,16 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if (isset($query_history) && is_array($query_history)) {
|
||||
$current_index = count($query_history);
|
||||
foreach($query_history AS $query_no => $query_sql) {
|
||||
if (!isset($dup_sql[$query_sql])) {
|
||||
|
||||
|
||||
$input_query_history[] = '<input type="hidden" name="query_history[]" value="' . $query_sql . '" />';
|
||||
$input_query_history[] = '<input type="hidden" name="query_history_db[]" value="' . htmlspecialchars($query_history_db[$query_no]) . '" />';
|
||||
$input_query_history[] = '<input type="hidden" name="query_history_table[]" value="' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '" />';
|
||||
|
||||
|
||||
$sql_history[] = '<li>'
|
||||
. '<a href="#" onClick="document.querywindow.querydisplay_tab.value = \'' . (isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full') . '\'; document.querywindow.query_history_latest.value = \'' . htmlspecialchars($query_sql) . '\'; document.querywindow.auto_commit.value = \'false\'; document.querywindow.db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.submit(); return false;">' . $titles['Change'] . '</a>'
|
||||
. '<a href="#" onClick="document.querywindow.querydisplay_tab.value = \'' . (isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full') . '\'; document.querywindow.query_history_latest.value = \'' . htmlspecialchars($query_sql) . '\'; document.querywindow.auto_commit.value = \'true\'; document.querywindow.db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.submit(); return false;">[' . htmlspecialchars($query_history_db[$query_no]) . '] ' . urldecode($query_sql) . '</a>'
|
||||
@@ -210,7 +210,7 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||
} // end if check if this item exists
|
||||
} // end while print history
|
||||
} // end if history exists
|
||||
|
||||
|
||||
} // end if DB-based history
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ if (!isset($goto)) {
|
||||
$goto = '';
|
||||
}
|
||||
|
||||
require './libraries/bookmark.lib.php';
|
||||
require_once './libraries/bookmark.lib.php';
|
||||
$is_inside_querywindow = TRUE;
|
||||
require './tbl_query_box.php';
|
||||
|
||||
@@ -232,7 +232,7 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
if (isset($sql_history) && isset($querydisplay_tab) && ($querydisplay_tab == 'history' || $querydisplay_tab == 'full') && is_array($sql_history) && count($sql_history) > 0) {
|
||||
?>
|
||||
<li>
|
||||
@@ -242,7 +242,7 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||
}
|
||||
?>
|
||||
<form action="querywindow.php" method="post" name="querywindow">
|
||||
<?php
|
||||
<?php
|
||||
echo PMA_generate_common_hidden_inputs('', '');
|
||||
if (count($input_query_history) > 0) {
|
||||
echo implode("\n", $input_query_history);
|
||||
@@ -254,14 +254,14 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||
<input type="hidden" name="query_history_latest" value="" />
|
||||
<input type="hidden" name="query_history_latest_db" value="" />
|
||||
<input type="hidden" name="query_history_latest_table" value="" />
|
||||
|
||||
|
||||
<input type="hidden" name="previous_db" value="<?php echo htmlspecialchars($db); ?>" />
|
||||
|
||||
<input type="hidden" name="auto_commit" value="false" />
|
||||
<input type="hidden" name="querydisplay_tab" value="<?php echo $querydisplay_tab; ?>" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
<?php
|
||||
}
|
||||
|
||||
/* REMOVE ME */
|
||||
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && $cfg['QueryFrameDebug']) {
|
||||
@@ -297,4 +297,4 @@ if (isset($cfg['OBGzip']) && $cfg['OBGzip']
|
||||
&& isset($ob_mode) && $ob_mode) {
|
||||
PMA_outBufferPost($ob_mode);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@@ -5,9 +5,9 @@
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./libraries/read_dump.lib.php');
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./libraries/common.lib.php');
|
||||
require_once('./libraries/read_dump.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
if (!isset($db)) {
|
||||
$db = '';
|
||||
@@ -49,7 +49,7 @@ if (!empty($sql_localfile) && !empty($cfg['UploadDir'])) {
|
||||
* Bookmark Support: get a query back from bookmark if required
|
||||
*/
|
||||
if (!empty($id_bookmark)) {
|
||||
include('./libraries/bookmark.lib.php');
|
||||
require_once('./libraries/bookmark.lib.php');
|
||||
switch ($action_bookmark) {
|
||||
case 0: // bookmarked query that have to be run
|
||||
$sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], $id_bookmark);
|
||||
@@ -150,7 +150,7 @@ if (!$cfg['AllowUserDropDatabase']
|
||||
// loic1: optimized query
|
||||
$result = @PMA_mysql_query('USE mysql');
|
||||
if (PMA_mysql_error()) {
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
PMA_mysqlDie($strNoDropDatabases, '', '', $err_url);
|
||||
}
|
||||
}
|
||||
@@ -160,14 +160,14 @@ define('PMA_CHK_DROP', 1);
|
||||
* Store a query as a bookmark before executing it?
|
||||
*/
|
||||
if (isset($SQLbookmark) && $sql_query != '') {
|
||||
include('./libraries/bookmark.lib.php');
|
||||
require_once('./libraries/bookmark.lib.php');
|
||||
$bfields = array(
|
||||
'dbase' => $db,
|
||||
'user' => $cfg['Bookmark']['user'],
|
||||
'query' => $sql_query,
|
||||
'label' => $bkm_label
|
||||
);
|
||||
|
||||
|
||||
PMA_addBookmarks($bfields, $cfg['Bookmark'], (isset($bkm_all_users) && $bkm_all_users == 'true' ? true : false));
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ if ($sql_query != '') {
|
||||
if ($pieces_count > 1) {
|
||||
$is_multiple = TRUE;
|
||||
}
|
||||
|
||||
|
||||
// Copy of the cleaned sql statement for display purpose only (see near the
|
||||
// beginning of "db_details.php" & "tbl_properties.php")
|
||||
|
||||
@@ -207,7 +207,7 @@ if ($sql_query != '') {
|
||||
$max_file_length = 50000;
|
||||
$max_file_pieces = 50;
|
||||
}
|
||||
|
||||
|
||||
if ($sql_file != 'none' &&
|
||||
(($max_file_pieces != 0 && ($pieces_count > $max_file_pieces))
|
||||
||
|
||||
@@ -239,8 +239,7 @@ if ($sql_query != '') {
|
||||
if (preg_match('@^(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@i', $sql_query)) {
|
||||
$reload = 1;
|
||||
}
|
||||
include('./sql.php');
|
||||
exit();
|
||||
require('./sql.php');
|
||||
}
|
||||
|
||||
// Runs multiple queries
|
||||
@@ -248,15 +247,14 @@ if ($sql_query != '') {
|
||||
$mult = TRUE;
|
||||
$info_msg = '';
|
||||
$info_count = 0;
|
||||
|
||||
|
||||
for ($i = 0; $i < $pieces_count; $i++) {
|
||||
$a_sql_query = $pieces[$i];
|
||||
if ($i == $pieces_count - 1 && preg_match('@^(SELECT|SHOW)@i', $a_sql_query)) {
|
||||
$complete_query = $sql_query;
|
||||
$display_query = $sql_query;
|
||||
$sql_query = $a_sql_query;
|
||||
include('./sql.php');
|
||||
exit();
|
||||
require('./sql.php');
|
||||
}
|
||||
|
||||
$result = PMA_mysql_query($a_sql_query);
|
||||
@@ -269,12 +267,12 @@ if ($sql_query != '') {
|
||||
} else {
|
||||
$my_die = $a_sql_query;
|
||||
}
|
||||
|
||||
|
||||
if ($cfg['VerboseMultiSubmit']) {
|
||||
$info_msg .= $a_sql_query . '; # ' . $strError . "\n";
|
||||
$info_count++;
|
||||
}
|
||||
|
||||
|
||||
if (!$cfg['IgnoreMultiSubmitErrors']) {
|
||||
break;
|
||||
}
|
||||
@@ -291,7 +289,7 @@ if ($sql_query != '') {
|
||||
$a_rows = '';
|
||||
$a_switch = $strEmptyResultSet;
|
||||
}
|
||||
|
||||
|
||||
$info_msg .= $a_sql_query . "; # " . $a_switch . $a_rows . "\n";
|
||||
$info_count++;
|
||||
}
|
||||
@@ -300,7 +298,7 @@ if ($sql_query != '') {
|
||||
$reload = 1;
|
||||
}
|
||||
} // end for
|
||||
|
||||
|
||||
if ($cfg['VerboseMultiSubmit'] && strlen($info_msg) > 0 &&
|
||||
((!isset($save_bandwidth) || $save_bandwidth == FALSE) ||
|
||||
($save_bandwidth_pieces == 0 && strlen($info_msg) < $save_bandwidth_length) ||
|
||||
@@ -320,7 +318,7 @@ if ($sql_query != '') {
|
||||
*/
|
||||
if (isset($my_die)) {
|
||||
$js_to_run = 'functions.js';
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
if (is_array($my_die)) {
|
||||
foreach($my_die AS $key => $die_string) {
|
||||
PMA_mysqlDie('', $die_string, '', $err_url, FALSE);
|
||||
@@ -387,7 +385,7 @@ if ($goto == 'db_details.php' || $goto == 'tbl_properties.php') {
|
||||
$js_to_run = 'functions.js';
|
||||
}
|
||||
if ($goto != 'main.php') {
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
}
|
||||
$active_page = $goto;
|
||||
require('./' . $goto);
|
||||
|
@@ -64,7 +64,7 @@ cat <<END
|
||||
|
||||
Please ensure you have:
|
||||
1. incremented rc count or version in CVS :
|
||||
- in libraries/defines_php.lib.php the line
|
||||
- in libraries/defines.lib.php the line
|
||||
" define('PMA_VERSION', '$1'); "
|
||||
- in Documentation.html the 2 lines
|
||||
" <title>phpMyAdmin $1 - Documentation</title> "
|
||||
@@ -177,7 +177,7 @@ Todo now:
|
||||
phpmyadmin-news@lists.sourceforge.net
|
||||
phpmyadmin-users@lists.sourceforge.net
|
||||
8. increment rc count or version in CVS :
|
||||
- in libraries/defines_php.lib.php the line
|
||||
- in libraries/defines.lib.php the line
|
||||
" define('PHPMYADMIN_VERSION', '2.2.2-rc1'); "
|
||||
- in Documentation.html the 2 lines
|
||||
" <title>phpMyAdmin 2.2.2-rc1 - Documentation</title> "
|
||||
|
@@ -28,15 +28,14 @@ echo '<h2>' . "\n"
|
||||
*/
|
||||
if (PMA_MYSQL_INT_VERSION < 40100) {
|
||||
// TODO: Some nice Message :-)
|
||||
include('./footer.inc.php');
|
||||
exit;
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Includes the required charset library
|
||||
*/
|
||||
require('./libraries/mysql_charsets.lib.php');
|
||||
require_once('./libraries/mysql_charsets.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
@@ -101,6 +100,6 @@ echo ' </table>' . "\n"
|
||||
. ' </tr>' . "\n"
|
||||
. '</table>' . "\n";
|
||||
|
||||
require('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -5,22 +5,13 @@
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
|
||||
include('./libraries/grab_globals.lib.php');
|
||||
}
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
/**
|
||||
* Handles some variables that may have been sent by the calling script
|
||||
*/
|
||||
if (isset($db)) {
|
||||
unset($db);
|
||||
}
|
||||
if (isset($table)) {
|
||||
unset($table);
|
||||
}
|
||||
unset($db, $table);
|
||||
|
||||
/**
|
||||
* Set parameters for links
|
||||
@@ -35,7 +26,7 @@ $err_url = 'main.php' . $url_query;
|
||||
/**
|
||||
* Displays the headers
|
||||
*/
|
||||
require('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
|
||||
/**
|
||||
* Checks for superuser privileges
|
||||
@@ -50,4 +41,4 @@ $is_superuser = @PMA_mysql_query('SELECT COUNT(*) FROM mysql.user', $userlink);
|
||||
if ($is_superuser) {
|
||||
@PMA_mysql_query('USE mysql', $userlink);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
/**
|
||||
* Checks if the left frame has to be reloaded
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
@@ -74,7 +74,7 @@ if ((!empty($drop_selected_dbs) || isset($query_type)) && ($is_superuser || $cfg
|
||||
$action = 'server_databases.php';
|
||||
$submit_mult = 'drop_db' ;
|
||||
$err_url = 'server_databases.php?' . PMA_generate_common_url();
|
||||
include('./mult_submits.inc.php');
|
||||
require('./mult_submits.inc.php');
|
||||
$message = sprintf($strDatabasesDropped, count($selected));
|
||||
// we need to reload the database list now.
|
||||
PMA_availableDatabases();
|
||||
@@ -102,8 +102,7 @@ echo '<h2>' . "\n"
|
||||
*/
|
||||
if (!empty($dbstats) && !$is_superuser) {
|
||||
echo $strNoPrivileges . "\n";
|
||||
include('./footer.inc.php');
|
||||
exit;
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
|
||||
|
||||
@@ -373,6 +372,6 @@ if (count($statistics) > 0) {
|
||||
/**
|
||||
* Sends the footer
|
||||
*/
|
||||
require('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
|
||||
?>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
/**
|
||||
* Checks if the left frame has to be reloaded
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
@@ -51,7 +51,7 @@ foreach($dblist AS $current_db) {
|
||||
$multi_values .= "\n";
|
||||
$multi_values .= '</select></div>';
|
||||
|
||||
$checkall_url = 'server_export.php?'
|
||||
$checkall_url = 'server_export.php?'
|
||||
. PMA_generate_common_url()
|
||||
. '&goto=db_details_export.php';
|
||||
|
||||
@@ -62,11 +62,11 @@ $multi_values .= '<br />
|
||||
<br /><br />';
|
||||
|
||||
$export_type = 'server';
|
||||
require('./libraries/display_export.lib.php');
|
||||
require_once('./libraries/display_export.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -4,9 +4,7 @@
|
||||
|
||||
// Check parameters
|
||||
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
require_once('./libraries/common.lib.php');
|
||||
PMA_checkParameters(array('is_superuser', 'url_query'));
|
||||
|
||||
/**
|
||||
@@ -66,4 +64,4 @@ echo PMA_printTab($strExport, 'server_export.php', $url_query);
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<br />
|
||||
|
@@ -27,13 +27,12 @@ if (!empty($pred_tablename)) {
|
||||
* Checks if the user is allowed to do what he tries to...
|
||||
*/
|
||||
if (!$is_superuser) {
|
||||
include('./server_links.inc.php');
|
||||
require('./server_links.inc.php');
|
||||
echo '<h2>' . "\n"
|
||||
. ' ' . $strPrivileges . "\n"
|
||||
. '</h2>' . "\n"
|
||||
. $strNoPrivileges . "\n";
|
||||
include('./footer.inc.php');
|
||||
exit;
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
|
||||
|
||||
@@ -1021,8 +1020,7 @@ if (empty($adduser) && empty($checkprivs)) {
|
||||
$res = PMA_mysql_query('SELECT "foo" FROM `user` WHERE `User` = "' . PMA_sqlAddslashes($username) . '" AND `Host` = "' . $hostname . '";', $userlink);
|
||||
if (mysql_affected_rows($userlink) <= 0) {
|
||||
echo $strUserNotFound;
|
||||
include('./footer.inc.php');
|
||||
exit;
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
mysql_free_result($res);
|
||||
unset($res);
|
||||
@@ -1427,6 +1425,6 @@ if (empty($adduser) && empty($checkprivs)) {
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n\n";
|
||||
require('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
|
||||
?>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
/**
|
||||
* Does the common work
|
||||
*/
|
||||
require('./server_common.inc.php');
|
||||
require_once('./server_common.inc.php');
|
||||
|
||||
|
||||
/**
|
||||
@@ -94,6 +94,6 @@ foreach($serverProcesses AS $name => $value) {
|
||||
/**
|
||||
* Sends the footer
|
||||
*/
|
||||
require('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
|
||||
?>
|
||||
|
@@ -29,8 +29,7 @@ if (!empty($innodbstatus)) {
|
||||
. htmlspecialchars($row[0]) . "\n"
|
||||
. '</pre>' . "\n";
|
||||
mysql_free_result($res);
|
||||
include('./footer.inc.php');
|
||||
exit;
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,8 +45,7 @@ echo '<h2>' . "\n"
|
||||
*/
|
||||
if (!$is_superuser && !$cfg['ShowMysqlInfo']) {
|
||||
echo $strNoPrivileges;
|
||||
include('./footer.inc.php');
|
||||
exit;
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
|
||||
|
||||
@@ -301,6 +299,6 @@ if ($res) {
|
||||
/**
|
||||
* Sends the footer
|
||||
*/
|
||||
require('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
|
||||
?>
|
||||
|
@@ -28,8 +28,7 @@ echo '<h2>' . "\n"
|
||||
*/
|
||||
if (!$is_superuser && !$cfg['ShowMysqlVars']) {
|
||||
echo $strNoPrivileges;
|
||||
include('./footer.inc.php');
|
||||
exit;
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +107,6 @@ foreach ($serverVars as $name => $value) {
|
||||
/**
|
||||
* Sends the footer
|
||||
*/
|
||||
require('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
|
||||
?>
|
||||
|
40
sql.php
40
sql.php
@@ -5,8 +5,8 @@
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./libraries/common.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
@@ -61,7 +61,7 @@ if (!defined('PMA_CHK_DROP')
|
||||
// loic1: optimized query
|
||||
$result = @PMA_mysql_query('USE mysql');
|
||||
if (PMA_mysql_error()) {
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
PMA_mysqlDie($strNoDropDatabases, '', '', $err_url);
|
||||
} // end if
|
||||
} // end if
|
||||
@@ -71,7 +71,7 @@ if (!defined('PMA_CHK_DROP')
|
||||
* Bookmark add
|
||||
*/
|
||||
if (isset($store_bkm)) {
|
||||
include('./libraries/bookmark.lib.php');
|
||||
require_once('./libraries/bookmark.lib.php');
|
||||
PMA_addBookmarks($fields, $cfg['Bookmark'], (isset($bkm_all_users) && $bkm_all_users == 'true' ? true : false));
|
||||
header('Location: ' . $cfg['PmaAbsoluteUri'] . $goto);
|
||||
} // end if
|
||||
@@ -151,7 +151,7 @@ if (isset($btnDrop) && $btnDrop == $strNo) {
|
||||
unset($table);
|
||||
}
|
||||
$active_page = $goto;
|
||||
include('./' . preg_replace('@\.\.*@', '.', $goto));
|
||||
require('./' . preg_replace('@\.\.*@', '.', $goto));
|
||||
} else {
|
||||
header('Location: ' . $cfg['PmaAbsoluteUri'] . str_replace('&', '&', $goto));
|
||||
}
|
||||
@@ -187,7 +187,7 @@ if (!$cfg['Confirm']
|
||||
|
||||
if ($do_confirm) {
|
||||
$stripped_sql_query = $sql_query;
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
echo $strDoYouReally . ' :<br />' . "\n";
|
||||
echo '<tt>' . htmlspecialchars($stripped_sql_query) . '</tt> ?<br/>' . "\n";
|
||||
?>
|
||||
@@ -324,7 +324,7 @@ else {
|
||||
// Displays an error message if required and stop parsing the script
|
||||
if (PMA_mysql_error()) {
|
||||
$error = PMA_mysql_error();
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
$full_err_url = (preg_match('@^(db_details|tbl_properties)@', $err_url))
|
||||
? $err_url . '&show_query=1&sql_query=' . urlencode($sql_query)
|
||||
: $err_url;
|
||||
@@ -498,7 +498,7 @@ else {
|
||||
|
||||
// garvin: if a table or database gets dropped, check column comments.
|
||||
if (isset($purge) && $purge == '1') {
|
||||
include('./libraries/relation_cleanup.lib.php');
|
||||
require_once('./libraries/relation_cleanup.lib.php');
|
||||
|
||||
if (isset($table) && isset($db) && !empty($table) && !empty($db)) {
|
||||
PMA_relationsCleanupTable($db, $table);
|
||||
@@ -513,7 +513,7 @@ else {
|
||||
if (isset($cpurge) && $cpurge == '1' && isset($purgekey)
|
||||
&& isset($db) && isset($table)
|
||||
&& !empty($db) && !empty($table) && !empty($purgekey)) {
|
||||
include('./libraries/relation_cleanup.lib.php');
|
||||
require_once('./libraries/relation_cleanup.lib.php');
|
||||
PMA_relationsCleanupColumn($db, $table, $purgekey);
|
||||
|
||||
} // end if column PMA_* purge
|
||||
@@ -585,10 +585,10 @@ else {
|
||||
$js_to_run = 'functions.js';
|
||||
}
|
||||
if ($goto != 'main.php') {
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
}
|
||||
$active_page = $goto;
|
||||
include('./' . $goto);
|
||||
require('./' . $goto);
|
||||
} // end if file_exist
|
||||
else {
|
||||
header('Location: ' . $cfg['PmaAbsoluteUri'] . str_replace('&', '&', $goto) . '&message=' . urlencode($message));
|
||||
@@ -603,22 +603,22 @@ else {
|
||||
unset($show_query);
|
||||
}
|
||||
if (isset($printview) && $printview == '1') {
|
||||
include('./header_printview.inc.php');
|
||||
require_once('./header_printview.inc.php');
|
||||
} else {
|
||||
$js_to_run = 'functions.js';
|
||||
unset($message);
|
||||
if (!empty($table)) {
|
||||
include('./tbl_properties_common.php');
|
||||
require('./tbl_properties_common.php');
|
||||
$url_query .= '&goto=tbl_properties.php&back=tbl_properties.php';
|
||||
include('./tbl_properties_table_info.php');
|
||||
require('./tbl_properties_table_info.php');
|
||||
}
|
||||
else {
|
||||
include('./db_details_common.php');
|
||||
include('./db_details_db_info.php');
|
||||
require('./db_details_common.php');
|
||||
require('./db_details_db_info.php');
|
||||
}
|
||||
}
|
||||
|
||||
include('./libraries/relation.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
// Gets the list of fields properties
|
||||
@@ -641,7 +641,7 @@ else {
|
||||
}
|
||||
|
||||
// Displays the results in a table
|
||||
include('./libraries/display_tbl.lib.php');
|
||||
require_once('./libraries/display_tbl.lib.php');
|
||||
if (empty($disp_mode)) {
|
||||
// see the "PMA_setDisplayMode()" function in
|
||||
// libraries/display_tbl.lib.php
|
||||
@@ -786,5 +786,5 @@ echo "\n\n";
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -6,9 +6,9 @@
|
||||
/**
|
||||
* Get some core libraries
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
$js_to_run = 'functions.js';
|
||||
require('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
|
||||
// Check parameters
|
||||
PMA_checkParameters(array('db', 'table'));
|
||||
@@ -183,8 +183,8 @@ if (isset($submit)) {
|
||||
} // end if
|
||||
|
||||
// garvin: If comments were sent, enable relation stuff
|
||||
require('./libraries/relation.lib.php');
|
||||
require('./libraries/transformations.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
require_once('./libraries/transformations.lib.php');
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
@@ -207,8 +207,7 @@ if (isset($submit)) {
|
||||
unset($sql_query_cpy);
|
||||
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
|
||||
$active_page = 'tbl_properties_structure.php';
|
||||
include('./tbl_properties_structure.php');
|
||||
exit();
|
||||
require('./tbl_properties_structure.php');
|
||||
} else {
|
||||
PMA_mysqlDie('', '', '', $err_url, FALSE);
|
||||
// garvin: An error happened while inserting/updating a table definition.
|
||||
@@ -227,11 +226,11 @@ if (isset($submit)) {
|
||||
*/
|
||||
if ($abort == FALSE) {
|
||||
$action = 'tbl_addfield.php';
|
||||
include('./tbl_properties.inc.php');
|
||||
require('./tbl_properties.inc.php');
|
||||
|
||||
// Diplays the footer
|
||||
echo "\n";
|
||||
include('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -6,9 +6,9 @@
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
$js_to_run = 'functions.js';
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
|
||||
// Check parameters
|
||||
PMA_checkParameters(array('db', 'table'));
|
||||
@@ -84,8 +84,8 @@ if (isset($submit)) {
|
||||
$btnDrop = 'Fake';
|
||||
|
||||
// garvin: If comments were sent, enable relation stuff
|
||||
require('./libraries/relation.lib.php');
|
||||
require('./libraries/transformations.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
require_once('./libraries/transformations.lib.php');
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
@@ -142,8 +142,7 @@ if (isset($submit)) {
|
||||
}
|
||||
|
||||
$active_page = 'tbl_properties_structure.php';
|
||||
include('./tbl_properties_structure.php');
|
||||
exit();
|
||||
require('./tbl_properties_structure.php');
|
||||
} else {
|
||||
PMA_mysqlDie('', '', '', $err_url, FALSE);
|
||||
// garvin: An error happened while inserting/updating a table definition.
|
||||
@@ -184,12 +183,12 @@ if ($abort == FALSE) {
|
||||
|
||||
$num_fields = count($fields_meta);
|
||||
$action = 'tbl_alter.php';
|
||||
include('./tbl_properties.inc.php');
|
||||
require('./tbl_properties.inc.php');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -6,10 +6,10 @@
|
||||
/**
|
||||
* Get the variables sent or posted to this script and displays the header
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
$js_to_run = 'tbl_change.js';
|
||||
require('./header.inc.php');
|
||||
require('./libraries/relation.lib.php'); // foreign keys
|
||||
require_once('./header.inc.php');
|
||||
require_once('./libraries/relation.lib.php'); // foreign keys
|
||||
|
||||
|
||||
/**
|
||||
@@ -221,7 +221,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
|
||||
$row_table_def = PMA_mysql_fetch_array($table_def);
|
||||
$row_table_def['True_Type'] = preg_replace('@\(.*@s', '', $row_table_def['Type']);
|
||||
|
||||
|
||||
$field = $row_table_def['Field'];
|
||||
|
||||
// garvin: possible workaround. If current field is numerical, do not try to
|
||||
@@ -249,7 +249,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
// UPDATE case with an empty and not NULL value under PHP4
|
||||
else if (empty($row[$rowfield]) && is_null($row[$rowfield])) {
|
||||
$row[$rowfield] = date('Y-m-d H:i:s', time());
|
||||
} // end if... else if...
|
||||
} // end if... else if...
|
||||
}
|
||||
$len = (preg_match('@float|double@', $row_table_def['Type']))
|
||||
? 100
|
||||
@@ -377,7 +377,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
$cnt_dropdown = count($dropdown);
|
||||
for ($j = 0; $j < $cnt_dropdown; $j++) {
|
||||
// Is current function defined as default?
|
||||
$selected = ($first_timestamp && $dropdown[$j] == $cfg['DefaultFunctions']['first_timestamp'])
|
||||
$selected = ($first_timestamp && $dropdown[$j] == $cfg['DefaultFunctions']['first_timestamp'])
|
||||
|| (!$first_timestamp && $dropdown[$j] == $default_function)
|
||||
? ' selected="selected"'
|
||||
: '';
|
||||
@@ -394,7 +394,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
for ($j = 0; $j < $cnt_functions; $j++) {
|
||||
if (!isset($dropdown_built[$cfg['Functions'][$j]]) || $dropdown_built[$cfg['Functions'][$j]] != 'TRUE') {
|
||||
// Is current function defined as default?
|
||||
$selected = ($first_timestamp && $cfg['Functions'][$j] == $cfg['DefaultFunctions']['first_timestamp'])
|
||||
$selected = ($first_timestamp && $cfg['Functions'][$j] == $cfg['DefaultFunctions']['first_timestamp'])
|
||||
|| (!$first_timestamp && $cfg['Functions'][$j] == $default_function)
|
||||
? ' selected="selected"'
|
||||
: '';
|
||||
@@ -453,7 +453,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
// The value column (depends on type)
|
||||
// ----------------
|
||||
|
||||
include('./libraries/get_foreign.lib.php');
|
||||
require('./libraries/get_foreign.lib.php');
|
||||
|
||||
if (isset($foreign_link) && $foreign_link == true) {
|
||||
?>
|
||||
@@ -780,5 +780,5 @@ if (!empty($disp_message)) {
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -6,15 +6,13 @@
|
||||
/**
|
||||
* Get some core libraries
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
$js_to_run = 'functions.js';
|
||||
require('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
|
||||
// Check parameters
|
||||
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
PMA_checkParameters(array('db', 'table'));
|
||||
|
||||
@@ -185,8 +183,8 @@ if (isset($submit)) {
|
||||
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenCreated;
|
||||
|
||||
// garvin: If comments were sent, enable relation stuff
|
||||
require('./libraries/relation.lib.php');
|
||||
require('./libraries/transformations.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
require_once('./libraries/transformations.lib.php');
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
@@ -204,7 +202,7 @@ if (isset($submit)) {
|
||||
}
|
||||
}
|
||||
|
||||
include('./' . $cfg['DefaultTabTable']);
|
||||
require('./' . $cfg['DefaultTabTable']);
|
||||
$abort = TRUE;
|
||||
exit();
|
||||
} else {
|
||||
@@ -235,10 +233,10 @@ if ($abort == FALSE) {
|
||||
// Table name and number of fields are valid -> show the form
|
||||
else {
|
||||
$action = 'tbl_create.php';
|
||||
include('./tbl_properties.inc.php');
|
||||
require('./tbl_properties.inc.php');
|
||||
// Diplays the footer
|
||||
echo "\n";
|
||||
include('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -6,12 +6,8 @@
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
|
||||
include('./libraries/grab_globals.lib.php');
|
||||
}
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
@@ -37,7 +33,7 @@ if (!defined('PMA_IDX_INCLUDED')) {
|
||||
}
|
||||
if (empty($db) || !$is_db) {
|
||||
header('Location: ' . $cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
|
||||
exit();
|
||||
exit;
|
||||
}
|
||||
// Not a valid table name -> back to the default db_details sub-page
|
||||
if (!empty($table)) {
|
||||
@@ -46,14 +42,14 @@ if (!defined('PMA_IDX_INCLUDED')) {
|
||||
if (empty($table)
|
||||
|| !($is_table && @mysql_numrows($is_table))) {
|
||||
header('Location: ' . $cfg['PmaAbsoluteUri'] . $cfg['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db, '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
|
||||
exit();
|
||||
exit;
|
||||
} else if (isset($is_table)) {
|
||||
mysql_free_result($is_table);
|
||||
}
|
||||
|
||||
// Displays headers (if needed)
|
||||
$js_to_run = ((isset($index) && isset($do_save_data)) ? 'functions.js' : 'indexes.js');
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
} // end if
|
||||
|
||||
|
||||
@@ -209,8 +205,7 @@ if (!defined('PMA_IDX_INCLUDED')
|
||||
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
|
||||
|
||||
$active_page = 'tbl_properties_structure.php';
|
||||
include('./tbl_properties_structure.php');
|
||||
exit();
|
||||
require('./tbl_properties_structure.php');
|
||||
} // end builds the new index
|
||||
|
||||
|
||||
@@ -504,6 +499,6 @@ else if (!defined('PMA_IDX_INCLUDED')
|
||||
echo "\n";
|
||||
|
||||
if (!defined('PMA_IDX_INCLUDED')){
|
||||
include('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
}
|
||||
?>
|
||||
|
@@ -4,11 +4,8 @@
|
||||
|
||||
// Check parameters
|
||||
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
PMA_checkParameters(array('db', 'table'));
|
||||
|
||||
@@ -46,16 +43,16 @@ function PMA_myHandler($sql_insert = '')
|
||||
* @param array Which fields will be used as new VALUES. These are the important
|
||||
* keys which differ from the old entry.
|
||||
* (array('FIELDNAME' => 'NEW FIELDVALUE'))
|
||||
|
||||
|
||||
* @global string relation variable
|
||||
*
|
||||
*
|
||||
* @author Garvin Hicking <me@supergarv.de>
|
||||
*/
|
||||
function PMA_duplicate_table($work, $pma_table, $get_fields, $where_fields, $new_fields) {
|
||||
global $cfgRelation;
|
||||
|
||||
$last_id = -1;
|
||||
|
||||
|
||||
if ($cfgRelation[$work]) {
|
||||
$select_parts = array();
|
||||
$row_fields = array();
|
||||
@@ -63,12 +60,12 @@ global $cfgRelation;
|
||||
$select_parts[] = PMA_backquote($get_field);
|
||||
$row_fields[$get_field] = 'cc';
|
||||
}
|
||||
|
||||
|
||||
$where_parts = array();
|
||||
foreach($where_fields AS $_where => $_value) {
|
||||
$where_parts[] = PMA_backquote($_where) . ' = \'' . PMA_sqlAddslashes($_value) . '\'';
|
||||
}
|
||||
|
||||
|
||||
$new_parts = array();
|
||||
$new_value_parts = array();
|
||||
foreach($new_fields AS $_where => $_value) {
|
||||
@@ -88,7 +85,7 @@ global $cfgRelation;
|
||||
$value_parts[] = PMA_sqlAddslashes($_val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$new_table_query = 'INSERT IGNORE INTO ' . PMA_backquote($cfgRelation[$pma_table])
|
||||
. ' (' . implode(', ', $select_parts) . ', ' . implode(', ', $new_parts) . ')'
|
||||
. ' VALUES '
|
||||
@@ -97,18 +94,18 @@ global $cfgRelation;
|
||||
$new_table_rs = PMA_query_as_cu($new_table_query);
|
||||
$last_id = (@function_exists('mysql_insert_id') ? @mysql_insert_id() : -1);
|
||||
} // end while
|
||||
|
||||
|
||||
return $last_id;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
} // end of 'PMA_duplicate_table()' function
|
||||
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php');
|
||||
require('./libraries/common.lib.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
@@ -142,15 +139,15 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
$source = PMA_backquote($db) . '.' . PMA_backquote($table);
|
||||
if (empty($target_db)) $target_db = $db;
|
||||
|
||||
// This could avoid some problems with replicated databases, when
|
||||
// This could avoid some problems with replicated databases, when
|
||||
// moving table from replicated one to not replicated one
|
||||
PMA_mysql_select_db($target_db);
|
||||
|
||||
|
||||
$target = PMA_backquote($target_db) . '.' . PMA_backquote($new_name);
|
||||
|
||||
// do not create the table if dataonly
|
||||
if ($what != 'dataonly') {
|
||||
include('./libraries/export/sql.php');
|
||||
require('./libraries/export/sql.php');
|
||||
|
||||
$no_constraints_comments = true;
|
||||
$sql_structure = PMA_getTableDef($db, $table, "\n", $err_url);
|
||||
@@ -161,23 +158,23 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
/* nijel: Find table name in query and replace it */
|
||||
$i = 0;
|
||||
while ($parsed_sql[$i]['type'] != 'quote_backtick') $i++;
|
||||
|
||||
|
||||
/* no need to PMA_backquote() */
|
||||
$parsed_sql[$i]['data'] = $target;
|
||||
|
||||
/* Generate query back */
|
||||
$sql_structure = PMA_SQP_formatHtml($parsed_sql, 'query_only');
|
||||
|
||||
|
||||
// If table exists, and 'add drop table' is selected: Drop it!
|
||||
$drop_query = '';
|
||||
if (isset($drop_if_exists) && $drop_if_exists == 'true') {
|
||||
$drop_query = 'DROP TABLE IF EXISTS ' . PMA_backquote($target_db) . '.' . PMA_backquote($new_name);
|
||||
$result = @PMA_mysql_query($drop_query);
|
||||
if (PMA_mysql_error()) {
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
PMA_mysqlDie('', $sql_structure, '', $err_url);
|
||||
}
|
||||
|
||||
|
||||
if (isset($sql_query)) {
|
||||
$sql_query .= "\n" . $drop_query . ';';
|
||||
} else {
|
||||
@@ -188,23 +185,23 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
// for the PMA_* tables
|
||||
$maintain_relations = true;
|
||||
}
|
||||
|
||||
|
||||
$result = @PMA_mysql_query($sql_structure);
|
||||
if (PMA_mysql_error()) {
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
PMA_mysqlDie('', $sql_structure, '', $err_url);
|
||||
} else if (isset($sql_query)) {
|
||||
$sql_query .= "\n" . $sql_structure . ';';
|
||||
} else {
|
||||
$sql_query = $sql_structure . ';';
|
||||
}
|
||||
|
||||
|
||||
if ((isset($submit_move) || isset($constraints)) && isset($sql_constraints)) {
|
||||
$parsed_sql = PMA_SQP_parse($sql_constraints);
|
||||
|
||||
|
||||
$i = 0;
|
||||
while ($parsed_sql[$i]['type'] != 'quote_backtick') $i++;
|
||||
|
||||
|
||||
/* no need to PMA_backquote() */
|
||||
$parsed_sql[$i]['data'] = $target;
|
||||
|
||||
@@ -212,7 +209,7 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
$sql_constraints = PMA_SQP_formatHtml($parsed_sql, 'query_only');
|
||||
$result = @PMA_mysql_query($sql_constraints);
|
||||
if (PMA_mysql_error()) {
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
PMA_mysqlDie('', $sql_structure, '', $err_url);
|
||||
} else if (isset($sql_query)) {
|
||||
$sql_query .= "\n" . $sql_constraints;
|
||||
@@ -230,26 +227,26 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
$sql_insert_data = 'INSERT INTO ' . $target . ' SELECT * FROM ' . $source;
|
||||
$result = @PMA_mysql_query($sql_insert_data);
|
||||
if (PMA_mysql_error()) {
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
PMA_mysqlDie('', $sql_insert_data, '', $err_url);
|
||||
}
|
||||
$sql_query .= "\n\n" . $sql_insert_data . ';';
|
||||
}
|
||||
|
||||
include('./libraries/relation.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
// Drops old table if the user has requested to move it
|
||||
if (isset($submit_move)) {
|
||||
|
||||
// This could avoid some problems with replicated databases, when
|
||||
|
||||
// This could avoid some problems with replicated databases, when
|
||||
// moving table from replicated one to not replicated one
|
||||
PMA_mysql_select_db($db);
|
||||
|
||||
|
||||
$sql_drop_table = 'DROP TABLE ' . $source;
|
||||
$result = @PMA_mysql_query($sql_drop_table);
|
||||
if (PMA_mysql_error()) {
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
PMA_mysqlDie('', $sql_drop_table, '', $err_url);
|
||||
}
|
||||
|
||||
@@ -263,7 +260,7 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
$rmv_rs = PMA_query_as_cu($remove_query);
|
||||
unset($rmv_query);
|
||||
}
|
||||
|
||||
|
||||
// garvin: updating bookmarks is not possible since only a single table is moved,
|
||||
// and not the whole DB.
|
||||
// if ($cfgRelation['bookmarkwork']) {
|
||||
@@ -273,7 +270,7 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
// $rmv_rs = PMA_query_as_cu($remove_query);
|
||||
// unset($rmv_query);
|
||||
// }
|
||||
|
||||
|
||||
if ($cfgRelation['displaywork']) {
|
||||
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_info'])
|
||||
. ' SET db_name = \'' . PMA_sqlAddslashes($target_db) . '\', '
|
||||
@@ -294,7 +291,7 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
$tb_rs = PMA_query_as_cu($table_query);
|
||||
unset($table_query);
|
||||
unset($tb_rs);
|
||||
|
||||
|
||||
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' SET master_table = \'' . PMA_sqlAddslashes($new_name) . '\','
|
||||
. ' master_db = \'' . PMA_sqlAddslashes($target_db) . '\''
|
||||
@@ -304,7 +301,7 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
unset($table_query);
|
||||
unset($tb_rs);
|
||||
}
|
||||
|
||||
|
||||
// garvin: [TODO] Can't get moving PDFs the right way. The page numbers always
|
||||
// get screwed up independently from duplication because the numbers do not
|
||||
// seem to be stored on a per-database basis. Would the author of pdf support
|
||||
@@ -325,7 +322,7 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($target_db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddslashes($new_name) . '\'';
|
||||
$pdf_rs = PMA_query_as_cu($pdf_query);
|
||||
|
||||
|
||||
while ($pdf_copy_row = @PMA_mysql_fetch_array($pdf_rs)) {
|
||||
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['pdf_pages'])
|
||||
. ' SET db_name = \'' . PMA_sqlAddslashes($target_db) . '\''
|
||||
@@ -351,7 +348,7 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
db_name = \'' . PMA_sqlAddslashes($db) . '\' AND
|
||||
table_name = \'' . PMA_sqlAddslashes($table) . '\'';
|
||||
$comments_copy_rs = PMA_query_as_cu($comments_copy_query);
|
||||
|
||||
|
||||
// Write every comment as new copied entry. [MIME]
|
||||
while ($comments_copy_row = @PMA_mysql_fetch_array($comments_copy_rs)) {
|
||||
$new_comment_query = 'REPLACE INTO ' . PMA_backquote($cfgRelation['column_info'])
|
||||
@@ -368,29 +365,29 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
$new_comment_rs = PMA_query_as_cu($new_comment_query);
|
||||
} // end while
|
||||
}
|
||||
|
||||
|
||||
if ($db != $target_db) {
|
||||
$get_fields = array('user','label','query');
|
||||
$where_fields = array('dbase' => $db);
|
||||
$new_fields = array('dbase' => $target_db);
|
||||
PMA_duplicate_table('bookmarkwork', 'bookmark', $get_fields, $where_fields, $new_fields);
|
||||
}
|
||||
|
||||
|
||||
$get_fields = array('display_field');
|
||||
$where_fields = array('db_name' => $db, 'table_name' => $table);
|
||||
$new_fields = array('db_name' => $target_db, 'table_name' => $new_name);
|
||||
PMA_duplicate_table('displaywork', 'table_info', $get_fields, $where_fields, $new_fields);
|
||||
|
||||
|
||||
$get_fields = array('master_field', 'foreign_db', 'foreign_table', 'foreign_field');
|
||||
$where_fields = array('master_db' => $db, 'master_table' => $table);
|
||||
$new_fields = array('master_db' => $target_db, 'master_table' => $new_name);
|
||||
PMA_duplicate_table('relwork', 'relation', $get_fields, $where_fields, $new_fields);
|
||||
|
||||
|
||||
$get_fields = array('foreign_field', 'master_db', 'master_table', 'master_field');
|
||||
$where_fields = array('foreign_db' => $db, 'foreign_table' => $table);
|
||||
$new_fields = array('foreign_db' => $target_db, 'foreign_table' => $new_name);
|
||||
PMA_duplicate_table('relwork', 'relation', $get_fields, $where_fields, $new_fields);
|
||||
|
||||
|
||||
// garvin: [TODO] Can't get duplicating PDFs the right way. The page numbers always
|
||||
// get screwed up independently from duplication because the numbers do not
|
||||
// seem to be stored on a per-database basis. Would the author of pdf support
|
||||
@@ -431,7 +428,7 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
}
|
||||
}
|
||||
}
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
} // end is target table name
|
||||
|
||||
|
||||
@@ -439,7 +436,7 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
* No new name for the table!
|
||||
*/
|
||||
else {
|
||||
include('./header.inc.php');
|
||||
require_once('./header.inc.php');
|
||||
PMA_mysqlDie($strTableEmpty, '', '', $err_url);
|
||||
}
|
||||
|
||||
|
@@ -6,8 +6,8 @@
|
||||
* Gets the variables sent or posted to this script, then displays headers
|
||||
*/
|
||||
if (!isset($selected_tbl)) {
|
||||
include('./libraries/grab_globals.lib.php');
|
||||
include('./header.inc.php');
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./header.inc.php');
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
@@ -19,8 +19,8 @@ if (!isset($the_tables) || !is_array($the_tables)) {
|
||||
/**
|
||||
* Gets the relations settings
|
||||
*/
|
||||
require('./libraries/relation.lib.php');
|
||||
require('./libraries/transformations.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
require_once('./libraries/transformations.lib.php');
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
@@ -632,5 +632,5 @@ function printPage()
|
||||
<?php
|
||||
echo '<br /><br /> <input type="button" style="visibility: ; width: 100px; height: 25px" id="print" value="' . $strPrint . '" onclick="printPage()">' . "\n";
|
||||
|
||||
require('./footer.inc.php');
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
@@ -3,18 +3,12 @@
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
// Check parameters
|
||||
|
||||
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
|
||||
include('./libraries/common.lib.php');
|
||||
}
|
||||
|
||||
require_once('./libraries/common.lib.php');
|
||||
PMA_checkParameters(array('db','table','action','num_fields'));
|
||||
|
||||
|
||||
// Get available character sets (MySQL >= 4.1)
|
||||
if (PMA_MYSQL_INT_VERSION >= 40100 && !defined('PMA_MYSQL_CHARSETS_LIB_INCLUDED')) {
|
||||
include('./libraries/mysql_charsets.lib.php');
|
||||
}
|
||||
// Get available character sets
|
||||
require_once('./libraries/mysql_charsets.lib.php');
|
||||
|
||||
?>
|
||||
<?php if ($cfg['CtrlArrowsMoving']) { ?>
|
||||
@@ -98,8 +92,8 @@ $header_cells[] = $strNull;
|
||||
$header_cells[] = $strDefault . '**';
|
||||
$header_cells[] = $strExtra;
|
||||
|
||||
require('./libraries/relation.lib.php');
|
||||
require('./libraries/transformations.lib.php');
|
||||
require_once('./libraries/relation.lib.php');
|
||||
require_once('./libraries/transformations.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
$comments_map = array();
|
||||
@@ -485,9 +479,9 @@ if ($cfg['DefaultPropDisplay'] == 'horizontal') {
|
||||
foreach($content_cells AS $content_nr => $content_row) {
|
||||
$i++;
|
||||
echo "\n" . '<tr>' . "\n";
|
||||
|
||||
|
||||
$bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
|
||||
|
||||
|
||||
if (is_array($content_row)) {
|
||||
foreach($content_row AS $content_row_nr => $content_row_val) {
|
||||
?>
|
||||
@@ -495,7 +489,7 @@ if ($cfg['DefaultPropDisplay'] == 'horizontal') {
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo "\n" . '</tr>' . "\n";
|
||||
}
|
||||
}
|
||||
|
@@ -35,5 +35,5 @@ require('./tbl_query_box.php');
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php');
|
||||
?>
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user