Skip to content

Commit

Permalink
oop: merge master, fix commits
Browse files Browse the repository at this point in the history
  • Loading branch information
amarin15 committed Jun 27, 2012
2 parents 5078d65 + 8d9ee40 commit 3fa180b
Show file tree
Hide file tree
Showing 138 changed files with 44,381 additions and 44,211 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ VerboseMultiSubmit, ReplaceHelpImg
+ Ajaxified "Create View" functionality
+ [import] New plugin: import mediawiki
+ Add Ajax support to Fast filter in order to search the term in all database tables
- bug #3535015 [navi] DbFilter, TableFilter clear button hidden on Chrome

3.5.3.0 (not yet released)

3.5.2.0 (not yet released)
- bug #3521416 [interface] JS error when editing index
Expand Down
2 changes: 1 addition & 1 deletion db_operations.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@
SELECT *
FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . '
WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\'';
$test_rs = PMA_query_as_controluser($test_query, null, PMA_DBI_QUERY_STORE);
$test_rs = PMA_queryAsControlUser($test_query, null, PMA_DBI_QUERY_STORE);

/*
* Export Relational Schema View
Expand Down
353 changes: 222 additions & 131 deletions db_search.php

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions db_structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
?>"
id="row_tbl_<?php echo $i; ?>">
<td class="center">
<input type="checkbox" name="selected_tbl[]"
<input type="checkbox" name="selected_tbl[]" class="checkall"
value="<?php echo htmlspecialchars($each_table['TABLE_NAME']); ?>"
id="checkbox_tbl_<?php echo $i; ?>"<?php echo $checked; ?> /></td>
<th><?php echo $browse_table_label; ?>
Expand Down Expand Up @@ -675,13 +675,8 @@ class="center">
?>
<img class="selectallarrow" src="<?php echo $pmaThemeImage .'arrow_'.$text_dir.'.png'; ?>"
width="38" height="22" alt="<?php echo __('With selected:'); ?>" />
<a href="<?php echo $checkall_url; ?>&amp;checkall=1"
onclick="if (markAllRows('tablesForm')) return false;">
<?php echo __('Check All'); ?></a>
/
<a href="<?php echo $checkall_url; ?>"
onclick="if (unMarkAllRows('tablesForm')) return false;">
<?php echo __('Uncheck All'); ?></a>
<input type="checkbox" id="checkall" title="<?php echo __('Check All'); ?>" />
<label for="checkall"><?php echo __('Check All'); ?></label>
<?php if ($overhead_check != '') { ?>
/
<a href="#" onclick="unMarkAllRows('tablesForm');
Expand Down
4 changes: 2 additions & 2 deletions db_tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
' GROUP BY table_name' .
' ORDER BY table_name ASC';

$all_tables_result = PMA_query_as_controluser($all_tables_query);
$all_tables_result = PMA_queryAsControlUser($all_tables_query);

// If a HEAD version exists
if (PMA_DBI_num_rows($all_tables_result) > 0) {
Expand Down Expand Up @@ -112,7 +112,7 @@
. '\' AND `table_name` = \'' . PMA_sqlAddSlashes($table_name)
. '\' AND `version` = \'' . $version_number . '\'';

$table_result = PMA_query_as_controluser($table_query);
$table_result = PMA_queryAsControlUser($table_query);
$version_data = PMA_DBI_fetch_array($table_result);

if ($version_data['tracking_active'] == 1) {
Expand Down
14 changes: 7 additions & 7 deletions export.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ function PMA_exportOutputHandler($line)
}
}
$filename = PMA_expandUserString($filename_template);
$filename = PMA_sanitize_filename($filename);
$filename = PMA_sanitizeFilename($filename);

// Grab basic dump extension and mime type
// Check if the user already added extension; get the substring where the extension would be if it was included
Expand Down Expand Up @@ -401,7 +401,7 @@ function PMA_exportOutputHandler($line)
// (avoid rewriting data containing HTML with anchors and forms;
// this was reported to happen under Plesk)
@ini_set('url_rewriter.tags', '');
$filename = PMA_sanitize_filename($filename);
$filename = PMA_sanitizeFilename($filename);

PMA_downloadHeader($filename, $mime_type);
} else {
Expand Down Expand Up @@ -459,6 +459,7 @@ function PMA_exportOutputHandler($line)
// Fake loop just to allow skip of remain of this code by break, I'd really
// need exceptions here :-)
do {

// Add possibly some comments to export
if (! $export_plugin->exportHeader($db)) {
break;
Expand Down Expand Up @@ -673,14 +674,13 @@ function PMA_exportOutputHandler($line)
// If this is an export of a single view, we have to export data;
// for example, a PDF report
// if it is a merge table, no data is exported

if (($GLOBALS[$what . '_structure_or_data'] == 'data'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data')
&& ! PMA_Table::isMerge($db, $table)
) {
if (!empty($sql_query)) {
if (! empty($sql_query)) {
// only preg_replace if needed
if (!empty($add_query)) {
if (! empty($add_query)) {
// remove trailing semicolon before adding a LIMIT
$sql_query = preg_replace('%;\s*$%', '', $sql_query);
}
Expand Down Expand Up @@ -751,8 +751,8 @@ function PMA_exportOutputHandler($line)
// 1. as a zipped file
if ($compression == 'zip') {
if (@function_exists('gzcompress')) {
$zipfile = new zipfile();
$zipfile->addFile($dump_buffer, substr($filename, 0, -4));
$zipfile = new ZipFile();
$zipfile -> addFile($dump_buffer, substr($filename, 0, -4));
$dump_buffer = $zipfile -> file();
}
} elseif ($compression == 'bzip2') {
Expand Down
65 changes: 19 additions & 46 deletions import_status.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,60 +24,33 @@
&& ini_get('session.upload_progress.enabled')
) {

if (!isset($_POST['session_upload_progress'])) {
$sessionupload = array();
$prefix = ini_get('session.upload_progress.prefix');

session_start();
foreach ($_SESSION as $key => $value) {
// only copy session-prefixed data
if (substr($key, 0, strlen($prefix)) == $prefix) {
$sessionupload[$key] = $value;
}
$sessionupload = array();
$prefix = ini_get('session.upload_progress.prefix');

session_start();
foreach ($_SESSION as $key => $value) {
// only copy session-prefixed data
if (substr($key, 0, strlen($prefix)) == $prefix) {
$sessionupload[$key] = $value;
}

// perform internal self-request
$url = 'http' .
((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 's' : '') .
'://' . $_SERVER['HTTP_HOST'] .
$_SERVER['REQUEST_URI'];

if (!function_exists('curl_exec') || !function_exists('getallheaders')) {
die();
}
$headers = @getallheaders();
if (!isset($headers['Cookie'])) {
die();
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt(
$ch, CURLOPT_POSTFIELDS,
'session_upload_progress=' . rawurlencode(serialize($sessionupload))
);
curl_setopt($ch, CURLOPT_COOKIE, $headers['Cookie']);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);

// to avoid problems with self-signed certs
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

// show the result of the internal request
echo @curl_exec($ch);
die();
}
// PMA will kill all variables, so let's use a constant
define('SESSIONUPLOAD', serialize($sessionupload));
session_write_close();

session_name('phpMyAdmin');
session_id($_COOKIE['phpMyAdmin']);
}

define('PMA_MINIMUM_COMMON', 1);

require_once 'libraries/common.inc.php';
require_once 'libraries/display_import_ajax.lib.php';

if (isset($_POST['session_upload_progress'])) {
// this is the internal request response
// restore sessionupload from the POSTed data (see above),
// then write sessionupload back into the loaded session
if (defined('SESSIONUPLOAD')) {
// write sessionupload back into the loaded PMA session

$sessionupload = unserialize($_POST['session_upload_progress']);
$sessionupload = unserialize(SESSIONUPLOAD);
foreach ($sessionupload as $key => $value) {
$_SESSION[$key] = $value;
}
Expand Down
41 changes: 36 additions & 5 deletions js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ $(function() {
var checked = $checkbox.prop('checked');
if (!$(e.target).is(':checkbox, label')) {
checked = !checked;
$checkbox.prop('checked', checked);
$checkbox.prop('checked', checked).trigger('change');
}
if (checked) {
$tr.addClass('marked');
Expand Down Expand Up @@ -593,7 +593,8 @@ $(function() {
.slice(start, end + 1)
.removeClass('marked')
.find(':checkbox')
.prop('checked', false);
.prop('checked', false)
.trigger('change');
}

// handle new shift click
Expand All @@ -609,15 +610,16 @@ $(function() {
.slice(start, end + 1)
.addClass('marked')
.find(':checkbox')
.prop('checked', true);
.prop('checked', true)
.trigger('change');

// remember the last shift clicked row
last_shift_clicked_row = curr_row;
}
});

addDateTimePicker();

/**
* Add attribute to text boxes for iOS devices (based on bugID: 3508912)
*/
Expand Down Expand Up @@ -669,6 +671,7 @@ function markAllRows(container_id)
{

$("#" + container_id).find("input:checkbox:enabled").prop('checked', true)
.trigger("change")
.parents("tr").addClass("marked");
return true;
}
Expand All @@ -683,6 +686,7 @@ function unMarkAllRows(container_id)
{

$("#" + container_id).find("input:checkbox:enabled").prop('checked', false)
.trigger("change")
.parents("tr").removeClass("marked");
return true;
}
Expand Down Expand Up @@ -1879,7 +1883,7 @@ function PMA_createProfilingChartJqplot(target, data)
seriesDefaults: {
renderer: $.jqplot.PieRenderer,
rendererOptions: {
showDataLabels: true
showDataLabels: true
}
},
legend: {
Expand Down Expand Up @@ -3782,6 +3786,33 @@ $(document).ready(function () {
}); // end $.live()
});

/**
* Watches checkboxes in a form to set the checkall box accordingly
*/
var checkboxes_sel = "input.checkall:checkbox:enabled";
$(checkboxes_sel).live("change", function () {
var $form = $(this.form);
// total number of checkboxes in current form
var total_boxes = $form.find(checkboxes_sel).length;
// number of checkboxes checked in current form
var checked_boxes = $form.find(checkboxes_sel + ":checked").length;
var $checkall = $form.find("input#checkall");
if (total_boxes == checked_boxes) {
$checkall.prop({checked: true, indeterminate: false});
}
else if (checked_boxes > 0) {
$checkall.prop({checked: true, indeterminate: true});
}
else {
$checkall.prop({checked: false, indeterminate: false});
}
});
$("input#checkall").live("change", function() {
var is_checked = $(this).is(":checked");
$(this.form).find(checkboxes_sel).prop("checked", is_checked)
.parents("tr").toggleClass("marked", is_checked);
});

/**
* Toggles row colors of a set of 'tr' elements starting from a given element
*
Expand Down
3 changes: 2 additions & 1 deletion js/server_databases.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ $(function() {
* @var selected_dbs Array containing the names of the checked databases
*/
var selected_dbs = [];
$form.find('input:checkbox:checked').each(function () {
// loop over all checked checkboxes, except the #checkall checkbox
$form.find('input:checkbox:checked:not(#checkall)').each(function () {
$(this).closest('tr').addClass('removeMe');
selected_dbs[selected_dbs.length] = 'DROP DATABASE `' + escapeHtml($(this).val()) + '`;';
});
Expand Down
2 changes: 1 addition & 1 deletion libraries/Config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Load vendor configuration.
*/
require './libraries/vendor_config.php';
require_once './libraries/vendor_config.php';

/**
* Configuration class
Expand Down
45 changes: 8 additions & 37 deletions libraries/DisplayResults.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4226,34 +4226,6 @@ private function _getMultiRowOperationLinks(
'sql_query' => $this->_sql_query,
'goto' => $this->_goto,
);
$uncheckall_url = 'sql.php' . PMA_generate_common_url($_url_params);

$_url_params['checkall'] = '1';
$checkall_url = 'sql.php' . PMA_generate_common_url($_url_params);

if ($_SESSION['tmp_user_values']['disp_direction'] == self::DISP_DIR_VERTICAL) {

$checkall_params['onclick']
= 'if (setCheckboxes(\'resultsForm\', true)) return false;';
$uncheckall_params['onclick']
= 'if (setCheckboxes(\'resultsForm\', false)) return false;';

} else {

$checkall_params['onclick']
= 'if (markAllRows(\'resultsForm\')) return false;';
$uncheckall_params['onclick']
= 'if (unMarkAllRows(\'resultsForm\')) return false;';

}

$checkall_link = PMA_linkOrButton(
$checkall_url, __('Check All'), $checkall_params, false
);

$uncheckall_link = PMA_linkOrButton(
$uncheckall_url, __('Uncheck All'), $uncheckall_params, false
);

if ($_SESSION['tmp_user_values']['disp_direction'] != self::DISP_DIR_VERTICAL) {

Expand All @@ -4263,10 +4235,9 @@ private function _getMultiRowOperationLinks(
. ' alt="' . __('With selected:') . '" />';
}

$links_html .= $checkall_link . "\n"
. ' / ' . "\n"
. $uncheckall_link . "\n"
. '<i>' . __('With selected:') . '</i>' . "\n";
$links_html .= '<input type="checkbox" id="checkall" title="' . __('Check All') . '" /> '
. '<label for="checkall">' . __('Check All') . '</label> '
. '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";

$links_html .= PMA_getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_change',
Expand Down Expand Up @@ -4775,8 +4746,8 @@ private function _getRowData(
* @param array $is_display array with explicit indexes for all
* the display elements
* @param string $row_no the row number
* @param string $where_clause_html url encoded where cluase
* @param array $condition_array array of conditions in the where cluase
* @param string $where_clause_html url encoded where clause
* @param array $condition_array array of conditions in the where clause
* @param string $del_query delete query
* @param string $id_suffix suffix for the id
* @param string $class css classes for the td element
Expand Down Expand Up @@ -4827,8 +4798,8 @@ private function _getCheckboxForMultiRowSubmissions(
* @param string $edit_url edit url
* @param string $class css classes for td element
* @param string $edit_str text for the edit link
* @param string $where_clause where cluase
* @param string $where_clause_html url encoded where cluase
* @param string $where_clause where clause
* @param string $where_clause_html url encoded where clause
*
* @return string the generated HTML
*
Expand Down Expand Up @@ -4867,7 +4838,7 @@ private function _getEditLink(
* @param string $copy_url copy url
* @param string $copy_str text for the copy link
* @param string $where_clause where clause
* @param string $where_clause_html url encoded where cluase
* @param string $where_clause_html url encoded where clause
* @param string $class css classes for the td element
*
* @return string the generated HTML
Expand Down
Loading

0 comments on commit 3fa180b

Please sign in to comment.