Skip to content

Commit

Permalink
Resolve merging conflicts in tbl_select.lib.php
Browse files Browse the repository at this point in the history
  • Loading branch information
atul516 committed Jun 4, 2012
2 parents 72cec14 + 1a171a9 commit 0b493d7
Show file tree
Hide file tree
Showing 106 changed files with 42,572 additions and 89,589 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Expand Up @@ -51,6 +51,9 @@ VerboseMultiSubmit, ReplaceHelpImg
- bug Fix popup message on build SQL of import
- bug #3523499 [core] Make X-WebKit-CSP work better
- replace Highcharts with jqplot for query profiling, zoom search
- bug #3531584 [interface] No form validation in change password dialog
- bug #3531585 [interface] Broken password validation in copy user form
- bug #3531586 [unterface] Add user form prints JSON when user presses enter

3.5.1.0 (2012-05-03)
- bug #3510784 [edit] Limit clause ignored when sort order is remembered
Expand Down
207 changes: 144 additions & 63 deletions export.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions file_echo.php
Expand Up @@ -54,13 +54,13 @@
/* Send data */
echo $data;

/* For monitor chart config export */
} else if (isset($_REQUEST['monitorconfig'])) {
/* For monitor chart config export */
PMA_download_header('monitor.cfg', 'application/force-download');
echo urldecode($_REQUEST['monitorconfig']);

/* For monitor chart config import */
} else if (isset($_REQUEST['import'])) {
/* For monitor chart config import */
header('Content-type: text/plain');
if (!file_exists($_FILES['file']['tmp_name'])) {
exit();
Expand Down
187 changes: 103 additions & 84 deletions import.php
Expand Up @@ -47,7 +47,8 @@
// default values
$GLOBALS['reload'] = false;

// Are we just executing plain query or sql file? (eg. non import, but query box/window run)
// Are we just executing plain query or sql file?
// (eg. non import, but query box/window run)
if (! empty($sql_query)) {
// run SQL query
$import_text = $sql_query;
Expand Down Expand Up @@ -151,9 +152,10 @@
} else {
$common = PMA_generate_common_url();
}
$err_url = $goto
. '?' . $common
. (preg_match('@^tbl_[a-z]*\.php$@', $goto) ? '&table=' . htmlspecialchars($table) : '');
$err_url = $goto . '?' . $common
. (preg_match('@^tbl_[a-z]*\.php$@', $goto)
? '&table=' . htmlspecialchars($table)
: '');
$_SESSION['Import_message']['go_back_url'] = $err_url;
}

Expand Down Expand Up @@ -196,42 +198,51 @@
$id_bookmark = (int)$id_bookmark;
include_once 'libraries/bookmark.lib.php';
switch ($action_bookmark) {
case 0: // bookmarked query that have to be run
$import_text = PMA_Bookmark_get($db, $id_bookmark, 'id', isset($action_bookmark_all));
if (isset($bookmark_variable) && ! empty($bookmark_variable)) {
$import_text = preg_replace('|/\*(.*)\[VARIABLE\](.*)\*/|imsU', '${1}' . PMA_sqlAddSlashes($bookmark_variable) . '${2}', $import_text);
}
case 0: // bookmarked query that have to be run
$import_text = PMA_Bookmark_get(
$db,
$id_bookmark,
'id',
isset($action_bookmark_all)
);
if (isset($bookmark_variable) && ! empty($bookmark_variable)) {
$import_text = preg_replace(
'|/\*(.*)\[VARIABLE\](.*)\*/|imsU',
'${1}' . PMA_sqlAddSlashes($bookmark_variable) . '${2}',
$import_text
);
}

// refresh left frame on changes in table or db structure
if (preg_match('/^(CREATE|ALTER|DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i', $import_text)) {
$GLOBALS['reload'] = true;
}
// refresh left frame on changes in table or db structure
if (preg_match('/^(CREATE|ALTER|DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i', $import_text)) {
$GLOBALS['reload'] = true;
}

break;
case 1: // bookmarked query that have to be displayed
$import_text = PMA_Bookmark_get($db, $id_bookmark);
if ($GLOBALS['is_ajax_request'] == true) {
$extra_data['sql_query'] = $import_text;
$extra_data['action_bookmark'] = $action_bookmark;
$message = PMA_Message::success(__('Showing bookmark'));
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
} else {
$run_query = false;
}
break;
case 2: // bookmarked query that have to be deleted
$import_text = PMA_Bookmark_get($db, $id_bookmark);
PMA_Bookmark_delete($db, $id_bookmark);
if ($GLOBALS['is_ajax_request'] == true) {
$message = PMA_Message::success(__('The bookmark has been deleted.'));
$extra_data['action_bookmark'] = $action_bookmark;
$extra_data['id_bookmark'] = $id_bookmark;
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
} else {
$run_query = false;
$error = true; // this is kind of hack to skip processing the query
}
break;
break;
case 1: // bookmarked query that have to be displayed
$import_text = PMA_Bookmark_get($db, $id_bookmark);
if ($GLOBALS['is_ajax_request'] == true) {
$extra_data['sql_query'] = $import_text;
$extra_data['action_bookmark'] = $action_bookmark;
$message = PMA_Message::success(__('Showing bookmark'));
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
} else {
$run_query = false;
}
break;
case 2: // bookmarked query that have to be deleted
$import_text = PMA_Bookmark_get($db, $id_bookmark);
PMA_Bookmark_delete($db, $id_bookmark);
if ($GLOBALS['is_ajax_request'] == true) {
$message = PMA_Message::success(__('The bookmark has been deleted.'));
$extra_data['action_bookmark'] = $action_bookmark;
$extra_data['id_bookmark'] = $id_bookmark;
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
} else {
$run_query = false;
$error = true; // this is kind of hack to skip processing the query
}
break;
}
} // end bookmarks reading

Expand Down Expand Up @@ -263,7 +274,8 @@
$memory_limit = (int)$memory_limit;
}

$read_limit = $memory_limit / 8; // Just to be sure, there might be lot of memory needed for uncompression
// Just to be sure, there might be lot of memory needed for uncompression
$read_limit = $memory_limit / 8;

// handle filenames
if (isset($_FILES['import_file'])) {
Expand Down Expand Up @@ -316,51 +328,51 @@
$error = true;
} else {
switch ($compression) {
case 'application/bzip2':
if ($cfg['BZipDump'] && @function_exists('bzopen')) {
$import_handle = @bzopen($import_file, 'r');
} else {
$message = PMA_Message::error(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'));
$message->addParam($compression);
$error = true;
}
break;
case 'application/gzip':
if ($cfg['GZipDump'] && @function_exists('gzopen')) {
$import_handle = @gzopen($import_file, 'r');
} else {
$message = PMA_Message::error(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'));
$message->addParam($compression);
case 'application/bzip2':
if ($cfg['BZipDump'] && @function_exists('bzopen')) {
$import_handle = @bzopen($import_file, 'r');
} else {
$message = PMA_Message::error(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'));
$message->addParam($compression);
$error = true;
}
break;
case 'application/gzip':
if ($cfg['GZipDump'] && @function_exists('gzopen')) {
$import_handle = @gzopen($import_file, 'r');
} else {
$message = PMA_Message::error(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'));
$message->addParam($compression);
$error = true;
}
break;
case 'application/zip':
if ($cfg['ZipDump'] && @function_exists('zip_open')) {
/**
* Load interface for zip extension.
*/
include_once 'libraries/zip_extension.lib.php';
$result = PMA_getZipContents($import_file);
if (! empty($result['error'])) {
$message = PMA_Message::rawError($result['error']);
$error = true;
}
break;
case 'application/zip':
if ($cfg['ZipDump'] && @function_exists('zip_open')) {
/**
* Load interface for zip extension.
*/
include_once 'libraries/zip_extension.lib.php';
$result = PMA_getZipContents($import_file);
if (! empty($result['error'])) {
$message = PMA_Message::rawError($result['error']);
$error = true;
} else {
$import_text = $result['data'];
}
} else {
$message = PMA_Message::error(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'));
$message->addParam($compression);
$error = true;
$import_text = $result['data'];
}
break;
case 'none':
$import_handle = @fopen($import_file, 'r');
break;
default:
} else {
$message = PMA_Message::error(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'));
$message->addParam($compression);
$error = true;
break;
}
break;
case 'none':
$import_handle = @fopen($import_file, 'r');
break;
default:
$message = PMA_Message::error(__('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.'));
$message->addParam($compression);
$error = true;
break;
}
}
// use isset() because zip compression type does not use a handle
Expand All @@ -385,7 +397,8 @@
}
} elseif (isset($charset_of_file) && $charset_of_file != 'utf8') {
if (PMA_DRIZZLE) {
// Drizzle doesn't support other character sets, so we can't fallback to SET NAMES - throw an error
// Drizzle doesn't support other character sets,
// so we can't fallback to SET NAMES - throw an error
$error = true;
$message = PMA_Message::error(__('Cannot convert file\'s character set without character set conversion library'));
} else {
Expand All @@ -401,7 +414,8 @@
$original_skip = $skip;
while ($skip > 0) {
PMA_importGetNextChunk($skip < $read_limit ? $skip : $read_limit);
$read_multiply = 1; // Disable read progresivity, otherwise we eat all memory!
// Disable read progresivity, otherwise we eat all memory!
$read_multiply = 1;
$skip -= $read_limit;
}
unset($skip);
Expand Down Expand Up @@ -431,7 +445,9 @@
// Reset charset back, if we did some changes
if ($reset_charset) {
PMA_DBI_query('SET CHARACTER SET utf8');
PMA_DBI_query('SET SESSION collation_connection =\'' . $collation_connection . '\'');
PMA_DBI_query(
'SET SESSION collation_connection =\'' . $collation_connection . '\''
);
}

// Show correct message
Expand All @@ -442,7 +458,10 @@
} elseif (! empty($id_bookmark) && $action_bookmark == 1) {
$message = PMA_Message::notice(__('Showing bookmark'));
} elseif ($bookmark_created) {
$special_message = '[br]' . sprintf(__('Bookmark %s created'), htmlspecialchars($bkm_label));
$special_message = '[br]' . sprintf(
__('Bookmark %s created'),
htmlspecialchars($bkm_label)
);
} elseif ($finished && ! $error) {
if ($import_type == 'query') {
$message = PMA_Message::success();
Expand All @@ -469,10 +488,10 @@
}
}

// if there is any message, copy it into $_SESSION as well, so we can obtain it by AJAX call
// if there is any message, copy it into $_SESSION as well,
// so we can obtain it by AJAX call
if (isset($message)) {
$_SESSION['Import_message']['message'] = $message->getDisplay();
// $_SESSION['Import_message']['go_back_url'] = $goto.'?'. PMA_generate_common_url();
}
// Parse and analyze the query, for correct db and table name
// in case of a query typed in the query window
Expand Down
6 changes: 4 additions & 2 deletions import_status.php
Expand Up @@ -104,7 +104,8 @@

header('Content-type: text/html');

// wait 0.3 sec before we check for $_SESSION variable, which is set inside import.php
// wait 0.3 sec before we check for $_SESSION variable,
// which is set inside import.php
usleep(300000);

// wait until message is available
Expand All @@ -114,7 +115,8 @@

echo $_SESSION['Import_message']['message'];
echo '<fieldset class="tblFooters">' . "\n";
echo ' [ <a href="' . $_SESSION['Import_message']['go_back_url'] . '">' . __('Back') . '</a> ]' . "\n";
echo ' [ <a href="' . $_SESSION['Import_message']['go_back_url']
. '">' . __('Back') . '</a> ]' . "\n";
echo '</fieldset>'."\n";

} else {
Expand Down
9 changes: 7 additions & 2 deletions index.php
Expand Up @@ -52,12 +52,17 @@
} else {
$_GET['db'] = $GLOBALS['db'];
$_GET['table'] = $GLOBALS['table'];
$main_target = ! empty($GLOBALS['goto']) ? $GLOBALS['goto'] : $GLOBALS['cfg']['DefaultTabTable'];
$main_target = ! empty($GLOBALS['goto'])
? $GLOBALS['goto']
: $GLOBALS['cfg']['DefaultTabTable'];
}

$url_query = PMA_generate_common_url($_GET);

if (! empty($_REQUEST['target']) && is_string($_REQUEST['target']) && in_array($_REQUEST['target'], $goto_whitelist)) {
if (! empty($_REQUEST['target'])
&& is_string($_REQUEST['target'])
&& in_array($_REQUEST['target'], $goto_whitelist)
) {
$main_target = $_REQUEST['target'];
}

Expand Down

0 comments on commit 0b493d7

Please sign in to comment.