Git
Threads by month
- ----- 2026 -----
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 6 participants
- 38809 discussions
[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-15914-g8b607b4
by Marc Delisle 19 Aug '11
by Marc Delisle 19 Aug '11
19 Aug '11
The branch, master has been updated
via 8b607b4a433338be070cd399dbcb8ec876ef4da5 (commit)
via 52648bbcf61fc1b1d0495f7d911e84a96c6d1913 (commit)
via e73110f21f2c85a0eb59d32c617e9a6c18a8931c (commit)
via 61a9a2f3a8774a617c99041b1e6e698366ff3586 (commit)
via de176a3da776c3b4c659f6670a4bf2ea0194fce3 (commit)
from c28c33c4713be676847386abb0c9694b5ce981b7 (commit)
- Log -----------------------------------------------------------------
commit 8b607b4a433338be070cd399dbcb8ec876ef4da5
Merge: c28c33c 52648bb
Author: Marc Delisle <marc(a)infomarc.info>
Date: Fri Aug 19 14:53:36 2011 -0400
Merge commit '52648bbcf61fc1b1d0495f7d911e84a96c6d1913'
commit 52648bbcf61fc1b1d0495f7d911e84a96c6d1913
Author: Aris Feryanto <aris_feryanto(a)yahoo.com>
Date: Fri Aug 19 15:33:31 2011 +0800
Grid edit: modify class for Original theme
commit e73110f21f2c85a0eb59d32c617e9a6c18a8931c
Author: Aris Feryanto <aris_feryanto(a)yahoo.com>
Date: Fri Aug 19 15:30:26 2011 +0800
Grid edit: remove unused function
commit 61a9a2f3a8774a617c99041b1e6e698366ff3586
Author: Aris Feryanto <aris_feryanto(a)yahoo.com>
Date: Fri Aug 19 14:29:46 2011 +0800
Grid edit: handle escaping HTML entities + remove 'edit area' when editing normal text
commit de176a3da776c3b4c659f6670a4bf2ea0194fce3
Author: Aris Feryanto <aris_feryanto(a)yahoo.com>
Date: Fri Aug 19 00:02:54 2011 +0800
Fix wrong relative position introduced in commit 2fdfc4fc1e19971767368061694a76499ca97463
-----------------------------------------------------------------------
Summary of changes:
js/functions.js | 2 -
js/makegrid.js | 222 +++++++++++++++----------------
themes/original/css/theme_right.css.php | 16 ++-
themes/pmahomme/css/theme_right.css.php | 15 ++-
4 files changed, 129 insertions(+), 126 deletions(-)
diff --git a/js/functions.js b/js/functions.js
index 92c4caf..022cb80 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -3307,8 +3307,6 @@ function PMA_getCellValue(td) {
return '';
} else if (! $(td).is('.to_be_saved') && $(td).data('original_data')) {
return $(td).data('original_data');
- } else if ($(td).is(':not(.transformed, .relation, .enum, .set, .null)')) {
- return unescape($(td).find('span').html()).replace(/<br>/g, "\n");
} else {
return $(td).text();
}
diff --git a/js/makegrid.js b/js/makegrid.js
index aabe9b5..70e9b9a 100644
--- a/js/makegrid.js
+++ b/js/makegrid.js
@@ -564,7 +564,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
!g.colRsz && !g.colReorder)
{
if (!g.isCellEditActive) {
- $cell = $(cell);
+ var $cell = $(cell);
// remove all edit area and hide it
$(g.cEdit).find('.edit_area').empty().hide();
// reposition the cEdit element
@@ -573,24 +573,19 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
left: $cell.position().left
})
.show()
- .find('input')
+ .find('.edit_box')
.css({
width: $cell.outerWidth(),
height: $cell.outerHeight()
});
- // fill the cell edit with text from <td>, if it is not null
- var value = $cell.is(':not(.null)') ? PMA_getCellValue(cell) : '';
- $(g.cEdit).find('input')
- .val(value);
+ // fill the cell edit with text from <td>
+ var value = PMA_getCellValue(cell);
+ $(g.cEdit).find('.edit_box').val(value);
g.currentEditCell = cell;
- $(g.cEdit).find('input[type=text]').focus();
+ $(g.cEdit).find('.edit_box').focus();
$(g.cEdit).find('*').removeAttr('disabled');
}
- } else {
- if (g.isCellEditActive) {
- g.hideEditCell();
- }
}
},
@@ -605,7 +600,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
*/
hideEditCell: function(force, data, field) {
if (g.isCellEditActive && !force) {
- // cell is being edited, post the edited data
+ // cell is being edited, save or post the edited data
g.saveOrPostEditedCell();
return;
}
@@ -620,21 +615,19 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if (g.currentEditCell) { // save value of currently edited cell
// replace current edited field with the new value
var $this_field = $(g.currentEditCell);
- var new_html = $this_field.data('value');
var is_null = $this_field.data('value') == null;
if (is_null) {
$this_field.find('span').html('NULL');
$this_field.addClass('null');
} else {
$this_field.removeClass('null');
+ var new_html = $this_field.data('value');
if ($this_field.is('.truncated')) {
if (new_html.length > g.maxTruncatedLen) {
new_html = new_html.substring(0, g.maxTruncatedLen) + '...';
}
}
- // replace '\n' with <br>
- new_html = new_html.replace(/\n/g, '<br />');
- $this_field.find('span').html(new_html);
+ $this_field.find('span').text(new_html);
}
}
if (data.transformations != undefined) {
@@ -657,7 +650,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// hide the cell editing area
$(g.cEdit).hide();
- $(g.cEdit).find('input[type=text]').blur();
+ $(g.cEdit).find('.edit_box').blur();
g.isCellEditActive = false;
g.currentEditCell = null;
// destroy datepicker in edit area, if exist
@@ -671,8 +664,17 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if (!g.isCellEditActive) { // make sure the edit area has not been shown
g.isCellEditActive = true;
g.isEditCellTextEditable = false;
+ /**
+ * @var $td current edited cell
+ */
var $td = $(g.currentEditCell);
+ /**
+ * @var $editArea the editing area
+ */
var $editArea = $(g.cEdit).find('.edit_area');
+ /**
+ * @var where_clause WHERE clause for the edited cell
+ */
var where_clause = $td.parent('tr').find('.where_clause').val();
/**
* @var field_name String containing the name of this field.
@@ -720,24 +722,24 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if ($td.is('.enum, .set')) {
$editArea.find('select').live('change', function(e) {
$checkbox.attr('checked', false);
- })
+ });
} else if ($td.is('.relation')) {
$editArea.find('select').live('change', function(e) {
$checkbox.attr('checked', false);
- })
+ });
$editArea.find('.browse_foreign').live('click', function(e) {
$checkbox.attr('checked', false);
- })
+ });
} else {
- $(g.cEdit).find('input[type=text]').live('keypress change', function(e) {
+ $(g.cEdit).find('.edit_box').live('keypress change', function(e) {
$checkbox.attr('checked', false);
- })
+ });
$editArea.find('textarea').live('keydown', function(e) {
$checkbox.attr('checked', false);
- })
+ });
}
- // if 'checkbox_null_<field_name>_<row_index>' is clicked empty the corresponding select/editor.
+ // if null checkbox is clicked empty the corresponding select/editor.
$checkbox.click(function(e) {
if ($td.is('.enum')) {
$editArea.find('select').attr('value', '');
@@ -745,7 +747,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$editArea.find('select').find('option').each(function() {
var $option = $(this);
$option.attr('selected', false);
- })
+ });
} else if ($td.is('.relation')) {
// if the dropdown is there to select the foreign value
if ($editArea.find('select').length > 0) {
@@ -754,12 +756,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
} else {
$editArea.find('textarea').val('');
}
- $(g.cEdit).find('input[type=text]').val('');
- })
+ $(g.cEdit).find('.edit_box').val('');
+ });
}
- if($td.is('.relation')) {
- /** @lends jQuery */
+ if ($td.is('.relation')) {
//handle relations
$editArea.addClass('edit_area_loading');
@@ -770,15 +771,15 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* @var post_params Object containing parameters for the POST request
*/
var post_params = {
- 'ajax_request' : true,
- 'get_relational_values' : true,
- 'server' : g.server,
- 'db' : g.db,
- 'table' : g.table,
- 'column' : field_name,
- 'token' : g.token,
- 'curr_value' : relation_curr_value,
- 'relation_key_or_display_column' : relation_key_or_display_column
+ 'ajax_request' : true,
+ 'get_relational_values' : true,
+ 'server' : g.server,
+ 'db' : g.db,
+ 'table' : g.table,
+ 'column' : field_name,
+ 'token' : g.token,
+ 'curr_value' : relation_curr_value,
+ 'relation_key_or_display_column' : relation_key_or_display_column
}
g.lastXHR = $.post('sql.php', post_params, function(data) {
@@ -788,18 +789,18 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
var value = $(data.dropdown).val();
$td.data('original_data', value);
// update the text input field, in case where the "Relational display column" is checked
- $(g.cEdit).find('input[type=text]').val(value);
+ $(g.cEdit).find('.edit_box').val(value);
$editArea.append(data.dropdown);
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
}) // end $.post()
$editArea.find('select').live('change', function(e) {
- $(g.cEdit).find('input[type=text]').val($(this).val());
+ $(g.cEdit).find('.edit_box').val($(this).val());
})
+ $editArea.show();
}
else if($td.is('.enum')) {
- /** @lends jQuery */
//handle enum fields
$editArea.addClass('edit_area_loading');
@@ -824,11 +825,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}) // end $.post()
$editArea.find('select').live('change', function(e) {
- $(g.cEdit).find('input[type=text]').val($(this).val());
+ $(g.cEdit).find('.edit_box').val($(this).val());
})
+ $editArea.show();
}
else if($td.is('.set')) {
- /** @lends jQuery */
//handle set fields
$editArea.addClass('edit_area_loading');
@@ -854,23 +855,25 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}) // end $.post()
$editArea.find('select').live('change', function(e) {
- $(g.cEdit).find('input[type=text]').val($(this).val());
+ $(g.cEdit).find('.edit_box').val($(this).val());
})
+ $editArea.show();
}
else if($td.is('.truncated, .transformed')) {
if ($td.is('.to_be_saved')) { // cell has been edited
var value = $td.data('value');
- $(g.cEdit).find('input[type=text]').val(value);
- $editArea.append('<textarea>'+value+'</textarea>');
- $editArea.find('textarea').live('keyup', function(e) {
- $(g.cEdit).find('input[type=text]').val($(this).val());
- });
- $(g.cEdit).find('input[type=text]').live('keyup', function(e) {
+ $(g.cEdit).find('.edit_box').val(value);
+ $editArea.append('<textarea></textarea>');
+ $editArea.find('textarea')
+ .val(value)
+ .live('keyup', function(e) {
+ $(g.cEdit).find('.edit_box').val($(this).val());
+ });
+ $(g.cEdit).find('.edit_box').live('keyup', function(e) {
$editArea.find('textarea').val($(this).val());
});
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
} else {
- /** @lends jQuery */
//handle truncated/transformed values values
$editArea.addClass('edit_area_loading');
@@ -900,12 +903,14 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}
$td.data('original_data', data.value);
- $(g.cEdit).find('input[type=text]').val(data.value);
- $editArea.append('<textarea>'+data.value+'</textarea>');
- $editArea.find('textarea').live('keyup', function(e) {
- $(g.cEdit).find('input[type=text]').val($(this).val());
- });
- $(g.cEdit).find('input[type=text]').live('keyup', function(e) {
+ $(g.cEdit).find('.edit_box').val(data.value);
+ $editArea.append('<textarea></textarea>');
+ $editArea.find('textarea')
+ .val(data.value)
+ .live('keyup', function(e) {
+ $(g.cEdit).find('.edit_box').val($(this).val());
+ });
+ $(g.cEdit).find('.edit_box').live('keyup', function(e) {
$editArea.find('textarea').val($(this).val());
});
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
@@ -916,8 +921,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}) // end $.post()
}
g.isEditCellTextEditable = true;
+ $editArea.show();
} else if ($td.is('.datefield, .datetimefield, .timestampfield')) {
- var $input_field = $(g.cEdit).find('input[type=text]');
+ var $input_field = $(g.cEdit).find('.edit_box');
// remember current datetime value in $input_field, if it is not null
var is_null = $td.is('.null');
@@ -943,19 +949,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
} else {
$input_field.val('');
}
+ $editArea.show();
} else {
- $editArea.append('<textarea>' + PMA_getCellValue(g.currentEditCell) + '</textarea>');
- $editArea.find('textarea').live('keyup', function(e) {
- $(g.cEdit).find('input[type=text]').val($(this).val());
- });
- $(g.cEdit).find('input[type=text]').live('keyup', function(e) {
- $editArea.find('textarea').val($(this).val());
- });
- $editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
g.isEditCellTextEditable = true;
}
-
- $editArea.show();
}
},
@@ -1138,7 +1135,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if (!g.saveCellsAtOnce) {
$(g.cEdit).find('*').attr('disabled', 'disabled');
var $editArea = $(g.cEdit).find('.edit_area');
- $editArea.addClass('edit_area_posting');
+ $(g.cEdit).find('.edit_box').addClass('edit_box_posting');
} else {
$('.save_edited').addClass('saving_edited_data')
.find('input').attr('disabled', 'disabled'); // disable the save button
@@ -1153,52 +1150,52 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
g.isSaving = false;
if (!g.saveCellsAtOnce) {
$(g.cEdit).find('*').removeAttr('disabled');
- $editArea.removeClass('edit_area_posting');
+ $(g.cEdit).find('.edit_box').removeClass('edit_box_posting');
} else {
$('.save_edited').removeClass('saving_edited_data')
.find('input').removeAttr('disabled'); // enable the save button back
}
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
- $('.to_be_saved').each(function() {
- var new_clause = $(this).parent('tr').data('new_clause');
- if (new_clause != '') {
- var $where_clause = $(this).parent('tr').find('.where_clause');
- var old_clause = $where_clause.attr('value');
- var decoded_old_clause = PMA_urldecode(old_clause);
- var decoded_new_clause = PMA_urldecode(new_clause);
-
- $where_clause.attr('value', new_clause);
- // update Edit, Copy, and Delete links also
- $(this).parent('tr').find('a').each(function() {
- $(this).attr('href', $(this).attr('href').replace(old_clause, new_clause));
- // update delete confirmation in Delete link
- if ($(this).attr('href').indexOf('DELETE') > -1) {
- $(this).removeAttr('onclick')
- .unbind('click')
- .bind('click', function() {
- return confirmLink(this, 'DELETE FROM `' + g.db + '`.`' + g.table + '` WHERE ' +
- decoded_new_clause + (is_unique ? '' : ' LIMIT 1'));
- });
- }
- });
- // update the multi edit checkboxes
- $(this).parent('tr').find('input[type=checkbox]').each(function() {
- var $checkbox = $(this);
- var checkbox_name = $checkbox.attr('name');
- var checkbox_value = $checkbox.attr('value');
-
- $checkbox.attr('name', checkbox_name.replace(old_clause, new_clause));
- $checkbox.attr('value', checkbox_value.replace(decoded_old_clause, decoded_new_clause));
- });
- }
+ // update where_clause related data in each edited row
+ $('.to_be_saved').parents('tr').each(function() {
+ var new_clause = $(this).data('new_clause');
+ var $where_clause = $(this).find('.where_clause');
+ var old_clause = $where_clause.attr('value');
+ var decoded_old_clause = PMA_urldecode(old_clause);
+ var decoded_new_clause = PMA_urldecode(new_clause);
+
+ $where_clause.attr('value', new_clause);
+ // update Edit, Copy, and Delete links also
+ $(this).find('a').each(function() {
+ $(this).attr('href', $(this).attr('href').replace(old_clause, new_clause));
+ // update delete confirmation in Delete link
+ if ($(this).attr('href').indexOf('DELETE') > -1) {
+ $(this).removeAttr('onclick')
+ .unbind('click')
+ .bind('click', function() {
+ return confirmLink(this, 'DELETE FROM `' + g.db + '`.`' + g.table + '` WHERE ' +
+ decoded_new_clause + (is_unique ? '' : ' LIMIT 1'));
+ });
+ }
+ });
+ // update the multi edit checkboxes
+ $(this).find('input[type=checkbox]').each(function() {
+ var $checkbox = $(this);
+ var checkbox_name = $checkbox.attr('name');
+ var checkbox_value = $checkbox.attr('value');
+
+ $checkbox.attr('name', checkbox_name.replace(old_clause, new_clause));
+ $checkbox.attr('value', checkbox_value.replace(decoded_old_clause, decoded_new_clause));
+ });
});
- // remove possible previous feedback message
+ // update the display of executed SQL query command
$('#result_query').remove();
if (typeof data.sql_query != 'undefined') {
// display feedback
$('#sqlqueryresults').prepend(data.sql_query);
}
+ // hide and/or update the successfully saved cells
g.hideEditCell(true, data);
// remove the "Save edited cells" button
@@ -1247,6 +1244,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
var value;
if ($(g.cEdit).find('.edit_area').is('.edit_area_loading')) {
+ // the edit area is still loading (retrieving cell data), no need to post
need_to_post = false;
} else if (is_null) {
if (!g.wasEditedCellNull) {
@@ -1255,7 +1253,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}
} else {
if ($this_field.is('.bit')) {
- this_field_params[field_name] = '0b' + $(g.cEdit).find('textarea').val();
+ this_field_params[field_name] = '0b' + $(g.cEdit).find('.edit_box').val();
} else if ($this_field.is('.set')) {
$test_element = $(g.cEdit).find('select');
this_field_params[field_name] = $test_element.map(function(){
@@ -1273,10 +1271,8 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if ($test_element.length != 0) {
this_field_params[field_name] = $test_element.text();
}
- } else if ($this_field.is('.datefield, .datetimefield, .timestampfield')) {
- this_field_params[field_name] = $(g.cEdit).find('input[type=text]').val();
} else {
- this_field_params[field_name] = $(g.cEdit).find('textarea').val();
+ this_field_params[field_name] = $(g.cEdit).find('.edit_box').val();
}
if (g.wasEditedCellNull || this_field_params[field_name] != PMA_getCellValue(g.currentEditCell)) {
need_to_post = true;
@@ -1533,7 +1529,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// adjust g.cEdit
g.cEdit.className = 'cEdit';
- $(g.cEdit).html('<input type="text" /><div class="edit_area" />');
+ $(g.cEdit).html('<textarea class="edit_box" rows="1" ></textarea><div class="edit_area" />');
$(g.cEdit).hide();
// assign cell editing hint
@@ -1560,10 +1556,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
e.preventDefault();
}
});
- $(g.cEdit).find('input[type=text]').focus(function(e) {
+ $(g.cEdit).find('.edit_box').focus(function(e) {
g.showEditArea();
});
- $(g.cEdit).find('input[type=text], select').live('keydown', function(e) {
+ $(g.cEdit).find('.edit_box, select').live('keydown', function(e) {
if (e.which == 13) {
// post on pressing "Enter"
e.preventDefault();
@@ -1614,9 +1610,6 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* Initialize grid
******************/
- // add relative position to table so that resize handlers are correctly positioned
- $(t).css('position', 'relative');
-
// wrap all data cells, except actions cell, with span
$(t).find('th, td:not(:has(span))')
.wrapInner('<span />');
@@ -1658,6 +1651,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// add table class
$(t).addClass('pma_table');
+ // add relative position to global div so that resize handlers are correctly positioned
+ $(g.gDiv).css('position', 'relative');
+
// link the global div
$(t).before(g.gDiv);
$(g.gDiv).append(t);
diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php
index 8f64772..be996e6 100644
--- a/themes/original/css/theme_right.css.php
+++ b/themes/original/css/theme_right.css.php
@@ -2548,15 +2548,19 @@ span.cm-number {
margin: 0.3em 0.2em;
}
-.cEdit .edit_area_loading {
- background: #FFF url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>ajax_clock_small.gif) no-repeat center;
- height: 10em;
+.cEdit .edit_box {
+ overflow: hidden;
+ padding: 0;
}
+.cEdit .edit_box_posting {
+ background: #FFF url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>ajax_clock_small.gif) no-repeat right center;
+ padding-right: 1.5em;
+}
-.cEdit .edit_area_posting {
- background: #FFF url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>ajax_clock_small.gif) no-repeat center top;
- padding-top: 1.5em;
+.cEdit .edit_area_loading {
+ background: #FFF url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>ajax_clock_small.gif) no-repeat center;
+ height: 10em;
}
.cEdit .goto_link {
diff --git a/themes/pmahomme/css/theme_right.css.php b/themes/pmahomme/css/theme_right.css.php
index 4fc6f43..ca554f1 100644
--- a/themes/pmahomme/css/theme_right.css.php
+++ b/themes/pmahomme/css/theme_right.css.php
@@ -2992,16 +2992,21 @@ span.cm-number {
margin: 0.3em 0.2em;
}
+.cEdit .edit_box {
+ overflow: hidden;
+ padding: 0;
+}
+
+.cEdit .edit_box_posting {
+ background: #FFF url(./themes/pmahomme/img/ajax_clock_small.gif) no-repeat right center;
+ padding-right: 1.5em;
+}
+
.cEdit .edit_area_loading {
background: #FFF url(./themes/pmahomme/img/ajax_clock_small.gif) no-repeat center;
height: 10em;
}
-.cEdit .edit_area_posting {
- background: #FFF url(./themes/pmahomme/img/ajax_clock_small.gif) no-repeat center top;
- padding-top: 1.5em;
-}
-
.cEdit .goto_link {
background: #EEE;
color: #555;
hooks/post-receive
--
phpMyAdmin
1
0
[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-15909-gc28c33c
by Madhura Jayaratne 19 Aug '11
by Madhura Jayaratne 19 Aug '11
19 Aug '11
The branch, master has been updated
via c28c33c4713be676847386abb0c9694b5ce981b7 (commit)
from 855dc6e6456be8503061ef7f473fa4d95b4a25d6 (commit)
- Log -----------------------------------------------------------------
commit c28c33c4713be676847386abb0c9694b5ce981b7
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Fri Aug 19 23:38:42 2011 +0530
Coding style improvements
-----------------------------------------------------------------------
Summary of changes:
libraries/Table.class.php | 423 +++++++++++++++++++++++++++------------------
1 files changed, 258 insertions(+), 165 deletions(-)
diff --git a/libraries/Table.class.php b/libraries/Table.class.php
index cdc3224..46ebb91 100644
--- a/libraries/Table.class.php
+++ b/libraries/Table.class.php
@@ -63,8 +63,8 @@ class PMA_Table
/**
* Constructor
*
- * @param string $table_name table name
- * @param string $db_name database name
+ * @param string $table_name table name
+ * @param string $db_name database name
*/
function __construct($table_name, $db_name)
{
@@ -83,11 +83,21 @@ class PMA_Table
return $this->getName();
}
+ /**
+ * return the last error
+ *
+ * @return the last error
+ */
function getLastError()
{
return end($this->errors);
}
+ /**
+ * return the last message
+ *
+ * @return the last message
+ */
function getLastMessage()
{
return end($this->messages);
@@ -96,7 +106,9 @@ class PMA_Table
/**
* sets table name
*
- * @param string $table_name new table name
+ * @param string $table_name new table name
+ *
+ * @return nothing
*/
function setName($table_name)
{
@@ -107,6 +119,7 @@ class PMA_Table
* returns table name
*
* @param boolean $backquoted whether to quote name with backticks ``
+ *
* @return string table name
*/
function getName($backquoted = false)
@@ -120,7 +133,9 @@ class PMA_Table
/**
* sets database name for this table
*
- * @param string $db_name
+ * @param string $db_name database name
+ *
+ * @return nothing
*/
function setDbName($db_name)
{
@@ -131,6 +146,7 @@ class PMA_Table
* returns database name for this table
*
* @param boolean $backquoted whether to quote name with backticks ``
+ *
* @return string database name for this table
*/
function getDbName($backquoted = false)
@@ -145,6 +161,7 @@ class PMA_Table
* returns full name for table, including database name
*
* @param boolean $backquoted whether to quote name with backticks ``
+ *
* @return string
*/
function getFullName($backquoted = false)
@@ -152,6 +169,14 @@ class PMA_Table
return $this->getDbName($backquoted) . '.' . $this->getName($backquoted);
}
+ /**
+ * returns whether the table is actually a view
+ *
+ * @param string $db database
+ * @param string $table table
+ *
+ * @return whether the given is a view
+ */
static public function isView($db = null, $table = null)
{
if (strlen($db) && strlen($table)) {
@@ -166,6 +191,8 @@ class PMA_Table
*
* @param string $param name
* @param mixed $value value
+ *
+ * @return nothing
*/
function set($param, $value)
{
@@ -176,6 +203,7 @@ class PMA_Table
* returns value for given setting/param
*
* @param string $param name for value to return
+ *
* @return mixed value for $param
*/
function get($param)
@@ -204,8 +232,10 @@ class PMA_Table
$this->settings = $table_info;
if ($this->get('TABLE_ROWS') === null) {
- $this->set('TABLE_ROWS', PMA_Table::countRecords($this->getDbName(),
- $this->getName(), true));
+ $this->set(
+ 'TABLE_ROWS',
+ PMA_Table::countRecords($this->getDbName(), $this->getName(), true)
+ );
}
$create_options = explode(' ', $this->get('TABLE_ROWS'));
@@ -224,10 +254,12 @@ class PMA_Table
/**
* Checks if this "table" is a view
*
+ * @param string $db the database name
+ * @param string $table the table name
+ *
* @deprecated
* @todo see what we could do with the possible existence of $table_is_view
- * @param string $db the database name
- * @param string $table the table name
+ *
* @return boolean whether this is a view
*/
static protected function _isView($db, $table)
@@ -237,7 +269,8 @@ class PMA_Table
return true;
}
- // Since phpMyAdmin 3.2 the field TABLE_TYPE is properly filled by PMA_DBI_get_tables_full()
+ // Since phpMyAdmin 3.2 the field TABLE_TYPE is properly filled by
+ // PMA_DBI_get_tables_full()
$type = PMA_Table::sGetStatusInfo($db, $table, 'TABLE_TYPE');
return $type == 'VIEW';
}
@@ -245,10 +278,12 @@ class PMA_Table
/**
* Checks if this is a merge table
*
- * If the ENGINE of the table is MERGE or MRG_MYISAM (alias), this is a merge table.
+ * If the ENGINE of the table is MERGE or MRG_MYISAM (alias),
+ * this is a merge table.
+ *
+ * @param string $db the database name
+ * @param string $table the table name
*
- * @param string $db the database name
- * @param string $table the table name
* @return boolean true if it is a merge table
*/
static public function isMerge($db = null, $table = null)
@@ -270,15 +305,17 @@ class PMA_Table
/**
* Returns full table status info, or specific if $info provided
- *
* this info is collected from information_schema
*
- * @todo PMA_DBI_get_tables_full needs to be merged somehow into this class or at least better documented
- * @param string $db
- * @param string $table
- * @param string $info
- * @param boolean $force_read
+ * @param string $db database name
+ * @param string $table table name
+ * @param string $info
+ * @param boolean $force_read read new rather than serving from cache
* @param boolean $disable_error if true, disables error message
+ *
+ * @todo PMA_DBI_get_tables_full needs to be merged somehow into this class
+ * or at least better documented
+ *
* @return mixed
*/
static public function sGetStatusInfo($db, $table, $info = null, $force_read = false, $disable_error = false)
@@ -311,21 +348,24 @@ class PMA_Table
/**
* generates column specification for ALTER or CREATE TABLE syntax
*
+ * @param string $name name
+ * @param string $type type ('INT', 'VARCHAR', 'BIT', ...)
+ * @param string $length length ('2', '5,2', '', ...)
+ * @param string $attribute attribute
+ * @param string $collation collation
+ * @param bool|string $null with 'NULL' or 'NOT NULL'
+ * @param string $default_type whether default is CURRENT_TIMESTAMP,
+ * NULL, NONE, USER_DEFINED
+ * @param string $default_value default value for USER_DEFINED default type
+ * @param string $extra 'AUTO_INCREMENT'
+ * @param string $comment field comment
+ * @param array &$field_primary list of fields for PRIMARY KEY
+ * @param string $index
+ *
* @todo move into class PMA_Column
- * @todo on the interface, some js to clear the default value when the default current_timestamp is checked
- * @param string $name name
- * @param string $type type ('INT', 'VARCHAR', 'BIT', ...)
- * @param string $length length ('2', '5,2', '', ...)
- * @param string $attribute
- * @param string $collation
- * @param bool|string $null with 'NULL' or 'NOT NULL'
- * @param string $default_type whether default is CURRENT_TIMESTAMP,
- * NULL, NONE, USER_DEFINED
- * @param string $default_value default value for USER_DEFINED default type
- * @param string $extra 'AUTO_INCREMENT'
- * @param string $comment field comment
- * @param array &$field_primary list of fields for PRIMARY KEY
- * @param string $index
+ * @todo on the interface, some js to clear the default value when the default
+ * current_timestamp is checked
+ *
* @return string field specification
*/
static function generateFieldSpec($name, $type, $length = '', $attribute = '',
@@ -339,8 +379,9 @@ class PMA_Table
$query = PMA_backquote($name) . ' ' . $type;
if ($length != ''
- && !preg_match('@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT'
- . '|SERIAL|BOOLEAN)$@i', $type)) {
+ && ! preg_match('@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|'
+ . 'MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN)$@i', $type)
+ ) {
$query .= '(' . $length . ')';
}
@@ -348,8 +389,9 @@ class PMA_Table
$query .= ' ' . $attribute;
}
- if (!empty($collation) && $collation != 'NULL'
- && preg_match('@^(TINYTEXT|TEXT|MEDIUMTEXT|LONGTEXT|VARCHAR|CHAR|ENUM|SET)$@i', $type)) {
+ if (! empty($collation) && $collation != 'NULL'
+ && preg_match('@^(TINYTEXT|TEXT|MEDIUMTEXT|LONGTEXT|VARCHAR|CHAR|ENUM|SET)$@i', $type)
+ ) {
$query .= PMA_generateCharsetQueryPart($collation);
}
@@ -400,9 +442,9 @@ class PMA_Table
$query .= ' PRIMARY KEY';
unset($field_primary[$j]);
}
- // but the PK could contain other columns so do not append
- // a PRIMARY KEY clause, just add a member to $field_primary
} else {
+ // but the PK could contain other columns so do not append
+ // a PRIMARY KEY clause, just add a member to $field_primary
$found_in_pk = false;
for ($j = 0; $j < $primary_cnt; $j++) {
if ($field_primary[$j] == $index) {
@@ -428,13 +470,13 @@ class PMA_Table
* Revision 13 July 2001: Patch for limiting dump size from
* vinay(a)sanisoft.com & girish(a)sanisoft.com
*
- * @param string $db the current database name
- * @param string $table the current table name
- * @param bool $force_exact whether to force an exact count
- * @param bool $is_view
+ * @param string $db the current database name
+ * @param string $table the current table name
+ * @param bool $force_exact whether to force an exact count
+ * @param bool $is_view whether the table is a view
*
- * @return mixed the number of records if "retain" param is true,
- * otherwise true
+ * @return mixed the number of records if "retain" param is true,
+ * otherwise true
*/
static public function countRecords($db, $table, $force_exact = false, $is_view = null)
{
@@ -466,7 +508,8 @@ class PMA_Table
if (! $is_view) {
$row_count = PMA_DBI_fetch_value(
'SELECT COUNT(*) FROM ' . PMA_backquote($db) . '.'
- . PMA_backquote($table));
+ . PMA_backquote($table)
+ );
} else {
// For complex views, even trying to get a partial record
// count could bring down a server, so we offer an
@@ -482,9 +525,11 @@ class PMA_Table
// based on a table that no longer exists)
$result = PMA_DBI_try_query(
'SELECT 1 FROM ' . PMA_backquote($db) . '.'
- . PMA_backquote($table) . ' LIMIT '
- . $GLOBALS['cfg']['MaxExactCountViews'],
- null, PMA_DBI_QUERY_STORE);
+ . PMA_backquote($table) . ' LIMIT '
+ . $GLOBALS['cfg']['MaxExactCountViews'],
+ null,
+ PMA_DBI_QUERY_STORE
+ );
if (!PMA_DBI_getError()) {
$row_count = PMA_DBI_num_rows($result);
PMA_DBI_free_result($result);
@@ -501,22 +546,24 @@ class PMA_Table
/**
* Generates column specification for ALTER syntax
*
+ * @param string $oldcol old column name
+ * @param string $newcol new column name
+ * @param string $type type ('INT', 'VARCHAR', 'BIT', ...)
+ * @param string $length length ('2', '5,2', '', ...)
+ * @param string $attribute attribute
+ * @param string $collation collation
+ * @param bool|string $null with 'NULL' or 'NOT NULL'
+ * @param string $default_type whether default is CURRENT_TIMESTAMP,
+ * NULL, NONE, USER_DEFINED
+ * @param string $default_value default value for USER_DEFINED default type
+ * @param string $extra 'AUTO_INCREMENT'
+ * @param string $comment field comment
+ * @param array &$field_primary list of fields for PRIMARY KEY
+ * @param string $index
+ * @param mixed $default_orig
+ *
* @see PMA_Table::generateFieldSpec()
- * @param string $oldcol old column name
- * @param string $newcol new column name
- * @param string $type type ('INT', 'VARCHAR', 'BIT', ...)
- * @param string $length length ('2', '5,2', '', ...)
- * @param string $attribute
- * @param string $collation
- * @param bool|string $null with 'NULL' or 'NOT NULL'
- * @param string $default_type whether default is CURRENT_TIMESTAMP,
- * NULL, NONE, USER_DEFINED
- * @param string $default_value default value for USER_DEFINED default type
- * @param string $extra 'AUTO_INCREMENT'
- * @param string $comment field comment
- * @param array &$field_primary list of fields for PRIMARY KEY
- * @param string $index
- * @param mixed $default_orig
+ *
* @return string field specification
*/
static public function generateAlter($oldcol, $newcol, $type, $length,
@@ -524,26 +571,32 @@ class PMA_Table
$extra, $comment = '', &$field_primary, $index, $default_orig)
{
return PMA_backquote($oldcol) . ' '
- . PMA_Table::generateFieldSpec($newcol, $type, $length, $attribute,
+ . PMA_Table::generateFieldSpec(
+ $newcol, $type, $length, $attribute,
$collation, $null, $default_type, $default_value, $extra,
- $comment, $field_primary, $index, $default_orig);
+ $comment, $field_primary, $index, $default_orig
+ );
} // end function
/**
* Inserts existing entries in a PMA_* table by reading a value from an old entry
*
+ * @param string $work The array index, which Relation feature to check
+ * ('relwork', 'commwork', ...)
+ * @param string $pma_table The array index, which PMA-table to update
+ * ('bookmark', 'relation', ...)
+ * @param array $get_fields Which fields will be SELECT'ed from the old entry
+ * @param array $where_fields Which fields will be used for the WHERE query
+ * (array('FIELDNAME' => 'FIELDVALUE'))
+ * @param array $new_fields Which fields will be used as new VALUES. These are
+ * the important keys which differ from the old entry
+ * (array('FIELDNAME' => 'NEW FIELDVALUE'))
+ *
* @global relation variable
- * @param string $work The array index, which Relation feature to check ('relwork', 'commwork', ...)
- * @param string $pma_table The array index, which PMA-table to update ('bookmark', 'relation', ...)
- * @param array $get_fields Which fields will be SELECT'ed from the old entry
- * @param array $where_fields Which fields will be used for the WHERE query (array('FIELDNAME' => 'FIELDVALUE'))
- * @param array $new_fields Which fields will be used as new VALUES. These are the important
- * keys which differ from the old entry.
- * (array('FIELDNAME' => 'NEW FIELDVALUE'))
+ *
* @return int|true
*/
- static public function duplicateInfo($work, $pma_table, $get_fields, $where_fields,
- $new_fields)
+ static public function duplicateInfo($work, $pma_table, $get_fields, $where_fields, $new_fields)
{
$last_id = -1;
@@ -576,8 +629,9 @@ class PMA_Table
// must use PMA_DBI_QUERY_STORE here, since we execute another
// query inside the loop
- $table_copy_rs = PMA_query_as_controluser($table_copy_query, true,
- PMA_DBI_QUERY_STORE);
+ $table_copy_rs = PMA_query_as_controluser(
+ $table_copy_query, true, PMA_DBI_QUERY_STORE
+ );
while ($table_copy_row = @PMA_DBI_fetch_assoc($table_copy_rs)) {
$value_parts = array();
@@ -587,9 +641,9 @@ class PMA_Table
}
}
- $new_table_query = '
- INSERT IGNORE INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db'])
- . '.' . PMA_backquote($GLOBALS['cfgRelation'][$pma_table]) . '
+ $new_table_query = 'INSERT IGNORE INTO '
+ . PMA_backquote($GLOBALS['cfgRelation']['db'])
+ . '.' . PMA_backquote($GLOBALS['cfgRelation'][$pma_table]) . '
(' . implode(', ', $select_parts) . ',
' . implode(', ', $new_parts) . ')
VALUES
@@ -612,14 +666,15 @@ class PMA_Table
/**
* Copies or renames table
*
- * @param $source_db
- * @param $source_table
- * @param $target_db
- * @param $target_table
- * @param $what
- * @param $move
- * @param $mode
- * @return bool
+ * @param string $source_db source database
+ * @param string $source_table source table
+ * @param string $target_db target database
+ * @param string $target_table target table
+ * @param string $what what to be moved or copied (data, dataonly)
+ * @param bool $move whether to move
+ * @param string $mode mode
+ *
+ * @return bool true if success, false otherwise
*/
static public function moveCopy($source_db, $source_table, $target_db, $target_table, $what, $move, $mode)
{
@@ -628,7 +683,10 @@ class PMA_Table
/* Try moving table directly */
if ($move && $what == 'data') {
$tbl = new PMA_Table($source_table, $source_db);
- $result = $tbl->rename($target_table, $target_db, PMA_Table::isView($source_db, $source_table));
+ $result = $tbl->rename(
+ $target_table, $target_db,
+ PMA_Table::isView($source_db, $source_table)
+ );
if ($result) {
$GLOBALS['message'] = $tbl->getLastMessage();
return true;
@@ -642,12 +700,14 @@ class PMA_Table
// Ensure the target is valid
if (! $GLOBALS['pma']->databases->exists($source_db, $target_db)) {
if (! $GLOBALS['pma']->databases->exists($source_db)) {
- $GLOBALS['message'] = PMA_Message::rawError('source database `'
- . htmlspecialchars($source_db) . '` not found');
+ $GLOBALS['message'] = PMA_Message::rawError(
+ 'source database `' . htmlspecialchars($source_db) . '` not found'
+ );
}
if (! $GLOBALS['pma']->databases->exists($target_db)) {
- $GLOBALS['message'] = PMA_Message::rawError('target database `'
- . htmlspecialchars($target_db) . '` not found');
+ $GLOBALS['message'] = PMA_Message::rawError(
+ 'target database `' . htmlspecialchars($target_db) . '` not found'
+ );
}
return false;
}
@@ -665,21 +725,25 @@ class PMA_Table
// do not create the table if dataonly
if ($what != 'dataonly') {
- require_once './libraries/export/sql.php';
+ include_once './libraries/export/sql.php';
$no_constraints_comments = true;
$GLOBALS['sql_constraints_query'] = '';
- $sql_structure = PMA_getTableDef($source_db, $source_table, "\n", $err_url, false, false);
+ $sql_structure = PMA_getTableDef(
+ $source_db, $source_table, "\n", $err_url, false, false
+ );
unset($no_constraints_comments);
$parsed_sql = PMA_SQP_parse($sql_structure);
$analyzed_sql = PMA_SQP_analyze($parsed_sql);
$i = 0;
if (empty($analyzed_sql[0]['create_table_fields'])) {
- // this is not a CREATE TABLE, so find the first VIEW
+ // this is not a CREATE TABLE, so find the first VIEW
$target_for_view = PMA_backquote($target_db);
while (true) {
- if ($parsed_sql[$i]['type'] == 'alpha_reservedWord' && $parsed_sql[$i]['data'] == 'VIEW') {
+ if ($parsed_sql[$i]['type'] == 'alpha_reservedWord'
+ && $parsed_sql[$i]['data'] == 'VIEW'
+ ) {
break;
}
$i++;
@@ -713,8 +777,10 @@ class PMA_Table
$last = $parsed_sql['len'] - 1;
$backquoted_source_db = PMA_backquote($source_db);
for (++$i; $i <= $last; $i++) {
- if ($parsed_sql[$i]['type'] == $table_delimiter && $parsed_sql[$i]['data'] == $backquoted_source_db) {
- $parsed_sql[$i]['data'] = $target_for_view;
+ if ($parsed_sql[$i]['type'] == $table_delimiter
+ && $parsed_sql[$i]['data'] == $backquoted_source_db
+ ) {
+ $parsed_sql[$i]['data'] = $target_for_view;
}
}
unset($last,$backquoted_source_db);
@@ -727,8 +793,9 @@ class PMA_Table
// If table exists, and 'add drop table' is selected: Drop it!
$drop_query = '';
if (isset($GLOBALS['drop_if_exists'])
- && $GLOBALS['drop_if_exists'] == 'true') {
- if (PMA_Table::_isView($target_db,$target_table)) {
+ && $GLOBALS['drop_if_exists'] == 'true'
+ ) {
+ if (PMA_Table::_isView($target_db, $target_table)) {
$drop_query = 'DROP VIEW';
} else {
$drop_query = 'DROP TABLE';
@@ -749,7 +816,8 @@ class PMA_Table
$GLOBALS['sql_query'] .= "\n" . $sql_structure . ';';
if (($move || isset($GLOBALS['add_constraints']))
- && !empty($GLOBALS['sql_constraints_query'])) {
+ && !empty($GLOBALS['sql_constraints_query'])
+ ) {
$parsed_sql = PMA_SQP_parse($GLOBALS['sql_constraints_query']);
$i = 0;
@@ -772,7 +840,8 @@ class PMA_Table
for ($j = $i; $j < $cnt; $j++) {
if ($parsed_sql[$j]['type'] == 'alpha_reservedWord'
- && strtoupper($parsed_sql[$j]['data']) == 'CONSTRAINT') {
+ && strtoupper($parsed_sql[$j]['data']) == 'CONSTRAINT'
+ ) {
if ($parsed_sql[$j+1]['type'] == $table_delimiter) {
$parsed_sql[$j+1]['data'] = '';
}
@@ -780,8 +849,9 @@ class PMA_Table
}
// Generate query back
- $GLOBALS['sql_constraints_query'] = PMA_SQP_formatHtml($parsed_sql,
- 'query_only');
+ $GLOBALS['sql_constraints_query'] = PMA_SQP_formatHtml(
+ $parsed_sql, 'query_only'
+ );
if ($mode == 'one_table') {
PMA_DBI_query($GLOBALS['sql_constraints_query']);
}
@@ -795,9 +865,10 @@ class PMA_Table
}
// Copy the data unless this is a VIEW
- if (($what == 'data' || $what == 'dataonly') && ! PMA_Table::_isView($target_db,$target_table)) {
- $sql_insert_data =
- 'INSERT INTO ' . $target . ' SELECT * FROM ' . $source;
+ if (($what == 'data' || $what == 'dataonly')
+ && ! PMA_Table::_isView($target_db, $target_table)
+ ) {
+ $sql_insert_data = 'INSERT INTO ' . $target . ' SELECT * FROM ' . $source;
PMA_DBI_query($sql_insert_data);
$GLOBALS['sql_query'] .= "\n\n" . $sql_insert_data . ';';
}
@@ -811,7 +882,7 @@ class PMA_Table
// moving table from replicated one to not replicated one
PMA_DBI_select_db($source_db);
- if (PMA_Table::_isView($source_db,$source_table)) {
+ if (PMA_Table::_isView($source_db, $source_table)) {
$sql_drop_query = 'DROP VIEW';
} else {
$sql_drop_query = 'DROP TABLE';
@@ -906,7 +977,7 @@ class PMA_Table
}
$GLOBALS['sql_query'] .= "\n\n" . $sql_drop_query . ';';
- // end if ($move)
+ // end if ($move)
} else {
// we are copying
// Create new entries as duplicates from old PMA DBs
@@ -997,9 +1068,11 @@ class PMA_Table
* checks if given name is a valid table name,
* currently if not empty, trailing spaces, '.', '/' and '\'
*
- * @todo add check for valid chars in filename on current system/os
- * @see http://dev.mysql.com/doc/refman/5.0/en/legal-names.html
- * @param string $table_name name to check
+ * @param string $table_name name to check
+ *
+ * @todo add check for valid chars in filename on current system/os
+ * @see http://dev.mysql.com/doc/refman/5.0/en/legal-names.html
+ *
* @return boolean whether the string is valid or not
*/
function isValidName($table_name)
@@ -1025,10 +1098,11 @@ class PMA_Table
/**
* renames table
*
- * @param string $new_name new table name
- * @param string $new_db new database name
- * @param bool $is_view is this for a VIEW rename?
- * @return bool success
+ * @param string $new_name new table name
+ * @param string $new_db new database name
+ * @param bool $is_view is this for a VIEW rename?
+ *
+ * @return bool success
*/
function rename($new_name, $new_db = null, $is_view = false)
{
@@ -1064,7 +1138,11 @@ class PMA_Table
}
// I don't think a specific error message for views is necessary
if (! PMA_DBI_query($GLOBALS['sql_query'])) {
- $this->errors[] = sprintf(__('Error renaming table %1$s to %2$s'), $this->getFullName(), $new_table->getFullName());
+ $this->errors[] = sprintf(
+ __('Error renaming table %1$s to %2$s'),
+ $this->getFullName(),
+ $new_table->getFullName()
+ );
return false;
}
@@ -1147,8 +1225,11 @@ class PMA_Table
unset($table_query);
}
- $this->messages[] = sprintf(__('Table %s has been renamed to %s'),
- htmlspecialchars($old_name), htmlspecialchars($new_name));
+ $this->messages[] = sprintf(
+ __('Table %s has been renamed to %s'),
+ htmlspecialchars($old_name),
+ htmlspecialchars($new_name)
+ );
return true;
}
@@ -1164,8 +1245,8 @@ class PMA_Table
* - PRIMARY(fk_id1, fk_id2) // NONE
* - UNIQUE(x,y) // NONE
*
+ * @param bool $backquoted whether to quote name with backticks ``
*
- * @param bool $backquoted whether to quote name with backticks ``
* @return array
*/
public function getUniqueColumns($backquoted = true)
@@ -1178,7 +1259,8 @@ class PMA_Table
if (count($index) > 1) {
continue;
}
- $return[] = $this->getFullName($backquoted) . '.' . ($backquoted ? PMA_backquote($index[0]) : $index[0]);
+ $return[] = $this->getFullName($backquoted) . '.'
+ . ($backquoted ? PMA_backquote($index[0]) : $index[0]);
}
return $return;
@@ -1192,7 +1274,8 @@ class PMA_Table
*
* e.g. index(col1, col2) would only return col1
*
- * @param bool $backquoted whether to quote name with backticks ``
+ * @param bool $backquoted whether to quote name with backticks ``
+ *
* @return array
*/
public function getIndexedColumns($backquoted = true)
@@ -1202,7 +1285,8 @@ class PMA_Table
$return = array();
foreach ($indexed as $column) {
- $return[] = $this->getFullName($backquoted) . '.' . ($backquoted ? PMA_backquote($column) : $column);
+ $return[] = $this->getFullName($backquoted) . '.'
+ . ($backquoted ? PMA_backquote($column) : $column);
}
return $return;
@@ -1213,7 +1297,8 @@ class PMA_Table
*
* returns an array with all columns
*
- * @param bool $backquoted whether to quote name with backticks ``
+ * @param bool $backquoted whether to quote name with backticks ``
+ *
* @return array
*/
public function getColumns($backquoted = true)
@@ -1223,7 +1308,8 @@ class PMA_Table
$return = array();
foreach ($indexed as $column) {
- $return[] = $this->getFullName($backquoted) . '.' . ($backquoted ? PMA_backquote($column) : $column);
+ $return[] = $this->getFullName($backquoted) . '.'
+ . ($backquoted ? PMA_backquote($column) : $column);
}
return $return;
@@ -1232,7 +1318,6 @@ class PMA_Table
/**
* Return UI preferences for this table from phpMyAdmin database.
*
- *
* @return array
*/
protected function getUiPrefsFromDb()
@@ -1241,11 +1326,10 @@ class PMA_Table
PMA_backquote($GLOBALS['cfg']['Server']['table_uiprefs']);
// Read from phpMyAdmin database
- $sql_query =
- " SELECT `prefs` FROM " . $pma_table .
- " WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'" .
- " AND `db_name` = '" . PMA_sqlAddSlashes($this->db_name) . "'" .
- " AND `table_name` = '" . PMA_sqlAddSlashes($this->name) . "'";
+ $sql_query = " SELECT `prefs` FROM " . $pma_table
+ . " WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'"
+ . " AND `db_name` = '" . PMA_sqlAddSlashes($this->db_name) . "'"
+ . " AND `table_name` = '" . PMA_sqlAddSlashes($this->name) . "'";
$row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
if (isset($row[0])) {
@@ -1262,22 +1346,23 @@ class PMA_Table
*/
protected function saveUiPrefsToDb()
{
- $pma_table = PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) .".".
- PMA_backquote($GLOBALS['cfg']['Server']['table_uiprefs']);
+ $pma_table = PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . "."
+ . PMA_backquote($GLOBALS['cfg']['Server']['table_uiprefs']);
$username = $GLOBALS['cfg']['Server']['user'];
- $sql_query =
- " REPLACE INTO " . $pma_table .
- " VALUES ('" . $username . "', '" . PMA_sqlAddSlashes($this->db_name) . "', '" .
- PMA_sqlAddSlashes($this->name) . "', '" .
- PMA_sqlAddSlashes(json_encode($this->uiprefs)) . "', NULL)";
+ $sql_query = " REPLACE INTO " . $pma_table
+ . " VALUES ('" . $username . "', '" . PMA_sqlAddSlashes($this->db_name)
+ . "', '" . PMA_sqlAddSlashes($this->name) . "', '"
+ . PMA_sqlAddSlashes(json_encode($this->uiprefs)) . "', NULL)";
$success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);
if (!$success) {
$message = PMA_Message::error(__('Could not save table UI preferences'));
$message->addMessage('<br /><br />');
- $message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink'])));
+ $message->addMessage(
+ PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink']))
+ );
return $message;
}
@@ -1294,13 +1379,15 @@ class PMA_Table
$success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);
if (!$success) {
- $message = PMA_Message::error(sprintf(
- __('Failed to cleanup table UI preferences (see $cfg[\'Servers\'][$i][\'MaxTableUiprefs\'] %s)'),
- PMA_showDocu('cfg_Servers_MaxTableUiprefs')
- ));
+ $message = PMA_Message::error(
+ sprintf(
+ __('Failed to cleanup table UI preferences (see $cfg[\'Servers\'][$i][\'MaxTableUiprefs\'] %s)'),
+ PMA_showDocu('cfg_Servers_MaxTableUiprefs')
+ )
+ );
$message->addMessage('<br /><br />');
$message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink'])));
- print_r($message);
+ print_r($message);
return $message;
}
}
@@ -1313,6 +1400,7 @@ class PMA_Table
* If pmadb and table_uiprefs is set, it will load the UI preferences from
* phpMyAdmin database.
*
+ * @return nothing
*/
protected function loadUiPrefs()
{
@@ -1320,10 +1408,11 @@ class PMA_Table
// set session variable if it's still undefined
if (! isset($_SESSION['tmp_user_values']['table_uiprefs'][$server_id][$this->db_name][$this->name])) {
$_SESSION['tmp_user_values']['table_uiprefs'][$server_id][$this->db_name][$this->name] =
- // check whether we can get from pmadb
- (strlen($GLOBALS['cfg']['Server']['pmadb'])
- && strlen($GLOBALS['cfg']['Server']['table_uiprefs'])) ?
- $this->getUiPrefsFromDb() : array();
+ // check whether we can get from pmadb
+ (strlen($GLOBALS['cfg']['Server']['pmadb'])
+ && strlen($GLOBALS['cfg']['Server']['table_uiprefs']))
+ ? $this->getUiPrefsFromDb()
+ : array();
}
$this->uiprefs =& $_SESSION['tmp_user_values']['table_uiprefs'][$server_id][$this->db_name][$this->name];
}
@@ -1336,8 +1425,8 @@ class PMA_Table
* - PROP_COLUMN_ORDER
* - PROP_COLUMN_VISIB
*
+ * @param string $property property
*
- * @param string $property
* @return mixed
*/
public function getUiProp($property)
@@ -1354,8 +1443,7 @@ class PMA_Table
$avail_columns = $this->getColumns();
foreach ($avail_columns as $each_col) {
// check if $each_col ends with $colname
- if (substr_compare($each_col, $colname,
- strlen($each_col) - strlen($colname)) === 0) {
+ if (substr_compare($each_col, $colname, strlen($each_col) - strlen($colname)) === 0) {
return $this->uiprefs[$property];
}
}
@@ -1365,12 +1453,12 @@ class PMA_Table
} else {
return false;
}
- } else if ($property == self::PROP_COLUMN_ORDER ||
- $property == self::PROP_COLUMN_VISIB) {
+ } elseif ($property == self::PROP_COLUMN_ORDER
+ || $property == self::PROP_COLUMN_VISIB
+ ) {
if (! PMA_Table::isView($this->db_name, $this->name) && isset($this->uiprefs[$property])) {
// check if the table has not been modified
- if (self::sGetStatusInfo($this->db_name, $this->name, 'Create_time') ==
- $this->uiprefs['CREATE_TIME']) {
+ if (self::sGetStatusInfo($this->db_name, $this->name, 'Create_time') == $this->uiprefs['CREATE_TIME']) {
return $this->uiprefs[$property];
} else {
// remove the property, since the table has been modified
@@ -1394,9 +1482,10 @@ class PMA_Table
* - PROP_COLUMN_ORDER
* - PROP_COLUMN_VISIB
*
- * @param string $property
- * @param mixed $value
+ * @param string $property Property
+ * @param mixed $value Value for the property
* @param string $table_create_time Needed for PROP_COLUMN_ORDER and PROP_COLUMN_VISIB
+ *
* @return boolean|PMA_Message
*/
public function setUiProp($property, $value, $table_create_time = null)
@@ -1405,12 +1494,13 @@ class PMA_Table
$this->loadUiPrefs();
}
// we want to save the create time if the property is PROP_COLUMN_ORDER
- if (! PMA_Table::isView($this->db_name, $this->name) && ($property == self::PROP_COLUMN_ORDER ||
- $property == self::PROP_COLUMN_VISIB)) {
-
+ if (! PMA_Table::isView($this->db_name, $this->name)
+ && ($property == self::PROP_COLUMN_ORDER || $property == self::PROP_COLUMN_VISIB)
+ ) {
$curr_create_time = self::sGetStatusInfo($this->db_name, $this->name, 'CREATE_TIME');
- if (isset($table_create_time) &&
- $table_create_time == $curr_create_time) {
+ if (isset($table_create_time)
+ && $table_create_time == $curr_create_time
+ ) {
$this->uiprefs['CREATE_TIME'] = $curr_create_time;
} else {
// there is no $table_create_time, or
@@ -1423,7 +1513,8 @@ class PMA_Table
$this->uiprefs[$property] = $value;
// check if pmadb is set
if (strlen($GLOBALS['cfg']['Server']['pmadb'])
- && strlen($GLOBALS['cfg']['Server']['table_uiprefs'])) {
+ && strlen($GLOBALS['cfg']['Server']['table_uiprefs'])
+ ) {
return $this->saveUiprefsToDb();
}
return true;
@@ -1432,7 +1523,8 @@ class PMA_Table
/**
* Remove a property from UI preferences.
*
- * @param string $property
+ * @param string $property the property
+ *
* @return true|PMA_Message
*/
public function removeUiProp($property)
@@ -1444,7 +1536,8 @@ class PMA_Table
unset($this->uiprefs[$property]);
// check if pmadb is set
if (strlen($GLOBALS['cfg']['Server']['pmadb'])
- && strlen($GLOBALS['cfg']['Server']['table_uiprefs'])) {
+ && strlen($GLOBALS['cfg']['Server']['table_uiprefs'])
+ ) {
return $this->saveUiprefsToDb();
}
}
hooks/post-receive
--
phpMyAdmin
1
0
[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-15908-g855dc6e
by Madhura Jayaratne 19 Aug '11
by Madhura Jayaratne 19 Aug '11
19 Aug '11
The branch, master has been updated
via 855dc6e6456be8503061ef7f473fa4d95b4a25d6 (commit)
via 6b0fb6c20678e490b72f768ec66ded5028187ec1 (commit)
via d5489c4432e09f5eb026223c4878db6e7261e0ff (commit)
from 5e860f187467162b2995c48feaff6689ba1accd2 (commit)
- Log -----------------------------------------------------------------
commit 855dc6e6456be8503061ef7f473fa4d95b4a25d6
Merge: 6b0fb6c 5e860f1
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Fri Aug 19 23:30:32 2011 +0530
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 6b0fb6c20678e490b72f768ec66ded5028187ec1
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Fri Aug 19 21:51:32 2011 +0530
Code style improvements
commit d5489c4432e09f5eb026223c4878db6e7261e0ff
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Fri Aug 19 21:43:07 2011 +0530
Fix doc blocks and multi line if statements
-----------------------------------------------------------------------
Summary of changes:
libraries/Tracker.class.php | 184 ++++++++++++++++++-------------------
libraries/transformations.lib.php | 47 ++++++----
2 files changed, 119 insertions(+), 112 deletions(-)
diff --git a/libraries/Tracker.class.php b/libraries/Tracker.class.php
index de216ab..e71b7d6 100644
--- a/libraries/Tracker.class.php
+++ b/libraries/Tracker.class.php
@@ -71,6 +71,7 @@ class PMA_Tracker
*
* @static
*
+ * @return nothing
*/
static public function init()
{
@@ -86,15 +87,15 @@ class PMA_Tracker
self::$default_tracking_set = $GLOBALS['cfg']['Server']['tracking_default_statements'];
self::$version_auto_create = $GLOBALS['cfg']['Server']['tracking_version_auto_create'];
-
}
/**
- * Actually enables tracking. This needs to be done after all
+ * Actually enables tracking. This needs to be done after all
* underlaying code is initialized.
*
* @static
*
+ * @return nothing
*/
static public function enable()
{
@@ -133,9 +134,9 @@ class PMA_Tracker
/**
* Parses the name of a table from a SQL statement substring.
*
- * @static
+ * @param string $string part of SQL statement
*
- * @param string $string part of SQL statement
+ * @static
*
* @return string the name of table
*/
@@ -144,8 +145,7 @@ class PMA_Tracker
if (strstr($string, '.')) {
$temp = explode('.', $string);
$tablename = $temp[1];
- }
- else {
+ } else {
$tablename = $string;
}
@@ -163,10 +163,10 @@ class PMA_Tracker
/**
* Gets the tracking status of a table, is it active or deactive ?
*
- * @static
+ * @param string $dbname name of database
+ * @param string $tablename name of table
*
- * @param string $dbname name of database
- * @param string $tablename name of table
+ * @static
*
* @return boolean true or false
*/
@@ -184,8 +184,7 @@ class PMA_Tracker
return false;
}
- $sql_query =
- " SELECT tracking_active FROM " . self::$pma_table .
+ $sql_query = " SELECT tracking_active FROM " . self::$pma_table .
" WHERE db_name = '" . PMA_sqlAddSlashes($dbname) . "' " .
" AND table_name = '" . PMA_sqlAddSlashes($tablename) . "' " .
" ORDER BY version DESC";
@@ -215,14 +214,14 @@ class PMA_Tracker
* Creates tracking version of a table / view
* (in other words: create a job to track future changes on the table).
*
- * @static
- *
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version
* @param string $tracking_set set of tracking statements
* @param bool $is_view if table is a view
*
+ * @static
+ *
* @return int result of version insertion
*/
static public function createVersion($dbname, $tablename, $version, $tracking_set = '', $is_view = false)
@@ -233,7 +232,7 @@ class PMA_Tracker
$tracking_set = self::$default_tracking_set;
}
- require_once './libraries/export/sql.php';
+ include_once './libraries/export/sql.php';
$sql_backquotes = true;
@@ -256,7 +255,7 @@ class PMA_Tracker
$indexes = array();
- while($row = PMA_DBI_fetch_assoc($sql_result)) {
+ while ($row = PMA_DBI_fetch_assoc($sql_result)) {
$indexes[] = $row;
}
@@ -284,8 +283,7 @@ class PMA_Tracker
// Save version
- $sql_query =
- "/*NOTRACK*/\n" .
+ $sql_query = "/*NOTRACK*/\n" .
"INSERT INTO" . self::$pma_table . " (" .
"db_name, " .
"table_name, " .
@@ -320,19 +318,18 @@ class PMA_Tracker
/**
- * Removes all tracking data for a table
+ * Removes all tracking data for a table
*
- * @static
+ * @param string $dbname name of database
+ * @param string $tablename name of table
*
- * @param string $dbname name of database
- * @param string $tablename name of table
+ * @static
*
* @return int result of version insertion
*/
static public function deleteTracking($dbname, $tablename)
{
- $sql_query =
- "/*NOTRACK*/\n" .
+ $sql_query = "/*NOTRACK*/\n" .
"DELETE FROM " . self::$pma_table . " WHERE `db_name` = '" . PMA_sqlAddSlashes($dbname) . "' AND `table_name` = '" . PMA_sqlAddSlashes($tablename) . "'";
$result = PMA_query_as_controluser($sql_query);
@@ -343,13 +340,13 @@ class PMA_Tracker
* Creates tracking version of a database
* (in other words: create a job to track future changes on the database).
*
- * @static
- *
* @param string $dbname name of database
* @param string $version version
* @param string $query query
* @param string $tracking_set set of tracking statements
*
+ * @static
+ *
* @return int result of version insertion
*/
static public function createDatabaseVersion($dbname, $version, $query, $tracking_set = 'CREATE DATABASE,ALTER DATABASE,DROP DATABASE')
@@ -360,7 +357,7 @@ class PMA_Tracker
$tracking_set = self::$default_tracking_set;
}
- require_once './libraries/export/sql.php';
+ include_once './libraries/export/sql.php';
$create_sql = "";
@@ -372,8 +369,7 @@ class PMA_Tracker
$create_sql .= self::getLogComment() . $query;
// Save version
- $sql_query =
- "/*NOTRACK*/\n" .
+ $sql_query = "/*NOTRACK*/\n" .
"INSERT INTO" . self::$pma_table . " (" .
"db_name, " .
"table_name, " .
@@ -406,19 +402,18 @@ class PMA_Tracker
/**
* Changes tracking of a table.
*
- * @static
+ * @param string $dbname name of database
+ * @param string $tablename name of table
+ * @param string $version version
+ * @param integer $new_state the new state of tracking
*
- * @param string $dbname name of database
- * @param string $tablename name of table
- * @param string $version version
- * @param integer $new_state the new state of tracking
+ * @static
*
* @return int result of SQL query
*/
- static private function changeTracking($dbname, $tablename, $version, $new_state)
+ static private function _changeTracking($dbname, $tablename, $version, $new_state)
{
- $sql_query =
- " UPDATE " . self::$pma_table .
+ $sql_query = " UPDATE " . self::$pma_table .
" SET `tracking_active` = '" . $new_state . "' " .
" WHERE `db_name` = '" . PMA_sqlAddSlashes($dbname) . "' " .
" AND `table_name` = '" . PMA_sqlAddSlashes($tablename) . "' " .
@@ -432,38 +427,38 @@ class PMA_Tracker
/**
* Changes tracking data of a table.
*
- * @static
+ * @param string $dbname name of database
+ * @param string $tablename name of table
+ * @param string $version version
+ * @param string $type type of data(DDL || DML)
+ * @param string|array $new_data the new tracking data
*
- * @param string $dbname name of database
- * @param string $tablename name of table
- * @param string $version version
- * @param string $type type of data(DDL || DML)
- * @param string|array $new_data the new tracking data
+ * @static
*
* @return bool result of change
*/
static public function changeTrackingData($dbname, $tablename, $version, $type, $new_data)
{
- if ($type == 'DDL')
+ if ($type == 'DDL') {
$save_to = 'schema_sql';
- elseif ($type == 'DML')
+ } elseif ($type == 'DML') {
$save_to = 'data_sql';
- else
+ } else {
return false;
-
+ }
$date = date('Y-m-d H:i:s');
$new_data_processed = '';
if (is_array($new_data)) {
foreach ($new_data as $data) {
- $new_data_processed .= '# log ' . $date . ' ' . $data['username'] . PMA_sqlAddSlashes($data['statement']) . "\n";
+ $new_data_processed .= '# log ' . $date . ' ' . $data['username']
+ . PMA_sqlAddSlashes($data['statement']) . "\n";
}
} else {
$new_data_processed = $new_data;
}
- $sql_query =
- " UPDATE " . self::$pma_table .
+ $sql_query = " UPDATE " . self::$pma_table .
" SET `" . $save_to . "` = '" . $new_data_processed . "' " .
" WHERE `db_name` = '" . PMA_sqlAddSlashes($dbname) . "' " .
" AND `table_name` = '" . PMA_sqlAddSlashes($tablename) . "' " .
@@ -477,34 +472,34 @@ class PMA_Tracker
/**
* Activates tracking of a table.
*
- * @static
+ * @param string $dbname name of database
+ * @param string $tablename name of table
+ * @param string $version version
*
- * @param string $dbname name of database
- * @param string $tablename name of table
- * @param string $version version
+ * @static
*
* @return int result of SQL query
*/
static public function activateTracking($dbname, $tablename, $version)
{
- return self::changeTracking($dbname, $tablename, $version, 1);
+ return self::_changeTracking($dbname, $tablename, $version, 1);
}
/**
* Deactivates tracking of a table.
*
- * @static
+ * @param string $dbname name of database
+ * @param string $tablename name of table
+ * @param string $version version
*
- * @param string $dbname name of database
- * @param string $tablename name of table
- * @param string $version version
+ * @static
*
* @return int result of SQL query
*/
static public function deactivateTracking($dbname, $tablename, $version)
{
- return self::changeTracking($dbname, $tablename, $version, 0);
+ return self::_changeTracking($dbname, $tablename, $version, 0);
}
@@ -512,18 +507,17 @@ class PMA_Tracker
* Gets the newest version of a tracking job
* (in other words: gets the HEAD version).
*
- * @static
+ * @param string $dbname name of database
+ * @param string $tablename name of table
+ * @param string $statement tracked statement
*
- * @param string $dbname name of database
- * @param string $tablename name of table
- * @param string $statement tracked statement
+ * @static
*
* @return int (-1 if no version exists | > 0 if a version exists)
*/
static public function getVersion($dbname, $tablename, $statement = null)
{
- $sql_query =
- " SELECT MAX(version) FROM " . self::$pma_table .
+ $sql_query = " SELECT MAX(version) FROM " . self::$pma_table .
" WHERE `db_name` = '" . PMA_sqlAddSlashes($dbname) . "' " .
" AND `table_name` = '" . PMA_sqlAddSlashes($tablename) . "' ";
@@ -540,11 +534,11 @@ class PMA_Tracker
/**
* Gets the record of a tracking job.
*
- * @static
+ * @param string $dbname name of database
+ * @param string $tablename name of table
+ * @param string $version version number
*
- * @param string $dbname name of database
- * @param string $tablename name of table
- * @param string $version version number
+ * @static
*
* @return mixed record DDM log, DDL log, structure snapshot, tracked statements.
*/
@@ -644,12 +638,12 @@ class PMA_Tracker
* - type of statement, is it part of DDL or DML ?
* - tablename
*
+ * @param string $query query
+ *
* @static
* @todo: using PMA SQL Parser when possible
* @todo: support multi-table/view drops
*
- * @param string $query
- *
* @return mixed Array containing identifier, type and tablename.
*
*/
@@ -684,9 +678,10 @@ class PMA_Tracker
$result['type'] = 'DDL';
// Parse CREATE VIEW statement
- if (in_array('CREATE', $tokens) == true &&
- in_array('VIEW', $tokens) == true &&
- in_array('AS', $tokens) == true) {
+ if (in_array('CREATE', $tokens) == true
+ && in_array('VIEW', $tokens) == true
+ && in_array('AS', $tokens) == true
+ ) {
$result['identifier'] = 'CREATE VIEW';
$index = array_search('VIEW', $tokens);
@@ -695,10 +690,11 @@ class PMA_Tracker
}
// Parse ALTER VIEW statement
- if (in_array('ALTER', $tokens) == true &&
- in_array('VIEW', $tokens) == true &&
- in_array('AS', $tokens) == true &&
- ! isset($result['identifier'])) {
+ if (in_array('ALTER', $tokens) == true
+ && in_array('VIEW', $tokens) == true
+ && in_array('AS', $tokens) == true
+ && ! isset($result['identifier'])
+ ) {
$result['identifier'] = 'ALTER VIEW';
$index = array_search('VIEW', $tokens);
@@ -778,11 +774,10 @@ class PMA_Tracker
}
// Parse CREATE INDEX statement
- if (! isset($result['identifier']) &&
- ( substr($query, 0, 12) == 'CREATE INDEX' ||
- substr($query, 0, 19) == 'CREATE UNIQUE INDEX' ||
- substr($query, 0, 20) == 'CREATE SPATIAL INDEX'
- )
+ if (! isset($result['identifier'])
+ && (substr($query, 0, 12) == 'CREATE INDEX'
+ || substr($query, 0, 19) == 'CREATE UNIQUE INDEX'
+ || substr($query, 0, 20) == 'CREATE SPATIAL INDEX')
) {
$result['identifier'] = 'CREATE INDEX';
$prefix = explode('ON ', $query);
@@ -822,7 +817,7 @@ class PMA_Tracker
}
// Parse INSERT INTO statement
- if (! isset($result['identifier']) && substr($query, 0, 11 ) == 'INSERT INTO') {
+ if (! isset($result['identifier']) && substr($query, 0, 11) == 'INSERT INTO') {
$result['identifier'] = 'INSERT';
$prefix = explode('INSERT INTO', $query);
$suffix = explode('(', $prefix[1]);
@@ -830,7 +825,7 @@ class PMA_Tracker
}
// Parse DELETE statement
- if (! isset($result['identifier']) && substr($query, 0, 6 ) == 'DELETE') {
+ if (! isset($result['identifier']) && substr($query, 0, 6) == 'DELETE') {
$result['identifier'] = 'DELETE';
$prefix = explode('FROM ', $query);
$suffix = explode(' ', $prefix[1]);
@@ -838,7 +833,7 @@ class PMA_Tracker
}
// Parse TRUNCATE statement
- if (! isset($result['identifier']) && substr($query, 0, 8 ) == 'TRUNCATE') {
+ if (! isset($result['identifier']) && substr($query, 0, 8) == 'TRUNCATE') {
$result['identifier'] = 'TRUNCATE';
$prefix = explode('TRUNCATE', $query);
$result['tablename'] = self::getTableName($prefix[1]);
@@ -851,8 +846,11 @@ class PMA_Tracker
/**
* Analyzes a given SQL statement and saves tracking data.
*
- * @static
* @param string $query a SQL query
+ *
+ * @static
+ *
+ * @return nothing
*/
static public function handleQuery($query)
{
@@ -881,8 +879,9 @@ class PMA_Tracker
// If version not exists and auto-creation is enabled
if (self::$version_auto_create == true
- && self::isTracked($dbname, $result['tablename']) == false
- && $version == -1) {
+ && self::isTracked($dbname, $result['tablename']) == false
+ && $version == -1
+ ) {
// Create the version
switch ($result['identifier']) {
@@ -916,11 +915,10 @@ class PMA_Tracker
$query = self::getLogComment() . $query ;
// Mark it as untouchable
- $sql_query =
- " /*NOTRACK*/\n" .
+ $sql_query = " /*NOTRACK*/\n" .
" UPDATE " . self::$pma_table .
- " SET " . PMA_backquote($save_to) ." = CONCAT( " . PMA_backquote($save_to) . ",'\n" . PMA_sqlAddSlashes($query) . "') ," .
- " `date_updated` = '" . $date . "' ";
+ " SET " . PMA_backquote($save_to) ." = CONCAT( " . PMA_backquote($save_to) . ",'\n"
+ . PMA_sqlAddSlashes($query) . "') ," . " `date_updated` = '" . $date . "' ";
// If table was renamed we have to change the tablename attribute in pma_tracking too
if ($result['identifier'] == 'RENAME TABLE') {
diff --git a/libraries/transformations.lib.php b/libraries/transformations.lib.php
index a5460ab..51da6ce 100644
--- a/libraries/transformations.lib.php
+++ b/libraries/transformations.lib.php
@@ -19,23 +19,26 @@
* // }
* </code>
*
- * @param string $option_string comma separated options
- * @return array options
+ * @param string $option_string comma separated options
+ *
+ * @return array options
*/
function PMA_transformation_getOptions($option_string)
{
$result = array();
if (! strlen($option_string)
- || ! $transform_options = preg_split('/,/', $option_string)) {
+ || ! $transform_options = preg_split('/,/', $option_string)
+ ) {
return $result;
}
while (($option = array_shift($transform_options)) !== null) {
$trimmed = trim($option);
if (strlen($trimmed) > 1
- && $trimmed[0] == "'"
- && $trimmed[strlen($trimmed) - 1] == "'") {
+ && $trimmed[0] == "'"
+ && $trimmed[strlen($trimmed) - 1] == "'"
+ ) {
// '...'
$option = substr($trimmed, 1, -1);
} elseif (isset($trimmed[0]) && $trimmed[0] == "'") {
@@ -117,11 +120,13 @@ function PMA_getAvailableMIMEtypes()
/**
* Gets the mimetypes for all columns of a table
*
+ * @param string $db the name of the db to check for
+ * @param string $table the name of the table to check for
+ * @param string $strict whether to include only results having a mimetype set
+ *
* @access public
- * @param string $db the name of the db to check for
- * @param string $table the name of the table to check for
- * @param string $strict whether to include only results having a mimetype set
- * @return array [field_name][field_key] = field_value
+ *
+ * @return array [field_name][field_key] = field_value
*/
function PMA_getMIME($db, $table, $strict = false)
{
@@ -136,7 +141,7 @@ function PMA_getMIME($db, $table, $strict = false)
`mimetype`,
`transformation`,
`transformation_options`
- FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
+ FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
WHERE `db_name` = \'' . PMA_sqlAddSlashes($db) . '\'
AND `table_name` = \'' . PMA_sqlAddSlashes($table) . '\'
AND ( `mimetype` != \'\'' . (!$strict ? '
@@ -148,14 +153,17 @@ function PMA_getMIME($db, $table, $strict = false)
/**
* Set a single mimetype to a certain value.
*
+ * @param string $db the name of the db
+ * @param string $table the name of the table
+ * @param string $key the name of the column
+ * @param string $mimetype the mimetype of the column
+ * @param string $transformation the transformation of the column
+ * @param string $transformation_options the transformation options of the column
+ * @param string $forcedelete force delete, will erase any existing
+ * comments for this column
+ *
* @access public
- * @param string $db the name of the db
- * @param string $table the name of the table
- * @param string $key the name of the column
- * @param string $mimetype the mimetype of the column
- * @param string $transformation the transformation of the column
- * @param string $transformation_options the transformation options of the column
- * @param string $forcedelete force delete, will erase any existing comments for this column
+ *
* @return boolean true, if comment-query was made.
*/
function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
@@ -181,8 +189,9 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
PMA_DBI_free_result($test_rs);
if (! $forcedelete
- && (strlen($mimetype) || strlen($transformation)
- || strlen($transformation_options) || strlen($row['comment']))) {
+ && (strlen($mimetype) || strlen($transformation)
+ || strlen($transformation_options) || strlen($row['comment']))
+ ) {
$upd_query = '
UPDATE ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
SET `mimetype` = \'' . PMA_sqlAddSlashes($mimetype) . '\',
hooks/post-receive
--
phpMyAdmin
1
0
[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-15905-g5e860f1
by Piotr Przybylski 19 Aug '11
by Piotr Przybylski 19 Aug '11
19 Aug '11
The branch, master has been updated
via 5e860f187467162b2995c48feaff6689ba1accd2 (commit)
from 941c186d27b3bf6a708ce182399cea4ab6f17474 (commit)
- Log -----------------------------------------------------------------
commit 5e860f187467162b2995c48feaff6689ba1accd2
Author: Piotr Przybylski <piotrprz(a)gmail.com>
Date: Fri Aug 19 18:24:04 2011 +0200
Fix usage of PMA_DBI_get_columns in tbl_change.php
-----------------------------------------------------------------------
Summary of changes:
tbl_change.php | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tbl_change.php b/tbl_change.php
index bf0704a..e7011eb 100644
--- a/tbl_change.php
+++ b/tbl_change.php
@@ -165,7 +165,7 @@ unset($show_create_table);
* Get the list of the fields of the current table
*/
PMA_DBI_select_db($db);
-$table_fields = PMA_DBI_get_columns($db, $table);
+$table_fields = array_values(PMA_DBI_get_columns($db, $table));
$rows = array();
if (isset($where_clause)) {
// when in edit mode load all selected rows from table
hooks/post-receive
--
phpMyAdmin
1
0
[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-15904-g941c186
by Piotr Przybylski 19 Aug '11
by Piotr Przybylski 19 Aug '11
19 Aug '11
The branch, master has been updated
via 941c186d27b3bf6a708ce182399cea4ab6f17474 (commit)
via c1f20fefd4c848f3b0e2ec952f60702b4237e341 (commit)
from 7b054e9b7d677306ab93ea3812b5b5fc2ee6e2f2 (commit)
- Log -----------------------------------------------------------------
commit 941c186d27b3bf6a708ce182399cea4ab6f17474
Author: Piotr Przybylski <piotrprz(a)gmail.com>
Date: Fri Aug 19 18:17:56 2011 +0200
Advisor: properly detect 64-bit builds of MySQL on Windows
commit c1f20fefd4c848f3b0e2ec952f60702b4237e341
Author: Piotr Przybylski <piotrprz(a)gmail.com>
Date: Fri Aug 19 18:16:14 2011 +0200
Make Advisor evaluation code easier to understand
-----------------------------------------------------------------------
Summary of changes:
libraries/Advisor.class.php | 21 +++++++++++++++++++--
libraries/advisory_rules.txt | 2 +-
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/libraries/Advisor.class.php b/libraries/Advisor.class.php
index 6159286..b681155 100644
--- a/libraries/Advisor.class.php
+++ b/libraries/Advisor.class.php
@@ -174,6 +174,22 @@ class Advisor
$this->runResult[$type][] = $rule;
}
+ private function ruleExprEvaluate_var1($matches)
+ {
+ // '/fired\s*\(\s*(\'|")(.*)\1\s*\)/Uie'
+ return '1'; //isset($this->runResult[\'fired\']
+ }
+
+ private function ruleExprEvaluate_var2($matches)
+ {
+ // '/\b(\w+)\b/e'
+ return isset($this->variables[$matches[1]])
+ ? (is_numeric($this->variables[$matches[1]])
+ ? $this->variables[$matches[1]]
+ : '"'.$this->variables[$matches[1]].'"')
+ : $matches[1];
+ }
+
// Runs a code expression, replacing variable names with their respective values
// ignoreUntil: if > 0, it doesn't replace any variables until that string position, but still evaluates the whole expr
function ruleExprEvaluate($expr, $ignoreUntil = 0)
@@ -182,13 +198,14 @@ class Advisor
$exprIgnore = substr($expr,0,$ignoreUntil);
$expr = substr($expr,$ignoreUntil);
}
- $expr = preg_replace('/fired\s*\(\s*(\'|")(.*)\1\s*\)/Uie','1',$expr); //isset($this->runResult[\'fired\']
- $expr = preg_replace('/\b(\w+)\b/e','isset($this->variables[\'\1\']) ? (!is_numeric($this->variables[\'\1\']) ? \'"\'.$this->variables[\'\1\'].\'"\' : $this->variables[\'\1\']) : \'\1\'', $expr);
+ $expr = preg_replace_callback('/fired\s*\(\s*(\'|")(.*)\1\s*\)/Ui', array($this, 'ruleExprEvaluate_var1'), $expr);
+ $expr = preg_replace_callback('/\b(\w+)\b/', array($this, 'ruleExprEvaluate_var2'), $expr);
if ($ignoreUntil > 0) {
$expr = $exprIgnore . $expr;
}
$value = 0;
$err = 0;
+
ob_start();
eval('$value = '.$expr.';');
$err = ob_get_contents();
diff --git a/libraries/advisory_rules.txt b/libraries/advisory_rules.txt
index f13f838..b2aa21d 100644
--- a/libraries/advisory_rules.txt
+++ b/libraries/advisory_rules.txt
@@ -111,7 +111,7 @@ rule 'Distribution'
rule 'MySQL Architecture'
system_memory
- value > 3072*1024 && !preg_match('/64/',version_compile_machine)
+ value > 3072*1024 && !preg_match('/64/',version_compile_machine) && !preg_match('/64/',version_compile_os)
MySQL is not compiled as a 64-bit package.
Your memory capacity is above 3 GiB (assuming the Server is on localhost), so MySQL might not be able to access all of your memory. You might want to consider installing the 64-bit version of MySQL.
Available memory on this host: %s | implode(' ',PMA_formatByteDown(value*1024, 2, 2))
hooks/post-receive
--
phpMyAdmin
1
0
[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-15902-g7b054e9
by Madhura Jayaratne 19 Aug '11
by Madhura Jayaratne 19 Aug '11
19 Aug '11
The branch, master has been updated
via 7b054e9b7d677306ab93ea3812b5b5fc2ee6e2f2 (commit)
from 88db32fafd2b8a6e3b4f3c04af4b1a34fdac7b3c (commit)
- Log -----------------------------------------------------------------
commit 7b054e9b7d677306ab93ea3812b5b5fc2ee6e2f2
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Fri Aug 19 20:48:27 2011 +0530
Fix doc blocks, multi line if statements, switch-case statements
-----------------------------------------------------------------------
Summary of changes:
libraries/url_generating.lib.php | 82 ++++++++++++++++++++-----------------
1 files changed, 44 insertions(+), 38 deletions(-)
diff --git a/libraries/url_generating.lib.php b/libraries/url_generating.lib.php
index e3cc02a..3884125 100644
--- a/libraries/url_generating.lib.php
+++ b/libraries/url_generating.lib.php
@@ -9,13 +9,14 @@
/**
* Generates text with hidden inputs.
*
- * @see PMA_generate_common_url()
- * @param string optional database name
- * (can also be an array of parameters)
- * @param string optional table name
- * @param int indenting level
- * @param string do not generate a hidden field for this parameter
- * (can be an array of strings)
+ * @param string $db optional database name
+ * (can also be an array of parameters)
+ * @param string $table optional table name
+ * @param int $indent indenting level
+ * @param string $skip do not generate a hidden field for this parameter
+ * (can be an array of strings)
+ *
+ * @see PMA_generate_common_url()
*
* @return string string with input fields
*
@@ -27,7 +28,6 @@
* @global boolean whether recoding is allowed or not
*
* @access public
- *
*/
function PMA_generate_common_hidden_inputs($db = '', $table = '', $indent = 0, $skip = array())
{
@@ -48,15 +48,16 @@ function PMA_generate_common_hidden_inputs($db = '', $table = '', $indent = 0, $
}
if (! empty($GLOBALS['server'])
- && $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']) {
+ && $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']
+ ) {
$params['server'] = $GLOBALS['server'];
}
- if (empty($_COOKIE['pma_lang'])
- && ! empty($GLOBALS['lang'])) {
+ if (empty($_COOKIE['pma_lang']) && ! empty($GLOBALS['lang'])) {
$params['lang'] = $GLOBALS['lang'];
}
if (empty($_COOKIE['pma_collation_connection'])
- && ! empty($GLOBALS['collation_connection'])) {
+ && ! empty($GLOBALS['collation_connection'])
+ ) {
$params['collation_connection'] = $GLOBALS['collation_connection'];
}
@@ -102,8 +103,9 @@ function PMA_generate_common_hidden_inputs($db = '', $table = '', $indent = 0, $
* <input type="hidden" name="ccc[b]" Value="ccc_b" />
* </code>
*
- * @param array $values
- * @param string $pre
+ * @param array $values hidden values
+ * @param string $pre prefix
+ *
* @return string form fields of type hidden
*/
function PMA_getHiddenFields($values, $pre = '')
@@ -160,19 +162,20 @@ function PMA_getHiddenFields($values, $pre = '')
* // script.php?server=1&lang=en
* </code>
*
- * @param mixed assoc. array with url params or optional string with database name
- * if first param is an array there is also an ? prefixed to the url
+ * @param mixed assoc. array with url params or optional string with database name
+ * if first param is an array there is also an ? prefixed to the url
+ *
+ * @param string - if first param is array: 'html' to use htmlspecialchars()
+ * on the resulting URL (for a normal URL displayed in HTML)
+ * or something else to avoid using htmlspecialchars() (for
+ * a URL sent via a header); if not set,'html' is assumed
+ * - if first param is not array: optional table name
*
- * @param string - if first param is array: 'html' to use htmlspecialchars()
- * on the resulting URL (for a normal URL displayed in HTML)
- * or something else to avoid using htmlspecialchars() (for
- * a URL sent via a header); if not set,'html' is assumed
- * - if first param is not array: optional table name
+ * @param string - if first param is array: optional character to
+ * use instead of '?'
+ * - if first param is not array: optional character to use
+ * instead of '&' for dividing URL parameters
*
- * @param string - if first param is array: optional character to
- * use instead of '?'
- * - if first param is not array: optional character to use
- * instead of '&' for dividing URL parameters
* @return string string with URL parameters
* @access public
*/
@@ -219,17 +222,18 @@ function PMA_generate_common_url()
if (isset($GLOBALS['server'])
&& $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']
- // avoid overwriting when creating navi panel links to servers
- && ! isset($params['server'])) {
+ // avoid overwriting when creating navi panel links to servers
+ && ! isset($params['server'])
+ ) {
$params['server'] = $GLOBALS['server'];
}
- if (empty($_COOKIE['pma_lang'])
- && ! empty($GLOBALS['lang'])) {
+ if (empty($_COOKIE['pma_lang']) && ! empty($GLOBALS['lang'])) {
$params['lang'] = $GLOBALS['lang'];
}
if (empty($_COOKIE['pma_collation_connection'])
- && ! empty($GLOBALS['collation_connection'])) {
+ && ! empty($GLOBALS['collation_connection'])
+ ) {
$params['collation_connection'] = $GLOBALS['collation_connection'];
}
@@ -256,7 +260,9 @@ function PMA_generate_common_url()
* extracted from arg_separator.input as set in php.ini
* we do not use arg_separator.output to avoid problems with & and &
*
- * @param string whether to encode separator or not, currently 'none' or 'html'
+ * @param string $encode whether to encode separator or not,
+ * currently 'none' or 'html'
+ *
* @return string character used for separating url parts usally ; or &
* @access public
*/
@@ -278,13 +284,13 @@ function PMA_get_arg_separator($encode = 'none')
}
switch ($encode) {
- case 'html':
- return htmlentities($separator);
- break;
- case 'text' :
- case 'none' :
- default :
- return $separator;
+ case 'html':
+ return htmlentities($separator);
+ break;
+ case 'text' :
+ case 'none' :
+ default :
+ return $separator;
}
}
hooks/post-receive
--
phpMyAdmin
1
0
[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-15901-g88db32f
by Madhura Jayaratne 19 Aug '11
by Madhura Jayaratne 19 Aug '11
19 Aug '11
The branch, master has been updated
via 88db32fafd2b8a6e3b4f3c04af4b1a34fdac7b3c (commit)
via 388dfb0e5d46961a4f987991bc76451a2052e96e (commit)
from ca16dfb46f98776555e0bcca8bcf17b8fafd49fc (commit)
- Log -----------------------------------------------------------------
commit 88db32fafd2b8a6e3b4f3c04af4b1a34fdac7b3c
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Fri Aug 19 20:31:44 2011 +0530
More coding style improvements
commit 388dfb0e5d46961a4f987991bc76451a2052e96e
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Fri Aug 19 20:29:47 2011 +0530
Coding style improvements
-----------------------------------------------------------------------
Summary of changes:
libraries/user_preferences.inc.php | 9 +++++--
libraries/user_preferences.lib.php | 40 ++++++++++++++++++++++++-----------
2 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/libraries/user_preferences.inc.php b/libraries/user_preferences.inc.php
index 1b04217..8295100 100644
--- a/libraries/user_preferences.inc.php
+++ b/libraries/user_preferences.inc.php
@@ -27,9 +27,12 @@ $tabs_icons = array(
'Import' => 'ic_b_import',
'Export' => 'ic_b_export');
echo '<ul id="topmenu2">';
-echo PMA_generate_html_tab(array(
- 'link' => 'prefs_manage.php',
- 'text' => __('Manage your settings'))) . "\n";
+echo PMA_generate_html_tab(
+ array(
+ 'link' => 'prefs_manage.php',
+ 'text' => __('Manage your settings')
+ )
+) . "\n";
echo '<li> </li>' . "\n";
$script_name = basename($GLOBALS['PMA_PHP_SELF']);
foreach (array_keys($forms) as $formset) {
diff --git a/libraries/user_preferences.lib.php b/libraries/user_preferences.lib.php
index 2246a4d..84ca5c4 100644
--- a/libraries/user_preferences.lib.php
+++ b/libraries/user_preferences.lib.php
@@ -16,9 +16,12 @@ function PMA_userprefs_pageinit()
$cf = ConfigFile::getInstance();
$cf->resetConfigData(); // start with a clean instance
$cf->setAllowedKeys($forms_all_keys);
- $cf->setCfgUpdateReadMapping(array(
- 'Server/hide_db' => 'Servers/1/hide_db',
- 'Server/only_db' => 'Servers/1/only_db'));
+ $cf->setCfgUpdateReadMapping(
+ array(
+ 'Server/hide_db' => 'Servers/1/hide_db',
+ 'Server/only_db' => 'Servers/1/only_db'
+ )
+ );
$cf->updateWithGlobalConfig($GLOBALS['cfg']);
}
@@ -64,7 +67,8 @@ function PMA_load_userprefs()
/**
* Saves user preferences
*
- * @param array $config_data
+ * @param array $config_array configuration array
+ *
* @return true|PMA_Message
*/
function PMA_save_userprefs(array $config_array)
@@ -80,7 +84,7 @@ function PMA_save_userprefs(array $config_array)
'db' => $config_array,
'ts' => time());
if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
- unset($_SESSION['cache'][$cache_key]['userprefs']);
+ unset($_SESSION['cache'][$cache_key]['userprefs']);
}
return true;
}
@@ -122,6 +126,7 @@ function PMA_save_userprefs(array $config_array)
* (blacklist) and keys from user preferences form (whitelist)
*
* @param array $config_data path => value pairs
+ *
* @return array
*/
function PMA_apply_userprefs(array $config_data)
@@ -155,6 +160,7 @@ function PMA_apply_userprefs(array $config_data)
* Reads user preferences field names
*
* @param array|null $forms
+ *
* @return array
*/
function PMA_read_userprefs_fieldnames(array $forms = null)
@@ -185,8 +191,10 @@ function PMA_read_userprefs_fieldnames(array $forms = null)
*
* No validation is done!
*
- * @param string $cfg_name
- * @param mixed $value
+ * @param string $path configuration
+ * @param mixed $value value
+ * @param mixed $default_value default value
+ *
* @return void
*/
function PMA_persist_option($path, $value, $default_value)
@@ -222,12 +230,16 @@ function PMA_userprefs_redirect(array $forms, array $old_settings, $file_name, $
? $old_settings['config_data']
: array();
$new_settings = ConfigFile::getInstance()->getConfigArray();
- $diff_keys = array_keys(array_diff_assoc($old_settings, $new_settings)
- + array_diff_assoc($new_settings, $old_settings));
+ $diff_keys = array_keys(
+ array_diff_assoc($old_settings, $new_settings)
+ + array_diff_assoc($new_settings, $old_settings)
+ );
$check_keys = array('NaturalOrder', 'MainPageIconic', 'DefaultTabDatabase',
'Server/hide_db', 'Server/only_db');
- $check_keys = array_merge($check_keys, $forms['Left_frame']['Left_frame'],
- $forms['Left_frame']['Left_databases']);
+ $check_keys = array_merge(
+ $check_keys, $forms['Left_frame']['Left_frame'],
+ $forms['Left_frame']['Left_databases']
+ );
$diff = array_intersect($check_keys, $diff_keys);
$reload_left_frame = !empty($diff);
}
@@ -242,8 +254,10 @@ function PMA_userprefs_redirect(array $forms, array $old_settings, $file_name, $
if ($hash) {
$hash = '#' . urlencode($hash);
}
- PMA_sendHeaderLocation($GLOBALS['cfg']['PmaAbsoluteUri'] . $file_name
- . PMA_generate_common_url($url_params, '&') . $hash);
+ PMA_sendHeaderLocation(
+ $GLOBALS['cfg']['PmaAbsoluteUri'] . $file_name
+ . PMA_generate_common_url($url_params, '&') . $hash
+ );
}
/**
hooks/post-receive
--
phpMyAdmin
1
0
[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-15899-gca16dfb
by Madhura Jayaratne 19 Aug '11
by Madhura Jayaratne 19 Aug '11
19 Aug '11
The branch, master has been updated
via ca16dfb46f98776555e0bcca8bcf17b8fafd49fc (commit)
from 878e78866c39b2b1229984861e094eccf9e59ae7 (commit)
- Log -----------------------------------------------------------------
commit ca16dfb46f98776555e0bcca8bcf17b8fafd49fc
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Fri Aug 19 20:05:48 2011 +0530
Coding style improvements
-----------------------------------------------------------------------
Summary of changes:
libraries/zip.lib.php | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/libraries/zip.lib.php b/libraries/zip.lib.php
index 9208e93..f8b5878 100644
--- a/libraries/zip.lib.php
+++ b/libraries/zip.lib.php
@@ -62,8 +62,11 @@ class zipfile
* "echo $zipfile;" command
*
* @access public
+ *
+ * @return nothing
*/
- function setDoWrite() {
+ function setDoWrite()
+ {
$this -> doWrite = true;
} // end of the 'setDoWrite()' method
@@ -71,13 +74,14 @@ class zipfile
* Converts an Unix timestamp to a four byte DOS date and time format (date
* in high two bytes, time in low two bytes allowing magnitude comparison).
*
- * @param integer the current Unix timestamp
+ * @param integer $unixtime the current Unix timestamp
*
- * @return integer the current date in a four byte DOS format
+ * @return integer the current date in a four byte DOS format
*
* @access private
*/
- function unix2DosTime($unixtime = 0) {
+ function unix2DosTime($unixtime = 0)
+ {
$timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);
if ($timearray['year'] < 1980) {
@@ -97,17 +101,19 @@ class zipfile
/**
* Adds "file" to archive
*
- * @param string file contents
- * @param string name of the file in the archive (may contains the path)
- * @param integer the current timestamp
+ * @param string $data file contents
+ * @param string $name name of the file in the archive (may contains the path)
+ * @param integer $time the current timestamp
*
* @access public
+ *
+ * @return nothing
*/
function addFile($data, $name, $time = 0)
{
$name = str_replace('\\', '/', $name);
- $dtime = substr( "00000000" . dechex($this->unix2DosTime($time)), -8);
+ $dtime = substr("00000000" . dechex($this->unix2DosTime($time)), -8);
$hexdtime = '\x' . $dtime[6] . $dtime[7]
. '\x' . $dtime[4] . $dtime[5]
. '\x' . $dtime[2] . $dtime[3]
hooks/post-receive
--
phpMyAdmin
1
0
[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-15898-g878e788
by Madhura Jayaratne 19 Aug '11
by Madhura Jayaratne 19 Aug '11
19 Aug '11
The branch, master has been updated
via 878e78866c39b2b1229984861e094eccf9e59ae7 (commit)
via 21510a093a91e6ed2748d46bb8d54b248e9cf082 (commit)
from d7e400416eda7ea663631ab19d8b1b59fbb1cd5d (commit)
- Log -----------------------------------------------------------------
commit 878e78866c39b2b1229984861e094eccf9e59ae7
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Fri Aug 19 19:55:43 2011 +0530
proper indentation for switch-case statements
commit 21510a093a91e6ed2748d46bb8d54b248e9cf082
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Fri Aug 19 19:54:25 2011 +0530
Fix some doc blocks
-----------------------------------------------------------------------
Summary of changes:
libraries/zip_extension.lib.php | 71 ++++++++++++++++++++++-----------------
1 files changed, 40 insertions(+), 31 deletions(-)
diff --git a/libraries/zip_extension.lib.php b/libraries/zip_extension.lib.php
index 7bfa848..9aa2758 100644
--- a/libraries/zip_extension.lib.php
+++ b/libraries/zip_extension.lib.php
@@ -7,13 +7,14 @@
*/
/**
- * Gets zip file contents
- *
- * @param string $specific_entry regular expression to match a file
- * @return array ($error_message, $file_data); $error_message
- * is empty if no error
- */
-
+ * Gets zip file contents
+ *
+ * @param string $file zip file
+ * @param string $specific_entry regular expression to match a file
+ *
+ * @return array ($error_message, $file_data); $error_message
+ * is empty if no error
+ */
function PMA_getZipContents($file, $specific_entry = null)
{
$error_message = '';
@@ -77,6 +78,8 @@ function PMA_getZipContents($file, $specific_entry = null)
*
* @param string $file_regexp regular expression for the file name to match
* @param string $file zip archive
+ *
+ * @return string the file name of the first file that matches the given regexp
*/
function PMA_findFileFromZipArchive ($file_regexp, $file)
{
@@ -100,7 +103,9 @@ function PMA_findFileFromZipArchive ($file_regexp, $file)
/**
* Returns the number of files in the zip archive.
*
- * @param string $file
+ * @param string $file zip archive
+ *
+ * @return int the number of files in the zip archive
*/
function PMA_getNoOfFilesInZip($file)
{
@@ -121,11 +126,14 @@ function PMA_getNoOfFilesInZip($file)
/**
* Extracts a set of files from the given zip archive to a given destinations.
*
- * @param string $zip_path
- * @param string $destination
- * @param array $entries
+ * @param string $zip_path path to the zip archive
+ * @param string $destination destination to extract files
+ * @param array $entries files in archive that should be extracted
+ *
+ * @return bool true on sucess, false otherwise
*/
-function PMA_zipExtract($zip_path, $destination, $entries) {
+function PMA_zipExtract($zip_path, $destination, $entries)
+{
$zip = new ZipArchive;
if ($zip->open($zip_path) === true) {
$zip->extractTo($destination, $entries);
@@ -138,30 +146,31 @@ function PMA_zipExtract($zip_path, $destination, $entries) {
/**
* Gets zip error message
*
- * @param integer error code
- * @return string error message
+ * @param integer $code error code
+ *
+ * @return string error message
*/
function PMA_getZipError($code)
{
// I don't think this needs translation
switch ($code) {
- case ZIPARCHIVE::ER_MULTIDISK:
- $message = 'Multi-disk zip archives not supported';
- break;
- case ZIPARCHIVE::ER_READ:
- $message = 'Read error';
- break;
- case ZIPARCHIVE::ER_CRC:
- $message = 'CRC error';
- break;
- case ZIPARCHIVE::ER_NOZIP:
- $message = 'Not a zip archive';
- break;
- case ZIPARCHIVE::ER_INCONS:
- $message = 'Zip archive inconsistent';
- break;
- default:
- $message = $code;
+ case ZIPARCHIVE::ER_MULTIDISK:
+ $message = 'Multi-disk zip archives not supported';
+ break;
+ case ZIPARCHIVE::ER_READ:
+ $message = 'Read error';
+ break;
+ case ZIPARCHIVE::ER_CRC:
+ $message = 'CRC error';
+ break;
+ case ZIPARCHIVE::ER_NOZIP:
+ $message = 'Not a zip archive';
+ break;
+ case ZIPARCHIVE::ER_INCONS:
+ $message = 'Zip archive inconsistent';
+ break;
+ default:
+ $message = $code;
}
return $message;
}
hooks/post-receive
--
phpMyAdmin
1
0
[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-15896-gd7e4004
by Michal ÄŒihaÅ™ 19 Aug '11
by Michal ÄŒihaÅ™ 19 Aug '11
19 Aug '11
The branch, master has been updated
via d7e400416eda7ea663631ab19d8b1b59fbb1cd5d (commit)
from 86dad703868c01089cfdceaaf3cc0a7e0bbdf10b (commit)
- Log -----------------------------------------------------------------
commit d7e400416eda7ea663631ab19d8b1b59fbb1cd5d
Author: Michal ÄŒihaÅ™ <michal(a)cihar.com>
Date: Fri Aug 19 13:49:05 2011 +0200
Fix displaying of hint
-----------------------------------------------------------------------
Summary of changes:
themes/pmahomme/css/theme_right.css.php | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/themes/pmahomme/css/theme_right.css.php b/themes/pmahomme/css/theme_right.css.php
index 6109d89..4fc6f43 100644
--- a/themes/pmahomme/css/theme_right.css.php
+++ b/themes/pmahomme/css/theme_right.css.php
@@ -3096,7 +3096,7 @@ canvas.pmd * {
top: 50px;
z-index: 3;
border: #00CC66 solid 1px;
- visibility: hidden;
+ display: none;
}
.scroll_tab {
hooks/post-receive
--
phpMyAdmin
1
0