Merge remote-tracking branch 'origin/master'
Conflicts: js/functions.js libraries/common.lib.php libraries/header.inc.php server_status.php
This commit is contained in:
commit
9f343e6ead
6
.gitignore
vendored
6
.gitignore
vendored
@ -20,6 +20,7 @@ phpmyadmin.wpj
|
||||
.buildpath
|
||||
.cache
|
||||
.idea
|
||||
.netbeans
|
||||
*.sw[op]
|
||||
# Locales
|
||||
/locale/
|
||||
@ -31,3 +32,8 @@ phpmyadmin.wpj
|
||||
/apidoc/
|
||||
# Demo server
|
||||
revision-info.php
|
||||
# PHPUnit
|
||||
phpunit.xml
|
||||
/test/bootstrap.php
|
||||
# Jenkins
|
||||
/build/
|
||||
@ -38,6 +38,7 @@ phpMyAdmin - ChangeLog
|
||||
+ AJAX for table Structure column Change
|
||||
+ [interface] Improved support for events
|
||||
+ [interface] Improved support for triggers
|
||||
+ [interface] Improved server monitoring
|
||||
|
||||
3.4.4.0 (not yet released)
|
||||
- bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes
|
||||
@ -48,6 +49,10 @@ phpMyAdmin - ChangeLog
|
||||
- bug #3350790 [interface] JS error in Table->Structure->Index->Edit
|
||||
- bug #3353811 [interface] Info message has "error" class
|
||||
- bug #3357837 [interface] TABbing through a NULL field in the inline mode resets NULL
|
||||
- remove version number in /setup
|
||||
- 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
|
||||
|
||||
3.4.3.1 (2011-07-02)
|
||||
- [security] Fixed possible session manipulation in swekey authentication, see PMASA-2011-5
|
||||
|
||||
@ -13,7 +13,7 @@ require_once './libraries/common.inc.php';
|
||||
PMA_checkParameters(array('reference', 'c_type'));
|
||||
|
||||
// Increase time limit, because fetching blob might take some time
|
||||
set_time_limit(0);
|
||||
@set_time_limit(0);
|
||||
|
||||
$reference = $_REQUEST['reference'];
|
||||
/*
|
||||
|
||||
87
build.xml
Normal file
87
build.xml
Normal file
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project name="phpMyAdmin" default="build" basedir=".">
|
||||
<property name="source" value="."/>
|
||||
<property name="source_comma_sep" value="."/>
|
||||
|
||||
<target name="clean" description="Clean up and create artifact directories">
|
||||
<delete dir="${basedir}/build/api"/>
|
||||
<delete dir="${basedir}/build/code-browser"/>
|
||||
<delete dir="${basedir}/build/coverage"/>
|
||||
<delete dir="${basedir}/build/logs"/>
|
||||
<delete dir="${basedir}/build/pdepend"/>
|
||||
|
||||
<mkdir dir="${basedir}/build/api"/>
|
||||
<mkdir dir="${basedir}/build/code-browser"/>
|
||||
<mkdir dir="${basedir}/build/coverage"/>
|
||||
<mkdir dir="${basedir}/build/logs"/>
|
||||
<mkdir dir="${basedir}/build/pdepend"/>
|
||||
</target>
|
||||
|
||||
<target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
|
||||
<exec executable="phpunit">
|
||||
<arg line="--configuration phpunit.xml.dist"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
|
||||
<exec executable="pdepend">
|
||||
<arg line="--jdepend-xml=${basedir}/build/logs/jdepend.xml
|
||||
--jdepend-chart=${basedir}/build/pdepend/dependencies.svg
|
||||
--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg
|
||||
${source_comma_sep}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phpmd" description="Generate pmd.xml using PHPMD">
|
||||
<exec executable="phpmd">
|
||||
<arg line="${source_comma_sep}
|
||||
xml
|
||||
codesize,design,naming,unusedcode
|
||||
--reportfile ${basedir}/build/logs/pmd.xml" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD">
|
||||
<exec executable="phpcpd">
|
||||
<arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml
|
||||
--exclude test
|
||||
--exclude libraries/PHPExcel
|
||||
--exclude libraries/tcpdf
|
||||
${source}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phploc" description="Generate phploc.csv">
|
||||
<exec executable="phploc">
|
||||
<arg line="--log-csv ${basedir}/build/logs/phploc.csv ${source}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer excluding test, PHPExcel, tcpdf directories">
|
||||
<exec executable="phpcs">
|
||||
<arg line="
|
||||
--ignore=*/PHPExcel/*,*/php-gettext/*,*/tcpdf/*,*/canvg/*,*/codemirror/*,*/highcharts/*,*/openlayers/*,*/jquery/*
|
||||
--report=checkstyle
|
||||
--report-file=${basedir}/build/logs/checkstyle.xml
|
||||
--standard=PEAR
|
||||
${source}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phpdoc" description="Generate API documentation using PHPDocumentor">
|
||||
<exec executable="phpdoc">
|
||||
<arg line="-d ${source} -t ${basedir}/build/api" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
|
||||
<exec executable="phpcb">
|
||||
<arg line="--log ${basedir}/build/logs
|
||||
--source ${source}
|
||||
--output ${basedir}/build/code-browser" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="build" depends="clean,phpunit,pdepend,phpmd,phpcpd,phpcs,phpdoc,phploc,phpcb"/>
|
||||
</project>
|
||||
@ -75,7 +75,7 @@ $replaces = array(
|
||||
=> '<a href="https://sourceforge.net/support/tracker.php?aid=\\1">bug #\\1</a>',
|
||||
|
||||
// all other 6+ digit numbers are treated as bugs
|
||||
'/(?<!BUG|RFE|patch) #?([0-9]{6,})/i'
|
||||
'/(?<!bug|RFE|patch) #?([0-9]{6,})/i'
|
||||
=> ' <a href="https://sourceforge.net/support/tracker.php?aid=\\1">bug #\\1</a>',
|
||||
|
||||
// CVE/CAN entries
|
||||
|
||||
@ -19,6 +19,8 @@ $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
|
||||
$GLOBALS['js_include'][] = 'jquery/timepicker.js';
|
||||
$GLOBALS['js_include'][] = 'rte/common.js';
|
||||
$GLOBALS['js_include'][] = 'rte/events.js';
|
||||
$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
|
||||
$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
|
||||
|
||||
/**
|
||||
* Include all other files
|
||||
@ -28,6 +30,7 @@ require_once './libraries/rte/rte_events.lib.php';
|
||||
/**
|
||||
* Do the magic
|
||||
*/
|
||||
$_PMA_RTE = 'EVN';
|
||||
require_once './libraries/rte/rte_main.inc.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
|
||||
|
||||
@ -21,6 +21,8 @@ $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
|
||||
$GLOBALS['js_include'][] = 'jquery/timepicker.js';
|
||||
$GLOBALS['js_include'][] = 'rte/common.js';
|
||||
$GLOBALS['js_include'][] = 'rte/routines.js';
|
||||
$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
|
||||
$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
|
||||
|
||||
/**
|
||||
* Include all other files
|
||||
@ -30,6 +32,7 @@ require_once './libraries/rte/rte_routines.lib.php';
|
||||
/**
|
||||
* Do the magic
|
||||
*/
|
||||
$_PMA_RTE = 'RTN';
|
||||
require_once './libraries/rte/rte_main.inc.php';
|
||||
|
||||
?>
|
||||
|
||||
@ -16,6 +16,8 @@ require_once './libraries/common.inc.php';
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'makegrid.js';
|
||||
$GLOBALS['js_include'][] = 'sql.js';
|
||||
$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
|
||||
$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
|
||||
|
||||
require './libraries/db_common.inc.php';
|
||||
require_once './libraries/sql_query_form.lib.php';
|
||||
|
||||
@ -18,6 +18,8 @@ require_once './libraries/common.lib.php';
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
|
||||
$GLOBALS['js_include'][] = 'rte/common.js';
|
||||
$GLOBALS['js_include'][] = 'rte/triggers.js';
|
||||
$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
|
||||
$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
|
||||
|
||||
/**
|
||||
* Include all other files
|
||||
@ -27,6 +29,7 @@ require_once './libraries/rte/rte_triggers.lib.php';
|
||||
/**
|
||||
* Do the magic
|
||||
*/
|
||||
$_PMA_RTE = 'TRI';
|
||||
require_once './libraries/rte/rte_main.inc.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('<input type="text" size="30" value="%s" name="field' . $field_counter . '" />', htmlspecialchars(str_replace(array("''", '\\\\', "\\'"), array("'", '\\', "'"), substr($value, 1, -1))));
|
||||
|
||||
@ -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</a> ]</p>';
|
||||
@ -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)) {
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
|
||||
@ -1,568 +0,0 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
|
||||
/**
|
||||
* Validate routine editor form fields.
|
||||
*
|
||||
* @param syntaxHiglighter an object containing the reference to the
|
||||
* codemirror editor. This will be used to
|
||||
* focus the form on the codemirror editor
|
||||
* if it contains invalid data.
|
||||
*/
|
||||
function validateRoutineEditor(syntaxHiglighter) {
|
||||
/**
|
||||
* @var inputname Will contain the value of the name
|
||||
* attribute of input fields being checked.
|
||||
*/
|
||||
var inputname = '';
|
||||
/**
|
||||
* @var $elm a jQuery object containing the reference
|
||||
* to an element that is being validated.
|
||||
*/
|
||||
var $elm = null;
|
||||
/**
|
||||
* @var isError Stores the outcome of the validation.
|
||||
*/
|
||||
var isError = false;
|
||||
|
||||
$elm = $('.rte_table').last().find('input[name=routine_name]');
|
||||
if ($elm.val() == '') {
|
||||
$elm.focus();
|
||||
isError = true;
|
||||
} else if ($elm.val().length > 64) {
|
||||
alert(PMA_messages['strValueTooLong']);
|
||||
$elm.focus().select();
|
||||
return false;
|
||||
}
|
||||
if (! isError) {
|
||||
$elm = $('.rte_table').find('textarea[name=routine_definition]');
|
||||
if ($elm.val() == '') {
|
||||
syntaxHiglighter.focus();
|
||||
isError = true;
|
||||
}
|
||||
}
|
||||
if (! isError) {
|
||||
$('.routine_params_table').last().find('tr').each(function() {
|
||||
if (! isError) {
|
||||
$(this).find(':input').each(function() {
|
||||
inputname = $(this).attr('name');
|
||||
if (inputname.substr(0, 17) == 'routine_param_dir' ||
|
||||
inputname.substr(0, 18) == 'routine_param_name' ||
|
||||
inputname.substr(0, 18) == 'routine_param_type') {
|
||||
if ($(this).val() == '') {
|
||||
$(this).focus();
|
||||
isError = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (! isError) {
|
||||
// SET, ENUM, VARCHAR and VARBINARY fields must have length/values
|
||||
$('.routine_params_table').last().find('tr').each(function() {
|
||||
var $inputtyp = $(this).find('select[name^=routine_param_type]');
|
||||
var $inputlen = $(this).find('input[name^=routine_param_length]');
|
||||
if ($inputtyp.length && $inputlen.length) {
|
||||
if (($inputtyp.val() == 'ENUM' || $inputtyp.val() == 'SET' || $inputtyp.val().substr(0,3) == 'VAR')
|
||||
&& $inputlen.val() == '') {
|
||||
$inputlen.focus();
|
||||
isError = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (! isError && $('select[name=routine_type]').find(':selected').val() == 'FUNCTION') {
|
||||
// The length/values of return variable for functions must
|
||||
// be set, if the type is SET, ENUM, VARCHAR or VARBINARY.
|
||||
var $returntyp = $('select[name=routine_returntype]');
|
||||
var $returnlen = $('input[name=routine_returnlength]');
|
||||
if (($returntyp.val() == 'ENUM' || $returntyp.val() == 'SET' || $returntyp.val().substr(0,3) == 'VAR')
|
||||
&& $returnlen.val() == '') {
|
||||
$returnlen.focus();
|
||||
isError = true;
|
||||
}
|
||||
}
|
||||
if (! isError && $('select[name=routine_type]').find(':selected').val() == 'FUNCTION') {
|
||||
if ($('.rte_table').find('textarea[name=routine_definition]').val().toLowerCase().indexOf('return') < 0) {
|
||||
syntaxHiglighter.focus();
|
||||
alert(PMA_messages['MissingReturn']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (! isError) {
|
||||
$elm = $('.rte_table').last().find('input[name=routine_comment]');
|
||||
if ($elm.val().length > 64) {
|
||||
alert(PMA_messages['strValueTooLong']);
|
||||
$elm.focus().select();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (! isError) {
|
||||
return true;
|
||||
} else {
|
||||
alert(PMA_messages['strFormEmpty']);
|
||||
return false;
|
||||
}
|
||||
} // end validateRoutineEditor()
|
||||
|
||||
/**
|
||||
* Enable/disable the "options" dropdown and "length" input for
|
||||
* parameters and the return variable in the routine editor
|
||||
* as necessary.
|
||||
*
|
||||
* @param $type a jQuery object containing the reference
|
||||
* to the "Type" dropdown box
|
||||
* @param $len a jQuery object containing the reference
|
||||
* to the "Length" input box
|
||||
* @param $text a jQuery object containing the reference
|
||||
* to the dropdown box with options for
|
||||
* parameters of text type
|
||||
* @param $num a jQuery object containing the reference
|
||||
* to the dropdown box with options for
|
||||
* parameters of numeric type
|
||||
*/
|
||||
function setOptionsForParameter($type, $len, $text, $num) {
|
||||
// Process for parameter options
|
||||
switch ($type.val()) {
|
||||
case 'TINYINT':
|
||||
case 'SMALLINT':
|
||||
case 'MEDIUMINT':
|
||||
case 'INT':
|
||||
case 'BIGINT':
|
||||
case 'DECIMAL':
|
||||
case 'FLOAT':
|
||||
case 'DOUBLE':
|
||||
case 'REAL':
|
||||
$text.parent().hide();
|
||||
$num.parent().show();
|
||||
break;
|
||||
case 'TINYTEXT':
|
||||
case 'TEXT':
|
||||
case 'MEDIUMTEXT':
|
||||
case 'LONGTEXT':
|
||||
case 'CHAR':
|
||||
case 'VARCHAR':
|
||||
case 'SET':
|
||||
case 'ENUM':
|
||||
$text.parent().show();
|
||||
$text.show();
|
||||
$num.parent().hide();
|
||||
break;
|
||||
default:
|
||||
$text.parent().show();
|
||||
$text.hide();
|
||||
$num.parent().hide();
|
||||
break;
|
||||
}
|
||||
// Process for parameter length
|
||||
switch ($type.val()) {
|
||||
case 'DATE':
|
||||
case 'DATETIME':
|
||||
case 'TIME':
|
||||
case 'TINYBLOB':
|
||||
case 'TINYTEXT':
|
||||
case 'BLOB':
|
||||
case 'TEXT':
|
||||
case 'MEDIUMBLOB':
|
||||
case 'MEDIUMTEXT':
|
||||
case 'LONGBLOB':
|
||||
case 'LONGTEXT':
|
||||
$len.hide();
|
||||
break;
|
||||
default:
|
||||
$len.show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the Routines functionalities.
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
/**
|
||||
* @var $ajaxDialog jQuery object containing the reference to the
|
||||
* dialog that contains the routine editor.
|
||||
*/
|
||||
var $ajaxDialog = null;
|
||||
/**
|
||||
* @var param_template This variable contains the template for one row
|
||||
* of the parameters table that is attached to the
|
||||
* dialog when a new parameter is added.
|
||||
*/
|
||||
var param_template = '';
|
||||
/**
|
||||
* @var syntaxHiglighter Reference to the codemirror editor.
|
||||
*/
|
||||
var syntaxHiglighter = null;
|
||||
/**
|
||||
* @var button_options Object containing options for jQueryUI dialog buttons
|
||||
*/
|
||||
var button_options = {};
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the Add/Edit routine functionality.
|
||||
*
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
* @uses PMA_ajaxRemoveMessage()
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$('.add_routine_anchor, .edit_routine_anchor').live('click', function(event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var $edit_row jQuery object containing the reference to
|
||||
* the row of the the routine being edited
|
||||
* from the list of routines .
|
||||
*/
|
||||
var $edit_row = null;
|
||||
if ($(this).hasClass('edit_routine_anchor')) {
|
||||
// Remeber the row of the routine being edited for later,
|
||||
// so that if the edit is successful, we can replace the
|
||||
// row with info about the modified routine.
|
||||
$edit_row = $(this).parents('tr');
|
||||
}
|
||||
/**
|
||||
* @var $msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user.
|
||||
*/
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages['strLoading']);
|
||||
$.get($(this).attr('href'), {'ajax_request': true}, function(data) {
|
||||
if(data.success == true) {
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
button_options[PMA_messages['strGo']] = function() {
|
||||
syntaxHiglighter.save();
|
||||
// Validate editor and submit request, if passed.
|
||||
if (validateRoutineEditor(syntaxHiglighter)) {
|
||||
/**
|
||||
* @var data Form data to be sent in the AJAX request.
|
||||
*/
|
||||
var data = $('.rte_form').last().serialize();
|
||||
$msg = PMA_ajaxShowMessage(PMA_messages['strLoading']);
|
||||
$.post('db_routines.php', data, function (data) {
|
||||
if(data.success == true) {
|
||||
// Routine created successfully
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
PMA_slidingMessage(data.message);
|
||||
$ajaxDialog.dialog('close');
|
||||
// If we are in 'edit' mode, we must remove the reference to the old row.
|
||||
if (mode == 'edit') {
|
||||
$edit_row.remove();
|
||||
}
|
||||
// Insert the new row at the correct location in the list of routines
|
||||
/**
|
||||
* @var text Contains the name of a routine from the list
|
||||
* that is used in comparisons to find the correct
|
||||
* location where to insert a new row.
|
||||
*/
|
||||
var text = '';
|
||||
/**
|
||||
* @var inserted Whether a new has been inserted
|
||||
* in the list of routines or not.
|
||||
*/
|
||||
var inserted = false;
|
||||
$('table.data').find('tr').each(function() {
|
||||
text = $(this).children('td').eq(0).find('strong').text().toUpperCase();
|
||||
if (text != '' && text > data.name) {
|
||||
$(this).before(data.new_row);
|
||||
inserted = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (! inserted) {
|
||||
$('table.data').append(data.new_row);
|
||||
}
|
||||
// Fade-in the new row
|
||||
$('.ajaxInsert').show('slow').removeClass('ajaxInsert');
|
||||
// Now we have inserted the row at the correct position, but surely
|
||||
// at least some row classes are wrong now. So we will itirate
|
||||
// throught all rows and assign correct classes to them.
|
||||
/**
|
||||
* @var ct Count of processed rows.
|
||||
*/
|
||||
var ct = 0;
|
||||
$('table.data').find('tr').has('td').each(function() {
|
||||
rowclass = (ct % 2 == 0) ? 'even' : 'odd';
|
||||
$(this).removeClass().addClass(rowclass);
|
||||
ct++;
|
||||
});
|
||||
// If this is the first routine being added, remove the
|
||||
// "No routines" message and show the list of routines.
|
||||
if ($('table.data').find('tr').has('td').length > 0 && $('#nothing2display').is(':visible')) {
|
||||
$('#nothing2display').hide("slow", function () {
|
||||
$('table.data').show("slow");
|
||||
});
|
||||
}
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
} // end of function that handles the submission of the Editor
|
||||
button_options[PMA_messages['strClose']] = function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
/**
|
||||
* Display the dialog to the user
|
||||
*/
|
||||
$ajaxDialog = $('<div>'+data.message+'</div>').dialog({
|
||||
width: 700, // TODO: make a better decision about the size
|
||||
height: 550, // of the dialog based on the size of the viewport
|
||||
buttons: button_options,
|
||||
title: data.title,
|
||||
modal: true,
|
||||
close: function () {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
$ajaxDialog.find('input[name=routine_name]').focus();
|
||||
/**
|
||||
* @var mode Used to remeber whether the editor is in
|
||||
* "Edit Routine" or "Add Routine" mode.
|
||||
*/
|
||||
var mode = 'add';
|
||||
if ($('input[name=routine_process_editroutine]').length > 0) {
|
||||
mode = 'edit';
|
||||
}
|
||||
// Cache the template for a parameter table row
|
||||
param_template = data.param_template;
|
||||
// Make adjustments in the dialog to make it AJAX compatible
|
||||
$('.routine_param_remove').show();
|
||||
$('input[name=routine_removeparameter]').remove();
|
||||
$('input[name=routine_addparameter]').css('width', '100%');
|
||||
// Enable/disable the 'options' dropdowns for parameters as necessary
|
||||
$('.routine_params_table').last().find('th[colspan=2]').attr('colspan', '1');
|
||||
$('.routine_params_table').last().find('tr').has('td').each(function() {
|
||||
setOptionsForParameter(
|
||||
$(this).find('select[name^=routine_param_type]'),
|
||||
$(this).find('input[name^=routine_param_length]'),
|
||||
$(this).find('select[name^=routine_param_opts_text]'),
|
||||
$(this).find('select[name^=routine_param_opts_num]')
|
||||
);
|
||||
});
|
||||
// Enable/disable the 'options' dropdowns for function return value as necessary
|
||||
setOptionsForParameter(
|
||||
$('.rte_table').last().find('select[name=routine_returntype]'),
|
||||
$('.rte_table').last().find('input[name=routine_returnlength]'),
|
||||
$('.rte_table').last().find('select[name=routine_returnopts_text]'),
|
||||
$('.rte_table').last().find('select[name=routine_returnopts_num]')
|
||||
);
|
||||
// Attach syntax highlited editor to routine definition
|
||||
/**
|
||||
* @var $elm jQuery object containing the reference to
|
||||
* the "Routine Definition" textarea.
|
||||
*/
|
||||
var $elm = $('textarea[name=routine_definition]').last();
|
||||
/**
|
||||
* @var opts Options to pass to the codemirror editor.
|
||||
*/
|
||||
var opts = {lineNumbers: true, matchBrackets: true, indentUnit: 4, mode: "text/x-mysql"};
|
||||
syntaxHiglighter = CodeMirror.fromTextArea($elm[0], opts);
|
||||
// Hack to prevent the syntax highlighter from expanding beyond dialog boundries
|
||||
$('.CodeMirror-scroll').find('div').first().css('width', '1px');
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
}) // end $.get()
|
||||
}); // end $.live()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the "Add parameter to routine" functionality.
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$('input[name=routine_addparameter]').live('click', function(event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var $routine_params_table jQuery object containing the reference
|
||||
* to the routine parameters table.
|
||||
*/
|
||||
var $routine_params_table = $('.routine_params_table').last();
|
||||
/**
|
||||
* @var $new_param_row A string containing the HTML code for the
|
||||
* new row for the routine paramaters table.
|
||||
*/
|
||||
var new_param_row = param_template.replace(/%s/g, $routine_params_table.find('tr').length-1);
|
||||
$routine_params_table.append(new_param_row);
|
||||
if ($('.rte_table').find('select[name=routine_type]').val() == 'FUNCTION') {
|
||||
$('.routine_return_row').show();
|
||||
$('.routine_direction_cell').hide();
|
||||
}
|
||||
/**
|
||||
* @var $newrow jQuery object containing the reference to the newly
|
||||
* inserted row in the routine parameters table.
|
||||
*/
|
||||
var $newrow = $('.routine_params_table').last().find('tr').has('td').last();
|
||||
setOptionsForParameter(
|
||||
$newrow.find('select[name^=routine_param_type]'),
|
||||
$newrow.find('input[name^=routine_param_length]'),
|
||||
$newrow.find('select[name^=routine_param_opts_text]'),
|
||||
$newrow.find('select[name^=routine_param_opts_num]')
|
||||
);
|
||||
}); // end $.live()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the "Remove parameter from routine" functionality.
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$('.routine_param_remove_anchor').live('click', function (event) {
|
||||
event.preventDefault();
|
||||
$(this).parent().parent().remove();
|
||||
// After removing a parameter, the indices of the name attributes in
|
||||
// the input fields lose the correct order and need to be reordered.
|
||||
/**
|
||||
* @var index Counter used for reindexing the input
|
||||
* fields in the routine parameters table.
|
||||
*/
|
||||
var index = 0;
|
||||
$('.routine_params_table').last().find('tr').has('td').each(function() {
|
||||
$(this).find(':input').each(function() {
|
||||
/**
|
||||
* @var inputname The value of the name attribute of
|
||||
* the input field being reindexed.
|
||||
*/
|
||||
var inputname = $(this).attr('name');
|
||||
if (inputname.substr(0, 17) == 'routine_param_dir') {
|
||||
$(this).attr('name', inputname.substr(0, 17) + '[' + index + ']');
|
||||
} else if (inputname.substr(0, 18) == 'routine_param_name') {
|
||||
$(this).attr('name', inputname.substr(0, 18) + '[' + index + ']');
|
||||
} else if (inputname.substr(0, 18) == 'routine_param_type') {
|
||||
$(this).attr('name', inputname.substr(0, 18) + '[' + index + ']');
|
||||
} else if (inputname.substr(0, 20) == 'routine_param_length') {
|
||||
$(this).attr('name', inputname.substr(0, 20) + '[' + index + ']');
|
||||
} else if (inputname.substr(0, 23) == 'routine_param_opts_text') {
|
||||
$(this).attr('name', inputname.substr(0, 23) + '[' + index + ']');
|
||||
} else if (inputname.substr(0, 22) == 'routine_param_opts_num') {
|
||||
$(this).attr('name', inputname.substr(0, 22) + '[' + index + ']');
|
||||
}
|
||||
});
|
||||
index++;
|
||||
});
|
||||
}); // end $.live()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the "Change routine type" functionality.
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$('select[name=routine_type]').live('change', function() {
|
||||
$('.routine_return_row, .routine_direction_cell').toggle();
|
||||
}); // end $.live()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the "Change parameter type" functionality.
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$('select[name^=routine_param_type]').live('change', function() {
|
||||
/**
|
||||
* @var $row jQuery object containing the reference to
|
||||
* a row in the routine parameters table.
|
||||
*/
|
||||
var $row = $(this).parents('tr').first();
|
||||
setOptionsForParameter(
|
||||
$row.find('select[name^=routine_param_type]'),
|
||||
$row.find('input[name^=routine_param_length]'),
|
||||
$row.find('select[name^=routine_param_opts_text]'),
|
||||
$row.find('select[name^=routine_param_opts_num]')
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the "Change the type of return
|
||||
* variable of function" functionality.
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$('select[name=routine_returntype]').live('change', function() {
|
||||
setOptionsForParameter(
|
||||
$('.rte_table').find('select[name=routine_returntype]'),
|
||||
$('.rte_table').find('input[name=routine_returnlength]'),
|
||||
$('.rte_table').find('select[name=routine_returnopts_text]'),
|
||||
$('.rte_table').find('select[name=routine_returnopts_num]')
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the Execute routine functionality.
|
||||
*
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
* @uses PMA_ajaxRemoveMessage()
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$('.exec_routine_anchor').live('click', function(event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var $msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user.
|
||||
*/
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages['strLoading']);
|
||||
$.get($(this).attr('href'), {'ajax_request': true}, function(data) {
|
||||
if(data.success == true) {
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
if (data.dialog) {
|
||||
button_options[PMA_messages['strGo']] = function() {
|
||||
/**
|
||||
* @var data Form data to be sent in the AJAX request.
|
||||
*/
|
||||
var data = $('.rte_form').last().serialize();
|
||||
$msg = PMA_ajaxShowMessage(PMA_messages['strLoading']);
|
||||
$.post('db_routines.php', data, function (data) {
|
||||
if(data.success == true) {
|
||||
// Routine executed successfully
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
PMA_slidingMessage(data.message);
|
||||
$ajaxDialog.dialog('close');
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
button_options[PMA_messages['strClose']] = function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
/**
|
||||
* Display the dialog to the user
|
||||
*/
|
||||
$ajaxDialog = $('<div>'+data.message+'</div>').dialog({
|
||||
width: 650, // TODO: make a better decision about the size
|
||||
// of the dialog based on the size of the viewport
|
||||
buttons: button_options,
|
||||
title: data.title,
|
||||
modal: true,
|
||||
close: function () {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
$ajaxDialog.find('input[name^=params]').first().focus();
|
||||
} else {
|
||||
// Routine executed successfully
|
||||
PMA_slidingMessage(data.message);
|
||||
}
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for input fields in the routines editor
|
||||
* and the routine execution dialog used to submit the Ajax request
|
||||
* when the ENTER key is pressed.
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$('input[name^=routine], input[name^=params]').live('keydown', function(e) {
|
||||
if (e.which == 13) {
|
||||
e.preventDefault();
|
||||
if (typeof button_options[PMA_messages['strGo']] == 'function') {
|
||||
button_options[PMA_messages['strGo']].call();
|
||||
}
|
||||
}
|
||||
});
|
||||
}); // end of $(document).ready() for the Routine Functionalities
|
||||
@ -57,15 +57,18 @@ $(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);
|
||||
$url = $url.substring(15);
|
||||
}
|
||||
|
||||
if ($("#insert_table_dialog").length > 0) {
|
||||
$("#insert_table_dialog").remove();
|
||||
}
|
||||
var $div = $('<div id="insert_table_dialog"></div>');
|
||||
var target = "tbl_change.php";
|
||||
|
||||
@ -110,10 +113,12 @@ $(document).ready(function() {
|
||||
$dialog.find("#topmenucontainer").hide();
|
||||
//Adding the datetime pikers for the dialog
|
||||
$dialog.find('.datefield, .datetimefield').each(function () {
|
||||
PMA_addDatepicker($(this));
|
||||
PMA_addDatepicker($(this));
|
||||
});
|
||||
$(".insertRowTable").addClass("ajax");
|
||||
$("#buttonYes").addClass("ajax");
|
||||
$div = $("#insert_table_dialog");
|
||||
PMA_convertFootnotesToTooltips($div);
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.get()
|
||||
@ -139,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"
|
||||
|
||||
@ -165,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 {
|
||||
@ -175,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()
|
||||
});
|
||||
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
|
||||
@ -1223,6 +1223,7 @@ function changeMIMEType(db, table, reference, mime_type)
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
$(".inline_edit_sql").live('click', function(){
|
||||
var server = $(this).prev().find("input[name='server']").val();
|
||||
var db = $(this).prev().find("input[name='db']").val();
|
||||
var table = $(this).prev().find("input[name='table']").val();
|
||||
var token = $(this).prev().find("input[name='token']").val();
|
||||
@ -1238,7 +1239,8 @@ $(document).ready(function(){
|
||||
$(this).click(function(){
|
||||
sql_query = $(this).prev().val();
|
||||
window.location.replace("import.php"
|
||||
+ "?db=" + encodeURIComponent(db)
|
||||
+ "?server=" + encodeURIComponent(server)
|
||||
+ "&db=" + encodeURIComponent(db)
|
||||
+ "&table=" + encodeURIComponent(table)
|
||||
+ "&sql_query=" + encodeURIComponent(sql_query)
|
||||
+ "&show_query=1"
|
||||
@ -2289,7 +2291,9 @@ function displayMoreTableOpts() {
|
||||
}
|
||||
|
||||
}
|
||||
$(document).ready(initTooltips);
|
||||
$(document).ready(function(){
|
||||
PMA_convertFootnotesToTooltips();
|
||||
});
|
||||
|
||||
/**
|
||||
* Ensures indexes names are valid according to their type and, for a primary
|
||||
@ -2325,27 +2329,53 @@ function checkIndexName(form_id)
|
||||
return true;
|
||||
} // end of the 'checkIndexName()' function
|
||||
|
||||
|
||||
/* Displays tooltips */
|
||||
function initTooltips() {
|
||||
/**
|
||||
* 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
|
||||
* the footnotes in the whole body
|
||||
**/
|
||||
function PMA_convertFootnotesToTooltips($div) {
|
||||
// Hide the footnotes from the footer (which are displayed for
|
||||
// JavaScript-disabled browsers) since the tooltip is sufficient
|
||||
$(".footnotes").hide();
|
||||
$(".footnotes span").each(function() {
|
||||
|
||||
if ($div == undefined || ! $div instanceof jQuery || $div.length == 0) {
|
||||
$div = $("#serverinfo").parent();
|
||||
}
|
||||
|
||||
$footnotes = $div.find(".footnotes");
|
||||
|
||||
$footnotes.hide();
|
||||
$footnotes.find('span').each(function() {
|
||||
$(this).children("sup").remove();
|
||||
});
|
||||
// The border and padding must be removed otherwise a thin yellow box remains visible
|
||||
$(".footnotes").css("border", "none");
|
||||
$(".footnotes").css("padding", "0px");
|
||||
$footnotes.css("border", "none");
|
||||
$footnotes.css("padding", "0px");
|
||||
|
||||
// Replace the superscripts with the help icon
|
||||
$("sup[class~='footnotemarker']").hide();
|
||||
$("img[class~='footnotemarker']").show();
|
||||
$div.find("sup.footnotemarker").hide();
|
||||
$div.find("img.footnotemarker").show();
|
||||
|
||||
$("img[class~='footnotemarker']").each(function() {
|
||||
var span_id = $(this).attr("id");
|
||||
span_id = span_id.split("_")[1];
|
||||
var tooltip_text = $(".footnotes span[id='footnote_" + span_id + "']").html();
|
||||
$div.find("img.footnotemarker").each(function() {
|
||||
var img_class = $(this).attr("class");
|
||||
/** 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++) {
|
||||
if (img_class[i].split("_")[0] == "footnote") {
|
||||
var span_id = img_class[i].split("_")[1];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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", 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();
|
||||
$(this).qtip({
|
||||
content: tooltip_text,
|
||||
show: { delay: 0 },
|
||||
@ -2926,3 +2956,42 @@ $(document).ready(function() {
|
||||
}; //end noSelect
|
||||
})(jQuery);
|
||||
|
||||
/**
|
||||
* Create default PMA tooltip for the element specified. The default appearance
|
||||
* can be overriden by specifying optional "options" parameter (see qTip options).
|
||||
*/
|
||||
function PMA_createqTip($elements, content, options) {
|
||||
var o = {
|
||||
content: content,
|
||||
style: {
|
||||
background: '#333',
|
||||
border: {
|
||||
radius: 5
|
||||
},
|
||||
fontSize: '0.8em',
|
||||
padding: '0 0.5em',
|
||||
name: 'dark'
|
||||
},
|
||||
position: {
|
||||
target: 'mouse',
|
||||
corner: { target: 'rightMiddle', tooltip: 'leftMiddle' },
|
||||
adjust: { x: 20 }
|
||||
},
|
||||
show: {
|
||||
delay: 0,
|
||||
effect: {
|
||||
type: 'grow',
|
||||
length: 100
|
||||
}
|
||||
},
|
||||
hide: {
|
||||
effect: {
|
||||
type: 'grow',
|
||||
length: 150
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$elements.qtip($.extend(true, o, options));
|
||||
}
|
||||
|
||||
|
||||
2
js/jquery/jquery.qtip-1.0.0.min.js
vendored
2
js/jquery/jquery.qtip-1.0.0.min.js
vendored
File diff suppressed because one or more lines are too long
@ -10,17 +10,16 @@
|
||||
colOrder: new Array(), // array of column order
|
||||
colVisib: new Array(), // array of column visibility
|
||||
tableCreateTime: null, // table creation time, only available in "Browse tab"
|
||||
hintShown: false, // true if hint balloon is shown, used by updateHint() method
|
||||
qtip: null, // qtip API
|
||||
reorderHint: '', // string, hint for column reordering
|
||||
sortHint: '', // string, hint for column sorting
|
||||
markHint: '', // string, hint for column marking
|
||||
colVisibHint: '', // string, hint for column visibility drop-down
|
||||
showAllColText: '', // string, text for "show all" button under column visibility list
|
||||
showReorderHint: false,
|
||||
showSortHint: false,
|
||||
showMarkHint: false,
|
||||
showColVisibHint: false,
|
||||
hintIsHiding: false, // true when hint is still shown, but hideHint() already called
|
||||
showAllColText: '', // string, text for "show all" button under column visibility list
|
||||
visibleHeadersCount: 0, // number of visible data headers
|
||||
|
||||
// functions
|
||||
@ -63,8 +62,8 @@
|
||||
objTop: objPos.top,
|
||||
objLeft: objPos.left
|
||||
};
|
||||
this.qtip.hide();
|
||||
$('body').css('cursor', 'move');
|
||||
this.hideHint();
|
||||
$('body').noSelect();
|
||||
},
|
||||
|
||||
@ -166,7 +165,7 @@
|
||||
*/
|
||||
reposRsz: function() {
|
||||
$(this.cRsz).find('div').hide();
|
||||
$firstRowCols = $(this.t).find('tr:first th.draggable:visible');
|
||||
var $firstRowCols = $(this.t).find('tr:first th.draggable:visible');
|
||||
for (var n = 0; n < $firstRowCols.length; n++) {
|
||||
$this = $($firstRowCols[n]);
|
||||
$cb = $(g.cRsz).find('div:eq(' + n + ')'); // column border
|
||||
@ -301,9 +300,10 @@
|
||||
},
|
||||
|
||||
/**
|
||||
* Show hint with the text supplied.
|
||||
* Update current hint using the boolean values (showReorderHint, showSortHint, etc.).
|
||||
* It will hide the hint if all the boolean values is false.
|
||||
*/
|
||||
showHint: function(e) {
|
||||
updateHint: function(e) {
|
||||
if (!this.colRsz && !this.colMov) { // if not resizing or dragging
|
||||
var text = '';
|
||||
if (this.showReorderHint && this.reorderHint) {
|
||||
@ -325,53 +325,14 @@
|
||||
}
|
||||
|
||||
// hide the hint if no text
|
||||
if (!text) {
|
||||
this.hideHint();
|
||||
return;
|
||||
}
|
||||
this.qtip.disable(!text && e.type == 'mouseenter');
|
||||
|
||||
$(this.dHint).html(text);
|
||||
if (!this.hintShown || this.hintIsHiding) {
|
||||
$(this.dHint)
|
||||
.stop(true, true)
|
||||
.css({
|
||||
top: e.clientY,
|
||||
left: e.clientX + 15
|
||||
})
|
||||
.show('fast');
|
||||
this.hintShown = true;
|
||||
this.hintIsHiding = false;
|
||||
}
|
||||
this.qtip.updateContent(text, false);
|
||||
} else {
|
||||
this.qtip.disable(true);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Hide the hint.
|
||||
*/
|
||||
hideHint: function() {
|
||||
if (this.hintShown) {
|
||||
$(this.dHint)
|
||||
.stop(true, true)
|
||||
.hide(300, function() {
|
||||
g.hintShown = false;
|
||||
g.hintIsHiding = false;
|
||||
});
|
||||
this.hintIsHiding = true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update hint position.
|
||||
*/
|
||||
updateHint: function(e) {
|
||||
if (this.hintShown) {
|
||||
$(this.dHint).css({
|
||||
top: e.clientY,
|
||||
left: e.clientX + 15
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Toggle column's visibility.
|
||||
* After calling this function and it returns true, afterToggleCol() must be called.
|
||||
@ -487,7 +448,6 @@
|
||||
g.cRsz = document.createElement('div'); // column resizer
|
||||
g.cCpy = document.createElement('div'); // column copy, to store copy of dragged column header
|
||||
g.cPointer = document.createElement('div'); // column pointer, used when reordering column
|
||||
g.dHint = document.createElement('div'); // draggable hint
|
||||
g.cDrop = document.createElement('div'); // column drop-down arrows
|
||||
g.cList = document.createElement('div'); // column visibility list
|
||||
|
||||
@ -499,10 +459,6 @@
|
||||
g.cPointer.className = 'cPointer';
|
||||
$(g.cPointer).css('visibility', 'hidden');
|
||||
|
||||
// adjust g.dHint
|
||||
g.dHint.className = 'dHint';
|
||||
$(g.dHint).hide();
|
||||
|
||||
// adjust g.cDrop
|
||||
g.cDrop.className = 'cDrop';
|
||||
|
||||
@ -632,6 +588,14 @@
|
||||
});
|
||||
g.reposRsz();
|
||||
|
||||
// bind event to update currently hovered qtip API
|
||||
$(t).find('th').mouseenter(function(e) {
|
||||
g.qtip = $(this).qtip('api');
|
||||
});
|
||||
|
||||
// create qtip for each <th> with draggable class
|
||||
PMA_createqTip($(t).find('th.draggable'));
|
||||
|
||||
// register events
|
||||
if (g.reorderHint) { // make sure columns is reorderable
|
||||
$(t).find('th.draggable')
|
||||
@ -647,46 +611,47 @@
|
||||
} else {
|
||||
$(this).css('cursor', 'inherit');
|
||||
}
|
||||
g.showHint(e);
|
||||
g.updateHint(e);
|
||||
})
|
||||
.mouseleave(function(e) {
|
||||
g.showReorderHint = false;
|
||||
g.showHint(e);
|
||||
g.updateHint(e);
|
||||
});
|
||||
}
|
||||
if ($firstRowCols.length > 1) {
|
||||
$(t).find('th:not(.draggable)')
|
||||
.mouseenter(function(e) {
|
||||
var $colVisibTh = $(t).find('th:not(.draggable)');
|
||||
|
||||
PMA_createqTip($colVisibTh);
|
||||
$colVisibTh.mouseenter(function(e) {
|
||||
g.showColVisibHint = true;
|
||||
g.showHint(e);
|
||||
g.updateHint(e);
|
||||
})
|
||||
.mouseleave(function(e) {
|
||||
g.showColVisibHint = false;
|
||||
g.showHint(e);
|
||||
g.updateHint(e);
|
||||
});
|
||||
}
|
||||
$(t).find('th.draggable a')
|
||||
.attr('title', '') // hide default tooltip for sorting
|
||||
.mouseenter(function(e) {
|
||||
g.showSortHint = true;
|
||||
g.showHint(e);
|
||||
g.updateHint(e);
|
||||
})
|
||||
.mouseleave(function(e) {
|
||||
g.showSortHint = false;
|
||||
g.showHint(e);
|
||||
g.updateHint(e);
|
||||
});
|
||||
$(t).find('th.marker')
|
||||
.mouseenter(function(e) {
|
||||
g.showMarkHint = true;
|
||||
g.showHint(e);
|
||||
g.updateHint(e);
|
||||
})
|
||||
.mouseleave(function(e) {
|
||||
g.showMarkHint = false;
|
||||
g.showHint(e);
|
||||
g.updateHint(e);
|
||||
});
|
||||
$(document).mousemove(function(e) {
|
||||
g.dragMove(e);
|
||||
g.updateHint(e);
|
||||
});
|
||||
$(document).mouseup(function(e) {
|
||||
g.dragEnd(e);
|
||||
@ -708,7 +673,6 @@
|
||||
$(g.gDiv).append(g.cPointer);
|
||||
$(g.gDiv).append(g.cDrop);
|
||||
$(g.gDiv).append(g.cList);
|
||||
$(g.gDiv).append(g.dHint);
|
||||
$(g.gDiv).append(g.cCpy);
|
||||
|
||||
// some adjustment
|
||||
|
||||
@ -19,6 +19,8 @@ header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT');
|
||||
// non-js-compatible stuff like DOCTYPE
|
||||
define('PMA_MINIMUM_COMMON', true);
|
||||
require_once './libraries/common.inc.php';
|
||||
// Close session early as we won't write anything there
|
||||
session_write_close();
|
||||
// But this one is needed for PMA_escapeJsString()
|
||||
require_once './libraries/js_escape.lib.php';
|
||||
|
||||
@ -126,7 +128,7 @@ $js_messages['strEnableVar'] = __('Enable %s');
|
||||
$js_messages['strDisableVar'] = __('Disable %s');
|
||||
/* l10n: %d seconds */
|
||||
$js_messages['setSetLongQueryTime'] = __('Set long_query_time to %ds');
|
||||
$js_messages['strNoSuperUser'] = __('You don\'t have super user rights to change this variables. Please log in as root account or contact your database administrator.');
|
||||
$js_messages['strNoSuperUser'] = __('You can\'t change these variables. Please log in as root or contact your database administrator.');
|
||||
$js_messages['strChangeSettings'] = __('Change settings');
|
||||
$js_messages['strCurrentSettings'] = __('Current settings');
|
||||
|
||||
|
||||
@ -527,6 +527,7 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
displayPasswordGenerateButton();
|
||||
}, 'top.frame_content'); //end $(document).ready()
|
||||
|
||||
/**#@- */
|
||||
|
||||
60
js/sql.js
60
js/sql.js
@ -223,7 +223,7 @@ $(document).ready(function() {
|
||||
$("#sqlqueryform.ajax").live('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
$form = $(this);
|
||||
var $form = $(this);
|
||||
if (! checkSqlQuery($form[0])) {
|
||||
return false;
|
||||
}
|
||||
@ -232,11 +232,12 @@ $(document).ready(function() {
|
||||
$('.error').remove();
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
var $sqlqueryresults = $('#sqlqueryresults');
|
||||
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
|
||||
$.post($(this).attr('action'), $(this).serialize() , function(data) {
|
||||
if(data.success == true) {
|
||||
$.post($form.attr('action'), $form.serialize() , function(data) {
|
||||
if (data.success == true) {
|
||||
// fade out previous messages, if any
|
||||
$('.success').fadeOut();
|
||||
$('.sqlquery_message').fadeOut();
|
||||
@ -250,7 +251,7 @@ $(document).ready(function() {
|
||||
} else {
|
||||
$('#sqlqueryform').before(data.message);
|
||||
}
|
||||
$('#sqlqueryresults').show();
|
||||
$sqlqueryresults.show();
|
||||
// this happens if a USE command was typed
|
||||
if (typeof data.reload != 'undefined') {
|
||||
// Unbind the submit event before reloading. See bug #3295529
|
||||
@ -267,25 +268,25 @@ $(document).ready(function() {
|
||||
else if (data.success == false ) {
|
||||
// show an error message that stays on screen
|
||||
$('#sqlqueryform').before(data.error);
|
||||
$('#sqlqueryresults').hide();
|
||||
$sqlqueryresults.hide();
|
||||
}
|
||||
else {
|
||||
// real results are returned
|
||||
// fade out previous messages, if any
|
||||
$('.success').fadeOut();
|
||||
$('.sqlquery_message').fadeOut();
|
||||
$received_data = $(data);
|
||||
$zero_row_results = $received_data.find('textarea[name="sql_query"]');
|
||||
var $received_data = $(data);
|
||||
var $zero_row_results = $received_data.find('textarea[name="sql_query"]');
|
||||
// if zero rows are returned from the query execution
|
||||
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();
|
||||
$sqlqueryresults.html(data);
|
||||
$sqlqueryresults.trigger('appendAnchor');
|
||||
$sqlqueryresults.trigger('makegrid');
|
||||
$('#togglequerybox').show();
|
||||
if($("#togglequerybox").siblings(":visible").length > 0) {
|
||||
if ($("#togglequerybox").siblings(":visible").length > 0) {
|
||||
$("#togglequerybox").trigger('click');
|
||||
}
|
||||
PMA_init_slider();
|
||||
@ -315,16 +316,18 @@ $(document).ready(function() {
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
/**
|
||||
* @var $the_form Object referring to the form element that paginates the results table
|
||||
* @var $form Object referring to the form element that paginates the results table
|
||||
*/
|
||||
var $the_form = $(this).parent("form");
|
||||
var $form = $(this).parent("form");
|
||||
|
||||
$the_form.append('<input type="hidden" name="ajax_request" value="true" />');
|
||||
var $sqlqueryresults = $("#sqlqueryresults");
|
||||
|
||||
$.post($the_form.attr('action'), $the_form.serialize(), function(data) {
|
||||
$("#sqlqueryresults").html(data);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
$("#sqlqueryresults").trigger('makegrid');
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
|
||||
$.post($form.attr('action'), $form.serialize(), function(data) {
|
||||
$sqlqueryresults.html(data);
|
||||
$sqlqueryresults.trigger('appendAnchor');
|
||||
$sqlqueryresults.trigger('makegrid');
|
||||
PMA_init_slider();
|
||||
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
@ -976,7 +979,7 @@ $(document).ready(function() {
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.get()
|
||||
} else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages['strNoRowSelected']);
|
||||
}
|
||||
});
|
||||
@ -1174,9 +1177,10 @@ function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings,
|
||||
}
|
||||
|
||||
/**
|
||||
* Starting from some th, change the class of all td under it
|
||||
* Starting from some th, change the class of all td under it.
|
||||
* If isAddClass is specified, it will be used to determine whether to add or remove the class.
|
||||
*/
|
||||
function PMA_changeClassForColumn($this_th, newclass) {
|
||||
function PMA_changeClassForColumn($this_th, newclass, isAddClass) {
|
||||
// index 0 is the th containing the big T
|
||||
var th_index = $this_th.index();
|
||||
var has_big_t = !$this_th.closest('tr').children(':first').hasClass('column_heading');
|
||||
@ -1185,12 +1189,10 @@ function PMA_changeClassForColumn($this_th, newclass) {
|
||||
th_index--;
|
||||
}
|
||||
var $tds = $this_th.closest('table').find('tbody tr').find('td.data:eq('+th_index+')');
|
||||
if ($this_th.data('has_class_'+newclass)) {
|
||||
$tds.removeClass(newclass);
|
||||
$this_th.data('has_class_'+newclass, false);
|
||||
if (isAddClass == undefined) {
|
||||
$tds.toggleClass(newclass);
|
||||
} else {
|
||||
$tds.addClass(newclass);
|
||||
$this_th.data('has_class_'+newclass, true);
|
||||
$tds.toggleClass(newclass, isAddClass);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1207,8 +1209,8 @@ $(document).ready(function() {
|
||||
/**
|
||||
* vertical column highlighting in horizontal mode when hovering over the column header
|
||||
*/
|
||||
$('.column_heading.pointer').live('hover', function() {
|
||||
PMA_changeClassForColumn($(this), 'hover');
|
||||
$('.column_heading.pointer').live('hover', function(e) {
|
||||
PMA_changeClassForColumn($(this), 'hover', e.type == 'mouseenter');
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@ -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']);
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
*
|
||||
* Configuration handling.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
@ -350,21 +350,16 @@ class PMA_Config
|
||||
$cfg = array();
|
||||
|
||||
/**
|
||||
* Parses the configuration file
|
||||
* Parses the configuration file, the eval is used here to avoid
|
||||
* problems with trailing whitespace, what is often a problem.
|
||||
*/
|
||||
$old_error_reporting = error_reporting(0);
|
||||
if (function_exists('file_get_contents')) {
|
||||
$eval_result =
|
||||
eval('?' . '>' . trim(file_get_contents($this->getSource())));
|
||||
} else {
|
||||
$eval_result =
|
||||
eval('?' . '>' . trim(implode("\n", file($this->getSource()))));
|
||||
}
|
||||
$eval_result = eval('?' . '>' . trim(file_get_contents($this->getSource())));
|
||||
error_reporting($old_error_reporting);
|
||||
|
||||
if ($eval_result === false) {
|
||||
$this->error_config_file = true;
|
||||
} else {
|
||||
} else {
|
||||
$this->error_config_file = false;
|
||||
$this->source_mtime = filemtime($this->getSource());
|
||||
}
|
||||
@ -679,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()
|
||||
{
|
||||
@ -696,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -980,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();
|
||||
}
|
||||
}
|
||||
@ -1073,7 +1067,9 @@ class PMA_Config
|
||||
/**
|
||||
* @todo finish
|
||||
*/
|
||||
function save() {}
|
||||
function save()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* returns options for font size selection
|
||||
|
||||
@ -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
|
||||
@ -73,7 +72,7 @@ class PMA_File
|
||||
/**
|
||||
* @staticvar string most recent BLOB repository reference
|
||||
*/
|
||||
static $_recent_bs_reference = NULL;
|
||||
static $_recent_bs_reference = null;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -254,11 +252,11 @@ class PMA_File
|
||||
$tmp_file_type = $file['type'];
|
||||
|
||||
if (! $tmp_file_type) {
|
||||
$tmp_file_type = NULL;
|
||||
$tmp_file_type = null;
|
||||
}
|
||||
|
||||
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]
|
||||
* </code>
|
||||
*
|
||||
* @todo re-check if requirements changes to PHP >= 4.2.0
|
||||
* @access public
|
||||
* @static
|
||||
* @param array $file the array
|
||||
@ -384,11 +381,11 @@ class PMA_File
|
||||
}
|
||||
|
||||
if (! $tmp_file_type) {
|
||||
$tmp_file_type = NULL;
|
||||
$tmp_file_type = null;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -828,7 +824,7 @@ class PMA_File
|
||||
static function getRecentBLOBReference()
|
||||
{
|
||||
$ref = PMA_File::$_recent_bs_reference;
|
||||
PMA_File::$_recent_bs_reference = NULL;
|
||||
PMA_File::$_recent_bs_reference = null;
|
||||
|
||||
return $ref;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1370,7 +1370,7 @@ class PMA_Table
|
||||
* @param string $table_create_time Needed for PROP_COLUMN_ORDER and PROP_COLUMN_VISIB
|
||||
* @return boolean|PMA_Message
|
||||
*/
|
||||
public function setUiProp($property, $value, $table_create_time = NULL)
|
||||
public function setUiProp($property, $value, $table_create_time = null)
|
||||
{
|
||||
if (! isset($this->uiprefs)) {
|
||||
$this->loadUiPrefs();
|
||||
|
||||
@ -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]);
|
||||
|
||||
@ -179,7 +179,7 @@ function checkBLOBStreamingPlugins()
|
||||
$PMA_Config->set('FILEINFO_EXISTS', false);
|
||||
|
||||
// check if PECL's fileinfo library exist
|
||||
$finfo = NULL;
|
||||
$finfo = null;
|
||||
|
||||
if (function_exists("finfo_open")) {
|
||||
$finfo = finfo_open(FILEINFO_MIME);
|
||||
|
||||
@ -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') . ')';
|
||||
}
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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)
|
||||
@ -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 <a> 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 <a> tag should be returned
|
||||
*
|
||||
* @return string the html link
|
||||
*
|
||||
@ -459,18 +459,13 @@ function PMA_showHint($message, $bbcode = false, $type = 'notice')
|
||||
$GLOBALS['footnotes'] = array();
|
||||
}
|
||||
$nr = count($GLOBALS['footnotes']) + 1;
|
||||
// this is the first instance of this message
|
||||
$instance = 1;
|
||||
$GLOBALS['footnotes'][$key] = array(
|
||||
'note' => $message,
|
||||
'type' => $type,
|
||||
'nr' => $nr,
|
||||
'instance' => $instance
|
||||
);
|
||||
} else {
|
||||
$nr = $GLOBALS['footnotes'][$key]['nr'];
|
||||
// another instance of this message (to ensure ids are unique)
|
||||
$instance = ++$GLOBALS['footnotes'][$key]['instance'];
|
||||
}
|
||||
|
||||
if ($bbcode) {
|
||||
@ -479,7 +474,7 @@ function PMA_showHint($message, $bbcode = false, $type = 'notice')
|
||||
|
||||
// footnotemarker used in js/tooltip.js
|
||||
return '<sup class="footnotemarker">' . $nr . '</sup>' .
|
||||
'<img class="footnotemarker ic_b_help" id="footnote_' . $nr . '_' . $instance . '" src="themes/dot.gif" alt="" />';
|
||||
'<img class="footnotemarker footnote_' . $nr . ' ic_b_help" src="themes/dot.gif" alt="" />';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1338,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
|
||||
*
|
||||
@ -1347,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);
|
||||
}
|
||||
|
||||
@ -1387,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
|
||||
@ -1396,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;
|
||||
@ -1842,7 +1837,6 @@ function PMA_flipstring($string, $Separator = "<br />\n")
|
||||
* Not sure we could use a strMissingParameter message here,
|
||||
* would have to check if the error message file is always available
|
||||
*
|
||||
* @todo localize error message
|
||||
* @todo use PMA_fatalError() if $die === true?
|
||||
* @param array $params The names of the parameters needed by the calling script.
|
||||
* @param bool $die Stop the execution?
|
||||
@ -1873,7 +1867,8 @@ function PMA_checkParameters($params, $die = true, $request = true)
|
||||
|
||||
if (! isset($GLOBALS[$param])) {
|
||||
$error_message .= $reported_script_name
|
||||
. ': Missing parameter: ' . $param
|
||||
. ': ' . __('Missing parameter:') . ' '
|
||||
. $param
|
||||
. PMA_showDocu('faqmissingparameters')
|
||||
. '<br />';
|
||||
$found_error = true;
|
||||
@ -2748,7 +2743,7 @@ function PMA_expandUserString($string, $escape = null, $updates = array()) {
|
||||
$vars['phpmyadmin_version'] = 'phpMyAdmin ' . PMA_VERSION;
|
||||
|
||||
/* Update forced variables */
|
||||
foreach($updates as $key => $val) {
|
||||
foreach ($updates as $key => $val) {
|
||||
$vars[$key] = $val;
|
||||
}
|
||||
|
||||
@ -2772,7 +2767,7 @@ function PMA_expandUserString($string, $escape = null, $updates = array()) {
|
||||
|
||||
/* Optional escaping */
|
||||
if (!is_null($escape)) {
|
||||
foreach($replace as $key => $val) {
|
||||
foreach ($replace as $key => $val) {
|
||||
$replace[$key] = $escape($val);
|
||||
}
|
||||
}
|
||||
@ -2845,7 +2840,9 @@ function PMA_ajaxResponse($message, $success = true, $extra_data = array())
|
||||
header("Content-Type: application/json");
|
||||
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
|
||||
if(!defined('TESTSUITE'))
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -224,8 +224,10 @@ function PMA_fatalError($error_message, $message_args = null)
|
||||
}
|
||||
|
||||
require('./libraries/error.inc.php');
|
||||
|
||||
exit;
|
||||
|
||||
if (!defined('TESTSUITE')) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -364,7 +364,7 @@ function PMA_DBI_get_tables_full($database, $table = false, $tbl_is_group = fals
|
||||
unset($sql_where_table, $sql);
|
||||
if ($sort_by == 'Name' && $GLOBALS['cfg']['NaturalOrder']) {
|
||||
// here, the array's first key is by schema name
|
||||
foreach($tables as $one_database_name => $one_database_tables) {
|
||||
foreach ($tables as $one_database_name => $one_database_tables) {
|
||||
uksort($one_database_tables, 'strnatcasecmp');
|
||||
|
||||
if ($sort_order == 'DESC') {
|
||||
@ -472,7 +472,7 @@ function PMA_DBI_get_tables_full($database, $table = false, $tbl_is_group = fals
|
||||
$each_tables[$table_name]['TABLE_COMMENT'] =& $each_tables[$table_name]['Comment'];
|
||||
|
||||
if (strtoupper($each_tables[$table_name]['Comment']) === 'VIEW'
|
||||
&& $each_tables[$table_name]['Engine'] == NULL) {
|
||||
&& $each_tables[$table_name]['Engine'] == null) {
|
||||
$each_tables[$table_name]['TABLE_TYPE'] = 'VIEW';
|
||||
} else {
|
||||
/**
|
||||
@ -494,7 +494,7 @@ function PMA_DBI_get_tables_full($database, $table = false, $tbl_is_group = fals
|
||||
// Note 2: Instead of array_merge(), simply use the + operator because
|
||||
// array_merge() renumbers numeric keys starting with 0, therefore
|
||||
// we would lose a db name thats consists only of numbers
|
||||
foreach($tables as $one_database => $its_tables) {
|
||||
foreach ($tables as $one_database => $its_tables) {
|
||||
if (isset(PMA_Table::$cache[$one_database])) {
|
||||
PMA_Table::$cache[$one_database] = PMA_Table::$cache[$one_database] + $tables[$one_database];
|
||||
} else {
|
||||
@ -769,7 +769,7 @@ function PMA_DBI_get_columns_full($database = null, $table = null,
|
||||
$sql = 'SHOW FULL COLUMNS FROM '
|
||||
. PMA_backquote($database) . '.' . PMA_backquote($table);
|
||||
if (null !== $column) {
|
||||
$sql .= " LIKE '" . $column . "'";
|
||||
$sql .= " LIKE '" . PMA_sqlAddSlashes($column, true) . "'";
|
||||
}
|
||||
|
||||
$columns = PMA_DBI_fetch_result($sql, 'Field', null, $link);
|
||||
@ -1341,7 +1341,7 @@ function PMA_DBI_get_triggers($db, $table = '', $delimiter = '//')
|
||||
|
||||
// Sort results by name
|
||||
$name = array();
|
||||
foreach($result as $key => $value) {
|
||||
foreach ($result as $key => $value) {
|
||||
$name[] = $value['name'];
|
||||
}
|
||||
array_multisort($name, SORT_ASC, $result);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -28,12 +28,12 @@ require_once './libraries/Index.class.php';
|
||||
* the "display printable view" option.
|
||||
* Of course '0'/'1' means the feature won't/will be enabled.
|
||||
*
|
||||
* @param string the synthetic value for display_mode (see a few
|
||||
* lines above for explanations)
|
||||
* @param integer the total number of rows returned by the SQL query
|
||||
* without any programmatically appended "LIMIT" clause
|
||||
* (just a copy of $unlim_num_rows if it exists, else
|
||||
* computed inside this function)
|
||||
* @param string &$the_disp_mode the synthetic value for display_mode (see a few
|
||||
* lines above for explanations)
|
||||
* @param integer &$the_total the total number of rows returned by the SQL query
|
||||
* without any programmatically appended "LIMIT" clause
|
||||
* (just a copy of $unlim_num_rows if it exists, else
|
||||
* computed inside this function)
|
||||
*
|
||||
* @return array an array with explicit indexes for all the display
|
||||
* elements
|
||||
@ -70,8 +70,8 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
|
||||
// 2. Display mode is not "false for all elements" -> updates the
|
||||
// display mode
|
||||
if ($the_disp_mode != 'nnnn000000') {
|
||||
// 2.0 Print view -> set all elements to false!
|
||||
if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
|
||||
// 2.0 Print view -> set all elements to false!
|
||||
$do_display['edit_lnk'] = 'nn'; // no edit link
|
||||
$do_display['del_lnk'] = 'nn'; // no delete link
|
||||
$do_display['sort_lnk'] = (string) '0';
|
||||
@ -80,11 +80,10 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
|
||||
$do_display['bkm_form'] = (string) '0';
|
||||
$do_display['text_btn'] = (string) '0';
|
||||
$do_display['pview_lnk'] = (string) '0';
|
||||
}
|
||||
// 2.1 Statement is a "SELECT COUNT", a
|
||||
// "CHECK/ANALYZE/REPAIR/OPTIMIZE", an "EXPLAIN" one or
|
||||
// contains a "PROC ANALYSE" part
|
||||
elseif ($GLOBALS['is_count'] || $GLOBALS['is_analyse'] || $GLOBALS['is_maint'] || $GLOBALS['is_explain']) {
|
||||
} elseif ($GLOBALS['is_count'] || $GLOBALS['is_analyse'] || $GLOBALS['is_maint'] || $GLOBALS['is_explain']) {
|
||||
// 2.1 Statement is a "SELECT COUNT", a
|
||||
// "CHECK/ANALYZE/REPAIR/OPTIMIZE", an "EXPLAIN" one or
|
||||
// contains a "PROC ANALYSE" part
|
||||
$do_display['edit_lnk'] = 'nn'; // no edit link
|
||||
$do_display['del_lnk'] = 'nn'; // no delete link
|
||||
$do_display['sort_lnk'] = (string) '0';
|
||||
@ -97,9 +96,8 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
|
||||
$do_display['text_btn'] = (string) '0';
|
||||
}
|
||||
$do_display['pview_lnk'] = (string) '1';
|
||||
}
|
||||
// 2.2 Statement is a "SHOW..."
|
||||
elseif ($GLOBALS['is_show']) {
|
||||
} elseif ($GLOBALS['is_show']) {
|
||||
// 2.2 Statement is a "SHOW..."
|
||||
/**
|
||||
* 2.2.1
|
||||
* @todo defines edit/delete links depending on show statement
|
||||
@ -120,11 +118,10 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
|
||||
$do_display['bkm_form'] = (string) '1';
|
||||
$do_display['text_btn'] = (string) '1';
|
||||
$do_display['pview_lnk'] = (string) '1';
|
||||
}
|
||||
// 2.3 Other statements (ie "SELECT" ones) -> updates
|
||||
// $do_display['edit_lnk'], $do_display['del_lnk'] and
|
||||
// $do_display['text_btn'] (keeps other default values)
|
||||
else {
|
||||
} else {
|
||||
// 2.3 Other statements (ie "SELECT" ones) -> updates
|
||||
// $do_display['edit_lnk'], $do_display['del_lnk'] and
|
||||
// $do_display['text_btn'] (keeps other default values)
|
||||
$prev_table = $fields_meta[0]->table;
|
||||
$do_display['text_btn'] = (string) '1';
|
||||
for ($i = 0; $i < $GLOBALS['fields_cnt']; $i++) {
|
||||
@ -207,19 +204,19 @@ function PMA_isSelect()
|
||||
* Displays a navigation button
|
||||
*
|
||||
*
|
||||
* @param string iconic caption for button
|
||||
* @param string text for button
|
||||
* @param integer position for next query
|
||||
* @param string query ready for display
|
||||
* @param string optional onsubmit clause
|
||||
* @param string optional hidden field for special treatment
|
||||
* @param string optional onclick clause
|
||||
* @param string $caption iconic caption for button
|
||||
* @param string $title text for button
|
||||
* @param integer $pos position for next query
|
||||
* @param string $html_sql_query query ready for display
|
||||
* @param string $onsubmit optional onsubmit clause
|
||||
* @param string $input_for_real_end optional hidden field for special treatment
|
||||
* @param string $onclick optional onclick clause
|
||||
*
|
||||
* @global string $db the database name
|
||||
* @global string $table the table name
|
||||
* @global string $goto the URL to go back in case of errors
|
||||
* @global string $db the database name
|
||||
* @global string $table the table name
|
||||
* @global string $goto the URL to go back in case of errors
|
||||
*
|
||||
* @access private
|
||||
* @access private
|
||||
*
|
||||
* @see PMA_displayTableNavigation()
|
||||
*/
|
||||
@ -254,10 +251,10 @@ function PMA_displayTableNavigationOneButton($caption, $title, $pos, $html_sql_q
|
||||
/**
|
||||
* Displays a navigation bar to browse among the results of a SQL query
|
||||
*
|
||||
* @param integer the offset for the "next" page
|
||||
* @param integer the offset for the "previous" page
|
||||
* @param string the URL-encoded query
|
||||
* @param string the id for the direction dropdown
|
||||
* @param integer $pos_next the offset for the "next" page
|
||||
* @param integer $pos_prev the offset for the "previous" page
|
||||
* @param string $sql_query the URL-encoded query
|
||||
* @param string $id_for_direction_dropdown the id for the direction dropdown
|
||||
*
|
||||
* @global string $db the database name
|
||||
* @global string $table the table name
|
||||
@ -310,7 +307,7 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di
|
||||
$pageNow = @floor($_SESSION['tmp_user_values']['pos'] / $_SESSION['tmp_user_values']['max_rows']) + 1;
|
||||
$nbTotalPage = @ceil($unlim_num_rows / $_SESSION['tmp_user_values']['max_rows']);
|
||||
|
||||
if ($nbTotalPage > 1){ //if2
|
||||
if ($nbTotalPage > 1) { //if2
|
||||
?>
|
||||
<td>
|
||||
<?php
|
||||
@ -324,14 +321,14 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di
|
||||
// and also to know what to execute when the selector changes
|
||||
echo '<form action="sql.php' . PMA_generate_common_url($_url_params). '" method="post">';
|
||||
echo PMA_pageselector(
|
||||
$_SESSION['tmp_user_values']['max_rows'],
|
||||
$pageNow,
|
||||
$nbTotalPage,
|
||||
200,
|
||||
5,
|
||||
5,
|
||||
20,
|
||||
10
|
||||
$_SESSION['tmp_user_values']['max_rows'],
|
||||
$pageNow,
|
||||
$nbTotalPage,
|
||||
200,
|
||||
5,
|
||||
5,
|
||||
20,
|
||||
10
|
||||
);
|
||||
?>
|
||||
</form>
|
||||
@ -388,7 +385,7 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di
|
||||
} // end move toward
|
||||
|
||||
// show separator if pagination happen
|
||||
if ($nbTotalPage > 1){
|
||||
if ($nbTotalPage > 1) {
|
||||
echo '<td><div class="navigation_separator">|</div></td>';
|
||||
}
|
||||
?>
|
||||
@ -1391,7 +1388,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
||||
$is_field_truncated = false;
|
||||
//If the previous column had blob data, we need to reset the class
|
||||
// to $inline_edit_class
|
||||
$class = 'data ' . $inline_edit_class . ' ' . $not_null_class . ' ' . $relation_class; //' ' . $alternating_color_class .
|
||||
$class = 'data ' . $inline_edit_class . ' ' . $not_null_class . ' ' . $relation_class; //' ' . $alternating_color_class .
|
||||
|
||||
// See if this column should get highlight because it's used in the
|
||||
// where-query.
|
||||
@ -2139,7 +2136,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
|
||||
// find the sorted column index in row result
|
||||
// (this might be a multi-table query)
|
||||
$sorted_column_index = false;
|
||||
foreach($fields_meta as $key => $meta) {
|
||||
foreach ($fields_meta as $key => $meta) {
|
||||
if ($meta->table == $sort_table && $meta->name == $sort_column) {
|
||||
$sorted_column_index = $key;
|
||||
break;
|
||||
|
||||
@ -1,123 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$url_query .= '&goto=tbl_triggers.php';
|
||||
|
||||
$triggers = PMA_DBI_get_triggers($db, $table);
|
||||
|
||||
$conditional_class_add = '';
|
||||
$conditional_class_drop = '';
|
||||
$conditional_class_export = '';
|
||||
if ($GLOBALS['cfg']['AjaxEnable']) {
|
||||
$conditional_class_add = 'class="add_trigger_anchor"';
|
||||
$conditional_class_drop = 'class="drop_trigger_anchor"';
|
||||
$conditional_class_export = 'class="export_trigger_anchor"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the export for a trigger. This is for when JS is disabled.
|
||||
*/
|
||||
if (! empty($_GET['exporttrigger']) && ! empty($_GET['triggername'])) {
|
||||
$success = false;
|
||||
foreach ($triggers as $trigger) {
|
||||
if ($trigger['name'] === $_GET['triggername']) {
|
||||
$success = true;
|
||||
$trigger_name = htmlspecialchars(PMA_backquote($_GET['triggername']));
|
||||
$create_trig = '<textarea cols="40" rows="15" style="width: 100%;">' . $trigger['create'] . '</textarea>';
|
||||
if (! empty($_REQUEST['ajax_request'])) {
|
||||
$extra_data = array('title' => sprintf(__('Export of trigger %s'), $trigger_name));
|
||||
PMA_ajaxResponse($create_trig, true, $extra_data);
|
||||
} else {
|
||||
echo '<fieldset>' . "\n"
|
||||
. ' <legend>' . sprintf(__('Export of trigger "%s"'), $trigger_name) . '</legend>' . "\n"
|
||||
. $create_trig
|
||||
. '</fieldset>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $success) {
|
||||
$response = __('Error in Processing Request') . ' : '
|
||||
. sprintf(__('No trigger with name %s found'), $event_name);
|
||||
$response = PMA_message::error($response);
|
||||
if (! empty($_REQUEST['ajax_request'])) {
|
||||
PMA_ajaxResponse($response, false);
|
||||
} else {
|
||||
$response->display();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a list of available triggers
|
||||
*/
|
||||
echo "\n\n<span id='js_query_display'></span>\n\n";
|
||||
echo '<fieldset>' . "\n";
|
||||
echo ' <legend>' . __('Triggers') . '</legend>' . "\n";
|
||||
if (! $triggers) {
|
||||
echo __('There are no triggers to display.');
|
||||
} else {
|
||||
echo '<div class="hide" id="nothing2display">' . __('There are no triggers to display.') . '</div>';
|
||||
echo '<table class="data">' . "\n";
|
||||
|
||||
// Print table header
|
||||
echo "<tr>\n<th>" . __('Name') . "</th>\n";
|
||||
if (empty($table)) {
|
||||
// if we don't have a table name, we will be showing the per-database list.
|
||||
// so we must specify which table each trigger belongs to
|
||||
echo "<th>" . __('Table') . "</th>\n";
|
||||
}
|
||||
echo "<th colspan='3'>" . __('Action') . "</th>\n";
|
||||
echo "<th>" . __('Time') . "</th>\n";
|
||||
echo "<th>" . __('Event') . "</th>\n";
|
||||
echo "</tr>";
|
||||
|
||||
$ct=0;
|
||||
$delimiter = '//';
|
||||
// Print table contents
|
||||
foreach ($triggers as $trigger) {
|
||||
$drop_and_create = $trigger['drop'] . $delimiter . "\n" . $trigger['create'] . "\n";
|
||||
$row = ($ct%2 == 0) ? 'even' : 'odd';
|
||||
$editlink = PMA_linkOrButton('tbl_sql.php?' . $url_query . '&sql_query='
|
||||
. urlencode($drop_and_create) . '&show_query=1&delimiter=' . urlencode($delimiter), $titles['Edit']);
|
||||
$exprlink = '<a ' . $conditional_class_export . ' href="db_triggers.php?' . $url_query
|
||||
. '&exporttrigger=1'
|
||||
. '&triggername=' . urlencode($trigger['name'])
|
||||
. '">' . $titles['Export'] . '</a>';
|
||||
$droplink = '<a ' . $conditional_class_drop . ' href="sql.php?' . $url_query . '&sql_query='
|
||||
. urlencode($trigger['drop']) . '" >' . $titles['Drop'] . '</a>';
|
||||
|
||||
echo "<tr class='noclick $row'>\n";
|
||||
echo "<td><span class='drop_sql' style='display:none;'>{$trigger['drop']}</span>";
|
||||
echo "<strong>{$trigger['name']}</strong></td>\n";
|
||||
if (empty($table)) {
|
||||
echo "<td><a href='tbl_triggers.php?db=$db&table={$trigger['table']}'>";
|
||||
echo $trigger['table'] . "</a></td>\n";
|
||||
}
|
||||
echo "<td>$editlink</td>\n";
|
||||
echo "<td><div class='create_sql' style='display: none;'>{$trigger['create']}</div>$exprlink</td>\n";
|
||||
echo "<td>$droplink</td>\n";
|
||||
echo "<td>{$trigger['action_timing']}</td>\n";
|
||||
echo "<td>{$trigger['event_manipulation']}</td>\n";
|
||||
echo "</tr>\n";
|
||||
$ct++;
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
|
||||
/**
|
||||
* Display the form for adding a new trigger
|
||||
*/
|
||||
echo '<fieldset>' . "\n"
|
||||
. ' <a href="tbl_triggers.php?' . $url_query . '&addtrigger=1" class="' . $conditional_class_add . '">' . "\n"
|
||||
. PMA_getIcon('b_trigger_add.png') . __('Add a trigger') . '</a>' . "\n"
|
||||
. '</fieldset>' . "\n";
|
||||
|
||||
?>
|
||||
@ -123,12 +123,12 @@ function PMA_exportDBCreate($db)
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
global $CG_FORMATS, $CG_HANDLERS;
|
||||
$format = cgGetOption("format");
|
||||
$index = array_search($format, $CG_FORMATS);
|
||||
if ($index >= 0)
|
||||
return PMA_exportOutputHandler($CG_HANDLERS[$index]($db, $table, $crlf));
|
||||
return PMA_exportOutputHandler(sprintf("%s is not supported.", $format));
|
||||
global $CG_FORMATS, $CG_HANDLERS, $what;
|
||||
$format = $GLOBALS[$what . '_format'];
|
||||
if (isset($CG_FORMATS[$format])) {
|
||||
return PMA_exportOutputHandler($CG_HANDLERS[$format]($db, $table, $crlf));
|
||||
}
|
||||
return PMA_exportOutputHandler(sprintf("%s is not supported.", $format));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,162 +138,197 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
*/
|
||||
class TableProperty
|
||||
{
|
||||
public $name;
|
||||
public $type;
|
||||
public $nullable;
|
||||
public $key;
|
||||
public $defaultValue;
|
||||
public $ext;
|
||||
function __construct($row)
|
||||
{
|
||||
$this->name = trim($row[0]);
|
||||
$this->type = trim($row[1]);
|
||||
$this->nullable = trim($row[2]);
|
||||
$this->key = trim($row[3]);
|
||||
$this->defaultValue = trim($row[4]);
|
||||
$this->ext = trim($row[5]);
|
||||
}
|
||||
function getPureType()
|
||||
{
|
||||
$pos=strpos($this->type, "(");
|
||||
if ($pos > 0)
|
||||
return substr($this->type, 0, $pos);
|
||||
return $this->type;
|
||||
}
|
||||
function isNotNull()
|
||||
{
|
||||
return $this->nullable == "NO" ? "true" : "false";
|
||||
}
|
||||
function isUnique()
|
||||
{
|
||||
return $this->key == "PRI" || $this->key == "UNI" ? "true" : "false";
|
||||
}
|
||||
function getDotNetPrimitiveType()
|
||||
{
|
||||
if (strpos($this->type, "int") === 0) return "int";
|
||||
if (strpos($this->type, "long") === 0) return "long";
|
||||
if (strpos($this->type, "char") === 0) return "string";
|
||||
if (strpos($this->type, "varchar") === 0) return "string";
|
||||
if (strpos($this->type, "text") === 0) return "string";
|
||||
if (strpos($this->type, "longtext") === 0) return "string";
|
||||
if (strpos($this->type, "tinyint") === 0) return "bool";
|
||||
if (strpos($this->type, "datetime") === 0) return "DateTime";
|
||||
return "unknown";
|
||||
}
|
||||
function getDotNetObjectType()
|
||||
{
|
||||
if (strpos($this->type, "int") === 0) return "Int32";
|
||||
if (strpos($this->type, "long") === 0) return "Long";
|
||||
if (strpos($this->type, "char") === 0) return "String";
|
||||
if (strpos($this->type, "varchar") === 0) return "String";
|
||||
if (strpos($this->type, "text") === 0) return "String";
|
||||
if (strpos($this->type, "longtext") === 0) return "String";
|
||||
if (strpos($this->type, "tinyint") === 0) return "Boolean";
|
||||
if (strpos($this->type, "datetime") === 0) return "DateTime";
|
||||
return "Unknown";
|
||||
}
|
||||
function getIndexName()
|
||||
{
|
||||
if (strlen($this->key)>0)
|
||||
return "index=\"" . $this->name . "\"";
|
||||
return "";
|
||||
}
|
||||
function isPK()
|
||||
{
|
||||
return $this->key=="PRI";
|
||||
}
|
||||
function format($pattern)
|
||||
{
|
||||
$text=$pattern;
|
||||
$text=str_replace("#name#", $this->name, $text);
|
||||
$text=str_replace("#type#", $this->getPureType(), $text);
|
||||
$text=str_replace("#notNull#", $this->isNotNull(), $text);
|
||||
$text=str_replace("#unique#", $this->isUnique(), $text);
|
||||
$text=str_replace("#ucfirstName#", ucfirst($this->name), $text);
|
||||
$text=str_replace("#dotNetPrimitiveType#", $this->getDotNetPrimitiveType(), $text);
|
||||
$text=str_replace("#dotNetObjectType#", $this->getDotNetObjectType(), $text);
|
||||
$text=str_replace("#indexName#", $this->getIndexName(), $text);
|
||||
return $text;
|
||||
}
|
||||
public $name;
|
||||
public $type;
|
||||
public $nullable;
|
||||
public $key;
|
||||
public $defaultValue;
|
||||
public $ext;
|
||||
function __construct($row)
|
||||
{
|
||||
$this->name = trim($row[0]);
|
||||
$this->type = trim($row[1]);
|
||||
$this->nullable = trim($row[2]);
|
||||
$this->key = trim($row[3]);
|
||||
$this->defaultValue = trim($row[4]);
|
||||
$this->ext = trim($row[5]);
|
||||
}
|
||||
function getPureType()
|
||||
{
|
||||
$pos=strpos($this->type, "(");
|
||||
if ($pos > 0)
|
||||
return substr($this->type, 0, $pos);
|
||||
return $this->type;
|
||||
}
|
||||
function isNotNull()
|
||||
{
|
||||
return $this->nullable == "NO" ? "true" : "false";
|
||||
}
|
||||
function isUnique()
|
||||
{
|
||||
return $this->key == "PRI" || $this->key == "UNI" ? "true" : "false";
|
||||
}
|
||||
function getDotNetPrimitiveType()
|
||||
{
|
||||
if (strpos($this->type, "int") === 0) return "int";
|
||||
if (strpos($this->type, "long") === 0) return "long";
|
||||
if (strpos($this->type, "char") === 0) return "string";
|
||||
if (strpos($this->type, "varchar") === 0) return "string";
|
||||
if (strpos($this->type, "text") === 0) return "string";
|
||||
if (strpos($this->type, "longtext") === 0) return "string";
|
||||
if (strpos($this->type, "tinyint") === 0) return "bool";
|
||||
if (strpos($this->type, "datetime") === 0) return "DateTime";
|
||||
return "unknown";
|
||||
}
|
||||
function getDotNetObjectType()
|
||||
{
|
||||
if (strpos($this->type, "int") === 0) return "Int32";
|
||||
if (strpos($this->type, "long") === 0) return "Long";
|
||||
if (strpos($this->type, "char") === 0) return "String";
|
||||
if (strpos($this->type, "varchar") === 0) return "String";
|
||||
if (strpos($this->type, "text") === 0) return "String";
|
||||
if (strpos($this->type, "longtext") === 0) return "String";
|
||||
if (strpos($this->type, "tinyint") === 0) return "Boolean";
|
||||
if (strpos($this->type, "datetime") === 0) return "DateTime";
|
||||
return "Unknown";
|
||||
}
|
||||
function getIndexName()
|
||||
{
|
||||
if (strlen($this->key)>0)
|
||||
return "index=\"" . htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8') . "\"";
|
||||
return "";
|
||||
}
|
||||
function isPK()
|
||||
{
|
||||
return $this->key=="PRI";
|
||||
}
|
||||
function formatCs($text)
|
||||
{
|
||||
$text=str_replace("#name#", cgMakeIdentifier($this->name, false), $text);
|
||||
return $this->format($text);
|
||||
}
|
||||
function formatXml($text)
|
||||
{
|
||||
$text=str_replace("#name#", htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8'), $text);
|
||||
$text=str_replace("#indexName#", $this->getIndexName(), $text);
|
||||
return $this->format($text);
|
||||
}
|
||||
function format($text)
|
||||
{
|
||||
$text=str_replace("#ucfirstName#", cgMakeIdentifier($this->name), $text);
|
||||
$text=str_replace("#dotNetPrimitiveType#", $this->getDotNetPrimitiveType(), $text);
|
||||
$text=str_replace("#dotNetObjectType#", $this->getDotNetObjectType(), $text);
|
||||
$text=str_replace("#type#", $this->getPureType(), $text);
|
||||
$text=str_replace("#notNull#", $this->isNotNull(), $text);
|
||||
$text=str_replace("#unique#", $this->isUnique(), $text);
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
function handleNHibernateCSBody($db, $table, $crlf)
|
||||
{
|
||||
$lines=array();
|
||||
$result=PMA_DBI_query(sprintf("DESC %s.%s", PMA_backquote($db), PMA_backquote($table)));
|
||||
if ($result)
|
||||
{
|
||||
$tableProperties=array();
|
||||
while ($row = PMA_DBI_fetch_row($result))
|
||||
$tableProperties[] = new TableProperty($row);
|
||||
$lines[] = "using System;";
|
||||
$lines[] = "using System.Collections;";
|
||||
$lines[] = "using System.Collections.Generic;";
|
||||
$lines[] = "using System.Text;";
|
||||
$lines[] = "namespace ".ucfirst($db);
|
||||
$lines[] = "{";
|
||||
$lines[] = " #region ".ucfirst($table);
|
||||
$lines[] = " public class ".ucfirst($table);
|
||||
$lines[] = " {";
|
||||
$lines[] = " #region Member Variables";
|
||||
foreach ($tableProperties as $tablePropertie)
|
||||
$lines[] = $tablePropertie->format(" protected #dotNetPrimitiveType# _#name#;");
|
||||
$lines[] = " #endregion";
|
||||
$lines[] = " #region Constructors";
|
||||
$lines[] = " public ".ucfirst($table)."() { }";
|
||||
$temp = array();
|
||||
foreach ($tableProperties as $tablePropertie)
|
||||
if (! $tablePropertie->isPK())
|
||||
$temp[] = $tablePropertie->format("#dotNetPrimitiveType# #name#");
|
||||
$lines[] = " public ".ucfirst($table)."(".implode(", ", $temp).")";
|
||||
$lines[] = " {";
|
||||
foreach ($tableProperties as $tablePropertie)
|
||||
if (! $tablePropertie->isPK())
|
||||
$lines[] = $tablePropertie->format(" this._#name#=#name#;");
|
||||
$lines[] = " }";
|
||||
$lines[] = " #endregion";
|
||||
$lines[] = " #region Public Properties";
|
||||
foreach ($tableProperties as $tablePropertie)
|
||||
$lines[] = $tablePropertie->format(" public virtual #dotNetPrimitiveType# _#ucfirstName#\n {\n get {return _#name#;}\n set {_#name#=value;}\n }");
|
||||
$lines[] = " #endregion";
|
||||
$lines[] = " }";
|
||||
$lines[] = " #endregion";
|
||||
$lines[] = "}";
|
||||
PMA_DBI_free_result($result);
|
||||
}
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
function cgMakeIdentifier($str, $ucfirst = true)
|
||||
{
|
||||
// remove unsafe characters
|
||||
$str = preg_replace('/[^\p{L}\p{Nl}_]/u', '', $str);
|
||||
// make sure first character is a letter or _
|
||||
if (!preg_match('/^\pL/u', $str)) {
|
||||
$str = '_' . $str;
|
||||
}
|
||||
if ($ucfirst) {
|
||||
$str = ucfirst($str);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
function handleNHibernateXMLBody($db, $table, $crlf)
|
||||
{
|
||||
$lines=array();
|
||||
$lines[] = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
|
||||
$lines[] = "<hibernate-mapping xmlns=\"urn:nhibernate-mapping-2.2\" namespace=\"".ucfirst(htmlspecialchars($db, ENT_COMPAT, 'UTF-8'))."\" assembly=\"".ucfirst(htmlspecialchars($db, ENT_COMPAT, 'UTF-8'))."\">";
|
||||
$lines[] = " <class name=\"".ucfirst(htmlspecialchars($table, ENT_COMPAT, 'UTF-8'))."\" table=\"".htmlspecialchars($table, ENT_COMPAT, 'UTF-8')."\">";
|
||||
$result = PMA_DBI_query(sprintf("DESC %s.%s", PMA_backquote($db), PMA_backquote($table)));
|
||||
if ($result)
|
||||
{
|
||||
$tableProperties = array();
|
||||
while ($row = PMA_DBI_fetch_row($result))
|
||||
$tableProperties[] = new TableProperty($row);
|
||||
foreach ($tableProperties as $tablePropertie)
|
||||
{
|
||||
if ($tablePropertie->isPK())
|
||||
$lines[] = $tablePropertie->format(" <id name=\"#ucfirstName#\" type=\"#dotNetObjectType#\" unsaved-value=\"0\">\n <column name=\"#name#\" sql-type=\"#type#\" not-null=\"#notNull#\" unique=\"#unique#\" index=\"PRIMARY\"/>\n <generator class=\"native\" />\n </id>");
|
||||
else
|
||||
$lines[] = $tablePropertie->format(" <property name=\"#ucfirstName#\" type=\"#dotNetObjectType#\">\n <column name=\"#name#\" sql-type=\"#type#\" not-null=\"#notNull#\" #indexName#/>\n </property>");
|
||||
}
|
||||
PMA_DBI_free_result($result);
|
||||
}
|
||||
$lines[]=" </class>";
|
||||
$lines[]="</hibernate-mapping>";
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
function handleNHibernateCSBody($db, $table, $crlf)
|
||||
{
|
||||
$lines=array();
|
||||
$result=PMA_DBI_query(sprintf('DESC %s.%s', PMA_backquote($db), PMA_backquote($table)));
|
||||
if ($result) {
|
||||
$tableProperties=array();
|
||||
while ($row = PMA_DBI_fetch_row($result)) {
|
||||
$tableProperties[] = new TableProperty($row);
|
||||
}
|
||||
PMA_DBI_free_result($result);
|
||||
$lines[] = 'using System;';
|
||||
$lines[] = 'using System.Collections;';
|
||||
$lines[] = 'using System.Collections.Generic;';
|
||||
$lines[] = 'using System.Text;';
|
||||
$lines[] = 'namespace ' . cgMakeIdentifier($db);
|
||||
$lines[] = '{';
|
||||
$lines[] = ' #region ' . cgMakeIdentifier($table);
|
||||
$lines[] = ' public class ' . cgMakeIdentifier($table);
|
||||
$lines[] = ' {';
|
||||
$lines[] = ' #region Member Variables';
|
||||
foreach ($tableProperties as $tablePropertie) {
|
||||
$lines[] = $tablePropertie->formatCs(' protected #dotNetPrimitiveType# _#name#;');
|
||||
}
|
||||
$lines[] = ' #endregion';
|
||||
$lines[] = ' #region Constructors';
|
||||
$lines[] = ' public ' . cgMakeIdentifier($table).'() { }';
|
||||
$temp = array();
|
||||
foreach ($tableProperties as $tablePropertie) {
|
||||
if (! $tablePropertie->isPK()) {
|
||||
$temp[] = $tablePropertie->formatCs('#dotNetPrimitiveType# #name#');
|
||||
}
|
||||
}
|
||||
$lines[] = ' public ' . cgMakeIdentifier($table) . '(' . implode(', ', $temp) . ')';
|
||||
$lines[] = ' {';
|
||||
foreach ($tableProperties as $tablePropertie) {
|
||||
if (! $tablePropertie->isPK()) {
|
||||
$lines[] = $tablePropertie->formatCs(' this._#name#=#name#;');
|
||||
}
|
||||
}
|
||||
$lines[] = ' }';
|
||||
$lines[] = ' #endregion';
|
||||
$lines[] = ' #region Public Properties';
|
||||
foreach ($tableProperties as $tablePropertie) {
|
||||
$lines[] = $tablePropertie->formatCs(''
|
||||
. ' public virtual #dotNetPrimitiveType# #ucfirstName#' . "\n"
|
||||
. ' {' . "\n"
|
||||
. ' get {return _#name#;}' . "\n"
|
||||
. ' set {_#name#=value;}' . "\n"
|
||||
. ' }'
|
||||
);
|
||||
}
|
||||
$lines[] = ' #endregion';
|
||||
$lines[] = ' }';
|
||||
$lines[] = ' #endregion';
|
||||
$lines[] = '}';
|
||||
}
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
|
||||
function cgGetOption($optionName)
|
||||
{
|
||||
global $what;
|
||||
return $GLOBALS[$what . "_" . $optionName];
|
||||
}
|
||||
function handleNHibernateXMLBody($db, $table, $crlf)
|
||||
{
|
||||
$lines = array();
|
||||
$lines[] = '<?xml version="1.0" encoding="utf-8" ?' . '>';
|
||||
$lines[] = '<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" '
|
||||
. 'namespace="' . cgMakeIdentifier($db) . '" '
|
||||
. 'assembly="' . cgMakeIdentifier($db) . '">';
|
||||
$lines[] = ' <class '
|
||||
. 'name="' . cgMakeIdentifier($table) . '" '
|
||||
. 'table="' . cgMakeIdentifier($table) . '">';
|
||||
$result = PMA_DBI_query(sprintf("DESC %s.%s", PMA_backquote($db), PMA_backquote($table)));
|
||||
if ($result) {
|
||||
while ($row = PMA_DBI_fetch_row($result)) {
|
||||
$tablePropertie = new TableProperty($row);
|
||||
if ($tablePropertie->isPK())
|
||||
$lines[] = $tablePropertie->formatXml(''
|
||||
. ' <id name="#ucfirstName#" type="#dotNetObjectType#" unsaved-value="0">' . "\n"
|
||||
. ' <column name="#name#" sql-type="#type#" not-null="#notNull#" unique="#unique#" index="PRIMARY"/>' . "\n"
|
||||
. ' <generator class="native" />' . "\n"
|
||||
. ' </id>');
|
||||
else
|
||||
$lines[] = $tablePropertie->formatXml(''
|
||||
. ' <property name="#ucfirstName#" type="#dotNetObjectType#">' . "\n"
|
||||
. ' <column name="#name#" sql-type="#type#" not-null="#notNull#" #indexName#/>' . "\n"
|
||||
. ' </property>');
|
||||
}
|
||||
PMA_DBI_free_result($result);
|
||||
}
|
||||
$lines[] = ' </class>';
|
||||
$lines[] = '</hibernate-mapping>';
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -213,9 +213,6 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
* Gets fields properties
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
|
||||
$result = PMA_DBI_query($local_query);
|
||||
$fields_cnt = PMA_DBI_num_rows($result);
|
||||
|
||||
// Check if we can use Relations
|
||||
if ($do_relation && ! empty($cfgRelation['relation'])) {
|
||||
@ -272,10 +269,11 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
return false;
|
||||
}
|
||||
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($columns as $column) {
|
||||
|
||||
$schema_insert = '<tr class="print-category">';
|
||||
$type = $row['Type'];
|
||||
$type = $column['Type'];
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
|
||||
@ -295,9 +293,9 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
$type = ' ';
|
||||
}
|
||||
|
||||
$binary = preg_match('/BINARY/i', $row['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $row['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $row['Type']);
|
||||
$binary = preg_match('/BINARY/i', $column['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $column['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $column['Type']);
|
||||
}
|
||||
$attribute = ' ';
|
||||
if ($binary) {
|
||||
@ -309,28 +307,28 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
if ($zerofill) {
|
||||
$attribute = 'UNSIGNED ZEROFILL';
|
||||
}
|
||||
if (! isset($row['Default'])) {
|
||||
if ($row['Null'] != 'NO') {
|
||||
$row['Default'] = 'NULL';
|
||||
if (! isset($column['Default'])) {
|
||||
if ($column['Null'] != 'NO') {
|
||||
$column['Default'] = 'NULL';
|
||||
}
|
||||
}
|
||||
|
||||
$fmt_pre = '';
|
||||
$fmt_post = '';
|
||||
if (in_array($row['Field'], $unique_keys)) {
|
||||
if (in_array($column['Field'], $unique_keys)) {
|
||||
$fmt_pre = '<b>' . $fmt_pre;
|
||||
$fmt_post = $fmt_post . '</b>';
|
||||
}
|
||||
if ($row['Key'] == 'PRI') {
|
||||
if ($column['Key'] == 'PRI') {
|
||||
$fmt_pre = '<i>' . $fmt_pre;
|
||||
$fmt_post = $fmt_post . '</i>';
|
||||
}
|
||||
$schema_insert .= '<td class="print">' . $fmt_pre . htmlspecialchars($row['Field']) . $fmt_post . '</td>';
|
||||
$schema_insert .= '<td class="print">' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post . '</td>';
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars($type) . '</td>';
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars(($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes')) . '</td>';
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars(isset($row['Default']) ? $row['Default'] : '') . '</td>';
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes')) . '</td>';
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '') . '</td>';
|
||||
|
||||
$field_name = $row['Field'];
|
||||
$field_name = $column['Field'];
|
||||
|
||||
if ($do_relation && $have_rel) {
|
||||
$schema_insert .= '<td class="print">' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '') . '</td>';
|
||||
@ -348,7 +346,6 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
return PMA_exportOutputHandler('</table>');
|
||||
}
|
||||
|
||||
@ -316,9 +316,6 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
* Gets fields properties
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
|
||||
$result = PMA_DBI_query($local_query);
|
||||
$fields_cnt = PMA_DBI_num_rows($result);
|
||||
|
||||
// Check if we can use Relations
|
||||
if ($do_relation && !empty($cfgRelation['relation'])) {
|
||||
@ -374,8 +371,6 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
$mime_map = PMA_getMIME($db, $table, true);
|
||||
}
|
||||
|
||||
$local_buffer = PMA_texEscape($table);
|
||||
|
||||
// Table caption for first page and label
|
||||
if (isset($GLOBALS['latex_caption'])) {
|
||||
$buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
|
||||
@ -394,8 +389,8 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
return false;
|
||||
}
|
||||
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
|
||||
$fields = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($fields as $row) {
|
||||
$type = $row['Type'];
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
@ -424,8 +419,6 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
if ($row['Null'] != 'NO') {
|
||||
$row['Default'] = 'NULL';
|
||||
}
|
||||
} else {
|
||||
$row['Default'] = $row['Default'];
|
||||
}
|
||||
|
||||
$field_name = $row['Field'];
|
||||
@ -468,7 +461,6 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
$buffer = ' \\end{longtable}' . $crlf;
|
||||
return PMA_exportOutputHandler($buffer);
|
||||
|
||||
@ -95,18 +95,16 @@ function PMA_exportDBCreate($db) {
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
global $mediawiki_export_struct;
|
||||
global $mediawiki_export_data;
|
||||
|
||||
$result = PMA_DBI_fetch_result("SHOW COLUMNS FROM `" . $db . "`.`" . $table . "`");
|
||||
$row_cnt = count($result);
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
$columns = array_values($columns);
|
||||
$row_cnt = count($columns);
|
||||
|
||||
$output = "{| cellpadding=\"10\" cellspacing=\"0\" border=\"1\" style=\"text-align:center;\"\n";
|
||||
$output .= "|+'''" . $table . "'''\n";
|
||||
$output .= "|- style=\"background:#ffdead;\"\n";
|
||||
$output .= "! style=\"background:#ffffff\" | \n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $result[$i]['Field'];
|
||||
$output .= " | " . $columns[$i]['Field'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
@ -116,7 +114,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
$output .= "|- style=\"background:#f9f9f9;\"\n";
|
||||
$output .= "! style=\"background:#f2f2f2\" | Type\n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $result[$i]['Type'];
|
||||
$output .= " | " . $columns[$i]['Type'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
@ -126,7 +124,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
$output .= "|- style=\"background:#f9f9f9;\"\n";
|
||||
$output .= "! style=\"background:#f2f2f2\" | Null\n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $result[$i]['Null'];
|
||||
$output .= " | " . $columns[$i]['Null'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
@ -136,7 +134,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
$output .= "|- style=\"background:#f9f9f9;\"\n";
|
||||
$output .= "! style=\"background:#f2f2f2\" | Default\n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $result[$i]['Default'];
|
||||
$output .= " | " . $columns[$i]['Default'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
@ -146,7 +144,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
$output .= "|- style=\"background:#f9f9f9;\"\n";
|
||||
$output .= "! style=\"background:#f2f2f2\" | Extra\n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $result[$i]['Extra'];
|
||||
$output .= " | " . $columns[$i]['Extra'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
|
||||
@ -251,9 +251,6 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
* Gets fields properties
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
|
||||
$result = PMA_DBI_query($local_query);
|
||||
$fields_cnt = PMA_DBI_num_rows($result);
|
||||
|
||||
// Check if we can use Relations
|
||||
if ($do_relation && !empty($cfgRelation['relation'])) {
|
||||
@ -318,16 +315,17 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '</table:table-row>';
|
||||
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($columns as $column) {
|
||||
|
||||
$field_name = $column['Field'];
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-row>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($row['Field']) . '</text:p>'
|
||||
. '<text:p>' . htmlspecialchars($field_name) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
$field_name = $row['Field'];
|
||||
$type = $row['Type'];
|
||||
$type = $column['Type'];
|
||||
if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
|
||||
$tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
|
||||
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
|
||||
@ -345,27 +343,27 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
$type = ' ';
|
||||
}
|
||||
|
||||
$binary = preg_match('/BINARY/i', $row['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $row['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $row['Type']);
|
||||
$binary = preg_match('/BINARY/i', $column['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $column['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $column['Type']);
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($type) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
if (!isset($row['Default'])) {
|
||||
if ($row['Null'] != 'NO') {
|
||||
$row['Default'] = 'NULL';
|
||||
if (!isset($column['Default'])) {
|
||||
if ($column['Null'] != 'NO') {
|
||||
$column['Default'] = 'NULL';
|
||||
} else {
|
||||
$row['Default'] = '';
|
||||
$column['Default'] = '';
|
||||
}
|
||||
} else {
|
||||
$row['Default'] = $row['Default'];
|
||||
$column['Default'] = $column['Default'];
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes')) . '</text:p>'
|
||||
. '<text:p>' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($row['Default']) . '</text:p>'
|
||||
. '<text:p>' . htmlspecialchars($column['Default']) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
|
||||
if ($do_relation && $have_rel) {
|
||||
@ -399,7 +397,6 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '</table:table-row>';
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
$GLOBALS['odt_buffer'] .= '</table:table>';
|
||||
return true;
|
||||
|
||||
@ -27,7 +27,9 @@ if (isset($plugin_list)) {
|
||||
'mime_type' => 'text/x-sql',
|
||||
'options' => array());
|
||||
|
||||
$plugin_list['sql']['options'][] = array('type' => 'begin_group', 'name' => 'general_opts');
|
||||
$plugin_list['sql']['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts');
|
||||
|
||||
/* comments */
|
||||
$plugin_list['sql']['options'][] = array(
|
||||
@ -77,7 +79,10 @@ if (isset($plugin_list)) {
|
||||
'type' => 'bool',
|
||||
'name' => 'disable_fk',
|
||||
'text' => __('Disable foreign key checks'),
|
||||
'doc' => array('manual_MySQL_Database_Administration', 'server-system-variables', 'sysvar_foreign_key_checks')
|
||||
'doc' => array(
|
||||
'manual_MySQL_Database_Administration',
|
||||
'server-system-variables',
|
||||
'sysvar_foreign_key_checks')
|
||||
);
|
||||
|
||||
$plugin_list['sql']['options_text'] = __('Options');
|
||||
@ -86,7 +91,7 @@ if (isset($plugin_list)) {
|
||||
$compats = PMA_DBI_getCompatibilities();
|
||||
if (count($compats) > 0) {
|
||||
$values = array();
|
||||
foreach($compats as $val) {
|
||||
foreach ($compats as $val) {
|
||||
$values[$val] = $val;
|
||||
}
|
||||
$plugin_list['sql']['options'][] = array(
|
||||
@ -94,7 +99,9 @@ if (isset($plugin_list)) {
|
||||
'name' => 'compatibility',
|
||||
'text' => __('Database system or older MySQL server to maximize output compatibility with:'),
|
||||
'values' => $values,
|
||||
'doc' => array('manual_MySQL_Database_Administration', 'Server_SQL_mode')
|
||||
'doc' => array(
|
||||
'manual_MySQL_Database_Administration',
|
||||
'Server_SQL_mode')
|
||||
);
|
||||
unset($values);
|
||||
}
|
||||
@ -322,11 +329,14 @@ function PMA_exportRoutines($db) {
|
||||
. PMA_exportComment(__('Procedures'))
|
||||
. PMA_exportComment();
|
||||
|
||||
foreach($procedure_names as $procedure_name) {
|
||||
foreach ($procedure_names as $procedure_name) {
|
||||
if (! empty($GLOBALS['sql_drop_table'])) {
|
||||
$text .= 'DROP PROCEDURE IF EXISTS ' . PMA_backquote($procedure_name) . $delimiter . $crlf;
|
||||
$text .= 'DROP PROCEDURE IF EXISTS '
|
||||
. PMA_backquote($procedure_name)
|
||||
. $delimiter . $crlf;
|
||||
}
|
||||
$text .= PMA_DBI_get_definition($db, 'PROCEDURE', $procedure_name) . $delimiter . $crlf . $crlf;
|
||||
$text .= PMA_DBI_get_definition($db, 'PROCEDURE', $procedure_name)
|
||||
. $delimiter . $crlf . $crlf;
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,11 +346,14 @@ function PMA_exportRoutines($db) {
|
||||
. PMA_exportComment(__('Functions'))
|
||||
. PMA_exportComment();
|
||||
|
||||
foreach($function_names as $function_name) {
|
||||
foreach ($function_names as $function_name) {
|
||||
if (! empty($GLOBALS['sql_drop_table'])) {
|
||||
$text .= 'DROP FUNCTION IF EXISTS ' . PMA_backquote($function_name) . $delimiter . $crlf;
|
||||
$text .= 'DROP FUNCTION IF EXISTS '
|
||||
. PMA_backquote($function_name)
|
||||
. $delimiter . $crlf;
|
||||
}
|
||||
$text .= PMA_DBI_get_definition($db, 'FUNCTION', $function_name) . $delimiter . $crlf . $crlf;
|
||||
$text .= PMA_DBI_get_definition($db, 'FUNCTION', $function_name)
|
||||
. $delimiter . $crlf . $crlf;
|
||||
}
|
||||
}
|
||||
|
||||
@ -469,7 +482,7 @@ function PMA_exportHeader()
|
||||
// backslash and n, as explained on the export interface
|
||||
$lines = explode('\n', $GLOBALS['sql_header_comment']);
|
||||
$head .= PMA_exportComment();
|
||||
foreach($lines as $one_line) {
|
||||
foreach ($lines as $one_line) {
|
||||
$head .= PMA_exportComment($one_line);
|
||||
}
|
||||
$head .= PMA_exportComment();
|
||||
@ -609,7 +622,7 @@ function PMA_exportDBFooter($db)
|
||||
. PMA_exportComment(__('Events'))
|
||||
. PMA_exportComment();
|
||||
|
||||
foreach($event_names as $event_name) {
|
||||
foreach ($event_names as $event_name) {
|
||||
if (! empty($GLOBALS['sql_drop_table'])) {
|
||||
$text .= 'DROP EVENT ' . PMA_backquote($event_name) . $delimiter . $crlf;
|
||||
}
|
||||
@ -650,7 +663,7 @@ function PMA_getTableDefStandIn($db, $view, $crlf) {
|
||||
$create_query .= PMA_backquote($view) . ' (' . $crlf;
|
||||
$tmp = array();
|
||||
$columns = PMA_DBI_get_columns_full($db, $view);
|
||||
foreach($columns as $column_name => $definition) {
|
||||
foreach ($columns as $column_name => $definition) {
|
||||
$tmp[] = PMA_backquote($column_name) . ' ' . $definition['Type'] . $crlf;
|
||||
}
|
||||
$create_query .= implode(',', $tmp) . ');';
|
||||
|
||||
@ -195,9 +195,6 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
* Gets fields properties
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
|
||||
$result = PMA_DBI_query($local_query);
|
||||
$fields_cnt = PMA_DBI_num_rows($result);
|
||||
|
||||
// Check if we can use Relations
|
||||
if ($do_relation && ! empty($cfgRelation['relation'])) {
|
||||
@ -251,10 +248,11 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
return false;
|
||||
}
|
||||
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($columns as $column) {
|
||||
|
||||
$text_output = '';
|
||||
$type = $row['Type'];
|
||||
$type = $column['Type'];
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
|
||||
@ -274,9 +272,9 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
$type = ' ';
|
||||
}
|
||||
|
||||
$binary = preg_match('/BINARY/i', $row['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $row['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $row['Type']);
|
||||
$binary = preg_match('/BINARY/i', $column['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $column['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $column['Type']);
|
||||
}
|
||||
$attribute = ' ';
|
||||
if ($binary) {
|
||||
@ -288,30 +286,28 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
if ($zerofill) {
|
||||
$attribute = 'UNSIGNED ZEROFILL';
|
||||
}
|
||||
if (! isset($row['Default'])) {
|
||||
if ($row['Null'] != 'NO') {
|
||||
$row['Default'] = 'NULL';
|
||||
if (! isset($column['Default'])) {
|
||||
if ($column['Null'] != 'NO') {
|
||||
$column['Default'] = 'NULL';
|
||||
}
|
||||
} else {
|
||||
$row['Default'] = $row['Default'];
|
||||
}
|
||||
|
||||
$fmt_pre = '';
|
||||
$fmt_post = '';
|
||||
if (in_array($row['Field'], $unique_keys)) {
|
||||
if (in_array($column['Field'], $unique_keys)) {
|
||||
$fmt_pre = '**' . $fmt_pre;
|
||||
$fmt_post = $fmt_post . '**';
|
||||
}
|
||||
if ($row['Key']=='PRI') {
|
||||
if ($column['Key']=='PRI') {
|
||||
$fmt_pre = '//' . $fmt_pre;
|
||||
$fmt_post = $fmt_post . '//';
|
||||
}
|
||||
$text_output .= '|' . $fmt_pre . htmlspecialchars($row['Field']) . $fmt_post;
|
||||
$text_output .= '|' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post;
|
||||
$text_output .= '|' . htmlspecialchars($type);
|
||||
$text_output .= '|' . htmlspecialchars(($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes'));
|
||||
$text_output .= '|' . htmlspecialchars(isset($row['Default']) ? $row['Default'] : '');
|
||||
$text_output .= '|' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes'));
|
||||
$text_output .= '|' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '');
|
||||
|
||||
$field_name = $row['Field'];
|
||||
$field_name = $column['Field'];
|
||||
|
||||
if ($do_relation && $have_rel) {
|
||||
$text_output .= '|' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '');
|
||||
@ -329,7 +325,6 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ function PMA_exportHeader() {
|
||||
global $db;
|
||||
global $table;
|
||||
global $tables;
|
||||
|
||||
|
||||
$export_struct = isset($GLOBALS['xml_export_functions']) || isset($GLOBALS['xml_export_procedures'])
|
||||
|| isset($GLOBALS['xml_export_tables']) || isset($GLOBALS['xml_export_triggers'])
|
||||
|| isset($GLOBALS['xml_export_views']);
|
||||
@ -114,7 +114,7 @@ function PMA_exportHeader() {
|
||||
$head .= ' -->' . $crlf;
|
||||
$head .= ' <pma:structure_schemas>' . $crlf;
|
||||
$head .= ' <pma:database name="' . htmlspecialchars($db) . '" collation="' . $db_collation . '" charset="' . $db_charset . '">' . $crlf;
|
||||
|
||||
|
||||
if (count($tables) == 0) {
|
||||
$tables[] = $table;
|
||||
}
|
||||
@ -131,23 +131,23 @@ function PMA_exportHeader() {
|
||||
} else {
|
||||
$type = 'table';
|
||||
}
|
||||
|
||||
|
||||
if ($is_view && ! isset($GLOBALS['xml_export_views'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (! $is_view && ! isset($GLOBALS['xml_export_tables'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$head .= ' <pma:' . $type . ' name="' . $table . '">' . $crlf;
|
||||
|
||||
|
||||
$tbl = " " . htmlspecialchars($tbl);
|
||||
$tbl = str_replace("\n", "\n ", $tbl);
|
||||
|
||||
$head .= $tbl . ';' . $crlf;
|
||||
$head .= ' </pma:' . $type . '>' . $crlf;
|
||||
|
||||
|
||||
if (isset($GLOBALS['xml_export_triggers']) && $GLOBALS['xml_export_triggers']) {
|
||||
// Export triggers
|
||||
$triggers = PMA_DBI_get_triggers($db, $table);
|
||||
@ -170,7 +170,7 @@ function PMA_exportHeader() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($GLOBALS['xml_export_functions']) && $GLOBALS['xml_export_functions']) {
|
||||
// Export functions
|
||||
$functions = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
|
||||
@ -193,7 +193,7 @@ function PMA_exportHeader() {
|
||||
unset($functions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($GLOBALS['xml_export_procedures']) && $GLOBALS['xml_export_procedures']) {
|
||||
// Export procedures
|
||||
$procedures = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
|
||||
@ -240,13 +240,13 @@ function PMA_exportHeader() {
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
global $crlf;
|
||||
|
||||
|
||||
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
|
||||
$head = ' <!--' . $crlf
|
||||
. ' - ' . __('Database') . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf
|
||||
. ' -->' . $crlf
|
||||
. ' <database name="' . htmlspecialchars($db) . '">' . $crlf;
|
||||
|
||||
|
||||
return PMA_exportOutputHandler($head);
|
||||
}
|
||||
else
|
||||
@ -265,7 +265,7 @@ function PMA_exportDBHeader($db) {
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
global $crlf;
|
||||
|
||||
|
||||
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
|
||||
return PMA_exportOutputHandler(' </database>' . $crlf);
|
||||
}
|
||||
@ -300,6 +300,7 @@ function PMA_exportDBCreate($db) {
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
|
||||
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
|
||||
@ -138,10 +138,9 @@ if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
|
||||
htmlspecialchars($GLOBALS['db']),
|
||||
__('Database'),
|
||||
'ic_s_db');
|
||||
// if the table is being dropped, $_REQUEST['purge'] is set
|
||||
// (it always contains "1")
|
||||
// if the table is being dropped, $_REQUEST['purge'] is set to '1'
|
||||
// so do not display the table name in upper div
|
||||
if (strlen($GLOBALS['table']) && ! (isset($_REQUEST['purge']))) {
|
||||
if (strlen($GLOBALS['table']) && ! (isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1')) {
|
||||
require_once './libraries/tbl_info.inc.php';
|
||||
|
||||
echo $separator;
|
||||
|
||||
@ -48,11 +48,4 @@ if ($GLOBALS['text_dir'] == 'ltr') {
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>phpmyadmin.css.php<?php echo PMA_generate_common_url(array('server' => $GLOBALS['server'])); ?>&js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>print.css" media="print" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['pmaThemePath']; ?>/jquery/jquery-ui-1.8.custom.css" />
|
||||
<?php
|
||||
if (is_readable($GLOBALS['pmaThemePath'] . '/jquery/jquery-ui-1.8.override.css')) {
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['pmaThemePath']; ?>/jquery/jquery-ui-1.8.override.css" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<meta name="robots" content="noindex,nofollow" />
|
||||
|
||||
@ -39,8 +39,6 @@ if (isset($GLOBALS['db'])) {
|
||||
$params['db'] = $GLOBALS['db'];
|
||||
}
|
||||
$GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params);
|
||||
$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
|
||||
$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
|
||||
|
||||
/**
|
||||
* Here we add a timestamp when loading the file, so that users who
|
||||
|
||||
@ -44,7 +44,7 @@ function PMA_checkTimeout()
|
||||
/**
|
||||
* Detects what compression filse uses
|
||||
*
|
||||
* @param string filename to check
|
||||
* @param string $filepath filename to check
|
||||
* @return string MIME type of compression, none for none
|
||||
* @access public
|
||||
*/
|
||||
@ -73,9 +73,9 @@ function PMA_detectCompression($filepath)
|
||||
* Runs query inside import buffer. This is needed to allow displaying
|
||||
* of last SELECT, SHOW or HANDLER results and similar nice stuff.
|
||||
*
|
||||
* @param string query to run
|
||||
* @param string query to display, this might be commented
|
||||
* @param bool whether to use control user for queries
|
||||
* @param string $sql query to run
|
||||
* @param string $full query to display, this might be commented
|
||||
* @param bool $controluser whether to use control user for queries
|
||||
* @access public
|
||||
*/
|
||||
function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
|
||||
@ -207,17 +207,17 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
|
||||
/**
|
||||
* Looks for the presence of USE to possibly change current db
|
||||
*
|
||||
* @param string buffer to examine
|
||||
* @param string current db
|
||||
* @param boolean reload
|
||||
* @param string $buffer buffer to examine
|
||||
* @param string $db current db
|
||||
* @param bool $reload reload
|
||||
* @return array (current or new db, whether to reload)
|
||||
* @access public
|
||||
*/
|
||||
function PMA_lookForUse($buffer, $db, $reload)
|
||||
{
|
||||
if (preg_match('@^[\s]*USE[[:space:]]*([\S]+)@i', $buffer, $match)) {
|
||||
if (preg_match('@^[\s]*USE[[:space:]]+([\S]+)@i', $buffer, $match)) {
|
||||
$db = trim($match[1]);
|
||||
$db = trim($db,';'); // for example, USE abc;
|
||||
$db = trim($db, ';'); // for example, USE abc;
|
||||
$reload = true;
|
||||
}
|
||||
return(array($db, $reload));
|
||||
@ -227,8 +227,7 @@ function PMA_lookForUse($buffer, $db, $reload)
|
||||
/**
|
||||
* Returns next part of imported file/buffer
|
||||
*
|
||||
* @param integer size of buffer to read (this is maximal size
|
||||
* function will return)
|
||||
* @param int $size size of buffer to read (this is maximal size function will return)
|
||||
* @return string part of file/buffer
|
||||
* @access public
|
||||
*/
|
||||
@ -436,7 +435,6 @@ define("SIZES", 1);
|
||||
/**
|
||||
* Obtains the precision (total # of digits) from a size of type decimal
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $last_cumulative_size
|
||||
@ -449,7 +447,6 @@ function PMA_getM($last_cumulative_size) {
|
||||
/**
|
||||
* Obtains the scale (# of digits to the right of the decimal point) from a size of type decimal
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $last_cumulative_size
|
||||
@ -462,7 +459,6 @@ function PMA_getD($last_cumulative_size) {
|
||||
/**
|
||||
* Obtains the decimal size of a given cell
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string &$cell
|
||||
@ -482,7 +478,6 @@ function PMA_getDecimalSize(&$cell) {
|
||||
/**
|
||||
* Obtains the size of the given cell
|
||||
*
|
||||
*
|
||||
* @todo Handle the error cases more elegantly
|
||||
*
|
||||
* @access public
|
||||
@ -696,7 +691,6 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
|
||||
/**
|
||||
* Determines what MySQL type a cell is
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param int $last_cumulative_type Last cumulative column type (VARCHAR or INT or BIGINT or DECIMAL or NONE)
|
||||
@ -710,7 +704,7 @@ function PMA_detectType($last_cumulative_type, &$cell) {
|
||||
*/
|
||||
|
||||
if (! strcmp('NULL', $cell)) {
|
||||
if ($last_cumulative_type === NULL || $last_cumulative_type == NONE) {
|
||||
if ($last_cumulative_type === null || $last_cumulative_type == NONE) {
|
||||
return NONE;
|
||||
} else {
|
||||
return $last_cumulative_type;
|
||||
@ -733,7 +727,6 @@ function PMA_detectType($last_cumulative_type, &$cell) {
|
||||
/**
|
||||
* Determines if the column types are int, decimal, or string
|
||||
*
|
||||
*
|
||||
* @link http://wiki.phpmyadmin.net/pma/Import
|
||||
*
|
||||
* @todo Handle the error case more elegantly
|
||||
@ -823,25 +816,24 @@ function PMA_analyzeTable(&$table) {
|
||||
}
|
||||
|
||||
/* Needed to quell the beast that is PMA_Message */
|
||||
$import_notice = NULL;
|
||||
$import_notice = null;
|
||||
|
||||
/**
|
||||
* Builds and executes SQL statements to create the database and tables
|
||||
* as necessary, as well as insert all the data.
|
||||
*
|
||||
*
|
||||
* @link http://wiki.phpmyadmin.net/pma/Import
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $db_name Name of the database
|
||||
* @param array &$tables Array of tables for the specified database
|
||||
* @param array &$analyses = NULL Analyses of the tables
|
||||
* @param array &$additional_sql = NULL Additional SQL statements to be executed
|
||||
* @param array $options = NULL Associative array of options
|
||||
* @param string $db_name Name of the database
|
||||
* @param array &$tables Array of tables for the specified database
|
||||
* @param array &$analyses Analyses of the tables
|
||||
* @param array &$additional_sql Additional SQL statements to be executed
|
||||
* @param array $options Associative array of options
|
||||
* @return void
|
||||
*/
|
||||
function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql = NULL, $options = NULL) {
|
||||
function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql = null, $options = null) {
|
||||
/* Take care of the options */
|
||||
if (isset($options['db_collation'])&& ! is_null($options['db_collation'])) {
|
||||
$collation = $options['db_collation'];
|
||||
@ -884,7 +876,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql =
|
||||
unset($sql);
|
||||
|
||||
/* Run the $additional_sql statements supplied by the caller plug-in */
|
||||
if ($additional_sql != NULL) {
|
||||
if ($additional_sql != null) {
|
||||
/* Clean the SQL first */
|
||||
$additional_sql_len = count($additional_sql);
|
||||
|
||||
@ -910,7 +902,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql =
|
||||
}
|
||||
}
|
||||
|
||||
if ($analyses != NULL) {
|
||||
if ($analyses != null) {
|
||||
$type_array = array(NONE => "NULL", VARCHAR => "varchar", INT => "int", DECIMAL => "decimal", BIGINT => "bigint");
|
||||
|
||||
/* TODO: Do more checking here to make sure they really are matched */
|
||||
@ -936,7 +928,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql =
|
||||
$tempSQLStr .= ", ";
|
||||
}
|
||||
}
|
||||
$tempSQLStr .= ") ENGINE=MyISAM DEFAULT CHARACTER SET " . $charset . " COLLATE " . $collation . ";";
|
||||
$tempSQLStr .= ") DEFAULT CHARACTER SET " . $charset . " COLLATE " . $collation . ";";
|
||||
|
||||
/**
|
||||
* Each SQL statement is executed immediately
|
||||
@ -975,7 +967,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql =
|
||||
$tempSQLStr .= "(";
|
||||
|
||||
for ($k = 0; $k < $num_cols; ++$k) {
|
||||
if ($analyses != NULL) {
|
||||
if ($analyses != null) {
|
||||
$is_varchar = ($analyses[$i][TYPES][$col_count] === VARCHAR);
|
||||
} else {
|
||||
$is_varchar = !is_numeric($tables[$i][ROWS][$j][$k]);
|
||||
|
||||
@ -258,7 +258,7 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) {
|
||||
// Need to strip trailing enclosing char?
|
||||
if ($need_end && $ch == $csv_enclosed) {
|
||||
if ($finished && $i == $len - 1) {
|
||||
$ch = NULL;
|
||||
$ch = null;
|
||||
} elseif ($i == $len - 1) {
|
||||
$i = $fallbacki;
|
||||
$ch = $buffer[$i];
|
||||
@ -417,11 +417,11 @@ if ($analyze) {
|
||||
$options = array('create_db' => false);
|
||||
} else {
|
||||
$db_name = 'CSV_DB';
|
||||
$options = NULL;
|
||||
$options = null;
|
||||
}
|
||||
|
||||
/* Non-applicable parameters */
|
||||
$create = NULL;
|
||||
$create = null;
|
||||
|
||||
/* Created and execute necessary SQL statements from data */
|
||||
PMA_buildSQL($db_name, $tables, $analyses, $create, $options);
|
||||
|
||||
@ -35,8 +35,8 @@ if (isset($plugin_list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ini_set('memory_limit', '128M');
|
||||
set_time_limit(120);
|
||||
@ini_set('memory_limit', '128M');
|
||||
@set_time_limit(120);
|
||||
|
||||
$i = 0;
|
||||
$len = 0;
|
||||
@ -275,11 +275,11 @@ if (strlen($db)) {
|
||||
$options = array('create_db' => false);
|
||||
} else {
|
||||
$db_name = 'ODS_DB';
|
||||
$options = NULL;
|
||||
$options = null;
|
||||
}
|
||||
|
||||
/* Non-applicable parameters */
|
||||
$create = NULL;
|
||||
$create = null;
|
||||
|
||||
/* Created and execute necessary SQL statements from data */
|
||||
PMA_buildSQL($db_name, $tables, $analyses, $create, $options);
|
||||
|
||||
@ -22,7 +22,7 @@ if (isset($plugin_list)) {
|
||||
$compats = PMA_DBI_getCompatibilities();
|
||||
if (count($compats) > 0) {
|
||||
$values = array();
|
||||
foreach($compats as $val) {
|
||||
foreach ($compats as $val) {
|
||||
$values[$val] = $val;
|
||||
}
|
||||
$plugin_list['sql']['options'] = array(
|
||||
|
||||
@ -31,8 +31,8 @@ if (isset($plugin_list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ini_set('memory_limit', '256M');
|
||||
set_time_limit(120);
|
||||
@ini_set('memory_limit', '256M');
|
||||
@set_time_limit(120);
|
||||
|
||||
/* Append the PHPExcel directory to the include path variable */
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/');
|
||||
@ -130,11 +130,11 @@ if (strlen($db)) {
|
||||
$options = array('create_db' => false);
|
||||
} else {
|
||||
$db_name = 'XLS_DB';
|
||||
$options = NULL;
|
||||
$options = null;
|
||||
}
|
||||
|
||||
/* Non-applicable parameters */
|
||||
$create = NULL;
|
||||
$create = null;
|
||||
|
||||
/* Created and execute necessary SQL statements from data */
|
||||
PMA_buildSQL($db_name, $tables, $analyses, $create, $options);
|
||||
|
||||
@ -31,8 +31,8 @@ if (isset($plugin_list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ini_set('memory_limit', '256M');
|
||||
set_time_limit(120);
|
||||
@ini_set('memory_limit', '256M');
|
||||
@set_time_limit(120);
|
||||
|
||||
/* Append the PHPExcel directory to the include path variable */
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/');
|
||||
@ -130,11 +130,11 @@ if (strlen($db)) {
|
||||
$options = array('create_db' => false);
|
||||
} else {
|
||||
$db_name = 'XLSX_DB';
|
||||
$options = NULL;
|
||||
$options = null;
|
||||
}
|
||||
|
||||
/* Non-applicable parameters */
|
||||
$create = NULL;
|
||||
$create = null;
|
||||
|
||||
/* Created and execute necessary SQL statements from data */
|
||||
PMA_buildSQL($db_name, $tables, $analyses, $create, $options);
|
||||
|
||||
@ -28,8 +28,8 @@ if (isset($plugin_list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ini_set('memory_limit', '128M');
|
||||
set_time_limit(120);
|
||||
@ini_set('memory_limit', '128M');
|
||||
@set_time_limit(120);
|
||||
|
||||
$i = 0;
|
||||
$len = 0;
|
||||
@ -119,14 +119,14 @@ if ($db_attr instanceof SimpleXMLElement) {
|
||||
*/
|
||||
$db_attr = $xml->children()->attributes();
|
||||
$db_name = (string)$db_attr['name'];
|
||||
$collation = NULL;
|
||||
$charset = NULL;
|
||||
$collation = null;
|
||||
$charset = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The XML was malformed
|
||||
*/
|
||||
if ($db_name === NULL) {
|
||||
if ($db_name === null) {
|
||||
PMA_Message::error(__('The XML file specified was either malformed or incomplete. Please correct the issue and try again.'))->display();
|
||||
unset($xml);
|
||||
$GLOBALS['finished'] = false;
|
||||
@ -145,7 +145,7 @@ if (isset($namespaces['pma'])) {
|
||||
$create = array();
|
||||
|
||||
foreach ($struct as $tier1 => $val1) {
|
||||
foreach($val1 as $tier2 => $val2) {
|
||||
foreach ($val1 as $tier2 => $val2) {
|
||||
/* Need to select the correct database for the creation of tables, views, triggers, etc. */
|
||||
/**
|
||||
* @todo Generating a USE here blocks importing of a table
|
||||
@ -259,9 +259,9 @@ if ($data_present) {
|
||||
* to maintain PMA_buildSQL() call integrity
|
||||
*/
|
||||
if (! isset($analyses)) {
|
||||
$analyses = NULL;
|
||||
$analyses = null;
|
||||
if (! $struct_present) {
|
||||
$create = NULL;
|
||||
$create = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -286,7 +286,7 @@ if (strlen($db)) {
|
||||
$db_name = $db;
|
||||
$options = array('create_db' => false);
|
||||
} else {
|
||||
if ($db_name === NULL) {
|
||||
if ($db_name === null) {
|
||||
$db_name = 'XML_DB';
|
||||
}
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ function PMA_pluginGetDefault($section, $opt)
|
||||
/* Possibly replace localised texts */
|
||||
if (preg_match_all('/(str[A-Z][A-Za-z0-9]*)/', $GLOBALS['cfg'][$section][$opt], $matches)) {
|
||||
$val = $GLOBALS['cfg'][$section][$opt];
|
||||
foreach($matches[0] as $match) {
|
||||
foreach ($matches[0] as $match) {
|
||||
if (isset($GLOBALS[$match])) {
|
||||
$val = str_replace($match, $GLOBALS[$match], $val);
|
||||
}
|
||||
@ -138,7 +138,7 @@ function PMA_pluginIsActive($section, $opt, $val)
|
||||
* @param string $cfgname name of config value, if none same as $name
|
||||
* @return string html select tag
|
||||
*/
|
||||
function PMA_pluginGetChoice($section, $name, &$list, $cfgname = NULL)
|
||||
function PMA_pluginGetChoice($section, $name, &$list, $cfgname = null)
|
||||
{
|
||||
if (! isset($cfgname)) {
|
||||
$cfgname = $name;
|
||||
@ -217,7 +217,7 @@ function PMA_pluginGetOneOption($section, $plugin_name, $id, &$opt)
|
||||
$ret .= '<select name="' . $plugin_name . '_' . $opt['name'] . '"'
|
||||
. ' id="select_' . $plugin_name . '_' . $opt['name'] . '">';
|
||||
$default = PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']);
|
||||
foreach($opt['values'] as $key => $val) {
|
||||
foreach ($opt['values'] as $key => $val) {
|
||||
$ret .= '<option value="' . $key . '"';
|
||||
if ($key == $default) {
|
||||
$ret .= ' selected="selected"';
|
||||
@ -227,7 +227,7 @@ function PMA_pluginGetOneOption($section, $plugin_name, $id, &$opt)
|
||||
$ret .= '</select>';
|
||||
} elseif ($opt['type'] == 'radio') {
|
||||
$default = PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']);
|
||||
foreach($opt['values'] as $key => $val) {
|
||||
foreach ($opt['values'] as $key => $val) {
|
||||
$ret .= '<li><input type="radio" name="' . $plugin_name . '_' . $opt['name'] . '" value="' . $key
|
||||
. '" id="radio_' . $plugin_name . '_' . $opt['name'] . '_' . $key . '"';
|
||||
if($key == $default) {
|
||||
|
||||
@ -43,34 +43,10 @@ function PMA_EVN_setGlobals()
|
||||
'MINUTE_SECOND');
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is defined in: rte_routines.lib.php, rte_triggers.lib.php and
|
||||
* rte_events.lib.php. It is used to retreive some language strings that are
|
||||
* used in functionalities that are common to routines, triggers and events.
|
||||
*
|
||||
* @param string $index The index of the string to get
|
||||
*
|
||||
* @return string The requested string or an empty string, if not available
|
||||
*/
|
||||
function PMA_RTE_getWord($index)
|
||||
{
|
||||
$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'),
|
||||
);
|
||||
return isset($words[$index]) ? $words[$index] : '';
|
||||
} // end PMA_RTE_getWord()
|
||||
|
||||
/**
|
||||
* Main function for the events functionality
|
||||
*/
|
||||
function PMA_RTE_main()
|
||||
function PMA_EVN_main()
|
||||
{
|
||||
global $db;
|
||||
|
||||
@ -95,7 +71,7 @@ function PMA_RTE_main()
|
||||
* toggle the state of the event scheduler.
|
||||
*/
|
||||
echo PMA_EVN_getFooterLinks();
|
||||
} // end PMA_RTE_main()
|
||||
} // end PMA_EVN_main()
|
||||
|
||||
/**
|
||||
* Handles editor requests for adding or editing an item
|
||||
|
||||
@ -13,6 +13,7 @@ if (! defined('PHPMYADMIN')) {
|
||||
* Include all other files that are common
|
||||
* to routines, triggers and events.
|
||||
*/
|
||||
require_once './libraries/rte/rte_words.lib.php';
|
||||
require_once './libraries/rte/rte_export.lib.php';
|
||||
require_once './libraries/rte/rte_list.lib.php';
|
||||
require_once './libraries/rte/rte_footer.lib.php';
|
||||
@ -71,14 +72,21 @@ $titles = PMA_buildActionTitles();
|
||||
*/
|
||||
$errors = array();
|
||||
|
||||
|
||||
/**
|
||||
* The below function is defined in rte_routines.lib.php,
|
||||
* rte_triggers.lib.php and rte_events.lib.php
|
||||
*
|
||||
* The appropriate function will now be called based on which one
|
||||
* of these files was included earlier in the top-level folder
|
||||
* Call the appropriate main function
|
||||
*/
|
||||
PMA_RTE_main();
|
||||
switch ($_PMA_RTE) {
|
||||
case 'RTN':
|
||||
PMA_RTN_main();
|
||||
break;
|
||||
case 'TRI':
|
||||
PMA_TRI_main();
|
||||
break;
|
||||
case 'EVN':
|
||||
PMA_EVN_main();
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the footer, if necessary
|
||||
|
||||
@ -28,34 +28,10 @@ function PMA_RTN_setGlobals()
|
||||
'MODIFIES SQL DATA');
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is defined in: rte_routines.lib.php, rte_triggers.lib.php and
|
||||
* rte_events.lib.php. It is used to retreive some language strings that are
|
||||
* used in functionalities that are common to routines, triggers and events.
|
||||
*
|
||||
* @param string $index The index of the string to get
|
||||
*
|
||||
* @return string The requested string or an empty string, if not available
|
||||
*/
|
||||
function PMA_RTE_getWord($index)
|
||||
{
|
||||
$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'),
|
||||
);
|
||||
return isset($words[$index]) ? $words[$index] : '';
|
||||
} // end PMA_RTE_getWord()
|
||||
|
||||
/**
|
||||
* Main function for the routines functionality
|
||||
*/
|
||||
function PMA_RTE_main()
|
||||
function PMA_RTN_main()
|
||||
{
|
||||
global $db;
|
||||
|
||||
@ -93,7 +69,7 @@ function PMA_RTE_main()
|
||||
E_USER_WARNING
|
||||
);
|
||||
}
|
||||
} // end PMA_RTE_main()
|
||||
} // end PMA_RTN_main()
|
||||
|
||||
/**
|
||||
* This function parses a string containing one parameter of a routine,
|
||||
@ -130,8 +106,7 @@ function PMA_RTN_parseOneParameter($value)
|
||||
$param_opts = array();
|
||||
for ($i=$pos; $i<$parsed_param['len']; $i++) {
|
||||
if (($parsed_param[$i]['type'] == 'alpha_columnType'
|
||||
|| $parsed_param[$i]['type'] == 'alpha_functionName') // "CHAR" seems to be mistaken for a function by the parser
|
||||
&& $depth == 0
|
||||
|| $parsed_param[$i]['type'] == 'alpha_functionName') && $depth == 0 // "CHAR" seems to be mistaken for a function by the parser
|
||||
) {
|
||||
$retval[2] = strtoupper($parsed_param[$i]['data']);
|
||||
} else if ($parsed_param[$i]['type'] == 'punct_bracket_open_round' && $depth == 0) {
|
||||
@ -452,7 +427,7 @@ function PMA_RTN_getDataFromRequest()
|
||||
$retval['item_param_length'] = array();
|
||||
$retval['item_param_opts_num'] = array();
|
||||
$retval['item_param_opts_text'] = array();
|
||||
if (isset($_REQUEST['item_param_name'])
|
||||
if ( isset($_REQUEST['item_param_name'])
|
||||
&& isset($_REQUEST['item_param_type'])
|
||||
&& isset($_REQUEST['item_param_length'])
|
||||
&& isset($_REQUEST['item_param_opts_num'])
|
||||
@ -464,65 +439,30 @@ function PMA_RTN_getDataFromRequest()
|
||||
&& is_array($_REQUEST['item_param_opts_text'])
|
||||
) {
|
||||
if ($_REQUEST['item_type'] == 'PROCEDURE') {
|
||||
$temp_num_params = 0;
|
||||
$retval['item_param_dir'] = $_REQUEST['item_param_dir'];
|
||||
foreach ($retval['item_param_dir'] as $key => $value) {
|
||||
if (! in_array($value, $param_directions, true)) {
|
||||
$retval['item_param_dir'][$key] = '';
|
||||
}
|
||||
$retval['item_num_params']++;
|
||||
}
|
||||
if ($temp_num_params > $retval['item_num_params']) {
|
||||
$retval['item_num_params'] = $temp_num_params;
|
||||
}
|
||||
}
|
||||
$temp_num_params = 0;
|
||||
$retval['item_param_name'] = $_REQUEST['item_param_name'];
|
||||
foreach ($retval['item_param_name'] as $key => $value) {
|
||||
$retval['item_param_name'][$key] = $value;
|
||||
$temp_num_params++;
|
||||
}
|
||||
if ($temp_num_params > $retval['item_num_params']) {
|
||||
$retval['item_num_params'] = $temp_num_params;
|
||||
}
|
||||
$temp_num_params = 0;
|
||||
$retval['item_param_type'] = $_REQUEST['item_param_type'];
|
||||
foreach ($retval['item_param_type'] as $key => $value) {
|
||||
if (! in_array($value, PMA_getSupportedDatatypes(), true)) {
|
||||
$retval['item_param_type'][$key] = '';
|
||||
}
|
||||
$temp_num_params++;
|
||||
}
|
||||
if ($temp_num_params > $retval['item_num_params']) {
|
||||
$retval['item_num_params'] = $temp_num_params;
|
||||
}
|
||||
$temp_num_params = 0;
|
||||
$retval['item_param_length'] = $_REQUEST['item_param_length'];
|
||||
foreach ($retval['item_param_length'] as $key => $value) {
|
||||
$retval['item_param_length'][$key] = $value;
|
||||
$temp_num_params++;
|
||||
}
|
||||
if ($temp_num_params > $retval['item_num_params']) {
|
||||
$retval['item_num_params'] = $temp_num_params;
|
||||
}
|
||||
$temp_num_params = 0;
|
||||
$retval['item_param_opts_num'] = $_REQUEST['item_param_opts_num'];
|
||||
foreach ($retval['item_param_opts_num'] as $key => $value) {
|
||||
$retval['item_param_opts_num'][$key] = $value;
|
||||
$temp_num_params++;
|
||||
}
|
||||
if ($temp_num_params > $retval['item_num_params']) {
|
||||
$retval['item_num_params'] = $temp_num_params;
|
||||
}
|
||||
$temp_num_params = 0;
|
||||
$retval['item_param_length'] = $_REQUEST['item_param_length'];
|
||||
$retval['item_param_opts_num'] = $_REQUEST['item_param_opts_num'];
|
||||
$retval['item_param_opts_text'] = $_REQUEST['item_param_opts_text'];
|
||||
foreach ($retval['item_param_opts_text'] as $key => $value) {
|
||||
$retval['item_param_opts_text'][$key] = $value;
|
||||
$temp_num_params++;
|
||||
}
|
||||
if ($temp_num_params > $retval['item_num_params']) {
|
||||
$retval['item_num_params'] = $temp_num_params;
|
||||
}
|
||||
$retval['item_num_params'] = max(
|
||||
count($retval['item_param_name']),
|
||||
count($retval['item_param_type']),
|
||||
count($retval['item_param_length']),
|
||||
count($retval['item_param_opts_num']),
|
||||
count($retval['item_param_opts_text'])
|
||||
);
|
||||
}
|
||||
$retval['item_returntype'] = '';
|
||||
if (isset($_REQUEST['item_returntype'])
|
||||
@ -1032,7 +972,9 @@ function PMA_RTN_getEditorForm($mode, $operation, $routine)
|
||||
*/
|
||||
function PMA_RTN_getQueryFromRequest()
|
||||
{
|
||||
global $_REQUEST, $cfg, $errors, $param_sqldataaccess, $param_opts_num;
|
||||
global $_REQUEST, $cfg, $errors, $param_sqldataaccess, $param_opts_num, $param_directions;
|
||||
|
||||
$_REQUEST['item_type'] = isset($_REQUEST['item_type']) ? $_REQUEST['item_type'] : '';
|
||||
|
||||
$query = 'CREATE ';
|
||||
if (! empty($_REQUEST['item_definer'])) {
|
||||
@ -1052,7 +994,7 @@ function PMA_RTN_getQueryFromRequest()
|
||||
$errors[] = sprintf(__('Invalid routine type: "%s"'), htmlspecialchars($_REQUEST['item_type']));
|
||||
}
|
||||
if (! empty($_REQUEST['item_name'])) {
|
||||
$query .= PMA_backquote($_REQUEST['item_name']) . ' ';
|
||||
$query .= PMA_backquote($_REQUEST['item_name']);
|
||||
} else {
|
||||
$errors[] = __('You must provide a routine name');
|
||||
}
|
||||
@ -1069,7 +1011,10 @@ function PMA_RTN_getQueryFromRequest()
|
||||
) {
|
||||
for ($i=0; $i<count($_REQUEST['item_param_name']); $i++) {
|
||||
if (! empty($_REQUEST['item_param_name'][$i]) && ! empty($_REQUEST['item_param_type'][$i])) {
|
||||
if ($_REQUEST['item_type'] == 'PROCEDURE' && ! empty($_REQUEST['item_param_dir'][$i])) {
|
||||
if ($_REQUEST['item_type'] == 'PROCEDURE'
|
||||
&& ! empty($_REQUEST['item_param_dir'][$i])
|
||||
&& in_array($_REQUEST['item_param_dir'][$i], $param_directions)
|
||||
) {
|
||||
$params .= $_REQUEST['item_param_dir'][$i] . " " . PMA_backquote($_REQUEST['item_param_name'][$i]) . " "
|
||||
. $_REQUEST['item_param_type'][$i];
|
||||
} else if ($_REQUEST['item_type'] == 'FUNCTION') {
|
||||
@ -1093,19 +1038,13 @@ function PMA_RTN_getQueryFromRequest()
|
||||
}
|
||||
}
|
||||
if (! empty($_REQUEST['item_param_opts_text'][$i])) {
|
||||
if (isset($cfg['RestrictColumnTypes'][strtoupper($_REQUEST['item_param_type'][$i])])) {
|
||||
$group = $cfg['RestrictColumnTypes'][strtoupper($_REQUEST['item_param_type'][$i])];
|
||||
if ($group == 'FUNC_CHAR') {
|
||||
$params .= ' CHARSET ' . strtolower($_REQUEST['item_param_opts_text'][$i]);
|
||||
}
|
||||
if (in_array($_REQUEST['item_param_type'][$i], $cfg['ColumnTypes']['STRING'])) {
|
||||
$params .= ' CHARSET ' . strtolower($_REQUEST['item_param_opts_text'][$i]);
|
||||
}
|
||||
}
|
||||
if (! empty($_REQUEST['item_param_opts_num'][$i])) {
|
||||
if (isset($cfg['RestrictColumnTypes'][strtoupper($_REQUEST['item_param_type'][$i])])) {
|
||||
$group = $cfg['RestrictColumnTypes'][strtoupper($_REQUEST['item_param_type'][$i])];
|
||||
if ($group == 'FUNC_NUMBER' && in_array($_REQUEST['item_param_opts_num'][$i], $param_opts_num)) {
|
||||
$params .= ' ' . strtoupper($_REQUEST['item_param_opts_num'][$i]);
|
||||
}
|
||||
if (in_array($_REQUEST['item_param_type'][$i], $cfg['ColumnTypes']['NUMERIC'])) {
|
||||
$params .= ' ' . strtoupper($_REQUEST['item_param_opts_num'][$i]);
|
||||
}
|
||||
}
|
||||
if ($i != count($_REQUEST['item_param_name'])-1) {
|
||||
@ -1118,7 +1057,7 @@ function PMA_RTN_getQueryFromRequest()
|
||||
}
|
||||
}
|
||||
}
|
||||
$query .= " (" . $params . ") ";
|
||||
$query .= "(" . $params . ") ";
|
||||
if ($_REQUEST['item_type'] == 'FUNCTION') {
|
||||
if (! empty($_REQUEST['item_returntype']) && in_array($_REQUEST['item_returntype'], PMA_getSupportedDatatypes())) {
|
||||
$query .= "RETURNS {$_REQUEST['item_returntype']}";
|
||||
@ -1137,19 +1076,13 @@ function PMA_RTN_getQueryFromRequest()
|
||||
}
|
||||
}
|
||||
if (! empty($_REQUEST['item_returnopts_text'])) {
|
||||
if (isset($cfg['RestrictColumnTypes'][strtoupper($_REQUEST['item_returntype'])])) {
|
||||
$group = $cfg['RestrictColumnTypes'][strtoupper($_REQUEST['item_returntype'])];
|
||||
if ($group == 'FUNC_CHAR') {
|
||||
$query .= ' CHARSET ' . strtolower($_REQUEST['item_returnopts_text']);
|
||||
}
|
||||
if (in_array($_REQUEST['item_returntype'], $cfg['ColumnTypes']['STRING'])) {
|
||||
$query .= ' CHARSET ' . strtolower($_REQUEST['item_returnopts_text']);
|
||||
}
|
||||
}
|
||||
if (! empty($_REQUEST['item_returnopts_num'])) {
|
||||
if (isset($cfg['RestrictColumnTypes'][strtoupper($_REQUEST['item_returntype'])])) {
|
||||
$group = $cfg['RestrictColumnTypes'][strtoupper($_REQUEST['item_returntype'])];
|
||||
if ($group == 'FUNC_NUMBER' && in_array($_REQUEST['item_returnopts_num'], $param_opts_num)) {
|
||||
$query .= ' ' . strtoupper($_REQUEST['item_returnopts_num']);
|
||||
}
|
||||
if (in_array($_REQUEST['item_returntype'], $cfg['ColumnTypes']['NUMERIC'])) {
|
||||
$query .= ' ' . strtoupper($_REQUEST['item_returnopts_num']);
|
||||
}
|
||||
}
|
||||
$query .= ' ';
|
||||
|
||||
@ -24,34 +24,10 @@ function PMA_TRI_setGlobals()
|
||||
'DELETE');
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is defined in: rte_routines.lib.php, rte_triggers.lib.php and
|
||||
* rte_events.lib.php. It is used to retreive some language strings that are
|
||||
* used in functionalities that are common to routines, triggers and events.
|
||||
*
|
||||
* @param string $index The index of the string to get
|
||||
*
|
||||
* @return string The requested string or an empty string, if not available
|
||||
*/
|
||||
function PMA_RTE_getWord($index)
|
||||
{
|
||||
$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'),
|
||||
);
|
||||
return isset($words[$index]) ? $words[$index] : '';
|
||||
} // end PMA_RTE_getWord()
|
||||
|
||||
/**
|
||||
* Main function for the triggers functionality
|
||||
*/
|
||||
function PMA_RTE_main()
|
||||
function PMA_TRI_main()
|
||||
{
|
||||
global $db, $table;
|
||||
|
||||
@ -71,7 +47,7 @@ function PMA_RTE_main()
|
||||
* if the user has the necessary privileges
|
||||
*/
|
||||
echo PMA_TRI_getFooterLinks();
|
||||
} // end PMA_RTE_main()
|
||||
} // end PMA_TRI_main()
|
||||
|
||||
/**
|
||||
* Handles editor requests for adding or editing an item
|
||||
|
||||
60
libraries/rte/rte_words.lib.php
Normal file
60
libraries/rte/rte_words.lib.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This function is used to retreive some language strings that are used
|
||||
* in functionalities that are common to routines, triggers and events.
|
||||
*
|
||||
* @param string $index The index of the string to get
|
||||
*
|
||||
* @return string The requested string or an empty string, if not available
|
||||
*/
|
||||
function PMA_RTE_getWord($index)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
return isset($words[$index]) ? $words[$index] : '';
|
||||
} // end PMA_RTE_getWord()
|
||||
|
||||
?>
|
||||
@ -637,7 +637,7 @@ class PMA_User_Schema
|
||||
*/
|
||||
$tables = PMA_DBI_get_tables_full($db);
|
||||
$foreignkey_tables = array();
|
||||
foreach($tables as $table_name => $table_properties) {
|
||||
foreach ($tables as $table_name => $table_properties) {
|
||||
if (PMA_foreignkey_supported($table_properties['ENGINE'])) {
|
||||
$foreignkey_tables[] = $table_name;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -362,7 +362,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
if (class_exists('PMA_Message') && $GLOBALS['is_ajax_request'] != true) {
|
||||
PMA_Message::notice(__('Automatically appended backtick to the end of query!'))->display();
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
$debugstr = __('Unclosed quote') . ' @ ' . $startquotepos. "\n"
|
||||
. 'STR: ' . htmlspecialchars($quotetype);
|
||||
PMA_SQP_throwError($debugstr, $sql);
|
||||
|
||||
@ -115,7 +115,7 @@ class Linux {
|
||||
$mem['MemUsed'] = $mem['MemTotal'] - $mem['MemFree'] - $mem['Cached'] - $mem['Buffers'];
|
||||
$mem['SwapUsed'] = $mem['SwapTotal'] - $mem['SwapFree'] - $mem['SwapCached'];
|
||||
|
||||
foreach($mem as $idx=>$value)
|
||||
foreach ($mem as $idx=>$value)
|
||||
$mem[$idx] = intval($value);
|
||||
|
||||
return $mem;
|
||||
|
||||
@ -8437,7 +8437,7 @@ class TCPDF {
|
||||
//Pages root
|
||||
$out = $this->_getobj(1)."\n";
|
||||
$out .= '<< /Type /Pages /Kids [';
|
||||
foreach($this->page_obj_id as $page_obj) {
|
||||
foreach ($this->page_obj_id as $page_obj) {
|
||||
$out .= ' '.$page_obj.' 0 R';
|
||||
}
|
||||
$out .= ' ] /Count '.$nb.' >>';
|
||||
@ -8902,7 +8902,7 @@ class TCPDF {
|
||||
}
|
||||
if (isset($pl['opt']['mk']['bc']) AND (is_array($pl['opt']['mk']['bc']))) {
|
||||
$annots .= ' /BC [';
|
||||
foreach($pl['opt']['mk']['bc'] AS $col) {
|
||||
foreach ($pl['opt']['mk']['bc'] AS $col) {
|
||||
$col = intval($col);
|
||||
$color = $col <= 0 ? 0 : ($col >= 255 ? 1 : $col / 255);
|
||||
$annots .= sprintf(' %.2F', $color);
|
||||
@ -8911,7 +8911,7 @@ class TCPDF {
|
||||
}
|
||||
if (isset($pl['opt']['mk']['bg']) AND (is_array($pl['opt']['mk']['bg']))) {
|
||||
$annots .= ' /BG [';
|
||||
foreach($pl['opt']['mk']['bg'] AS $col) {
|
||||
foreach ($pl['opt']['mk']['bg'] AS $col) {
|
||||
$col = intval($col);
|
||||
$color = $col <= 0 ? 0 : ($col >= 255 ? 1 : $col / 255);
|
||||
$annots .= sprintf(' %.2F', $color);
|
||||
@ -8988,7 +8988,7 @@ class TCPDF {
|
||||
if (is_array($pl['opt']['ff'])) {
|
||||
// array of bit settings
|
||||
$flag = 0;
|
||||
foreach($pl['opt']['ff'] as $val) {
|
||||
foreach ($pl['opt']['ff'] as $val) {
|
||||
$flag += 1 << ($val - 1);
|
||||
}
|
||||
} else {
|
||||
@ -9052,7 +9052,7 @@ class TCPDF {
|
||||
}
|
||||
if (isset($pl['opt']['opt']) AND (is_array($pl['opt']['opt'])) AND !empty($pl['opt']['opt'])) {
|
||||
$annots .= ' /Opt [';
|
||||
foreach($pl['opt']['opt'] AS $copt) {
|
||||
foreach ($pl['opt']['opt'] AS $copt) {
|
||||
if (is_array($copt)) {
|
||||
$annots .= ' ['.$this->_textstring($copt[0], $annot_obj_id).' '.$this->_textstring($copt[1], $annot_obj_id).']';
|
||||
} else {
|
||||
@ -9066,7 +9066,7 @@ class TCPDF {
|
||||
}
|
||||
if (isset($pl['opt']['i']) AND (is_array($pl['opt']['i'])) AND !empty($pl['opt']['i'])) {
|
||||
$annots .= ' /I [';
|
||||
foreach($pl['opt']['i'] AS $copt) {
|
||||
foreach ($pl['opt']['i'] AS $copt) {
|
||||
$annots .= intval($copt).' ';
|
||||
}
|
||||
$annots .= ']';
|
||||
@ -10595,7 +10595,7 @@ class TCPDF {
|
||||
$objrefs .= $this->sig_obj_id.' 0 R';
|
||||
}
|
||||
if (!empty($this->form_obj_id)) {
|
||||
foreach($this->form_obj_id as $objid) {
|
||||
foreach ($this->form_obj_id as $objid) {
|
||||
$objrefs .= ' '.$objid.' 0 R';
|
||||
}
|
||||
}
|
||||
@ -17875,7 +17875,7 @@ class TCPDF {
|
||||
protected function getTagStyleFromCSS($dom, $key, $css) {
|
||||
$tagstyle = ''; // style to be returned
|
||||
// get all styles that apply
|
||||
foreach($css as $selector => $style) {
|
||||
foreach ($css as $selector => $style) {
|
||||
// remove specificity
|
||||
$selector = substr($selector, strpos($selector, ' '));
|
||||
// check if this selector apply to current tag
|
||||
@ -23789,7 +23789,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
$patterns_array = preg_split('/[\s]+/', $data);
|
||||
// create new language array of patterns
|
||||
$patterns = array();
|
||||
foreach($patterns_array as $val) {
|
||||
foreach ($patterns_array as $val) {
|
||||
if (!$this->empty_string($val)) {
|
||||
$val = trim($val);
|
||||
$val = str_replace('\'', '\\\'', $val);
|
||||
@ -25077,12 +25077,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
$gradient['coords'][4] /= $w;
|
||||
}
|
||||
} elseif ($gradient['mode'] == 'percentage') {
|
||||
foreach($gradient['coords'] as $key => $val) {
|
||||
foreach ($gradient['coords'] as $key => $val) {
|
||||
$gradient['coords'][$key] = (intval($val) / 100);
|
||||
}
|
||||
}
|
||||
// fix values
|
||||
foreach($gradient['coords'] as $key => $val) {
|
||||
foreach ($gradient['coords'] as $key => $val) {
|
||||
if ($val < 0) {
|
||||
$gradient['coords'][$key] = 0;
|
||||
} elseif ($val > 1) {
|
||||
|
||||
@ -20,7 +20,7 @@ function PMA_transformation_application_octetstream__download(&$buffer, $options
|
||||
$cn = $options[0]; // filename
|
||||
} else {
|
||||
if (isset($options[1]) && !empty($options[1])) {
|
||||
foreach($fields_meta as $key => $val) {
|
||||
foreach ($fields_meta as $key => $val) {
|
||||
if ($val->name == $options[1]) {
|
||||
$pos = $key;
|
||||
break;
|
||||
|
||||
@ -9,18 +9,7 @@
|
||||
* Zip file creation class.
|
||||
* Makes zip files.
|
||||
*
|
||||
* Based on :
|
||||
*
|
||||
* http://www.zend.com/codex.php?id=535&single=1
|
||||
* By Eric Mueller <eric@themepark.com>
|
||||
*
|
||||
* http://www.zend.com/codex.php?id=470&single=1
|
||||
* by Denis125 <webmaster@atlant.ru>
|
||||
*
|
||||
* a patch from Peter Listiak <mlady@users.sourceforge.net> for last modified
|
||||
* date and time of the compressed file
|
||||
*
|
||||
* Official ZIP file format: http://www.pkware.com/appnote.txt
|
||||
* @see Official ZIP file format: http://www.pkware.com/support/zip-app-note
|
||||
*
|
||||
* @access public
|
||||
* @package phpMyAdmin
|
||||
@ -147,14 +136,6 @@ class zipfile
|
||||
// "file data" segment
|
||||
$fr .= $zdata;
|
||||
|
||||
// "data descriptor" segment (optional but necessary if archive is not
|
||||
// served as file)
|
||||
// this seems not to be needed at all and causes
|
||||
// problems in some cases (bug #1037737)
|
||||
//$fr .= pack('V', $crc); // crc32
|
||||
//$fr .= pack('V', $c_len); // compressed filesize
|
||||
//$fr .= pack('V', $unc_len); // uncompressed filesize
|
||||
|
||||
// echo this entry on the fly, ...
|
||||
if ( $this -> doWrite) {
|
||||
echo $fr;
|
||||
@ -205,7 +186,7 @@ class zipfile
|
||||
pack('v', sizeof($this -> ctrl_dir)) . // total # of entries "on this disk"
|
||||
pack('v', sizeof($this -> ctrl_dir)) . // total # of entries overall
|
||||
pack('V', strlen($ctrldir)) . // size of central dir
|
||||
pack('V', strlen($data)) . // offset to start of central dir
|
||||
pack('V', $this -> old_offset) . // offset to start of central dir
|
||||
"\x00\x00"; // .zip file comment length
|
||||
|
||||
if ( $this -> doWrite ) { // Send central directory & end ctrl dir to STDOUT
|
||||
|
||||
53
phpunit.xml.dist
Normal file
53
phpunit.xml.dist
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit bootstrap="test/bootstrap-dist.php"
|
||||
backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
strict="true"
|
||||
verbose="true">
|
||||
|
||||
<selenium>
|
||||
<browser name="Firefox on localhost"
|
||||
browser="*firefox"
|
||||
host="127.0.0.1"
|
||||
port="4444"
|
||||
timeout="30000"/>
|
||||
<browser name="Google Chrome on localhost"
|
||||
browser="googlechrome"
|
||||
host="127.0.0.1"
|
||||
port="4444"
|
||||
timeout="30000"/>
|
||||
</selenium>
|
||||
|
||||
<php>
|
||||
<const name="TESTSUITE_SERVER" value="localhost"/>
|
||||
<const name="TESTSUITE_USER" value="root"/>
|
||||
<const name="TESTSUITE_PASSWORD" value=""/>
|
||||
<const name="TESTSUITE_DATABASE" value="test"/>
|
||||
<const name="TESTSUITE_PHPMYADMIN_HOST" value="http://localhost" />
|
||||
<const name="TESTSUITE_PHPMYADMIN_URL" value="/phpmyadmin" />
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Classes">
|
||||
<directory suffix="_test.php">test/classes</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Unit">
|
||||
<file>test/Environment_test.php</file>
|
||||
<directory suffix="_test.php">test/libraries/core</directory>
|
||||
<directory suffix="_test.php">test/libraries/common</directory>
|
||||
<directory suffix="_test.php">test/libraries</directory>
|
||||
</testsuite>
|
||||
<!--<testsuite name="Selenium">-->
|
||||
<!--<directory suffix="Test.php">test/selenium</directory>-->
|
||||
<!--</testsuite>-->
|
||||
</testsuites>
|
||||
|
||||
<logging>
|
||||
<log type="coverage-html" target="build/coverage" title="phpMyAdmin"
|
||||
charset="UTF-8" yui="true" highlight="true"
|
||||
lowUpperBound="35" highLowerBound="70"/>
|
||||
<log type="coverage-clover" target="build/logs/clover.xml"/>
|
||||
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
|
||||
</logging>
|
||||
|
||||
</phpunit>
|
||||
1901
po/be@latin.po
1901
po/be@latin.po
File diff suppressed because it is too large
Load Diff
2044
po/en_GB.po
2044
po/en_GB.po
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user