The branch, master has been updated via 3f8badd37f3e7ea78a718660e615ecf1c856e2f0 (commit) via b8d5cee5d7dd90aecdd109da06b3f7e4cbf8ea08 (commit) from bf9def5d50aab33dda6a38e4aa9b820a1f0c086a (commit)
- Log ----------------------------------------------------------------- commit 3f8badd37f3e7ea78a718660e615ecf1c856e2f0 Author: Michal Čihař mcihar@suse.cz Date: Fri Jul 22 09:53:41 2011 +0200
Replace tabs with spaces, cleanup identation
commit b8d5cee5d7dd90aecdd109da06b3f7e4cbf8ea08 Author: Michal Čihař mcihar@suse.cz Date: Fri Jul 22 09:39:00 2011 +0200
Fix indentation
-----------------------------------------------------------------------
Summary of changes: db_structure.php | 20 +- docs.css | 30 ++-- js/functions.js | 220 +++++++++--------- js/navigation.js | 16 +- libraries/auth/swekey/swekey.auth.lib.php | 176 +++++++------- libraries/auth/swekey/swekey.php | 208 +++++++++--------- libraries/engines/pbms.lib.php | 2 +- libraries/import.lib.php | 360 ++++++++++++++-------------- libraries/rte/rte_words.lib.php | 86 ++++---- pmd/styles/default/style1.css | 182 ++++++++-------- pmd_general.php | 142 ++++++------ server_synchronize.php | 116 +++++----- setup/config.php | 38 ++-- 13 files changed, 798 insertions(+), 798 deletions(-)
diff --git a/db_structure.php b/db_structure.php index 2bae5a7..01c2156 100644 --- a/db_structure.php +++ b/db_structure.php @@ -58,17 +58,17 @@ $titles = PMA_buildActionTitles();
// 1. No tables if ($num_tables == 0) { - echo '<p>' . __('No tables found in database') . '</p>' . "\n"; + echo '<p>' . __('No tables found in database') . '</p>' . "\n";
- if (empty($db_is_information_schema)) { - require './libraries/display_create_table.lib.php'; - } // end if (Create Table dialog) + if (empty($db_is_information_schema)) { + require './libraries/display_create_table.lib.php'; + } // end if (Create Table dialog)
- /** - * Displays the footer - */ - require_once './libraries/footer.inc.php'; - exit; + /** + * Displays the footer + */ + require_once './libraries/footer.inc.php'; + exit; }
// else @@ -176,7 +176,7 @@ foreach ($tables as $keyname => $each_table) { } //$display_rows = ' - '; break; - // Mysql 5.0.x (and lower) uses MRG_MyISAM and MySQL 5.1.x (and higher) uses MRG_MYISAM + // Mysql 5.0.x (and lower) uses MRG_MyISAM and MySQL 5.1.x (and higher) uses MRG_MYISAM // Both are aliases for MERGE case 'MRG_MyISAM' : case 'MRG_MYISAM' : diff --git a/docs.css b/docs.css index 96574d9..7e15537 100644 --- a/docs.css +++ b/docs.css @@ -18,8 +18,8 @@ img { #header { margin: 0px; padding: 1em 0.5em 0.5em 1em; - background: #036; - border: 0px; + background: #036; + border: 0px; border-bottom: 1px solid black; }
@@ -31,16 +31,16 @@ img { }
#header h1 a { - color: #7584b3; + color: #7584b3; }
#header h1 a .myadmin { - color: #ffad17; + color: #ffad17; }
#body { - margin: 2em 1em 1em 1em; - padding: 0px; + margin: 2em 1em 1em 1em; + padding: 0px; padding-right: 13em; }
@@ -54,13 +54,13 @@ ul#footer { font-size: smaller; list-style: none; float: left; - padding: 1em; + padding: 1em; color: gray; border: none; }
#footer a { - color: #c19e66; + color: #c19e66; }
abbr, acronym { @@ -73,12 +73,12 @@ abbr, acronym {
a { text-decoration: none; - color: #c17d11; + color: #c17d11; }
a:hover { - text-decoration: underline; - color: #8f5902; + text-decoration: underline; + color: #8f5902; }
sup { @@ -128,22 +128,22 @@ ul.header a:hover { }
h2 { - color: #727e0a; + color: #727e0a; max-width: 70em; }
h3 { - color: #727e0a; + color: #727e0a; max-width: 70em; }
h4, h5 { - color: #727e0a; + color: #727e0a; max-width: 70em; }
h4 a { - color: #727e0a; + color: #727e0a; }
p { diff --git a/js/functions.js b/js/functions.js index dbb962d..1e2cced 100644 --- a/js/functions.js +++ b/js/functions.js @@ -28,7 +28,7 @@ var codemirror_editor = false; * @var chart_activeTimeouts object active timeouts that refresh the charts. When disabling a realtime chart, this can be used to stop the continuous ajax requests */ var chart_activeTimeouts = new Object(); - +
/** * Add a hidden field to the form to indicate that this will be an @@ -140,8 +140,8 @@ function PMA_addDatepicker($this_element, options) { if ($this_element.is('.datetimefield')) { showTimeOption = true; } - - var defaultOptions = { + + var defaultOptions = { showOn: 'button', buttonImage: themeCalendarImage, // defined in js/messages.php buttonImageOnly: true, @@ -159,11 +159,11 @@ function PMA_addDatepicker($this_element, options) {
// Fix wrong timepicker z-index, doesn't work without timeout setTimeout(function() { - $('#ui-timepicker-div').css('z-index',$('#ui-datepicker-div').css('z-index')) + $('#ui-timepicker-div').css('z-index',$('#ui-datepicker-div').css('z-index')) },0); }, constrainInput: false - }; + };
$this_element.datepicker($.extend(defaultOptions, options)); } @@ -630,13 +630,13 @@ $(document).ready(function() { return; } var $tr = $(this); - + // make the table unselectable (to prevent default highlighting when shift+click) $tr.parents('table').noSelect(); - + if (!e.shiftKey || last_clicked_row == -1) { // usual click - + // XXX: FF fires two click events for <label> (label and checkbox), so we need to handle this differently var $checkbox = $tr.find(':checkbox'); if ($checkbox.length) { @@ -657,14 +657,14 @@ $(document).ready(function() { $tr.toggleClass('marked'); last_click_checked = false; } - + // remember the last clicked row last_clicked_row = last_click_checked ? $('tr.odd:not(.noclick), tr.even:not(.noclick)').index(this) : -1; last_shift_clicked_row = -1; } else { // handle the shift click var start, end; - + // clear last shift click result if (last_shift_clicked_row >= 0) { if (last_shift_clicked_row >= last_clicked_row) { @@ -680,7 +680,7 @@ $(document).ready(function() { .find(':checkbox') .attr('checked', false); } - + // handle new shift click var curr_row = $('tr.odd:not(.noclick), tr.even:not(.noclick)').index(this); if (curr_row >= last_clicked_row) { @@ -695,7 +695,7 @@ $(document).ready(function() { .addClass('marked') .find(':checkbox') .attr('checked', true); - + // remember the last shift clicked row last_shift_clicked_row = curr_row; } @@ -1452,17 +1452,17 @@ function PMA_createTableDialog( div, url , target) { * realtime: { * url: adress to get the data from (will always add token, ajax_request=1 and chart_data=1 to the GET request) * type: the GET request will also add type=[value of the type property] to the request - * callback: Callback function that should draw the point, it's called with 4 parameters in this order: + * callback: Callback function that should draw the point, it's called with 4 parameters in this order: * - the chart object * - the current response value of the GET request, JSON parsed * - the previous response value of the GET request, JSON parsed * - the number of added points - * + * * @return object The created highcharts instance */ function PMA_createChart(passedSettings) { var container = passedSettings.chart.renderTo; - + var settings = { chart: { type: 'spline', @@ -1475,45 +1475,45 @@ function PMA_createChart(passedSettings) { var lastValue = null, curValue = null; var numLoadedPoints = 0, otherSum = 0; var diff; - + // No realtime updates for graphs that are being exported, and disabled when realtime is not set // Also don't do live charting if we don't have the server time - if(thisChart.options.chart.forExport == true || - ! thisChart.options.realtime || + if(thisChart.options.chart.forExport == true || + ! thisChart.options.realtime || ! thisChart.options.realtime.callback || ! server_time_diff) return; - + thisChart.options.realtime.timeoutCallBack = function() { thisChart.options.realtime.postRequest = $.post( thisChart.options.realtime.url, thisChart.options.realtime.postData, function(data) { curValue = jQuery.parseJSON(data); - + if(lastValue==null) diff = curValue.x - thisChart.xAxis[0].getExtremes().max; else diff = parseInt(curValue.x - lastValue.x); - + thisChart.xAxis[0].setExtremes( - thisChart.xAxis[0].getExtremes().min+diff, - thisChart.xAxis[0].getExtremes().max+diff, + thisChart.xAxis[0].getExtremes().min+diff, + thisChart.xAxis[0].getExtremes().max+diff, false ); - + thisChart.options.realtime.callback(thisChart,curValue,lastValue,numLoadedPoints); - + lastValue = curValue; numLoadedPoints++; - + // Timeout has been cleared => don't start a new timeout if(chart_activeTimeouts[container] == null) return; - + chart_activeTimeouts[container] = setTimeout( - thisChart.options.realtime.timeoutCallBack, + thisChart.options.realtime.timeoutCallBack, thisChart.options.realtime.refreshRate - ); + ); }); } - + chart_activeTimeouts[container] = setTimeout(thisChart.options.realtime.timeoutCallBack, 5); } } @@ -1545,7 +1545,7 @@ function PMA_createChart(passedSettings) { tooltip: { formatter: function() { return '<b>' + this.series.name +'</b><br/>' + - Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' + + Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' + Highcharts.numberFormat(this.y, 2); } }, @@ -1554,18 +1554,18 @@ function PMA_createChart(passedSettings) { }, series: [] } - + /* Set/Get realtime chart default values */ - if(passedSettings.realtime) { - if(!passedSettings.realtime.refreshRate) + if(passedSettings.realtime) { + if(!passedSettings.realtime.refreshRate) passedSettings.realtime.refreshRate = 5000; - - if(!passedSettings.realtime.numMaxPoints) + + if(!passedSettings.realtime.numMaxPoints) passedSettings.realtime.numMaxPoints = 30; - + // Allow custom POST vars to be added passedSettings.realtime.postData = $.extend(false,{ ajax_request: true, chart_data: 1, type: passedSettings.realtime.type },passedSettings.realtime.postData); - + if(server_time_diff) { settings.xAxis.min = new Date().getTime() - server_time_diff - passedSettings.realtime.numMaxPoints * passedSettings.realtime.refreshRate; settings.xAxis.max = new Date().getTime() - server_time_diff + passedSettings.realtime.refreshRate; @@ -2284,9 +2284,9 @@ function checkIndexName(form_id) /** * function to convert the footnotes to tooltips * - * @param jquery-Object $div a div jquery object which specifies the - * domain for searching footnootes. If we - * ommit this parameter the function searches + * @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) { @@ -2485,65 +2485,65 @@ var toggleButton = function ($obj) { } else { var right = 'left'; } - /** - * var h Height of the button, used to scale the - * background image and position the layers - */ - var h = $obj.height(); - $('img', $obj).height(h); - $('table', $obj).css('bottom', h-1); - /** - * var on Width of the "ON" part of the toggle switch - * var off Width of the "OFF" part of the toggle switch - */ - var on = $('.toggleOn', $obj).width(); - var off = $('.toggleOff', $obj).width(); - // Make the "ON" and "OFF" parts of the switch the same size - $('.toggleOn > div', $obj).width(Math.max(on, off)); - $('.toggleOff > div', $obj).width(Math.max(on, off)); - /** - * var w Width of the central part of the switch - */ - var w = parseInt(($('img', $obj).height() / 16) * 22, 10); - // Resize the central part of the switch on the top - // layer to match the background - $('table td:nth-child(2) > div', $obj).width(w); - /** - * var imgw Width of the background image - * var tblw Width of the foreground layer - * var offset By how many pixels to move the background - * image, so that it matches the top layer - */ - var imgw = $('img', $obj).width(); - var tblw = $('table', $obj).width(); - var offset = parseInt(((imgw - tblw) / 2), 10); - // Move the background to match the layout of the top layer - $obj.find('img').css(right, offset); - /** - * var offw Outer width of the "ON" part of the toggle switch - * var btnw Outer width of the central part of the switch - */ - var offw = $('.toggleOff', $obj).outerWidth(); - var btnw = $('table td:nth-child(2)', $obj).outerWidth(); - // Resize the main div so that exactly one side of - // the switch plus the central part fit into it. - $obj.width(offw + btnw + 2); - /** - * var move How many pixels to move the - * switch by when toggling - */ - var move = $('.toggleOff', $obj).outerWidth(); - // If the switch is initialized to the - // OFF state we need to move it now. - if ($('.container', $obj).hasClass('off')) { + /** + * var h Height of the button, used to scale the + * background image and position the layers + */ + var h = $obj.height(); + $('img', $obj).height(h); + $('table', $obj).css('bottom', h-1); + /** + * var on Width of the "ON" part of the toggle switch + * var off Width of the "OFF" part of the toggle switch + */ + var on = $('.toggleOn', $obj).width(); + var off = $('.toggleOff', $obj).width(); + // Make the "ON" and "OFF" parts of the switch the same size + $('.toggleOn > div', $obj).width(Math.max(on, off)); + $('.toggleOff > div', $obj).width(Math.max(on, off)); + /** + * var w Width of the central part of the switch + */ + var w = parseInt(($('img', $obj).height() / 16) * 22, 10); + // Resize the central part of the switch on the top + // layer to match the background + $('table td:nth-child(2) > div', $obj).width(w); + /** + * var imgw Width of the background image + * var tblw Width of the foreground layer + * var offset By how many pixels to move the background + * image, so that it matches the top layer + */ + var imgw = $('img', $obj).width(); + var tblw = $('table', $obj).width(); + var offset = parseInt(((imgw - tblw) / 2), 10); + // Move the background to match the layout of the top layer + $obj.find('img').css(right, offset); + /** + * var offw Outer width of the "ON" part of the toggle switch + * var btnw Outer width of the central part of the switch + */ + var offw = $('.toggleOff', $obj).outerWidth(); + var btnw = $('table td:nth-child(2)', $obj).outerWidth(); + // Resize the main div so that exactly one side of + // the switch plus the central part fit into it. + $obj.width(offw + btnw + 2); + /** + * var move How many pixels to move the + * switch by when toggling + */ + var move = $('.toggleOff', $obj).outerWidth(); + // If the switch is initialized to the + // OFF state we need to move it now. + if ($('.container', $obj).hasClass('off')) { if (right == 'right') { - $('table, img', $obj).animate({'left': '-=' + move + 'px'}, 0); + $('table, img', $obj).animate({'left': '-=' + move + 'px'}, 0); } else { - $('table, img', $obj).animate({'left': '+=' + move + 'px'}, 0); + $('table, img', $obj).animate({'left': '+=' + move + 'px'}, 0); } - } - // Attach an 'onclick' event to the switch - $('.container', $obj).click(function () { + } + // Attach an 'onclick' event to the switch + $('.container', $obj).click(function () { if ($(this).hasClass('isActive')) { return false; } else { @@ -2552,8 +2552,8 @@ var toggleButton = function ($obj) { var $msg = PMA_ajaxShowMessage(PMA_messages['strLoading']); var $container = $(this); var callback = $('.callback', this).text(); - // Perform the actual toggle - if ($(this).hasClass('on')) { + // Perform the actual toggle + if ($(this).hasClass('on')) { if (right == 'right') { var operator = '-='; } else { @@ -2562,7 +2562,7 @@ var toggleButton = function ($obj) { var url = $(this).find('.toggleOff > span').text(); var removeClass = 'on'; var addClass = 'off'; - } else { + } else { if (right == 'right') { var operator = '+='; } else { @@ -2575,10 +2575,10 @@ var toggleButton = function ($obj) { $.post(url, {'ajax_request': true}, function(data) { if(data.success == true) { PMA_ajaxRemoveMessage($msg); - $container - .removeClass(removeClass) - .addClass(addClass) - .animate({'left': operator + move + 'px'}, function () { + $container + .removeClass(removeClass) + .addClass(addClass) + .animate({'left': operator + move + 'px'}, function () { $container.removeClass('isActive'); }); eval(callback); @@ -2587,7 +2587,7 @@ var toggleButton = function ($obj) { $container.removeClass('isActive'); } }); - }); + }); };
/** @@ -2598,8 +2598,8 @@ $(window).load(function () { $(this) .show() .find('.toggleButton') - toggleButton($(this)); - }); + toggleButton($(this)); + }); });
/** @@ -2641,7 +2641,7 @@ $(document).ready(function() { $checkbox.attr('checked', checked); } // for all td of the same vertical row, toggle the marked class - if (checked) { + if (checked) { $('.vmarker').filter('.row_' + row_num).addClass('marked'); } else { $('.vmarker').filter('.row_' + row_num).removeClass('marked'); @@ -2905,7 +2905,7 @@ $(document).ready(function() { else $(this).removeAttr('unselectable', 'on'); }); } - }; //end noSelect + }; //end noSelect })(jQuery);
/** @@ -2943,7 +2943,7 @@ function PMA_createqTip($elements, content, options) { } } } - + $elements.qtip($.extend(true, o, options)); }
diff --git a/js/navigation.js b/js/navigation.js index 167eb37..5ce805c 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -58,7 +58,7 @@ function PMA_saveFrameSizeReal() if (parent.text_dir == 'ltr') { pma_navi_width = parseInt(parent.document.getElementById('mainFrameset').cols) } else { - pma_navi_width = parent.document.getElementById('mainFrameset').cols.match(/\d+$/) + pma_navi_width = parent.document.getElementById('mainFrameset').cols.match(/\d+$/) } if ((pma_navi_width > 0) && (pma_navi_width != PMA_getCookie('pma_navi_width'))) { PMA_setCookie('pma_navi_width', pma_navi_width, expires); @@ -209,18 +209,18 @@ $(document).ready(function(){ /* Create table */ $('#newtable a.ajax').click(function(event){ event.preventDefault(); - /*Getting the url */ + /*Getting the url */ var url = $('#newtable a').attr("href"); if (url.substring(0, 15) == "tbl_create.php?") { url = url.substring(15); } - url = url +"&num_fields=&ajax_request=true"; - /*Creating a div on the frame_content frame */ - var div = parent.frame_content.$('<div id="create_table_dialog"></div>'); - var target = "tbl_create.php"; + url = url +"&num_fields=&ajax_request=true"; + /*Creating a div on the frame_content frame */ + var div = parent.frame_content.$('<div id="create_table_dialog"></div>'); + var target = "tbl_create.php";
- /*Calling to the createTableDialog function*/ - PMA_createTableDialog(div , url , target); + /*Calling to the createTableDialog function*/ + PMA_createTableDialog(div , url , target); });//end of create new table });//end of document get ready
diff --git a/libraries/auth/swekey/swekey.auth.lib.php b/libraries/auth/swekey/swekey.auth.lib.php index c5f613b..184c845 100644 --- a/libraries/auth/swekey/swekey.auth.lib.php +++ b/libraries/auth/swekey/swekey.auth.lib.php @@ -11,24 +11,24 @@ function Swekey_auth_check() global $cfg; $confFile = $cfg['Server']['auth_swekey_config'];
- if (! isset($_SESSION['SWEKEY'])) { + if (! isset($_SESSION['SWEKEY'])) { $_SESSION['SWEKEY'] = array(); }
$_SESSION['SWEKEY']['ENABLED'] = (! empty($confFile) && file_exists($confFile));
// Load the swekey.conf file the first time - if ($_SESSION['SWEKEY']['ENABLED'] && empty($_SESSION['SWEKEY']['CONF_LOADED'])) { + if ($_SESSION['SWEKEY']['ENABLED'] && empty($_SESSION['SWEKEY']['CONF_LOADED'])) { $_SESSION['SWEKEY']['CONF_LOADED'] = true; $_SESSION['SWEKEY']['VALID_SWEKEYS'] = array(); $valid_swekeys = explode("\n", @file_get_contents($confFile)); foreach ($valid_swekeys as $line) { if (preg_match("/^[0-9A-F]{32}:.+$/", $line) != false) - { - $items = explode(":", $line); - if (count($items) == 2) + { + $items = explode(":", $line); + if (count($items) == 2) $_SESSION['SWEKEY']['VALID_SWEKEYS'][$items[0]] = trim($items[1]); - } + } else if (preg_match("/^[A-Z_]+=.*$/", $line) != false) { $items = explode("=", $line); $_SESSION['SWEKEY']['CONF_'.trim($items[0])] = trim($items[1]); @@ -36,27 +36,27 @@ function Swekey_auth_check() }
// Set default values for settings - if (! isset($_SESSION['SWEKEY']['CONF_SERVER_CHECK'])) - $_SESSION['SWEKEY']['CONF_SERVER_CHECK'] = ""; - if (! isset($_SESSION['SWEKEY']['CONF_SERVER_RNDTOKEN'])) - $_SESSION['SWEKEY']['CONF_SERVER_RNDTOKEN'] = ""; - if (! isset($_SESSION['SWEKEY']['CONF_SERVER_STATUS'])) - $_SESSION['SWEKEY']['CONF_SERVER_STATUS'] = ""; - if (! isset($_SESSION['SWEKEY']['CONF_CA_FILE'])) - $_SESSION['SWEKEY']['CONF_CA_FILE'] = ""; - if (! isset($_SESSION['SWEKEY']['CONF_ENABLE_TOKEN_CACHE'])) - $_SESSION['SWEKEY']['CONF_ENABLE_TOKEN_CACHE'] = true; - if (! isset($_SESSION['SWEKEY']['CONF_DEBUG'])) - $_SESSION['SWEKEY']['CONF_DEBUG'] = false; + if (! isset($_SESSION['SWEKEY']['CONF_SERVER_CHECK'])) + $_SESSION['SWEKEY']['CONF_SERVER_CHECK'] = ""; + if (! isset($_SESSION['SWEKEY']['CONF_SERVER_RNDTOKEN'])) + $_SESSION['SWEKEY']['CONF_SERVER_RNDTOKEN'] = ""; + if (! isset($_SESSION['SWEKEY']['CONF_SERVER_STATUS'])) + $_SESSION['SWEKEY']['CONF_SERVER_STATUS'] = ""; + if (! isset($_SESSION['SWEKEY']['CONF_CA_FILE'])) + $_SESSION['SWEKEY']['CONF_CA_FILE'] = ""; + if (! isset($_SESSION['SWEKEY']['CONF_ENABLE_TOKEN_CACHE'])) + $_SESSION['SWEKEY']['CONF_ENABLE_TOKEN_CACHE'] = true; + if (! isset($_SESSION['SWEKEY']['CONF_DEBUG'])) + $_SESSION['SWEKEY']['CONF_DEBUG'] = false; }
// check if a web key has been authenticated if ($_SESSION['SWEKEY']['ENABLED']) { if (empty($_SESSION['SWEKEY']['AUTHENTICATED_SWEKEY'])) return false; - } + }
- return true; + return true; }
@@ -68,32 +68,32 @@ function Swekey_auth_error() if (! isset($_SESSION['SWEKEY'])) return null;
- if (! $_SESSION['SWEKEY']['ENABLED']) + if (! $_SESSION['SWEKEY']['ENABLED']) return null;
- require_once './libraries/auth/swekey/authentication.inc.php'; + require_once './libraries/auth/swekey/authentication.inc.php';
?> <script> function Swekey_GetValidKey() - { - var valids = "<?php - foreach ($_SESSION['SWEKEY']['VALID_SWEKEYS'] as $key => $value) - echo $key.','; - ?>"; - var connected_keys = Swekey_ListKeyIds().split(","); - for (i in connected_keys) - if (connected_keys[i] != null && connected_keys[i].length == 32) - if (valids.indexOf(connected_keys[i]) >= 0) - return connected_keys[i]; + { + var valids = "<?php + foreach ($_SESSION['SWEKEY']['VALID_SWEKEYS'] as $key => $value) + echo $key.','; + ?>"; + var connected_keys = Swekey_ListKeyIds().split(","); + for (i in connected_keys) + if (connected_keys[i] != null && connected_keys[i].length == 32) + if (valids.indexOf(connected_keys[i]) >= 0) + return connected_keys[i];
if (connected_keys.length > 0) - if (connected_keys[0].length == 32) - return "unknown_key_" + connected_keys[0]; + if (connected_keys[0].length == 32) + return "unknown_key_" + connected_keys[0];
- return "none"; - } + return "none"; + }
var key = Swekey_GetValidKey();
@@ -103,16 +103,16 @@ function Swekey_auth_error() { window.location.search = "?swekey_reset"; } - else - setTimeout("timedCheck()",1000); + else + setTimeout("timedCheck()",1000); }
- setTimeout("timedCheck()",1000); + setTimeout("timedCheck()",1000); </script> - <?php + <?php
- if (! empty($_SESSION['SWEKEY']['AUTHENTICATED_SWEKEY'])) - return null; + if (! empty($_SESSION['SWEKEY']['AUTHENTICATED_SWEKEY'])) + return null;
if (count($_SESSION['SWEKEY']['VALID_SWEKEYS']) == 0) return sprintf(__('File %s does not contain any key id'), $GLOBALS['cfg']['Server']['auth_swekey_config']); @@ -158,7 +158,7 @@ function Swekey_auth_error() } else { $_SESSION['SWEKEY']['AUTHENTICATED_SWEKEY'] = $swekey_id; - $_SESSION['SWEKEY']['FORCE_USER'] = $_SESSION['SWEKEY']['VALID_SWEKEYS'][$swekey_id]; + $_SESSION['SWEKEY']['FORCE_USER'] = $_SESSION['SWEKEY']['VALID_SWEKEYS'][$swekey_id]; return null; } } @@ -184,19 +184,19 @@ function Swekey_auth_error() if (! isset($swekey_id)) { ?> <script> - if (key.length != 32) - { - window.location.search="?swekey_id=" + key; - } - else - { - var url = "" + window.location; - if (url.indexOf("?") > 0) - url = url.substr(0, url.indexOf("?")); - Swekey_SetUnplugUrl(key, "pma_login", url + "?session_to_unset=<?php echo session_id();?>"); - var otp = Swekey_GetOtp(key, <?php echo '"'.$_SESSION['SWEKEY']['RND_TOKEN'].'"';?>); - window.location.search="?swekey_id=" + key + "&swekey_otp=" + otp; - } + if (key.length != 32) + { + window.location.search="?swekey_id=" + key; + } + else + { + var url = "" + window.location; + if (url.indexOf("?") > 0) + url = url.substr(0, url.indexOf("?")); + Swekey_SetUnplugUrl(key, "pma_login", url + "?session_to_unset=<?php echo session_id();?>"); + var otp = Swekey_GetOtp(key, <?php echo '"'.$_SESSION['SWEKEY']['RND_TOKEN'].'"';?>); + window.location.search="?swekey_id=" + key + "&swekey_otp=" + otp; + } </script> <?php return __('Authenticating...'); @@ -225,7 +225,7 @@ function Swekey_login($input_name, $input_go) echo '<script type="text/javascript">'; if (empty($_SESSION['SWEKEY']['FORCE_USER'])) echo 'var user = null;'; - else + else echo 'var user = "'.$_SESSION['SWEKEY']['FORCE_USER'].'";';
?> @@ -236,47 +236,47 @@ function Swekey_login($input_name, $input_go)
var input_username = document.getElementById("<?php echo $input_name; ?>"); var input_go = document.getElementById("<?php echo $input_go; ?>"); - var swekey_status = document.createElement('img'); - swekey_status.setAttribute('onClick', 'open_swekey_site()'); - swekey_status.setAttribute('style', 'width:8px; height:16px; border:0px; vspace:0px; hspace:0px; frameborder:no'); + var swekey_status = document.createElement('img'); + swekey_status.setAttribute('onClick', 'open_swekey_site()'); + swekey_status.setAttribute('style', 'width:8px; height:16px; border:0px; vspace:0px; hspace:0px; frameborder:no'); if (user == null) - { - swekey_status.setAttribute('src', 'http://artwork.swekey.com/unplugged-8x16.png'); - //swekey_status.setAttribute('title', 'No swekey plugged'); - input_go.disabled = true; - } - else - { - swekey_status.setAttribute('src', 'http://artwork.swekey.com/plugged-8x16.png'); - //swekey_status.setAttribute('title', 'swekey plugged'); - input_username.value = user; - } - input_username.readOnly = true; - - if (input_username.nextSibling == null) - input_username.parentNode.appendChild(swekey_status); - else - input_username.parentNode.insertBefore(swekey_status, input_username.nextSibling); - - <?php + { + swekey_status.setAttribute('src', 'http://artwork.swekey.com/unplugged-8x16.png'); + //swekey_status.setAttribute('title', 'No swekey plugged'); + input_go.disabled = true; + } + else + { + swekey_status.setAttribute('src', 'http://artwork.swekey.com/plugged-8x16.png'); + //swekey_status.setAttribute('title', 'swekey plugged'); + input_username.value = user; + } + input_username.readOnly = true; + + if (input_username.nextSibling == null) + input_username.parentNode.appendChild(swekey_status); + else + input_username.parentNode.insertBefore(swekey_status, input_username.nextSibling); + + <?php echo '</script>'; - } + } }
if (!empty($_GET['session_to_unset'])) { - session_write_close(); - session_id($_GET['session_to_unset']); - session_start(); - $_SESSION = array(); - session_write_close(); - session_destroy(); - exit; + session_write_close(); + session_id($_GET['session_to_unset']); + session_start(); + $_SESSION = array(); + session_write_close(); + session_destroy(); + exit; }
if (isset($_GET['swekey_reset'])) { - unset($_SESSION['SWEKEY']); + unset($_SESSION['SWEKEY']); }
?> diff --git a/libraries/auth/swekey/swekey.php b/libraries/auth/swekey/swekey.php index b456061..869d3d5 100644 --- a/libraries/auth/swekey/swekey.php +++ b/libraries/auth/swekey/swekey.php @@ -128,7 +128,7 @@ function Swekey_SetStatusServer($server) function Swekey_SetCAFile($cafile) { global $gSwekeyCA; - $gSwekeyCA = $cafile; + $gSwekeyCA = $cafile; }
/** @@ -142,7 +142,7 @@ function Swekey_SetCAFile($cafile) function Swekey_EnableTokenCache($enable) { global $gSwekeyTokenCacheEnabled; - $gSwekeyTokenCacheEnabled = ! empty($enable); + $gSwekeyTokenCacheEnabled = ! empty($enable); }
@@ -186,51 +186,51 @@ function Swekey_HttpGet($url, &$response_code) global $gSwekeyLastResult; $gSwekeyLastResult = "<not set>";
- // use curl if available - if (function_exists('curl_init')) - { - $sess = curl_init($url); - if (substr($url, 0, 8) == "https://") - { - global $gSwekeyCA; - - if (! empty($gSwekeyCA)) - { - if (file_exists($gSwekeyCA)) - { - if (! curl_setopt($sess, CURLOPT_CAINFO, $gSwekeyCA)) - error_log("SWEKEY_ERROR:Could not set CA file : ".curl_error($sess)); - else - $caFileOk = true; - } - else - error_log("SWEKEY_ERROR:Could not find CA file $gSwekeyCA getting $url"); - } - - curl_setopt($sess, CURLOPT_SSL_VERIFYHOST, '2'); - curl_setopt($sess, CURLOPT_SSL_VERIFYPEER, '2'); - curl_setopt($sess, CURLOPT_CONNECTTIMEOUT, '20'); - curl_setopt($sess, CURLOPT_TIMEOUT, '20'); - } - else - { - curl_setopt($sess, CURLOPT_CONNECTTIMEOUT, '3'); - curl_setopt($sess, CURLOPT_TIMEOUT, '5'); - } - - curl_setopt($sess, CURLOPT_RETURNTRANSFER, '1'); - $res=curl_exec($sess); - $response_code = curl_getinfo($sess, CURLINFO_HTTP_CODE); - $curlerr = curl_error($sess); - curl_close($sess); - - if ($response_code == 200) - { - $gSwekeyLastResult = $res; - return $res; - } - - if (! empty($response_code)) + // use curl if available + if (function_exists('curl_init')) + { + $sess = curl_init($url); + if (substr($url, 0, 8) == "https://") + { + global $gSwekeyCA; + + if (! empty($gSwekeyCA)) + { + if (file_exists($gSwekeyCA)) + { + if (! curl_setopt($sess, CURLOPT_CAINFO, $gSwekeyCA)) + error_log("SWEKEY_ERROR:Could not set CA file : ".curl_error($sess)); + else + $caFileOk = true; + } + else + error_log("SWEKEY_ERROR:Could not find CA file $gSwekeyCA getting $url"); + } + + curl_setopt($sess, CURLOPT_SSL_VERIFYHOST, '2'); + curl_setopt($sess, CURLOPT_SSL_VERIFYPEER, '2'); + curl_setopt($sess, CURLOPT_CONNECTTIMEOUT, '20'); + curl_setopt($sess, CURLOPT_TIMEOUT, '20'); + } + else + { + curl_setopt($sess, CURLOPT_CONNECTTIMEOUT, '3'); + curl_setopt($sess, CURLOPT_TIMEOUT, '5'); + } + + curl_setopt($sess, CURLOPT_RETURNTRANSFER, '1'); + $res=curl_exec($sess); + $response_code = curl_getinfo($sess, CURLINFO_HTTP_CODE); + $curlerr = curl_error($sess); + curl_close($sess); + + if ($response_code == 200) + { + $gSwekeyLastResult = $res; + return $res; + } + + if (! empty($response_code)) { $gSwekeyLastError = $response_code; error_log("SWEKEY_ERROR:Error $gSwekeyLastError ($curlerr) getting $url"); @@ -241,9 +241,9 @@ function Swekey_HttpGet($url, &$response_code) $gSwekeyLastError = $response_code; error_log("SWEKEY_ERROR:Error $curlerr getting $url"); return ""; - } + }
- // use pecl_http if available + // use pecl_http if available if (class_exists('HttpRequest')) { // retry if one of the server is down @@ -276,18 +276,18 @@ function Swekey_HttpGet($url, &$response_code) { $reply = $r->send(); $res = $reply->getBody(); - $info = $r->getResponseInfo(); - $response_code = $info['response_code']; - if ($response_code != 200) - { + $info = $r->getResponseInfo(); + $response_code = $info['response_code']; + if ($response_code != 200) + { $gSwekeyLastError = $response_code; error_log("SWEKEY_ERROR:Error ".$gSwekeyLastError." getting ".$url); return ""; }
- $gSwekeyLastResult = $res; - return $res; + $gSwekeyLastResult = $res; + return $res; } // catch (HttpException $e) // { @@ -301,14 +301,14 @@ function Swekey_HttpGet($url, &$response_code) return ""; }
- global $http_response_header; - $res = @file_get_contents($url); - $response_code = substr($http_response_header[0], 9, 3); //HTTP/1.0 - if ($response_code == 200) - { - $gSwekeyLastResult = $res; - return $res; - } + global $http_response_header; + $res = @file_get_contents($url); + $response_code = substr($http_response_header[0], 9, 3); //HTTP/1.0 + if ($response_code == 200) + { + $gSwekeyLastResult = $res; + return $res; + }
$gSwekeyLastError = $response_code; error_log("SWEKEY_ERROR:Error ".$response_code." getting ".$url); @@ -336,7 +336,7 @@ function Swekey_GetRndToken() function Swekey_GetHalfRndToken() { global $gSwekeyRndTokenServer; - return Swekey_HttpGet($gSwekeyRndTokenServer.'/HALF-RND-TOKEN', $response_code); + return Swekey_HttpGet($gSwekeyRndTokenServer.'/HALF-RND-TOKEN', $response_code); }
/** @@ -357,7 +357,7 @@ function Swekey_GetFastHalfRndToken() // We check if we have a valid RT is the session if (isset($_SESSION['rnd-token-date'])) if (time() - $_SESSION['rnd-token-date'] < 30) - $res = $_SESSION['rnd-token']; + $res = $_SESSION['rnd-token'];
// If not we try to get it from a temp file (PHP >= 5.2.1 only) if (strlen($res) != 32 && $gSwekeyTokenCacheEnabled) @@ -367,18 +367,18 @@ function Swekey_GetFastHalfRndToken() $tempdir = sys_get_temp_dir(); $cachefile = $tempdir."/swekey-rnd-token-".get_current_user(); $modif = filemtime($cachefile); - if ($modif != false) + if ($modif != false) if (time() - $modif < 30) - { - $res = @file_get_contents($cachefile); - if (strlen($res) != 32) - $res = ""; - else - { - $_SESSION['rnd-token'] = $res; - $_SESSION['rnd-token-date'] = $modif; - } - } + { + $res = @file_get_contents($cachefile); + if (strlen($res) != 32) + $res = ""; + else + { + $_SESSION['rnd-token'] = $res; + $_SESSION['rnd-token-date'] = $modif; + } + } } }
@@ -390,14 +390,14 @@ function Swekey_GetFastHalfRndToken() $_SESSION['rnd-token-date'] = time(); if (! empty($cachefile)) { - // we unlink the file so no possible tempfile race attack - unlink($cachefile); - $file = fopen($cachefile , "x"); - if ($file != false) - { - @fwrite($file, $res); - @fclose($file); - } + // we unlink the file so no possible tempfile race attack + unlink($cachefile); + $file = fopen($cachefile , "x"); + if ($file != false) + { + @fwrite($file, $res); + @fclose($file); + } } }
@@ -434,8 +434,8 @@ function Swekey_GetFastRndToken() function Swekey_CheckOtp($id, $rt, $otp) { global $gSwekeyCheckServer; - $res = Swekey_HttpGet($gSwekeyCheckServer.'/CHECK-OTP/'.$id.'/'.$rt.'/'.$otp, $response_code); - return $response_code == 200 && $res == "OK"; + $res = Swekey_HttpGet($gSwekeyCheckServer.'/CHECK-OTP/'.$id.'/'.$rt.'/'.$otp, $response_code); + return $response_code == 200 && $res == "OK"; }
/** @@ -445,9 +445,9 @@ function Swekey_CheckOtp($id, $rt, $otp) define ("SWEKEY_STATUS_OK",0); define ("SWEKEY_STATUS_NOT_FOUND",1); // The key does not exist in the db define ("SWEKEY_STATUS_INACTIVE",2); // The key has never been activated -define ("SWEKEY_STATUS_LOST",3); // The user has lost his key -define ("SWEKEY_STATUS_STOLEN",4); // The key was stolen -define ("SWEKEY_STATUS_FEE_DUE",5); // The annual fee was not paid +define ("SWEKEY_STATUS_LOST",3); // The user has lost his key +define ("SWEKEY_STATUS_STOLEN",4); // The key was stolen +define ("SWEKEY_STATUS_FEE_DUE",5); // The annual fee was not paid define ("SWEKEY_STATUS_OBSOLETE",6); // The hardware is no longer supported define ("SWEKEY_STATUS_UNKOWN",201); // We could not connect to the authentication server
@@ -455,7 +455,7 @@ define ("SWEKEY_STATUS_UNKOWN",201); // We could not connect to the authentica * Values that are associated with a key. * The Javascript Api can also return the following values */ -define ("SWEKEY_STATUS_REPLACED",100); // This key has been replaced by a backup key +define ("SWEKEY_STATUS_REPLACED",100); // This key has been replaced by a backup key define ("SWEKEY_STATUS_BACKUP_KEY",101); // This key is a backup key that is not activated yet define ("SWEKEY_STATUS_NOTPLUGGED",200); // This key is not plugged in the computer
@@ -469,21 +469,21 @@ define ("SWEKEY_STATUS_NOTPLUGGED",200); // This key is not plugged in the compu */ function Swekey_GetStatusStr($status) { - switch($status) - { - case SWEKEY_STATUS_OK : return 'OK'; - case SWEKEY_STATUS_NOT_FOUND : return 'Key does not exist in the db'; - case SWEKEY_STATUS_INACTIVE : return 'Key not activated'; - case SWEKEY_STATUS_LOST : return 'Key was lost'; - case SWEKEY_STATUS_STOLEN : return 'Key was stolen'; - case SWEKEY_STATUS_FEE_DUE : return 'The annual fee was not paid'; - case SWEKEY_STATUS_OBSOLETE : return 'Key no longer supported'; - case SWEKEY_STATUS_REPLACED : return 'This key has been replaced by a backup key'; + switch($status) + { + case SWEKEY_STATUS_OK : return 'OK'; + case SWEKEY_STATUS_NOT_FOUND : return 'Key does not exist in the db'; + case SWEKEY_STATUS_INACTIVE : return 'Key not activated'; + case SWEKEY_STATUS_LOST : return 'Key was lost'; + case SWEKEY_STATUS_STOLEN : return 'Key was stolen'; + case SWEKEY_STATUS_FEE_DUE : return 'The annual fee was not paid'; + case SWEKEY_STATUS_OBSOLETE : return 'Key no longer supported'; + case SWEKEY_STATUS_REPLACED : return 'This key has been replaced by a backup key'; case SWEKEY_STATUS_BACKUP_KEY : return 'This key is a backup key that is not activated yet'; case SWEKEY_STATUS_NOTPLUGGED : return 'This key is not plugged in the computer'; - case SWEKEY_STATUS_UNKOWN : return 'Unknow Status, could not connect to the authentication server'; - } - return 'unknown status '.$status; + case SWEKEY_STATUS_UNKOWN : return 'Unknow Status, could not connect to the authentication server'; + } + return 'unknown status '.$status; }
/** @@ -497,7 +497,7 @@ function Swekey_GetStatusStr($status) function Swekey_GetStatus($id) { global $gSwekeyStatusServer; - $res = Swekey_HttpGet($gSwekeyStatusServer.'/GET-STATUS/'.$id, $response_code); + $res = Swekey_HttpGet($gSwekeyStatusServer.'/GET-STATUS/'.$id, $response_code); if ($response_code == 200) return intval($res);
diff --git a/libraries/engines/pbms.lib.php b/libraries/engines/pbms.lib.php index 7f8c44b..7f8f58c 100644 --- a/libraries/engines/pbms.lib.php +++ b/libraries/engines/pbms.lib.php @@ -23,7 +23,7 @@ class PMA_StorageEngine_pbms extends PMA_StorageEngine $this->support = PMA_ENGINE_SUPPORT_YES; }
- function getVariables() + function getVariables() { return array( 'pbms_garbage_threshold' => array( diff --git a/libraries/import.lib.php b/libraries/import.lib.php index 73f9008..f257205 100644 --- a/libraries/import.lib.php +++ b/libraries/import.lib.php @@ -336,35 +336,35 @@ function PMA_importGetNextChunk($size = 32768) */ function PMA_getColumnAlphaName($num) { - $A = 65; // ASCII value for capital "A" - $col_name = ""; - - if ($num > 26) { - $div = (int)($num / 26); - $remain = (int)($num % 26); - - // subtract 1 of divided value in case the modulus is 0, - // this is necessary because A-Z has no 'zero' - if ($remain == 0) { - $div--; - } - - // recursive function call - $col_name = PMA_getColumnAlphaName($div); - // use modulus as new column number - $num = $remain; - } - - if ($num == 0) { - // use 'Z' if column number is 0, - // this is necessary because A-Z has no 'zero' - $col_name .= chr(($A + 26) - 1); - } else { - // convert column number to ASCII character - $col_name .= chr(($A + $num) - 1); - } - - return $col_name; + $A = 65; // ASCII value for capital "A" + $col_name = ""; + + if ($num > 26) { + $div = (int)($num / 26); + $remain = (int)($num % 26); + + // subtract 1 of divided value in case the modulus is 0, + // this is necessary because A-Z has no 'zero' + if ($remain == 0) { + $div--; + } + + // recursive function call + $col_name = PMA_getColumnAlphaName($div); + // use modulus as new column number + $num = $remain; + } + + if ($num == 0) { + // use 'Z' if column number is 0, + // this is necessary because A-Z has no 'zero' + $col_name .= chr(($A + 26) - 1); + } else { + // convert column number to ASCII character + $col_name .= chr(($A + $num) - 1); + } + + return $col_name; }
/** @@ -387,19 +387,19 @@ function PMA_getColumnNumberFromName($name) { $num_chars = strlen($name); $column_number = 0; for ($i = 0; $i < $num_chars; ++$i) { - // read string from back to front - $char_pos = ($num_chars - 1) - $i; - - // convert capital character to ASCII value - // and subtract 64 to get corresponding decimal value - // ASCII value of "A" is 65, "B" is 66, etc. - // Decimal equivalent of "A" is 1, "B" is 2, etc. - $number = (ord($name[$char_pos]) - 64); - - // base26 to base10 conversion : multiply each number - // with corresponding value of the position, in this case - // $i=0 : 1; $i=1 : 26; $i=2 : 676; ... - $column_number += $number * pow(26,$i); + // read string from back to front + $char_pos = ($num_chars - 1) - $i; + + // convert capital character to ASCII value + // and subtract 64 to get corresponding decimal value + // ASCII value of "A" is 65, "B" is 66, etc. + // Decimal equivalent of "A" is 1, "B" is 2, etc. + $number = (ord($name[$char_pos]) - 64); + + // base26 to base10 conversion : multiply each number + // with corresponding value of the position, in this case + // $i=0 : 1; $i=1 : 26; $i=2 : 676; ... + $column_number += $number * pow(26,$i); } return $column_number; } else { @@ -453,7 +453,7 @@ function PMA_getM($last_cumulative_size) { * @return int Scale of the given decimal size notation */ function PMA_getD($last_cumulative_size) { - return (int)substr($last_cumulative_size, (strpos($last_cumulative_size, ",") + 1), (strlen($last_cumulative_size) - strpos($last_cumulative_size, ","))); + return (int)substr($last_cumulative_size, (strpos($last_cumulative_size, ",") + 1), (strlen($last_cumulative_size) - strpos($last_cumulative_size, ","))); }
/** @@ -489,7 +489,7 @@ function PMA_getDecimalSize(&$cell) { * @return string Size of the given cell in the type-appropriate format */ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type, &$cell) { - $curr_size = strlen((string)$cell); + $curr_size = strlen((string)$cell);
/** * If the cell is NULL, don't treat it as a varchar @@ -500,17 +500,17 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type /** * What to do if the current cell is of type VARCHAR */ - elseif ($curr_type == VARCHAR) { + elseif ($curr_type == VARCHAR) { /** * The last cumulative type was VARCHAR */ - if ($last_cumulative_type == VARCHAR) { - if ($curr_size >= $last_cumulative_size) { - return $curr_size; + if ($last_cumulative_type == VARCHAR) { + if ($curr_size >= $last_cumulative_size) { + return $curr_size; } else { - return $last_cumulative_size; + return $last_cumulative_size; } - } + } /** * The last cumulative type was DECIMAL */ @@ -522,7 +522,7 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type } else { return $oldM; } - } + } /** * The last cumulative type was BIGINT or INT */ @@ -532,7 +532,7 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type } else { return $last_cumulative_size; } - } + } /** * This is the first row to be analyzed */ @@ -549,7 +549,7 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
return -1; } - } + } /** * What to do if the current cell is of type DECIMAL */ @@ -557,66 +557,66 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type /** * The last cumulative type was VARCHAR */ - if ($last_cumulative_type == VARCHAR) { + if ($last_cumulative_type == VARCHAR) { /* Convert $last_cumulative_size from varchar to decimal format */ - $size = PMA_getDecimalSize($cell); + $size = PMA_getDecimalSize($cell);
- if ($size[M] >= $last_cumulative_size) { - return $size[M]; + if ($size[M] >= $last_cumulative_size) { + return $size[M]; } else { - return $last_cumulative_size; + return $last_cumulative_size; } - } + } /** * The last cumulative type was DECIMAL */ elseif ($last_cumulative_type == DECIMAL) { - $size = PMA_getDecimalSize($cell); + $size = PMA_getDecimalSize($cell);
- $oldM = PMA_getM($last_cumulative_size); - $oldD = PMA_getD($last_cumulative_size); + $oldM = PMA_getM($last_cumulative_size); + $oldD = PMA_getD($last_cumulative_size);
- /* New val if M or D is greater than current largest */ - if ($size[M] > $oldM || $size[D] > $oldD) { - /* Take the largest of both types */ - return (string)((($size[M] > $oldM) ? $size[M] : $oldM) . "," . (($size[D] > $oldD) ? $size[D] : $oldD)); + /* New val if M or D is greater than current largest */ + if ($size[M] > $oldM || $size[D] > $oldD) { + /* Take the largest of both types */ + return (string)((($size[M] > $oldM) ? $size[M] : $oldM) . "," . (($size[D] > $oldD) ? $size[D] : $oldD)); } else { - return $last_cumulative_size; + return $last_cumulative_size; } - } + } /** * The last cumulative type was BIGINT or INT */ elseif ($last_cumulative_type == BIGINT || $last_cumulative_type == INT) { - /* Convert $last_cumulative_size from int to decimal format */ - $size = PMA_getDecimalSize($cell); + /* Convert $last_cumulative_size from int to decimal format */ + $size = PMA_getDecimalSize($cell);
- if ($size[M] >= $last_cumulative_size) { - return $size[FULL]; + if ($size[M] >= $last_cumulative_size) { + return $size[FULL]; } else { - return ($last_cumulative_size.",".$size[D]); + return ($last_cumulative_size.",".$size[D]); } - } + } /** * This is the first row to be analyzed */ elseif (! isset($last_cumulative_type) || $last_cumulative_type == NONE) { /* First row of the column */ - $size = PMA_getDecimalSize($cell); + $size = PMA_getDecimalSize($cell);
- return $size[FULL]; - } + return $size[FULL]; + } /** * An error has DEFINITELY occurred */ - else { + else { /** * TODO: Handle this MUCH more elegantly */
return -1; } - } + } /** * What to do if the current cell is of type BIGINT or INT */ @@ -624,41 +624,41 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type /** * The last cumulative type was VARCHAR */ - if ($last_cumulative_type == VARCHAR) { - if ($curr_size >= $last_cumulative_size) { - return $curr_size; + if ($last_cumulative_type == VARCHAR) { + if ($curr_size >= $last_cumulative_size) { + return $curr_size; } else { - return $last_cumulative_size; + return $last_cumulative_size; } - } + } /** * The last cumulative type was DECIMAL */ elseif ($last_cumulative_type == DECIMAL) { $oldM = PMA_getM($last_cumulative_size); - $oldD = PMA_getD($last_cumulative_size); - $oldInt = $oldM - $oldD; - $newInt = strlen((string)$cell); - - /* See which has the larger integer length */ - if ($oldInt >= $newInt) { - /* Use old decimal size */ - return $last_cumulative_size; + $oldD = PMA_getD($last_cumulative_size); + $oldInt = $oldM - $oldD; + $newInt = strlen((string)$cell); + + /* See which has the larger integer length */ + if ($oldInt >= $newInt) { + /* Use old decimal size */ + return $last_cumulative_size; } else { - /* Use $newInt + $oldD as new M */ - return (($newInt + $oldD) . "," . $oldD); + /* Use $newInt + $oldD as new M */ + return (($newInt + $oldD) . "," . $oldD); } - } + } /** * The last cumulative type was BIGINT or INT */ elseif ($last_cumulative_type == BIGINT || $last_cumulative_type == INT) { - if ($curr_size >= $last_cumulative_size) { - return $curr_size; + if ($curr_size >= $last_cumulative_size) { + return $curr_size; } else { - return $last_cumulative_size; + return $last_cumulative_size; } - } + } /** * This is the first row to be analyzed */ @@ -668,18 +668,18 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type /** * An error has DEFINITELY occurred */ - else { + else { /** * TODO: Handle this MUCH more elegantly */
return -1; } - } + } /** * An error has DEFINITELY occurred */ - else { + else { /** * TODO: Handle this MUCH more elegantly */ @@ -713,11 +713,11 @@ function PMA_detectType($last_cumulative_type, &$cell) { if ($cell == (string)(float)$cell && strpos($cell, ".") !== false && substr_count($cell, ".") == 1) { return DECIMAL; } else { - if (abs($cell) > 2147483647) { - return BIGINT; - } else { - return INT; - } + if (abs($cell) > 2147483647) { + return BIGINT; + } else { + return INT; + } } } else { return VARCHAR; @@ -737,62 +737,62 @@ function PMA_detectType($last_cumulative_type, &$cell) { * @return array array(array $types, array $sizes) */ function PMA_analyzeTable(&$table) { - /* Get number of rows in table */ - $numRows = count($table[ROWS]); - /* Get number of columns */ - $numCols = count($table[COL_NAMES]); - /* Current type for each column */ - $types = array(); - $sizes = array(); - - /* Initialize $sizes to all 0's */ - for ($i = 0; $i < $numCols; ++$i) { - $sizes[$i] = 0; - } + /* Get number of rows in table */ + $numRows = count($table[ROWS]); + /* Get number of columns */ + $numCols = count($table[COL_NAMES]); + /* Current type for each column */ + $types = array(); + $sizes = array(); + + /* Initialize $sizes to all 0's */ + for ($i = 0; $i < $numCols; ++$i) { + $sizes[$i] = 0; + }
/* Initialize $types to NONE */ for ($i = 0; $i < $numCols; ++$i) { $types[$i] = NONE; }
- /* Temp vars */ - $curr_type = NONE; - $curr_size = 0; - - /* If the passed array is not of the correct form, do not process it */ - if (is_array($table) && ! is_array($table[TBL_NAME]) && is_array($table[COL_NAMES]) && is_array($table[ROWS])) { - /* Analyze each column */ - for ($i = 0; $i < $numCols; ++$i) { - /* Analyze the column in each row */ - for ($j = 0; $j < $numRows; ++$j) { - /* Determine type of the current cell */ - $curr_type = PMA_detectType($types[$i], $table[ROWS][$j][$i]); - /* Determine size of the current cell */ - $sizes[$i] = PMA_detectSize($sizes[$i], $types[$i], $curr_type, $table[ROWS][$j][$i]); - - /** - * If a type for this column has already been declared, - * only alter it if it was a number and a varchar was found - */ - if ($curr_type != NONE) { - if ($curr_type == VARCHAR) { - $types[$i] = VARCHAR; - } else if ($curr_type == DECIMAL) { - if ($types[$i] != VARCHAR) { - $types[$i] = DECIMAL; - } - } else if ($curr_type == BIGINT) { - if ($types[$i] != VARCHAR && $types[$i] != DECIMAL) { - $types[$i] = BIGINT; - } - } else if ($curr_type == INT) { - if ($types[$i] != VARCHAR && $types[$i] != DECIMAL && $types[$i] != BIGINT) { - $types[$i] = INT; - } - } - } - } - } + /* Temp vars */ + $curr_type = NONE; + $curr_size = 0; + + /* If the passed array is not of the correct form, do not process it */ + if (is_array($table) && ! is_array($table[TBL_NAME]) && is_array($table[COL_NAMES]) && is_array($table[ROWS])) { + /* Analyze each column */ + for ($i = 0; $i < $numCols; ++$i) { + /* Analyze the column in each row */ + for ($j = 0; $j < $numRows; ++$j) { + /* Determine type of the current cell */ + $curr_type = PMA_detectType($types[$i], $table[ROWS][$j][$i]); + /* Determine size of the current cell */ + $sizes[$i] = PMA_detectSize($sizes[$i], $types[$i], $curr_type, $table[ROWS][$j][$i]); + + /** + * If a type for this column has already been declared, + * only alter it if it was a number and a varchar was found + */ + if ($curr_type != NONE) { + if ($curr_type == VARCHAR) { + $types[$i] = VARCHAR; + } else if ($curr_type == DECIMAL) { + if ($types[$i] != VARCHAR) { + $types[$i] = DECIMAL; + } + } else if ($curr_type == BIGINT) { + if ($types[$i] != VARCHAR && $types[$i] != DECIMAL) { + $types[$i] = BIGINT; + } + } else if ($curr_type == INT) { + if ($types[$i] != VARCHAR && $types[$i] != DECIMAL && $types[$i] != BIGINT) { + $types[$i] = INT; + } + } + } + } + }
/* Check to ensure that all types are valid */ $len = count($types); @@ -803,16 +803,16 @@ function PMA_analyzeTable(&$table) { } }
- return array($types, $sizes); - } - else - { + return array($types, $sizes); + } + else + { /** * TODO: Handle this better */
- return false; - } + return false; + } }
/* Needed to quell the beast that is PMA_Message */ @@ -944,10 +944,10 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql = * * Only one insert query is formed for each table */ - $tempSQLStr = ""; - $col_count = 0; + $tempSQLStr = ""; + $col_count = 0; $num_tables = count($tables); - for ($i = 0; $i < $num_tables; ++$i) { + for ($i = 0; $i < $num_tables; ++$i) { $num_cols = count($tables[$i][COL_NAMES]); $num_rows = count($tables[$i][ROWS]);
@@ -963,10 +963,10 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql =
$tempSQLStr .= ") VALUES ";
- for ($j = 0; $j < $num_rows; ++$j) { + for ($j = 0; $j < $num_rows; ++$j) { $tempSQLStr .= "(";
- for ($k = 0; $k < $num_cols; ++$k) { + for ($k = 0; $k < $num_cols; ++$k) { if ($analyses != null) { $is_varchar = ($analyses[$i][TYPES][$col_count] === VARCHAR); } else { @@ -979,22 +979,22 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql = }
$tempSQLStr .= (($is_varchar) ? "'" : ""); - $tempSQLStr .= PMA_sqlAddSlashes((string)$tables[$i][ROWS][$j][$k]); - $tempSQLStr .= (($is_varchar) ? "'" : ""); + $tempSQLStr .= PMA_sqlAddSlashes((string)$tables[$i][ROWS][$j][$k]); + $tempSQLStr .= (($is_varchar) ? "'" : "");
- if ($k != ($num_cols - 1)) { - $tempSQLStr .= ", "; + if ($k != ($num_cols - 1)) { + $tempSQLStr .= ", "; }
- if ($col_count == ($num_cols - 1)) { - $col_count = 0; - } else { - $col_count++; + if ($col_count == ($num_cols - 1)) { + $col_count = 0; + } else { + $col_count++; }
/* Delete the cell after we are done with it */ unset($tables[$i][ROWS][$j][$k]); - } + }
$tempSQLStr .= ")";
@@ -1002,10 +1002,10 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql = $tempSQLStr .= ",\n "; }
- $col_count = 0; + $col_count = 0; /* Delete the row after we are done with it */ unset($tables[$i][ROWS][$j]); - } + }
$tempSQLStr .= ";";
@@ -1015,7 +1015,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql = * to store them in a (possibly large) buffer */ PMA_importRunQuery($tempSQLStr, $tempSQLStr); - } + }
/* No longer needed */ unset($tempSQLStr); diff --git a/libraries/rte/rte_words.lib.php b/libraries/rte/rte_words.lib.php index 6e7836a..e046ac2 100644 --- a/libraries/rte/rte_words.lib.php +++ b/libraries/rte/rte_words.lib.php @@ -1,5 +1,5 @@ <?php - +/* vim: set expandtab sw=4 ts=4 sts=4: */ /** * This function is used to retreive some language strings that are used * in functionalities that are common to routines, triggers and events. @@ -10,49 +10,49 @@ */ function PMA_RTE_getWord($index) { - global $_PMA_RTE; + global $_PMA_RTE;
- switch ($_PMA_RTE) { - case 'RTN': - $words = array( - 'add' => __('Add routine'), - 'docu' => 'STORED_ROUTINES', - 'export' => __('Export of routine %s'), - 'human' => __('routine'), - 'no_create' => __('You do not have the necessary privileges to create a routine'), - 'not_found' => __('No routine with name %1$s found in database %2$s'), - 'nothing' => __('There are no routines to display.'), - 'title' => __('Routines'), - ); - break; - case 'TRI': - $words = array( - 'add' => __('Add trigger'), - 'docu' => 'TRIGGERS', - 'export' => __('Export of trigger %s'), - 'human' => __('trigger'), - 'no_create' => __('You do not have the necessary privileges to create a trigger'), - 'not_found' => __('No trigger with name %1$s found in database %2$s'), - 'nothing' => __('There are no triggers to display.'), - 'title' => __('Triggers'), - ); - break; - case 'EVN': - $words = array( - 'add' => __('Add event'), - 'docu' => 'EVENTS', - 'export' => __('Export of event %s'), - 'human' => __('event'), - 'no_create' => __('You do not have the necessary privileges to create an event'), - 'not_found' => __('No event with name %1$s found in database %2$s'), - 'nothing' => __('There are no events to display.'), - 'title' => __('Events'), - ); - break; - default: - $words = array(); - break; - } + switch ($_PMA_RTE) { + case 'RTN': + $words = array( + 'add' => __('Add routine'), + 'docu' => 'STORED_ROUTINES', + 'export' => __('Export of routine %s'), + 'human' => __('routine'), + 'no_create' => __('You do not have the necessary privileges to create a routine'), + 'not_found' => __('No routine with name %1$s found in database %2$s'), + 'nothing' => __('There are no routines to display.'), + 'title' => __('Routines'), + ); + break; + case 'TRI': + $words = array( + 'add' => __('Add trigger'), + 'docu' => 'TRIGGERS', + 'export' => __('Export of trigger %s'), + 'human' => __('trigger'), + 'no_create' => __('You do not have the necessary privileges to create a trigger'), + 'not_found' => __('No trigger with name %1$s found in database %2$s'), + 'nothing' => __('There are no triggers to display.'), + 'title' => __('Triggers'), + ); + break; + case 'EVN': + $words = array( + 'add' => __('Add event'), + 'docu' => 'EVENTS', + 'export' => __('Export of event %s'), + 'human' => __('event'), + 'no_create' => __('You do not have the necessary privileges to create an event'), + 'not_found' => __('No event with name %1$s found in database %2$s'), + 'nothing' => __('There are no events to display.'), + 'title' => __('Events'), + ); + break; + default: + $words = array(); + break; + }
return isset($words[$index]) ? $words[$index] : ''; } // end PMA_RTE_getWord() diff --git a/pmd/styles/default/style1.css b/pmd/styles/default/style1.css index eb3d690..21ddbce 100644 --- a/pmd/styles/default/style1.css +++ b/pmd/styles/default/style1.css @@ -147,19 +147,19 @@ form { }
.option_tab { - padding-left: 2px; - padding-right: 2px; - width: 5px; + padding-left: 2px; + padding-right: 2px; + width: 5px; }
.select_all { - vertical-align: top; - padding-left: 2px; - padding-right: 2px; - cursor: default; - width: 1px; - color: #000000; - background-image: url(images/Header.png); + vertical-align: top; + padding-left: 2px; + padding-right: 2px; + cursor: default; + width: 1px; + color: #000000; + background-image: url(images/Header.png); background-repeat: repeat-x; }
@@ -456,127 +456,127 @@ z-index:999; }
h2.tiger{ - background-repeat: repeat-x; + background-repeat: repeat-x; padding: 1px; font-weight: bold; - font-size:14px; - padding: 50 20 50 20px; - margin: 0 0 5px 0; - width: 250px; - float: left; - color : #333; - text-align: center; + font-size:14px; + padding: 50 20 50 20px; + margin: 0 0 5px 0; + width: 250px; + float: left; + color : #333; + text-align: center; }
h2.tiger a { - background-image: url(images/Header.png); - text-align: center; - text-decoration: none; - color : #333; - display: block; + background-image: url(images/Header.png); + text-align: center; + text-decoration: none; + color : #333; + display: block; }
h2.tiger a:hover { - color: #000; - background-image: url(images/Header_Linked.png); + color: #000; + background-image: url(images/Header_Linked.png); }
h2.active { - background-image: url(images/Header.png); + background-image: url(images/Header.png); background-repeat: repeat-x; padding: 1px; - background-position: left bottom; + background-position: left bottom; }
.toggle_container { - margin: 0 0 5px; - padding: 0; - border-top: 1px solid #d6d6d6; - background: #FFF ; - width: 250px; - overflow: hidden; - font-size: 1.2em; - clear: both; + margin: 0 0 5px; + padding: 0; + border-top: 1px solid #d6d6d6; + background: #FFF ; + width: 250px; + overflow: hidden; + font-size: 1.2em; + clear: both; }
.toggle_container .block { - background-color: #DBE4E8; - padding:40 15 40 15px; /*--Padding of Container--*/ - border:1px solid #999; - color:#000; + background-color: #DBE4E8; + padding:40 15 40 15px; /*--Padding of Container--*/ + border:1px solid #999; + color:#000; }
.history_table { - text-align: center; - background-color: #9999CC; + text-align: center; + background-color: #9999CC; }
.history_table2 { - text-align: center; - background-color: #DBE4E8; + text-align: center; + background-color: #DBE4E8; }
#filter { - display: none; - position: absolute; - top: 0%; - left: 0%; - width: 100%; - height: 100%; - background-color: #CCA; - z-index:10; - opacity:0.5; - filter: alpha(opacity=50); + display: none; + position: absolute; + top: 0%; + left: 0%; + width: 100%; + height: 100%; + background-color: #CCA; + z-index:10; + opacity:0.5; + filter: alpha(opacity=50); }
#box { - display: none; - position: absolute; - top: 20%; - left: 30%; - width: 500px; - height: 220px; - padding: 48px; - margin:0; - border: 1px solid black; - background-color: white; - z-index:101; - overflow: visible; + display: none; + position: absolute; + top: 20%; + left: 30%; + width: 500px; + height: 220px; + padding: 48px; + margin:0; + border: 1px solid black; + background-color: white; + z-index:101; + overflow: visible; }
#boxtitle { - position:absolute; - float:center; - top:0; - left:0; - width:593px; - height:20px; - padding:0; - padding-top:4px; - left-padding:8px; - margin:0; - border-bottom:4px solid #3CF; - background-color: #D0DCE0; //#09c; - color:black; - font-weight:bold; - padding-left: 2px; - font-family:"Times New Roman", Times, serif; - font-size:16px; - text-align:left; + position:absolute; + float:center; + top:0; + left:0; + width:593px; + height:20px; + padding:0; + padding-top:4px; + left-padding:8px; + margin:0; + border-bottom:4px solid #3CF; + background-color: #D0DCE0; //#09c; + color:black; + font-weight:bold; + padding-left: 2px; + font-family:"Times New Roman", Times, serif; + font-size:16px; + text-align:left; }
#tblfooter { - background-color: D3DCE3; - float: right; - padding-top:10px; - color: black; - font-weight: normal; + background-color: D3DCE3; + float: right; + padding-top:10px; + color: black; + font-weight: normal; }
input.btn { - color:#333; - font: bold 84%'trebuchet ms',helvetica,sans-serif; - background-color: #D0DCE0; + color:#333; + font: bold 84%'trebuchet ms',helvetica,sans-serif; + background-color: #D0DCE0; }
diff --git a/pmd_general.php b/pmd_general.php index 74ff124..a93265e 100644 --- a/pmd_general.php +++ b/pmd_general.php @@ -41,23 +41,23 @@ echo ' var server = "' . PMA_escapeJsString($server) . '"; var db = "' . PMA_escapeJsString($db) . '"; var token = "' . PMA_escapeJsString($token) . '";'; - echo "\n"; - if ($_REQUEST['query']) { - echo ' - $(document).ready(function() { - $(".trigger").click(function() { - $(".panel").toggle("fast"); - $(this).toggleClass("active"); - return false; - }); - });'; - } + echo "\n"; + if ($_REQUEST['query']) { + echo ' + $(document).ready(function() { + $(".trigger").click(function() { + $(".panel").toggle("fast"); + $(this).toggleClass("active"); + return false; + }); + });'; + } ?> // ]]> </script> <script src="pmd/scripts/ajax.js" type="text/javascript"></script> <script src="pmd/scripts/history.js" type="text/javascript"></script> - <script src="pmd/scripts/move.js" type="text/javascript"></script> + <script src="pmd/scripts/move.js" type="text/javascript"></script> <!--[if IE]> <script src="pmd/scripts/iecanvas.js" type="text/javascript"></script> <![endif]--> @@ -205,12 +205,12 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <thead> <tr> <?php - if (isset($_REQUEST['query'])) { - echo '<td class="select_all">'; - echo '<input type="checkbox" value="select_all_'.htmlspecialchars($t_n_url).'" style="margin: 0px;" '; + if (isset($_REQUEST['query'])) { + echo '<td class="select_all">'; + echo '<input type="checkbox" value="select_all_'.htmlspecialchars($t_n_url).'" style="margin: 0px;" '; echo 'id="select_all_'.htmlspecialchars($t_n_url).'" title="select all" '; echo 'onclick="Select_all(\''. htmlspecialchars($t_n_url) .'\',\''.htmlspecialchars($GLOBALS['PMD_OUT']["OWNER"][$i]).'\')"></td>'; - }?> + }?> <td class="small_tab" onmouseover="this.className='small_tab2';" onmouseout="this.className='small_tab';" id="id_hide_tbody_<?php echo $t_n_url ?>" @@ -238,11 +238,11 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { echo $GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i]; ?></td> <?php - if (isset($_REQUEST['query'])) { - echo '<td class="tab_zag" onmouseover="Table_onover(\''.htmlspecialchars($t_n_url).'\',0,1)" id="id_zag_'.htmlspecialchars($t_n_url).'_2"'; + if (isset($_REQUEST['query'])) { + echo '<td class="tab_zag" onmouseover="Table_onover(\''.htmlspecialchars($t_n_url).'\',0,1)" id="id_zag_'.htmlspecialchars($t_n_url).'_2"'; echo 'onmousedown="cur_click=document.getElementById(\''.htmlspecialchars($t_n_url).'\');"'; echo 'onmouseout="Table_onover(\''.htmlspecialchars($t_n_url).'\',1,1)">'; - }?> + }?> </tr> </thead> <tbody id="id_tbody_<?php echo $t_n_url ?>" @@ -274,13 +274,13 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { } ?>)"> <?php - if (isset($_REQUEST['query'])) { - echo '<td class="select_all">'; - echo '<input value="'.htmlspecialchars($t_n_url).urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]).'"'; + if (isset($_REQUEST['query'])) { + echo '<td class="select_all">'; + echo '<input value="'.htmlspecialchars($t_n_url).urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]).'"'; echo 'type="checkbox" id="select_'.htmlspecialchars($t_n_url).'._'.urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]).'" '; - echo 'style="margin: 0px;" title="select_'.urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]).'" '; - echo 'onclick="store_column(\''.urlencode($GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i]).'\',\''.htmlspecialchars($GLOBALS['PMD_OUT']["OWNER"][$i]).'\',\''.urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]).'\')"></td>'; - }?> + echo 'style="margin: 0px;" title="select_'.urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]).'" '; + echo 'onclick="store_column(''.urlencode($GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i]).'',''.htmlspecialchars($GLOBALS['PMD_OUT']["OWNER"][$i]).'',''.urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]).'')"></td>'; + }?> <td width="10px" colspan="3" id="<?php echo $t_n_url.".".urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) ?>"> <div style="white-space:nowrap"> @@ -316,12 +316,12 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { </td> <?php if (isset($_REQUEST['query'])) { - //$temp = $GLOBALS['PMD_OUT']["OWNER"][$i].'.'.$GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i]; - echo '<td class="small_tab_pref" onmouseover="this.className=\'small_tab_pref2\';"'; - echo 'onmouseout="this.className=\'small_tab_pref\';"'; - echo 'onclick="Click_option(\'pmd_optionse\',\''.urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]).'\',\''.$GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i].'\')" >'; - echo '<img src="pmd/images/exec_small.png" title="options" alt="" /></td> '; - } ?> + //$temp = $GLOBALS['PMD_OUT']["OWNER"][$i].'.'.$GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i]; + echo '<td class="small_tab_pref" onmouseover="this.className='small_tab_pref2';"'; + echo 'onmouseout="this.className='small_tab_pref';"'; + echo 'onclick="Click_option('pmd_optionse',''.urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]).'',''.$GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i].'')" >'; + echo '<img src="pmd/images/exec_small.png" title="options" alt="" /></td> '; + } ?> </tr> <?php } @@ -451,7 +451,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <table width="168" border="0" align="center" cellpadding="2" cellspacing="0"> <thead> <tr> - <td colspan="2" rowspan="2" id="option_col_name" nowrap="nowrap" align="center"></td> + <td colspan="2" rowspan="2" id="option_col_name" nowrap="nowrap" align="center"></td> </tr> </thead> <tbody id="where"> @@ -480,7 +480,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <tr><td align="center" nowrap="nowrap"><b><?php echo __('Rename to'); ?></b></td></tr> <tr> <td width="58" nowrap="nowrap"><?php echo __('New name'); ?></td> - <td width="102"><input type="text" value="" id="new_name"/></td> + <td width="102"><input type="text" value="" id="new_name"/></td> </tr> <tr><td align="center" nowrap="nowrap"><b><?php echo __('Aggregate'); ?></b></td></tr> <tr> @@ -495,11 +495,11 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { </select> </td></tr> <tr> - <td nowrap="nowrap" width="58" align="center"><b>GROUP BY</b></td> + <td nowrap="nowrap" width="58" align="center"><b>GROUP BY</b></td> <td><input type="checkbox" value="groupby" id="groupby"/></td> </tr> <tr> - <td nowrap="nowrap" width="58" align="center"><b>ORDER BY</b></td> + <td nowrap="nowrap" width="58" align="center"><b>ORDER BY</b></td> <td><input type="checkbox" value="orderby" id="orderby"/></td> </tr> <tr><td align="center" nowrap="nowrap"><b>HAVING</b></td></tr> @@ -514,7 +514,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <option value="avg"> AVG </option> <option value="count"> COUNT </option> </select> - </td></tr> + </td></tr> <tr> <td width="58" nowrap="nowrap"><?php echo __('Relation operator'); ?></td> <td width="102"><select name="h_rel_opt" id="h_rel_opt"> @@ -530,11 +530,11 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <option value="NOT IN"> NOT IN </option> </select> </td> - </tr> + </tr> <tr> <td width="58" nowrap="nowrap"><?php echo __('Value'); ?>/<br/><?php echo __('subquery'); ?></td> - <td width="102"><textarea id="having" value="" cols="18"></textarea></td> - </tr> + <td width="102"><textarea id="having" value="" cols="18"></textarea></td> + </tr> </tbody> <tbody> <tr> @@ -580,7 +580,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <tr> <td width="58" nowrap="nowrap"><?php echo __('New name'); ?></td> <td width="102"> - <input type="text" value="" id="e_rename"/> + <input type="text" value="" id="e_rename"/> </td> </tr> </tbody> @@ -610,11 +610,11 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <table id="query_having" style="visibility:<?php echo $hidden ?>;" width="5%" border="0" cellpadding="0" cellspacing="0"> <tbody> - <tr> - <td class="frams1" width="10px"></td> - <td class="frams5" width="99%" ></td> - <td class="frams2" width="10px"><div class="bor"></div></td> - </tr> + <tr> + <td class="frams1" width="10px"></td> + <td class="frams5" width="99%" ></td> + <td class="frams2" width="10px"><div class="bor"></div></td> + </tr> <tr> <td class="frams8"></td> <td class="input_tab"> @@ -641,7 +641,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <tr> <td width="58" nowrap="nowrap"><?php echo __('Operator'); ?></td> <td width="102"><select name="hrel_opt" id="hrel_opt"> - <option value="--" selected="selected"> -- </option> + <option value="--" selected="selected"> -- </option> <option value="=" > = </option> <option value=">"> > </option> <option value="<"> < </option> @@ -658,7 +658,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <td nowrap="nowrap"><?php echo __('Value'); ?>/<br /><?php echo __('subquery'); ?></td> <td><textarea id="hQuery" value="" cols="18"></textarea> </td> - </tr> + </tr> </tbody> <tbody> <tr> @@ -704,13 +704,13 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <tr> <td width="58" nowrap="nowrap"><?php echo __('Operator'); ?></td> <td width="102"> - <select name="operator" id="e_operator"> - <option value="---" selected="selected">---</option> - <option value="sum" > SUM </option> - <option value="min"> MIN </option> - <option value="max"> MAX </option> - <option value="avg"> AVG </option> - <option value="avg"> COUNT </option> + <select name="operator" id="e_operator"> + <option value="---" selected="selected">---</option> + <option value="sum" > SUM </option> + <option value="min"> MIN </option> + <option value="max"> MAX </option> + <option value="avg"> AVG </option> + <option value="avg"> COUNT </option> </select> </td></tr> </tbody> @@ -740,11 +740,11 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <table id="query_where" style="visibility:<?php echo $hidden ?>;" width="5%" border="0" cellpadding="0" cellspacing="0"> <tbody> - <tr> - <td class="frams1" width="10px"></td> - <td class="frams5" width="99%" ></td> - <td class="frams2" width="10px"><div class="bor"></div></td> - </tr> + <tr> + <td class="frams1" width="10px"></td> + <td class="frams5" width="99%" ></td> + <td class="frams2" width="10px"><div class="bor"></div></td> + </tr> <tr> <td class="frams8"></td> <td class="input_tab"> @@ -758,7 +758,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <tr> <td width="58" nowrap="nowrap"><?php echo __('Operator'); ?></td> <td width="102"><select name="erel_opt" id="erel_opt"> - <option value="--" selected="selected"> -- </option> + <option value="--" selected="selected"> -- </option> <option value="=" > = </option> <option value=">"> > </option> <option value="<"> < </option> @@ -775,7 +775,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { <td nowrap="nowrap"><?php echo __('Value'); ?>/<br /><?php echo __('subquery'); ?></td> <td><textarea id="eQuery" value="" cols="18"></textarea> </td> - </tr> + </tr> </tbody> <tbody> <tr> @@ -802,16 +802,16 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
<?php if ($_REQUEST['query']) { - echo '<div class="panel">'; - echo '<div style="clear:both;"></div>'; - echo '<div id="ab"></div>'; - echo '<div style="clear:both;"></div>'; - echo '</div>'; - echo '<a class="trigger" href="#">' . __('Active options') . '</a>'; - echo '<div id="filter"></div>'; - echo '<div id="box">'; - echo '<span id="boxtitle"></span>'; - echo '<form method="post" action="db_qbe.php" >'; + echo '<div class="panel">'; + echo '<div style="clear:both;"></div>'; + echo '<div id="ab"></div>'; + echo '<div style="clear:both;"></div>'; + echo '</div>'; + echo '<a class="trigger" href="#">' . __('Active options') . '</a>'; + echo '<div id="filter"></div>'; + echo '<div id="box">'; + echo '<span id="boxtitle"></span>'; + echo '<form method="post" action="db_qbe.php" >'; echo '<textarea cols="80" name="sql_query" id="textSqlquery" rows="15"></textarea><div id="tblfooter">'; echo ' <input type="submit" name="submit_sql" class="btn">'; echo ' <input type="button" name="cancel" value="Cancel" onClick="closebox()" class="btn">'; diff --git a/server_synchronize.php b/server_synchronize.php index 431ae6b..6c23d97 100644 --- a/server_synchronize.php +++ b/server_synchronize.php @@ -60,22 +60,22 @@ if ((isset($_REQUEST['submit_connect']))) { ${"{$con}_port"} = $_REQUEST[$con . '_port']; ${"{$con}_socket"} = $_REQUEST[$con . '_socket']; ${"{$con}_db"} = $_REQUEST[$con . '_db']; - ${"{$con}_type"} = $_REQUEST[$con . '_type']; + ${"{$con}_type"} = $_REQUEST[$con . '_type'];
if (${"{$con}_type"} == 'cur') { - ${"{$con}_connection"} = null; - ${"{$con}_server"} = null; - ${"{$con}_db"} = $_REQUEST[$con . '_db_sel']; - continue; + ${"{$con}_connection"} = null; + ${"{$con}_server"} = null; + ${"{$con}_db"} = $_REQUEST[$con . '_db_sel']; + continue; }
if (isset(${"{$con}_socket"}) && ! empty(${"{$con}_socket"})) { - ${"{$con}_server"}['socket'] = ${"{$con}_socket"}; + ${"{$con}_server"}['socket'] = ${"{$con}_socket"}; } else { - ${"{$con}_server"}['host'] = ${"{$con}_host"}; - if (isset(${"{$con}_port"}) && ! empty(${"{$con}_port"}) && ((int)${"{$con}_port"} * 1) > 0) { - ${"{$con}_server"}['port'] = (int)${"{$con}_port"}; - } + ${"{$con}_server"}['host'] = ${"{$con}_host"}; + if (isset(${"{$con}_port"}) && ! empty(${"{$con}_port"}) && ((int)${"{$con}_port"} * 1) > 0) { + ${"{$con}_server"}['port'] = (int)${"{$con}_port"}; + } }
${"{$con}_connection"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"}, $auxiliary_connection = true); @@ -102,14 +102,14 @@ if ((isset($_REQUEST['submit_connect']))) { * Creating the link object for both source and target databases and * selecting the source and target databases using these links */ - foreach ($cons as $con) { - if (${"{$con}_connection"} != null) { - ${"{$con}_link"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"}); - } else { + foreach ($cons as $con) { + if (${"{$con}_connection"} != null) { + ${"{$con}_link"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"}); + } else { ${"{$con}_link"} = null; } - ${"{$con}_db_selected"} = PMA_DBI_select_db(${"{$con}_db"}, ${"{$con}_link"}); - } // end foreach ($cons as $con) + ${"{$con}_db_selected"} = PMA_DBI_select_db(${"{$con}_db"}, ${"{$con}_link"}); + } // end foreach ($cons as $con)
if (($src_db_selected != 1) || ($trg_db_selected != 1)) { /** @@ -225,10 +225,10 @@ if ((isset($_REQUEST['submit_connect']))) { $_SESSION['src_password'] = $src_password; $_SESSION['trg_password'] = $trg_password; $_SESSION['trg_password'] = $trg_password; - $_SESSION['src_server'] = $src_server; - $_SESSION['trg_server'] = $trg_server; - $_SESSION['src_type'] = $src_type; - $_SESSION['trg_type'] = $trg_type; + $_SESSION['src_server'] = $src_server; + $_SESSION['trg_server'] = $trg_server; + $_SESSION['src_type'] = $src_type; + $_SESSION['trg_type'] = $trg_type; $_SESSION['matching_tables_keys'] = $matching_tables_keys; $_SESSION['uncommon_tables_fields'] = $uncommon_tables_fields; $_SESSION['uncommon_tables_row_count'] = $row_count; @@ -731,7 +731,7 @@ if (isset($_REQUEST['Table_ids'])) {
if (($num_alter_cols > 0) || ($num_insert_cols > 0) || ($num_remove_cols > 0) || ($num_add_index > 0) || ($num_remove_index > 0)) { echo '<img class="icon struct_img" src="' . $pmaThemeImage . 'new_struct.jpg" width="29" height="29" - alt="' . __('Click to select') . '" + alt="' . __('Click to select') . '" onclick="showDetails(' . "'MS" . $i . "','" . $num_alter_cols . "','" . $num_insert_cols . "','" . $num_remove_cols . "','" . $num_add_index . "','" . $num_remove_index . "'" .', this ,' . "'" . htmlspecialchars($matching_tables[$i]) . "'" . ')"/>'; } @@ -799,7 +799,7 @@ if (isset($_REQUEST['Table_ids'])) { if (!(in_array($j, $uncommon_table_data_diff))) { if (isset($row_count[$j]) && ($row_count > 0)) { echo '<img class="icon data_img" src="' . $pmaThemeImage . 'new_data.jpg" width="29" height="29" - alt="' . __('Click to select') . '" + alt="' . __('Click to select') . '" onclick="showDetails(' . "'UD" . $j . "','" . null ."','" . $row_count[$j] ."','" . null . "','" . null . "','" . null . "'" . ', this ,' . "'". htmlspecialchars($source_tables_uncommon[$j]) . "'" . ')" />'; } @@ -1117,8 +1117,8 @@ if (isset($_REQUEST['synchronize_db'])) { <table id="serverconnection_<?php echo $type; ?>_remote" class="data"> <caption class="tblHeaders"><?php echo $database_header; ?></caption> <tr class="odd"> - <td colspan="2" style="text-align: center"> - <select name="<?php echo $type; ?>_type" id="<?php echo $type; ?>_type" class="server_selector"> + <td colspan="2" style="text-align: center"> + <select name="<?php echo $type; ?>_type" id="<?php echo $type; ?>_type" class="server_selector"> <?php if ($GLOBALS['cfg']['AllowArbitraryServer']) { $preselected_option = 'rmt'; @@ -1162,53 +1162,53 @@ if (isset($_REQUEST['synchronize_db'])) { . htmlspecialchars(sprintf(__('Configuration: %s'), $label)) . '</option>'; } // end foreach ?> - </select> - </td> + </select> + </td> </tr> - <tr class="even toggler remote-server"> - <td><?php echo __('Server'); ?></td> + <tr class="even toggler remote-server"> + <td><?php echo __('Server'); ?></td> <td><input type="text" name="<?php echo $type; ?>_host" class="server-host" <?php echo $possibly_readonly; ?>/></td> - </tr> - <tr class="odd toggler remote-server"> - <td><?php echo __('Port'); ?></td> + </tr> + <tr class="odd toggler remote-server"> + <td><?php echo __('Port'); ?></td> <td><input type="text" name="<?php echo $type; ?>_port" class="server-port" <?php echo $possibly_readonly; ?> value="3306" maxlength="5" size="5" /></td> - </tr> - <tr class="even toggler remote-server"> - <td><?php echo __('Socket'); ?></td> + </tr> + <tr class="even toggler remote-server"> + <td><?php echo __('Socket'); ?></td> <td><input type="text" name="<?php echo $type; ?>_socket" class="server-socket" <?php echo $possibly_readonly; ?>/></td> - </tr> - <tr class="odd toggler remote-server"> - <td><?php echo __('User name'); ?></td> + </tr> + <tr class="odd toggler remote-server"> + <td><?php echo __('User name'); ?></td> <td><input type="text" name="<?php echo $type; ?>_username" class="server-user" /></td> - </tr> - <tr class="even toggler remote-server"> - <td><?php echo __('Password'); ?></td> + </tr> + <tr class="even toggler remote-server"> + <td><?php echo __('Password'); ?></td> <td><input type="password" name="<?php echo $type; ?>_pass" class="server-pass" /> </td> - </tr> - <tr class="odd toggler remote-server"> - <td><?php echo __('Database'); ?></td> + </tr> + <tr class="odd toggler remote-server"> + <td><?php echo __('Database'); ?></td> <td><input type="text" name="<?php echo $type; ?>_db" class="server-db" /></td> - </tr> - <tr class="even toggler current-server" style="display: none;"> - <td><?php echo __('Database'); ?></td> - <td> + </tr> + <tr class="even toggler current-server" style="display: none;"> + <td><?php echo __('Database'); ?></td> + <td> <?php // these unset() do not complain if the elements do not exist unset($databases['mysql']); unset($databases['information_schema']);
- if (count($databases) == 0) { - echo __('No databases'); - } else { - echo ' - <select name="' . $type . '_db_sel"> - '; - foreach ($databases as $db) { - echo ' <option>' . htmlspecialchars($db['SCHEMA_NAME']) . '</option>'; - } + if (count($databases) == 0) { + echo __('No databases'); + } else { + echo ' + <select name="' . $type . '_db_sel"> + '; + foreach ($databases as $db) { + echo ' <option>' . htmlspecialchars($db['SCHEMA_NAME']) . '</option>'; + } echo '</select>'; - } - echo '</td> </tr> + } + echo '</td> </tr> </table>'; } unset ($types, $type); diff --git a/setup/config.php b/setup/config.php index 193b57f..5333cb0 100644 --- a/setup/config.php +++ b/setup/config.php @@ -26,34 +26,34 @@ if (isset($_POST['eol'])) { }
if (PMA_ifSetOr($_POST['submit_clear'], '')) { - // - // Clear current config and return to main page - // - ConfigFile::getInstance()->resetConfigData(); + // + // Clear current config and return to main page + // + ConfigFile::getInstance()->resetConfigData(); // drop post data header('HTTP/1.1 303 See Other'); header('Location: index.php'); exit; } elseif (PMA_ifSetOr($_POST['submit_download'], '')) { - // - // Output generated config file - // + // + // Output generated config file + // header('Content-Type: text/plain'); header('Content-Disposition: attachment; filename="config.inc.php"'); echo ConfigGenerator::getConfigFile(); exit; } elseif (PMA_ifSetOr($_POST['submit_save'], '')) { - // - // Save generated config file on the server - // + // + // Save generated config file on the server + // file_put_contents($config_file_path, ConfigGenerator::getConfigFile()); header('HTTP/1.1 303 See Other'); header('Location: index.php?action_done=config_saved'); exit; } elseif (PMA_ifSetOr($_POST['submit_load'], '')) { - // - // Load config file from the server - // + // + // Load config file from the server + // $cfg = array(); require_once $config_file_path; ConfigFile::getInstance()->setConfigData($cfg); @@ -61,17 +61,17 @@ if (PMA_ifSetOr($_POST['submit_clear'], '')) { header('Location: index.php'); exit; } elseif (PMA_ifSetOr($_POST['submit_delete'], '')) { - // - // Delete config file on the server - // + // + // Delete config file on the server + // @unlink($config_file_path); header('HTTP/1.1 303 See Other'); header('Location: index.php'); exit; } else { - // - // Show generated config file in a <textarea> - // + // + // Show generated config file in a <textarea> + // header('HTTP/1.1 303 See Other'); header('Location: index.php?page=config'); exit;
hooks/post-receive