diff --git a/ChangeLog b/ChangeLog index 94861f50a6..dc2f709b0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -53,6 +53,7 @@ phpMyAdmin - ChangeLog - bug #3367993 [usability] Missing "Generate Password" button - bug #3363221 [display] Missing Server Parameter on inline sql query - bug #3367986 [navi] Drop field -> lost active table +- remove misleading comment on the "Rename database" interface 3.4.3.1 (2011-07-02) - [security] Fixed possible session manipulation in swekey authentication, see PMASA-2011-5 diff --git a/build.xml b/build.xml index a6f09da0ed..ad4dc40597 100644 --- a/build.xml +++ b/build.xml @@ -46,6 +46,7 @@ @@ -60,8 +61,8 @@ - 'bug #\\1', // all other 6+ digit numbers are treated as bugs - '/(? ' bug #\\1', // CVE/CAN entries diff --git a/db_operations.php b/db_operations.php index 190f9b649b..e2d1e2bba5 100644 --- a/db_operations.php +++ b/db_operations.php @@ -77,7 +77,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { // the db name $procedure_names = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE'); if ($procedure_names) { - foreach($procedure_names as $procedure_name) { + foreach ($procedure_names as $procedure_name) { PMA_DBI_select_db($db); $tmp_query = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure_name); // collect for later display @@ -89,7 +89,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { $function_names = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION'); if ($function_names) { - foreach($function_names as $function_name) { + foreach ($function_names as $function_name) { PMA_DBI_select_db($db); $tmp_query = PMA_DBI_get_definition($db, 'FUNCTION', $function_name); // collect for later display @@ -234,7 +234,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { // the db name $event_names = PMA_DBI_fetch_result('SELECT EVENT_NAME FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' . PMA_sqlAddSlashes($db,true) . '\';'); if ($event_names) { - foreach($event_names as $event_name) { + foreach ($event_names as $event_name) { PMA_DBI_select_db($db); $tmp_query = PMA_DBI_get_definition($db, 'EVENT', $event_name); // collect for later display @@ -398,24 +398,12 @@ if ($db != 'mysql') { '; + echo ''; } echo __('Rename database to') . ':'; ?> - = XYYZZ) { - // echo 'RENAME DATABASE'; - //} else { - echo 'INSERT INTO ... SELECT'; - //} - echo ')'; ?>
@@ -434,8 +422,7 @@ if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && ! $db_is_info
'; + echo ''; } echo __('Remove database'); ?> @@ -481,8 +468,7 @@ echo __('Remove database'); '; + echo ''; } echo __('Copy database to') . ':'; $drop_clause = 'DROP TABLE / DROP VIEW'; @@ -546,8 +532,7 @@ echo __('Remove database'); . '
' . "\n" . ' '; if ($cfg['PropertiesIconic']) { - echo ''; + echo ''; } echo ' ' . "\n" . ' ' . "\n" @@ -594,8 +579,7 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?> */ echo ''; } // end if diff --git a/db_structure.php b/db_structure.php index 000ab6afbf..d1ffdc3b77 100644 --- a/db_structure.php +++ b/db_structure.php @@ -284,9 +284,9 @@ foreach ($tables as $keyname => $each_table) { $tracking_icon = ''; if (PMA_Tracker::isActive()) { if (PMA_Tracker::isTracked($GLOBALS["db"], $truename)) { - $tracking_icon = '' . __('Tracking is active.') . ''; + $tracking_icon = '' . __('Tracking is active.') . ''; } elseif (PMA_Tracker::getVersion($GLOBALS["db"], $truename) > 0) { - $tracking_icon = '' . __('Tracking is not active.') . ''; + $tracking_icon = '' . __('Tracking is not active.') . ''; } } @@ -341,7 +341,7 @@ foreach ($tables as $keyname => $each_table) { - ' : ''. $do ? ' REPLICATED' : ''; ?> + ' : ''. $do ? ' REPLICATED' : ''; ?> @@ -548,15 +548,13 @@ PMA_listNavigator($total_num_tables, $pos, $_url_params, 'db_structure.php', 'fr echo '

'; echo ''; if ($cfg['PropertiesIconic']) { - echo ''; + echo ''; } echo __('Print view') . ' '; echo ''; if ($cfg['PropertiesIconic']) { - echo ''; + echo ''; } echo __('Data Dictionary') . ''; echo '

'; diff --git a/db_tracking.php b/db_tracking.php index 3a9b6954b7..38a231d4e0 100644 --- a/db_tracking.php +++ b/db_tracking.php @@ -98,7 +98,7 @@ if (PMA_DBI_num_rows($all_tables_result) > 0) { $drop_image_or_text = ''; if (true == $GLOBALS['cfg']['PropertiesIconic']) { - $drop_image_or_text .= '' . __('Delete tracking data for this table') . ''; + $drop_image_or_text .= '' . __('Delete tracking data for this table') . ''; } if ('both' === $GLOBALS['cfg']['PropertiesIconic'] || false === $GLOBALS['cfg']['PropertiesIconic']) { $drop_image_or_text .= __('Drop'); @@ -198,7 +198,7 @@ if (isset($my_tables)) { $my_link = ''; if ($cfg['PropertiesIconic']) { - $my_link .= '' . __('Track table') . ' '; + $my_link .= '' . __('Track table') . ' '; } $my_link .= __('Track table') . ''; ?> diff --git a/enum_editor.php b/enum_editor.php index ab86d737cb..5fe962fc10 100644 --- a/enum_editor.php +++ b/enum_editor.php @@ -32,7 +32,7 @@ require_once './libraries/header_meta_style.inc.php'; } // Display the values in text fields, excluding empty strings $field_counter = 0; - foreach($values as $value) { + foreach ($values as $value) { if(trim($value) != "") { $field_counter++; echo sprintf('', htmlspecialchars(str_replace(array("''", '\\\\', "\\'"), array("'", '\\', "'"), substr($value, 1, -1)))); diff --git a/export.php b/export.php index 6137b96e7c..f5a985ac75 100644 --- a/export.php +++ b/export.php @@ -400,7 +400,7 @@ if (!$save_on_server) { $_REQUEST['table_select'] = implode(",", $_REQUEST['table_select']); } - foreach($_REQUEST as $name => $value) { + foreach ($_REQUEST as $name => $value) { $back_button .= '&' . urlencode($name) . '=' . urlencode($value); } $back_button .= '&repopulate=1">Back ]

'; @@ -492,7 +492,7 @@ if ($export_type == 'server') { } } } - foreach($views as $view) { + foreach ($views as $view) { // no data export for a view if ($GLOBALS[$what . '_structure_or_data'] == 'structure' || $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data') { if (!PMA_exportStructure($current_db, $view, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, 'create_view', $export_type)) { diff --git a/import.php b/import.php index afc513ce3c..b9b7d150bc 100644 --- a/import.php +++ b/import.php @@ -264,7 +264,7 @@ if ($import_file != 'none' && !$error) { $file_to_unlink = $import_file_new; } - $size = filesize($import_file); + $size = filesize($import_file); } } diff --git a/js/db_search.js b/js/db_search.js index 0cb04b7f28..72b30463d4 100644 --- a/js/db_search.js +++ b/js/db_search.js @@ -87,7 +87,7 @@ $(document).ready(function() { }); /** Hide the table link in the initial search result */ - $("#table-info").prepend('').hide(); + $("#table-info").prepend('').hide(); /** Hide the browse and deleted results in the new search criteria */ $('#buttonGo').click(function(){ diff --git a/js/db_structure.js b/js/db_structure.js index 1f2d0e6395..efc8f2ad2d 100644 --- a/js/db_structure.js +++ b/js/db_structure.js @@ -57,10 +57,10 @@ $(document).ready(function() { * @uses PMA_ajaxShowMessage() * @see $cfg['AjaxEnable'] */ - var currrent_insert_table; + var current_insert_table; $("td.insert_table a.ajax").live('click', function(event){ event.preventDefault(); - currrent_insert_table = $(this); + current_insert_table = $(this); var $url = $(this).attr("href"); if ($url.substring(0, 15) == "tbl_change.php?") { $url = $url.substring(15); @@ -144,7 +144,7 @@ $(document).ready(function() { $("#insert_table_dialog").dialog("close").remove(); } /**Update the row count at the tableForm*/ - currrent_insert_table.closest('tr').find('.value.tbl_rows').html(data.row_count); + current_insert_table.closest('tr').find('.value.tbl_rows').html(data.row_count); }) // end $.post() }) // end insert table button "Go" @@ -170,7 +170,7 @@ $(document).ready(function() { } if (selected_after_insert == "new_insert") { /**Trigger the insert dialog for new_insert option*/ - currrent_insert_table.trigger('click'); + current_insert_table.trigger('click'); } } else { @@ -180,7 +180,7 @@ $(document).ready(function() { $("#insert_table_dialog").dialog("close").remove(); } /**Update the row count at the tableForm*/ - currrent_insert_table.closest('tr').find('.value.tbl_rows').html(data.row_count); + current_insert_table.closest('tr').find('.value.tbl_rows').html(data.row_count); }) // end $.post() }); @@ -218,7 +218,7 @@ $(document).ready(function() { PMA_ajaxShowMessage(data.message); //Fetch inner span of this anchor //and replace the icon with its disabled version - var span = $this_anchor.html().replace(/b_empty.png/, 'bd_empty.png'); + var span = $this_anchor.html().replace(/ic_b_empty/, 'ic_bd_empty'); PMA_adjustTotals($this_anchor); //To disable further attempts to truncate the table, diff --git a/js/functions.js b/js/functions.js index ab43c0eaea..c08dbf2f6d 100644 --- a/js/functions.js +++ b/js/functions.js @@ -135,14 +135,13 @@ function displayPasswordGenerateButton() { * * @param object $this_element a jQuery object pointing to the element */ -function PMA_addDatepicker($this_element) { +function PMA_addDatepicker($this_element, options) { var showTimeOption = false; if ($this_element.is('.datetimefield')) { showTimeOption = true; } - - $this_element - .datepicker({ + + var defaultOptions = { showOn: 'button', buttonImage: themeCalendarImage, // defined in js/messages.php buttonImageOnly: true, @@ -157,9 +156,16 @@ function PMA_addDatepicker($this_element) { // Remember that we came from the datepicker; this is used // in tbl_change.js by verificationsAfterFieldChange() $this_element.data('comes_from', 'datepicker'); + + // Fix wrong timepicker z-index, doesn't work without timeout + setTimeout(function() { + $('#ui-timepicker-div').css('z-index',$('#ui-datepicker-div').css('z-index')) + },0); }, constrainInput: false - }); + }; + + $this_element.datepicker($.extend(defaultOptions, options)); } /** @@ -2282,10 +2288,10 @@ function checkIndexName(form_id) /** * function to convert the footnotes to tooltips * - * @param jquery-Object $div a div jquery object which crries the domain - * for searching footnootes. If we ommit this - * parameter the function searches the footnotes - * in the whole body + * @param jquery-Object $div a div jquery object which specifies the + * domain for searching footnootes. If we + * ommit this parameter the function searches + * the footnotes in the whole body **/ function PMA_convertFootnotesToTooltips($div) { // Hide the footnotes from the footer (which are displayed for @@ -2311,8 +2317,8 @@ function PMA_convertFootnotesToTooltips($div) { $div.find("img.footnotemarker").each(function() { var img_class = $(this).attr("class"); - /** img contains two classes, as example "footnotemarker footnote_1_1". - * We spit it by second classs and take it for the id of span + /** img contains two classes, as example "footnotemarker footnote_1". + * We split it by second class and take it for the id of span */ img_class = img_class.split(" "); for (i = 0; i < img_class.length; i++) { @@ -2322,7 +2328,7 @@ function PMA_convertFootnotesToTooltips($div) { } /** * Now we get the #id of the span with span_id variable. As an example if we - * initially get the img class as "footnotemarker footnote_2_3", now we get + * initially get the img class as "footnotemarker footnote_2", now we get * #2 as the span_id. Using that we can find footnote_2 in footnotes. * */ var tooltip_text = $footnotes.find("span[id='footnote_" + span_id + "']").html(); @@ -2408,7 +2414,7 @@ $(function() { }); var img = topmenu.find('li:first-child img'); if (img.length) { - img.clone().attr('src', img.attr('src').replace(/\/[^\/]+$/, '/b_more.png')).prependTo(link); + img.clone().attr('class', 'icon ic_b_more').prependTo(link); } var submenu = $('
  • ', {'class': 'submenu'}) .append(link) diff --git a/js/makegrid.js b/js/makegrid.js index a5bbdb89cf..00d839f9ce 100644 --- a/js/makegrid.js +++ b/js/makegrid.js @@ -70,8 +70,9 @@ dragMove: function(e) { if (this.colRsz) { var dx = e.pageX - this.colRsz.x0; - if (this.colRsz.objWidth + dx > this.minColWidth) + if (this.colRsz.objWidth + dx > this.minColWidth) { $(this.colRsz.obj).css('left', this.colRsz.objLeft + dx + 'px'); + } } else if (this.colMov) { // dragged column animation var dx = e.pageX - this.colMov.x0; diff --git a/js/navigation.js b/js/navigation.js index 20aea18bd4..167eb3725c 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -28,13 +28,13 @@ function toggle(id, only_open) { if (el.style.display == 'none' || only_open) { el.style.display = ''; if (img) { - img.src = image_minus; + img.className = 'icon ic_b_minus'; img.alt = '-'; } } else { el.style.display = 'none'; if (img) { - img.src = image_plus; + img.className = 'icon ic_b_plus'; img.alt = '+'; } } diff --git a/js/server_privileges.js b/js/server_privileges.js index d5729d98d8..35c34aa34e 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -210,7 +210,7 @@ $(document).ready(function() { /* post request for get the updated userForm table */ $.post($form.attr('action' ), url, function(priv_data) { - /*Remove the old userForm table*/ + /*Remove the old userForm table*/ if ($('#userFormDiv').length != 0) { $('#userFormDiv').remove(); } else { diff --git a/js/server_status.js b/js/server_status.js index 2fda29f784..4a61bfe891 100644 --- a/js/server_status.js +++ b/js/server_status.js @@ -368,7 +368,7 @@ $(function() { switch(tab.attr('id')) { case 'statustabs_traffic': if(data != null) tab.find('.tabInnerContent').html(data); - initTooltips(); + PMA_convertFootnotesToTooltips(); break; case 'statustabs_queries': if(data != null) { @@ -439,7 +439,7 @@ $(function() { }); $('#serverstatusqueriesdetails tr:first th') - .append(''); + .append(''); break; @@ -453,7 +453,7 @@ $(function() { }); $('#serverstatusvariables tr:first th') - .append(''); + .append(''); break; } @@ -942,9 +942,9 @@ $(function() { $('a[href="#pauseCharts"]').click(function() { runtime.redrawCharts = ! runtime.redrawCharts; if(! runtime.redrawCharts) - $(this).html(' ' + PMA_messages['strResumeMonitor']); + $(this).html(' ' + PMA_messages['strResumeMonitor']); else { - $(this).html(' ' + PMA_messages['strPauseMonitor']); + $(this).html(' ' + PMA_messages['strPauseMonitor']); if(runtime.charts == null) { initGrid(); $('a[href="#settingsPopup"]').show(); @@ -968,7 +968,7 @@ $(function() { $.get('server_status.php?' + url_query, vars, function(data) { var logVars = $.parseJSON(data), - icon = 's_success.png', msg='', str=''; + icon = 'ic_s_success', msg='', str=''; if(logVars['general_log'] == 'ON') { if(logVars['slow_query_log'] == 'ON') @@ -982,26 +982,26 @@ $(function() { } if(msg.length == 0) { - icon = 's_error.png'; + icon = 'ic_s_error'; msg = PMA_messages['strBothLogOff']; } str = '' + PMA_messages['strCurrentSettings'] + '
    '; - str += ' ' + msg + '
    '; + str += ' ' + msg + '
    '; if(logVars['log_output'] != 'TABLE') - str += ' ' + PMA_messages['strLogOutNotTable'] + '
    '; + str += ' ' + PMA_messages['strLogOutNotTable'] + '
    '; else - str += ' ' + PMA_messages['strLogOutIsTable'] + '
    '; + str += ' ' + PMA_messages['strLogOutIsTable'] + '
    '; if(logVars['slow_query_log'] == 'ON') { if(logVars['long_query_time'] > 2) - str += ' ' + str += ' ' + $.sprintf(PMA_messages['strSmallerLongQueryTimeAdvice'], logVars['long_query_time']) + '
    '; if(logVars['long_query_time'] < 2) - str += ' ' + str += ' ' + $.sprintf(PMA_messages['strLongQueryTimeSet'], logVars['long_query_time']) + '
    '; } @@ -1261,27 +1261,47 @@ $(function() { $('#logAnalyseDialog').html( '

    ' + PMA_messages['strSelectedTimeRange'] - + Highcharts.dateFormat('%H:%M:%S',new Date(min)) + ' - ' - + Highcharts.dateFormat('%H:%M:%S',new Date(max)) + '

    ' + + ' - ' + + '

    ' + '' + '' + PMA_messages['strLogAnalyseInfo'] ); + PMA_addDatepicker($('#logAnalyseDialog').find('input[name="dateStart"],input[name="dateEnd"]'), { + showOn: 'focus', + beforeShow: function() { + // Fix wrong timepicker z-index, doesn't work without timeout + setTimeout(function() { + $('#ui-timepicker-div').css('z-index',$('#ui-datepicker-div').css('z-index')) + },0); + } + }); + var dlgBtns = { }; dlgBtns[PMA_messages['strFromSlowLog']] = function() { + var dateStart = Date.parse($('#logAnalyseDialog input[name="dateStart"]').attr('value')) || min; + var dateEnd = Date.parse($('#logAnalyseDialog input[name="dateEnd"]').attr('value')) || max; + loadLogStatistics( - { src: 'slow', start: min, end: max, groupInserts: $('input#groupInserts').attr('checked') } + { src: 'slow', start: dateStart, end: dateEnd, groupInserts: $('input#groupInserts').attr('checked') } ); + + $('#logAnalyseDialog').find('dateStart,dateEnd').datepicker('destroy'); $(this).dialog("close"); } dlgBtns[PMA_messages['strFromGeneralLog']] = function() { + var dateStart = Date.parse($('#logAnalyseDialog input[name="dateStart"]').attr('value')) || min; + var dateEnd = Date.parse($('#logAnalyseDialog input[name="dateEnd"]').attr('value')) || max; + loadLogStatistics( - { src: 'general', start: min, end: max, groupInserts: $('input#groupInserts').attr('checked') } + { src: 'general', start: dateStart, end: dateEnd, groupInserts: $('input#groupInserts').attr('checked') } ); + + $('#logAnalyseDialog').find('dateStart,dateEnd').datepicker('destroy'); $(this).dialog("close"); } @@ -1508,14 +1528,16 @@ $(function() { tableStr += '' + formatValue(cols[j], rows[i][cols[j]]) + ''; tableStr += ''; } - - tableStr+=''; - + + tableStr += ''; + tableStr += 'Sum of grouped rows: '+ data.numRows +'Total:' + data.sum.TOTAL + ''; + tableStr += ''; + $('#logTable').html(tableStr); // Append a tooltip to the count column, if there exist one if($('#logTable th:last').html() == '#') { - $('#logTable th:last').append(' '); + $('#logTable th:last').append(' '); var qtipContent = PMA_messages['strCountColumnExplanation']; if(groupInserts) qtipContent += '

    ' + PMA_messages['strMoreCountColumnExplanation'] + '

    '; @@ -1533,13 +1555,15 @@ $(function() { }) } + + $('div#logTable table').tablesorter({ sortList: [[0,1]], widgets: ['zebra'] }); $('div#logTable table thead th') - .append(''); + .append(''); $('#loadingLogsDialog').html('

    ' + PMA_messages['strLogDataLoaded'] + '

    '); @@ -1549,6 +1573,64 @@ $(function() { $('#loadingLogsDialog').append(key + ': ' + value + '
    '); }); + if(data.numRows > 12) { + $('div#logTable').prepend( + '
    ' + + ' Filters' + + '
    ' + + ' ' + + ' ' + + ((data.numRows > 250) ? ' ' : '') + + '
    ' + + '
    ' + ); + + if(data.numRows > 250) { + $('div#logTable button#startFilterQueryText').click(filterQueries); + } else { + $('div#logTable input#filterQueryText').keyup(filterQueries); + } + + function filterQueries() { + var odd_row=false, cell, textFilter; + var val = $('div#logTable input#filterQueryText').val(); + + if(val.length == 0) textFilter = null; + else textFilter = new RegExp(val, 'i'); + + var rowSum = 0, totalSum = 0; + + $('div#logTable table tbody tr').each(function() { + // We just assume the sql text is always in the second last column + cell = $(this).children(':nth-child(' + (cols.length - 1) + ')'); + + if(textFilter==null || textFilter.exec(cell.text())) { + // And that total count is right of the sql text + totalSum += parseInt(cell.next().text()); + rowSum ++; + + odd_row = !odd_row; + $(this).css('display',''); + if(odd_row) { + $(this).addClass('odd'); + $(this).removeClass('even'); + } else { + $(this).addClass('even'); + $(this).removeClass('odd'); + } + } else { + $(this).css('display','none'); + } + }); + + + $('div#logTable table tfoot tr') + .html('Sum of grouped rows: '+ rowSum +'Total:' + + totalSum + ''); + }; + } + var dlgBtns = {}; dlgBtns[PMA_messages['strJumpToTable']] = function() { $(this).dialog("close"); @@ -1595,4 +1677,4 @@ $(function() { $(this).hide(); }); -}); \ No newline at end of file +}); diff --git a/js/server_synchronize.js b/js/server_synchronize.js index e1645aecae..1dfd3d2387 100644 --- a/js/server_synchronize.js +++ b/js/server_synchronize.js @@ -96,7 +96,8 @@ function showDetails(i, update_size, insert_size, remove_size, insert_index, rem insert_rows.align = "center"; var tick_image = document.createElement("img"); - tick_image.src = pmaThemeImage + "s_success.png"; + tick_image.src = 'themes/dot.gif'; + tick_image.className = "icon ic_s_success"; if (update_size == '' && insert_size == '' && remove_size == '') { /** diff --git a/js/server_variables.js b/js/server_variables.js index e7e469c0e0..e9bc1cf817 100644 --- a/js/server_variables.js +++ b/js/server_variables.js @@ -54,9 +54,9 @@ $(function() { var charWidth; // Global vars - editLink = ' '+PMA_messages['strEdit']+''; - saveLink = ' '+PMA_messages['strSave']+' '; - cancelLink = ' '+PMA_messages['strCancel']+' '; + editLink = ' '+PMA_messages['strEdit']+''; + saveLink = ' '+PMA_messages['strSave']+' '; + cancelLink = ' '+PMA_messages['strCancel']+' '; $.ajaxSetup({ diff --git a/js/sql.js b/js/sql.js index c1106cdfcd..fb24f5da66 100644 --- a/js/sql.js +++ b/js/sql.js @@ -65,8 +65,8 @@ function appendInlineAnchor() { var $img_object = $cloned_anchor.find('img').attr('title', PMA_messages['strInlineEdit']); if ($img_object.length != 0) { - var img_src = $img_object.attr('src').replace(/b_edit/,'b_inline_edit'); - $img_object.attr('src', img_src); + var img_class = $img_object.attr('class').replace(/b_edit/,'b_inline_edit'); + $img_object.attr('class', img_class); $cloned_anchor.find('a').attr('href', '#'); var $edit_span = $cloned_anchor.find('span:contains("' + PMA_messages['strEdit'] + '")'); var $span = $cloned_anchor.find('a').find('span'); @@ -85,8 +85,8 @@ function appendInlineAnchor() { // the link was too big so is there $img_object = $cloned_anchor.find('input:image').attr('title', PMA_messages['strInlineEdit']); if ($img_object.length > 0) { - var img_src = $img_object.attr('src').replace(/b_edit/,'b_inline_edit'); - $img_object.attr('src', img_src); + var img_class = $img_object.attr('class').replace(/b_edit/,'b_inline_edit'); + $img_object.attr('class', img_class); } $cloned_anchor .find('.clickprevimage') @@ -143,7 +143,7 @@ $(document).ready(function() { .parent() .toggle($(this).attr('value').length > 0); }).trigger('keyup'); - + /** * Attach the {@link appendInlineAnchor} function to a custom event, which * will be triggered manually everytime the table of results is reloaded @@ -152,7 +152,7 @@ $(document).ready(function() { $("#sqlqueryresults").live('appendAnchor',function() { appendInlineAnchor(); }) - + /** * Attach the {@link makegrid} function to a custom event, which will be * triggered manually everytime the table of results is reloaded @@ -161,7 +161,7 @@ $(document).ready(function() { $("#sqlqueryresults").live('makegrid', function() { $('#table_results').makegrid(); }) - + /** * Attach the {@link refreshgrid} function to a custom event, which will be * triggered manually everytime the table of results is manipulated (e.g., by inline edit) @@ -281,10 +281,11 @@ $(document).ready(function() { if ($zero_row_results.length > 0) { $('#sqlquery').val($zero_row_results.val()); } else { - $sqlqueryresults.show(); - $sqlqueryresults.html(data); - $sqlqueryresults.trigger('appendAnchor'); - $sqlqueryresults.trigger('makegrid'); + $sqlqueryresults + .show() + .html(data) + .trigger('appendAnchor') + .trigger('makegrid'); $('#togglequerybox').show(); if ($("#togglequerybox").siblings(":visible").length > 0) { $("#togglequerybox").trigger('click'); @@ -320,14 +321,13 @@ $(document).ready(function() { */ var $form = $(this).parent("form"); - var $sqlqueryresults = $("#sqlqueryresults"); - PMA_prepareForAjaxRequest($form); $.post($form.attr('action'), $form.serialize(), function(data) { - $sqlqueryresults.html(data); - $sqlqueryresults.trigger('appendAnchor'); - $sqlqueryresults.trigger('makegrid'); + $("#sqlqueryresults") + .html(data) + .trigger('appendAnchor') + .trigger('makegrid'); PMA_init_slider(); PMA_ajaxRemoveMessage($msgbox); @@ -341,22 +341,23 @@ $(document).ready(function() { * @see $cfg['AjaxEnable'] */ $("#pageselector").live('change', function(event) { - var $the_form = $(this).parent("form"); + var $form = $(this).parent("form"); if ($(this).hasClass('ajax')) { event.preventDefault(); var $msgbox = PMA_ajaxShowMessage(); - $.post($the_form.attr('action'), $the_form.serialize() + '&ajax_request=true', function(data) { - $("#sqlqueryresults").html(data); - $("#sqlqueryresults").trigger('appendAnchor'); - $("#sqlqueryresults").trigger('makegrid'); + $.post($form.attr('action'), $form.serialize() + '&ajax_request=true', function(data) { + $("#sqlqueryresults") + .html(data) + .trigger('appendAnchor') + .trigger('makegrid'); PMA_init_slider(); PMA_ajaxRemoveMessage($msgbox); }) // end $.post() } else { - $the_form.submit(); + $form.submit(); } })// end Paginate results with Page Selector @@ -444,8 +445,8 @@ $(document).ready(function() { // If icons are displayed. See $cfg['PropertiesIconic'] if ($img_object.length > 0) { $img_object.attr('title', PMA_messages['strSave']); - var img_src = $img_object.attr('src').replace(/b_inline_edit/,'b_save'); - $img_object.attr('src', img_src); + var img_class = $img_object.attr('class').replace(/b_inline_edit/,'b_save'); + $img_object.attr('class', img_class); $this_children.prepend($img_object); } @@ -464,8 +465,8 @@ $(document).ready(function() { // If icons are displayed. See $cfg['PropertiesIconic'] if ($img_object.length > 0) { $img_object.attr('title', PMA_messages['strHide']); - var img_src = $img_object.attr('src').replace(/b_save/,'b_close'); - $img_object.attr('src', img_src); + var img_class = $img_object.attr('class').replace(/b_save/,'b_close'); + $img_object.attr('class', img_class); $hide_span.prepend($img_object); } @@ -496,7 +497,7 @@ $(document).ready(function() { $(this).prev().prev().remove(); $(this).prev().remove(); $(this).remove(); - + // refresh the grid $("#sqlqueryresults").trigger('refreshgrid'); }); @@ -710,10 +711,10 @@ $(document).ready(function() { $this_field.data('original_data', 'NULL'); } }); - + // refresh the grid $("#sqlqueryresults").trigger('refreshgrid'); - + }) // End On click, replace the current field with an input/textarea /** @@ -979,13 +980,13 @@ $(document).ready(function() { } PMA_ajaxRemoveMessage($msgbox); }) // end $.get() - } else { + } else { PMA_ajaxShowMessage(PMA_messages['strNoRowSelected']); } }); /** - * Click action for "Go" button in ajax dialog insertForm -> insertRowTable + * Click action for "Go" button in ajax dialog insertForm -> insertRowTable */ $("#insertForm .insertRowTable.ajax input[value=Go]").live('click', function(event) { event.preventDefault(); @@ -1230,7 +1231,9 @@ $(document).ready(function() { * Profiling Chart */ function createProfilingChart() { - if($('#profilingchart').length==0) return; + if ($('#profilingchart').length == 0) { + return; + } var cdata = new Array(); $.each(jQuery.parseJSON($('#profilingchart').html()),function(key,value) { diff --git a/js/tbl_structure.js b/js/tbl_structure.js index 38503892cc..0d2f051c01 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -160,7 +160,7 @@ $(document).ready(function() { var url = $form.serialize()+"&ajax_request=true&submit_mult=change"; /*Calling for the changeColumns fucntion*/ changeColumns(action,url); - } else { + } else { PMA_ajaxShowMessage(PMA_messages['strNoRowSelected']); } }); diff --git a/libraries/Config.class.php b/libraries/Config.class.php index 942ee9e2d4..28f9ac32cb 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -1,7 +1,7 @@ error_config_file = true; - } else { + } else { $this->error_config_file = false; $this->source_mtime = filemtime($this->getSource()); } @@ -674,7 +674,7 @@ class PMA_Config * or the theme changes * must also check the pma_fontsize cookie in case there is no * config file - * @return int Unix timestamp + * @return int Summary of unix timestamps and fontsize, to be unique on theme parameters change */ function getThemeUniqueValue() { @@ -691,8 +691,7 @@ class PMA_Config $this->default_source_mtime + $this->get('user_preferences_mtime') + $_SESSION['PMA_Theme']->mtime_info + - $_SESSION['PMA_Theme']->filesize_info) - . (isset($_SESSION['tmp_user_values']['custom_color']) ? substr($_SESSION['tmp_user_values']['custom_color'],1,6) : ''); + $_SESSION['PMA_Theme']->filesize_info); } /** @@ -975,7 +974,7 @@ class PMA_Config // At first we try to parse REQUEST_URI, it might contain full URL, if (PMA_getenv('REQUEST_URI')) { $url = @parse_url(PMA_getenv('REQUEST_URI')); // produces E_WARNING if it cannot get parsed, e.g. '/foobar:/' - if($url === false) { + if ($url === false) { $url = array(); } } @@ -1068,7 +1067,9 @@ class PMA_Config /** * @todo finish */ - function save() {} + function save() + { + } /** * returns options for font size selection diff --git a/libraries/File.class.php b/libraries/File.class.php index 553cc2db0d..031a266fe1 100644 --- a/libraries/File.class.php +++ b/libraries/File.class.php @@ -8,7 +8,6 @@ /** * - * @todo replace error messages with localized string * @todo when uploading a file into a blob field, should we also consider using * chunks like in import? UPDATE `table` SET `field` = `field` + [chunk] * @package phpMyAdmin @@ -208,7 +207,6 @@ class PMA_File } /** - * @todo replace error message with localized string * @access public * @param string name of file uploaded * @return boolean success @@ -219,7 +217,7 @@ class PMA_File if (! $this->isUploaded()) { $this->setName(null); - $this->_error_message = 'not an uploaded file'; + $this->_error_message = __('File was not an uploaded file.'); return false; } @@ -258,7 +256,7 @@ class PMA_File } if (! $bs_db || ! $bs_table) { - $this->_error_message = $GLOBALS['strUploadErrorUnknown']; + $this->_error_message = __('Unknown error while uploading.'); return false; } $blob_url = PMA_BS_UpLoadFile($bs_db, $bs_table, $tmp_file_type, $tmp_filename); @@ -319,7 +317,6 @@ class PMA_File * $file['error'] = [value] * * - * @todo re-check if requirements changes to PHP >= 4.2.0 * @access public * @static * @param array $file the array @@ -388,7 +385,7 @@ class PMA_File } if (! $bs_db || !$bs_table) { - $this->_error_message = $GLOBALS['strUploadErrorUnknown']; + $this->_error_message = __('Unknown error while uploading.'); return false; } $blob_url = PMA_BS_UpLoadFile($bs_db, $bs_table, $tmp_file_type, $tmp_filename); @@ -483,7 +480,6 @@ class PMA_File * before opening it. The FAQ 1.11 explains how to create the "./tmp" * directory - if needed * - * @todo replace error message with localized string * @todo move check of $cfg['TempDir'] into PMA_Config? * @access public * @return boolean whether uploaded fiel is fine or not @@ -508,7 +504,7 @@ class PMA_File $move_uploaded_file_result = move_uploaded_file($this->getName(), $new_file_to_upload); ob_end_clean(); if (! $move_uploaded_file_result) { - $this->_error_message = 'error while moving uploaded file'; + $this->_error_message = __('Error while moving uploaded file.'); return false; } @@ -516,7 +512,7 @@ class PMA_File $this->isTemp(true); if (! $this->isReadable()) { - $this->_error_message = 'cannot read (moved) upload file'; + $this->_error_message = __('Cannot read (moved) upload file.'); return false; } diff --git a/libraries/List_Database.class.php b/libraries/List_Database.class.php index bf1d4687fa..7616f6095f 100644 --- a/libraries/List_Database.class.php +++ b/libraries/List_Database.class.php @@ -71,8 +71,6 @@ require_once './libraries/List.class.php'; /** * checks if the configuration wants to hide some databases - * - * @todo temporaly use this docblock to test how to doc $GLOBALS */ protected function _checkHideDatabase() { @@ -128,14 +126,14 @@ require_once './libraries/List.class.php'; $this->_show_databases_disabled = true; } } - + if ($GLOBALS['cfg']['NaturalOrder']) { natsort($database_list); } else { // need to sort anyway, otherwise information_schema // goes at the top sort($database_list); - } + } return $database_list; } @@ -255,7 +253,7 @@ require_once './libraries/List.class.php'; $pos = false; - foreach($separators as $separator) { + foreach ($separators as $separator) { // use strpos instead of strrpos; it seems more common to // have the db name, the separator, then the rest which // might contain a separator diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php index ff758b8c97..9360b9aae0 100644 --- a/libraries/auth/cookie.auth.lib.php +++ b/libraries/auth/cookie.auth.lib.php @@ -131,7 +131,7 @@ function PMA_auth() // Defines the charset to be used header('Content-Type: text/html; charset=utf-8'); // Defines the "item" image depending on text direction - $item_img = $GLOBALS['pmaThemeImage'] . 'item_' . $GLOBALS['text_dir'] . '.png'; + $item_img = 'ic_item_' . $GLOBALS['text_dir']; /* HTML header; do not show here the PMA version to improve security */ $page_title = 'phpMyAdmin '; @@ -198,7 +198,7 @@ if (top != self) { echo ''; if ($GLOBALS['cfg']['ReplaceHelpImg']) { - echo '' . __('phpMyAdmin documentation') . ''; + echo '' . __('phpMyAdmin documentation') . ''; } else { echo '(*)'; } @@ -332,7 +332,7 @@ function PMA_auth_check() // END Swekey Integration if (defined('PMA_CLEAR_COOKIES')) { - foreach($GLOBALS['cfg']['Servers'] as $key => $val) { + foreach ($GLOBALS['cfg']['Servers'] as $key => $val) { $GLOBALS['PMA_Config']->removeCookie('pmaPass-' . $key); $GLOBALS['PMA_Config']->removeCookie('pmaServer-' . $key); $GLOBALS['PMA_Config']->removeCookie('pmaUser-' . $key); @@ -352,7 +352,7 @@ function PMA_auth_check() session_destroy(); // -> delete password cookie(s) if ($GLOBALS['cfg']['LoginCookieDeleteAll']) { - foreach($GLOBALS['cfg']['Servers'] as $key => $val) { + foreach ($GLOBALS['cfg']['Servers'] as $key => $val) { $GLOBALS['PMA_Config']->removeCookie('pmaPass-' . $key); if (isset($_COOKIE['pmaPass-' . $key])) { unset($_COOKIE['pmaPass-' . $key]); diff --git a/libraries/bookmark.lib.php b/libraries/bookmark.lib.php index 9ff7d1bca3..c978730b8b 100644 --- a/libraries/bookmark.lib.php +++ b/libraries/bookmark.lib.php @@ -69,7 +69,7 @@ function PMA_Bookmark_getList($db) . ' ORDER BY label'; $global = PMA_DBI_fetch_result($query, 'id', 'label', $controllink, PMA_DBI_QUERY_STORE); - foreach($global as $key => $val) { + foreach ($global as $key => $val) { $global[$key] = $val . ' (' . __('shared') . ')'; } diff --git a/libraries/cleanup.lib.php b/libraries/cleanup.lib.php index b77fd315e0..26a559c16d 100644 --- a/libraries/cleanup.lib.php +++ b/libraries/cleanup.lib.php @@ -20,7 +20,7 @@ function PMA_remove_request_vars(&$whitelist) // strings $keys = array_keys(array_merge((array)$_REQUEST, (array)$_GET, (array)$_POST, (array)$_COOKIE)); - foreach($keys as $key) { + foreach ($keys as $key) { if (! in_array($key, $whitelist)) { unset($_REQUEST[$key], $_GET[$key], $_POST[$key], $GLOBALS[$key]); } else { diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 1abe88544e..ed32faba0b 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -176,7 +176,7 @@ $PMA_PHP_SELF = htmlspecialchars($PMA_PHP_SELF); /** * just to be sure there was no import (registering) before here * we empty the global space (but avoid unsetting $variables_list - * and $key in the foreach(), we still need them!) + * and $key in the foreach (), we still need them!) */ $variables_whitelist = array ( 'GLOBALS', @@ -313,7 +313,7 @@ if (isset($_COOKIE) && (isset($_COOKIE['pmaCookieVer']) && $_COOKIE['pmaCookieVer'] < $pma_cookie_version)) { // delete all cookies - foreach($_COOKIE as $cookie_name => $tmp) { + foreach ($_COOKIE as $cookie_name => $tmp) { $GLOBALS['PMA_Config']->removeCookie($cookie_name); } $_COOKIE = array(); diff --git a/libraries/common.lib.php b/libraries/common.lib.php index d1d0b4f016..f710b80c4f 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -9,10 +9,10 @@ /** * Exponential expression / raise number into power * - * @param string $base - * @param string $exp - * @param mixed $use_function pow function to use, or false for auto-detect - * @return mixed string or float + * @param string $base base to raise + * @param string $exp exponent to use + * @param mixed $use_function pow function to use, or false for auto-detect + * @return mixed string or float */ function PMA_pow($base, $exp, $use_function = false) { @@ -62,10 +62,10 @@ function PMA_pow($base, $exp, $use_function = false) /** * string PMA_getIcon(string $icon) * - * @param string $icon name of icon file - * @param string $alternate alternate text - * @param boolean $container include in container - * @param boolean $force_text whether to force alternate text to be displayed + * @param string $icon name of icon file + * @param string $alternate alternate text + * @param boolean $container include in container + * @param boolean $force_text whether to force alternate text to be displayed * @return html img tag */ function PMA_getIcon($icon, $alternate = '', $container = false, $force_text = false) @@ -97,9 +97,9 @@ function PMA_getIcon($icon, $alternate = '', $container = false, $force_text = f $button .= ''; if ($include_icon) { - $button .= '' . $alternate . ''; + . ' class="icon ic_' . str_replace('.png','',$icon) . '" />'; } if ($include_icon && $include_text) { @@ -118,8 +118,8 @@ function PMA_getIcon($icon, $alternate = '', $container = false, $force_text = f /** * Displays the maximum size for an upload * - * @param integer $max_upload_size the size - * @return string the message + * @param integer $max_upload_size the size + * @return string the message * * @access public */ @@ -135,8 +135,8 @@ function PMA_displayMaximumUploadSize($max_upload_size) * Generates a hidden field which should indicate to the browser * the maximum size for upload * - * @param integer $max_size the size - * @return string the INPUT field + * @param integer $max_size the size + * @return string the INPUT field * * @access public */ @@ -149,13 +149,13 @@ function PMA_generateHiddenMaxFileSize($max_size) * Add slashes before "'" and "\" characters so a value containing them can * be used in a sql comparison. * - * @param string $a_string the string to slash - * @param bool $is_like whether the string will be used in a 'LIKE' clause - * (it then requires two more escaped sequences) or not - * @param bool $crlf whether to treat cr/lfs as escape-worthy entities - * (converts \n to \\n, \r to \\r) - * @param bool $php_code whether this function is used as part of the - * "Create PHP code" dialog + * @param string $a_string the string to slash + * @param bool $is_like whether the string will be used in a 'LIKE' clause + * (it then requires two more escaped sequences) or not + * @param bool $crlf whether to treat cr/lfs as escape-worthy entities + * (converts \n to \\n, \r to \\r) + * @param bool $php_code whether this function is used as part of the + * "Create PHP code" dialog * * @return string the slashed string * @@ -190,8 +190,8 @@ function PMA_sqlAddSlashes($a_string = '', $is_like = false, $crlf = false, $php * database, table and field names. * Note: This function does not escape backslashes! * - * @param string $name the string to escape - * @return string the escaped string + * @param string $name the string to escape + * @return string the escaped string * * @access public */ @@ -224,9 +224,9 @@ function PMA_unescape_mysql_wildcards($name) * * checks if the sting is quoted and removes this quotes * - * @param string $quoted_string string to remove quotes from - * @param string $quote type of quote to remove - * @return string unqoted string + * @param string $quoted_string string to remove quotes from + * @param string $quote type of quote to remove + * @return string unqoted string */ function PMA_unQuote($quoted_string, $quote = null) { @@ -257,8 +257,8 @@ function PMA_unQuote($quoted_string, $quote = null) * format sql strings * * @todo move into PMA_Sql - * @param mixed $parsed_sql pre-parsed SQL structure - * @param string $unparsed_sql + * @param mixed $parsed_sql pre-parsed SQL structure + * @param string $unparsed_sql raw SQL string * @return string the formatted sql * * @global array the configuration array @@ -314,11 +314,11 @@ function PMA_formatSql($parsed_sql, $unparsed_sql = '') /** * Displays a link to the official MySQL documentation * - * @param string $chapter chapter of "HTML, one page per chapter" documentation - * @param string $link contains name of page/anchor that is being linked - * @param bool $big_icon whether to use big icon (like in left frame) - * @param string $anchor anchor to page part - * @param bool $just_open whether only the opening tag should be returned + * @param string $chapter chapter of "HTML, one page per chapter" documentation + * @param string $link contains name of page/anchor that is being linked + * @param bool $big_icon whether to use big icon (like in left frame) + * @param string $anchor anchor to page part + * @param bool $just_open whether only the opening tag should be returned * * @return string the html link * @@ -393,9 +393,9 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $ju if ($just_open) { return ''; } elseif ($big_icon) { - return '' . __('Documentation') . ''; + return '' . __('Documentation') . ''; } elseif ($GLOBALS['cfg']['ReplaceHelpImg']) { - return '' . __('Documentation') . ''; + return '' . __('Documentation') . ''; } else { return '[' . __('Documentation') . ']'; } @@ -412,7 +412,7 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $ju */ function PMA_showDocu($anchor) { if ($GLOBALS['cfg']['ReplaceHelpImg']) { - return '' . __('Documentation') . ''; + return '' . __('Documentation') . ''; } else { return '[' . __('Documentation') . ']'; } @@ -430,7 +430,7 @@ function PMA_showPHPDocu($target) { $url = PMA_getPHPDocLink($target); if ($GLOBALS['cfg']['ReplaceHelpImg']) { - return '' . __('Documentation') . ''; + return '' . __('Documentation') . ''; } else { return '[' . __('Documentation') . ']'; } @@ -474,8 +474,7 @@ function PMA_showHint($message, $bbcode = false, $type = 'notice') // footnotemarker used in js/tooltip.js return '' . $nr . '' . - ''; + ''; } /** @@ -1334,7 +1333,7 @@ function PMA_localizeNumber($value) * @param integer $digits_left number of digits left of the comma * @param integer $digits_right number of digits right of the comma * @param boolean $only_down do not reformat numbers below 1 - * @param boolean $noTrailingZero removes trailing zeros right of the comma (default: true) + * @param boolean $noTrailingZero removes trailing zeros right of the comma (default: true) * * @return string the formatted value and its unit * @@ -1343,13 +1342,13 @@ function PMA_localizeNumber($value) function PMA_formatNumber($value, $digits_left = 3, $digits_right = 0, $only_down = false, $noTrailingZero = true) { if($value==0) return '0'; - + $originalValue = $value; //number_format is not multibyte safe, str_replace is safe if ($digits_left === 0) { $value = number_format($value, $digits_right); if($originalValue!=0 && floatval($value) == 0) $value = ' <'.(1/PMA_pow(10,$digits_right)); - + return PMA_localizeNumber($value); } @@ -1383,7 +1382,7 @@ function PMA_formatNumber($value, $digits_left = 3, $digits_right = 0, $only_dow } $dh = PMA_pow(10, $digits_right); - + // This gives us the right SI prefix already, but $digits_left parameter not incorporated $d = floor(log10($value) / 3); // Lowering the SI prefix by 1 gives us an additional 3 zeros @@ -1392,18 +1391,18 @@ function PMA_formatNumber($value, $digits_left = 3, $digits_right = 0, $only_dow if($digits_left > $cur_digits) { $d-= floor(($digits_left - $cur_digits)/3); } - + if($d<0 && $only_down) $d=0; - + $value = round($value / (PMA_pow(1000, $d, 'pow') / $dh)) /$dh; $unit = $units[$d]; - + // If we dont want any zeros after the comma just add the thousand seperator if($noTrailingZero) $value = PMA_localizeNumber(preg_replace("/(?<=\d)(?=(\d{3})+(?!\d))/",",",$value)); else $value = PMA_localizeNumber(number_format($value, $digits_right)); //number_format is not multibyte safe, str_replace is safe - + if($originalValue!=0 && floatval($value) == 0) return ' <'.(1/PMA_pow(10,$digits_right)).' '.$unit; return $sign . $value . ' ' . $unit; @@ -1506,7 +1505,7 @@ function PMA_localisedDate($timestamp = -1, $format = '') * @return string html code for one tab, a link if valid otherwise a span * @access public */ -function PMA_generate_html_tab($tab, $url_params = array()) +function PMA_generate_html_tab($tab, $url_params = array(), $base_dir='') { // default values $defaults = array( @@ -1568,8 +1567,8 @@ function PMA_generate_html_tab($tab, $url_params = array()) // avoid generating an alt tag, because it only illustrates // the text that follows and if browser does not display // images, the text is duplicated - $image = '%2$s'; + $image = '%2$s'; $tab['text'] = sprintf($image, htmlentities($tab['icon']), $tab['text']); } // check to not display an empty link-text @@ -1604,7 +1603,7 @@ function PMA_generate_html_tab($tab, $url_params = array()) * @param string $url_params * @return string html-code for tab-navigation */ -function PMA_generate_html_tabs($tabs, $url_params) +function PMA_generate_html_tabs($tabs, $url_params, $base_dir='') { $tag_id = 'topmenu'; $tab_navigation = @@ -1612,7 +1611,7 @@ function PMA_generate_html_tabs($tabs, $url_params) .'