Merge remote-tracking branch 'origin/master' into grid
This commit is contained in:
commit
4d9715e6ca
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/
|
||||
11
ChangeLog
11
ChangeLog
@ -34,6 +34,11 @@ phpMyAdmin - ChangeLog
|
||||
+ Show/hide column in table Browse
|
||||
- bug #3353856 [AJAX] AJAX dialogs use wrong font-size
|
||||
- bug #3354356 [interface] Timepicker does not work in AJAX dialogs
|
||||
+ AJAX for table Structure Indexes Edit
|
||||
+ 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
|
||||
@ -43,6 +48,12 @@ phpMyAdmin - ChangeLog
|
||||
- bug #3353649 [interface] "Create an index on X columns" form not validated
|
||||
- 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
|
||||
- remove misleading comment on the "Rename database" interface
|
||||
|
||||
3.4.3.1 (2011-07-02)
|
||||
- [security] Fixed possible session manipulation in swekey authentication, see PMASA-2011-5
|
||||
|
||||
@ -2143,7 +2143,7 @@ setfacl -d -m "g:www-data:rwx" tmp
|
||||
identify what they mean.
|
||||
</dd>
|
||||
|
||||
<dt id="cfg_ShowDisplayDir">$cfg['ShowDisplayDir'] boolean</dt>
|
||||
<dt id="cfg_ShowDisplayDirection">$cfg['ShowDisplayDirection'] boolean</dt>
|
||||
<dd>
|
||||
Defines whether or not type display direction option is shown
|
||||
when browsing a table.
|
||||
|
||||
@ -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'];
|
||||
/*
|
||||
|
||||
88
build.xml
Normal file
88
build.xml
Normal file
@ -0,0 +1,88 @@
|
||||
<?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 build
|
||||
--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/*,*/build/*
|
||||
--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
|
||||
|
||||
@ -7,17 +7,17 @@
|
||||
*/
|
||||
|
||||
|
||||
define('PMA_MINIMUM_COMMON',true);
|
||||
define('PMA_MINIMUM_COMMON', true);
|
||||
|
||||
require_once './libraries/common.inc.php';
|
||||
|
||||
if(isset($_REQUEST['filename']) && isset($_REQUEST['image'])) {
|
||||
$allowed = Array( 'image/png'=>'png', 'image/svg+xml'=>'svg');
|
||||
|
||||
if(!isset($allowed[$_REQUEST['type']])) exit('Invalid export type');
|
||||
if(! isset($allowed[$_REQUEST['type']])) exit('Invalid export type');
|
||||
|
||||
if(!preg_match("/(".implode("|",$allowed).")$/i",$_REQUEST['filename']))
|
||||
$_REQUEST['filename'].='.'.$allowed[$_REQUEST['type']];
|
||||
if(! preg_match("/(".implode("|",$allowed).")$/i", $_REQUEST['filename']))
|
||||
$_REQUEST['filename'] .= '.' . $allowed[$_REQUEST['type']];
|
||||
|
||||
header("Cache-Control: public");
|
||||
header("Content-Description: File Transfer");
|
||||
@ -25,8 +25,8 @@ if(isset($_REQUEST['filename']) && isset($_REQUEST['image'])) {
|
||||
header("Content-Type: ".$_REQUEST['type']);
|
||||
header("Content-Transfer-Encoding: binary");
|
||||
|
||||
if($allowed[$_REQUEST['type']]!='svg')
|
||||
echo base64_decode(substr($_REQUEST['image'],strpos($_REQUEST['image'],',')+1));
|
||||
if($allowed[$_REQUEST['type']] != 'svg')
|
||||
echo base64_decode(substr($_REQUEST['image'], strpos($_REQUEST['image'],',') + 1));
|
||||
else
|
||||
echo $_REQUEST['image'];
|
||||
|
||||
|
||||
@ -1,40 +1,36 @@
|
||||
<?php
|
||||
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Events management.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include required files
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
require_once './libraries/common.lib.php';
|
||||
|
||||
/**
|
||||
* Include JavaScript libraries
|
||||
*/
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
|
||||
$GLOBALS['js_include'][] = 'db_events.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';
|
||||
|
||||
/**
|
||||
* Create labels for the list
|
||||
* Include all other files
|
||||
*/
|
||||
$titles = PMA_buildActionTitles();
|
||||
require_once './libraries/rte/rte_events.lib.php';
|
||||
|
||||
/**
|
||||
* Displays the header
|
||||
* Do the magic
|
||||
*/
|
||||
require_once './libraries/db_common.inc.php';
|
||||
|
||||
/**
|
||||
* Displays the tabs
|
||||
*/
|
||||
require_once './libraries/db_info.inc.php';
|
||||
|
||||
/**
|
||||
* Displays the list of events
|
||||
*/
|
||||
require_once './libraries/db_events.inc.php';
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require './libraries/footer.inc.php';
|
||||
|
||||
$_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
|
||||
@ -398,24 +398,12 @@ if ($db != 'mysql') {
|
||||
<legend>
|
||||
<?php
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img class="icon" src="' . $pmaThemeImage . 'b_edit.png"'
|
||||
.' alt="" width="16" height="16" />';
|
||||
echo '<img class="icon ic_b_edit" src="themes/dot.gif" alt="" />';
|
||||
}
|
||||
echo __('Rename database to') . ':';
|
||||
?>
|
||||
</legend>
|
||||
<input id="new_db_name" type="text" name="newname" size="30" class="textfield" value="" />
|
||||
<?php
|
||||
echo '(' . __('Command') . ': ';
|
||||
/**
|
||||
* @todo (see explanations above in a previous todo)
|
||||
*/
|
||||
//if (PMA_MYSQL_INT_VERSION >= XYYZZ) {
|
||||
// echo 'RENAME DATABASE';
|
||||
//} else {
|
||||
echo 'INSERT INTO ... SELECT';
|
||||
//}
|
||||
echo ')'; ?>
|
||||
</fieldset>
|
||||
<fieldset class="tblFooters">
|
||||
<input id="rename_db_input" type="submit" value="<?php echo __('Go'); ?>" />
|
||||
@ -434,8 +422,7 @@ if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && ! $db_is_info
|
||||
<fieldset class="caution">
|
||||
<legend><?php
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img class="icon" src="' . $pmaThemeImage . 'b_deltbl.png"'
|
||||
.' alt="" width="16" height="16" />';
|
||||
echo '<img class="icon ic_b_deltbl" src="themes/dot.gif" alt="" />';
|
||||
}
|
||||
echo __('Remove database');
|
||||
?></legend>
|
||||
@ -481,8 +468,7 @@ echo __('Remove database');
|
||||
<legend>
|
||||
<?php
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img class="icon" src="' . $pmaThemeImage . 'b_edit.png"'
|
||||
.' alt="" width="16" height="16" />';
|
||||
echo '<img class="icon ic_b_edit" src="themes/dot.gif" alt="" />';
|
||||
}
|
||||
echo __('Copy database to') . ':';
|
||||
$drop_clause = 'DROP TABLE / DROP VIEW';
|
||||
@ -546,8 +532,7 @@ echo __('Remove database');
|
||||
. '<fieldset>' . "\n"
|
||||
. ' <legend>';
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img class="icon" src="' . $pmaThemeImage . 's_asci.png"'
|
||||
.' alt="" width="16" height="16" />';
|
||||
echo '<img class="icon ic_s_asci" src="themes/dot.gif" alt="" />';
|
||||
}
|
||||
echo ' <label for="select_db_collation">' . __('Collation') . ':</label>' . "\n"
|
||||
. ' </legend>' . "\n"
|
||||
@ -594,8 +579,7 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
|
||||
*/
|
||||
echo '<div class="operations_full_width"><fieldset><a href="schema_edit.php?' . $url_query . '">';
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img class="icon" src="' . $pmaThemeImage . 'b_edit.png"'
|
||||
.' alt="" width="16" height="16" />';
|
||||
echo '<img class="icon ic_b_edit" src="themes/dot.gif" alt="" />';
|
||||
}
|
||||
echo __('Edit or export relational schema') . '</a></fieldset></div>';
|
||||
} // end if
|
||||
|
||||
431
db_routines.php
431
db_routines.php
@ -11,7 +11,6 @@
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
require_once './libraries/common.lib.php';
|
||||
require_once './libraries/db_routines.lib.php';
|
||||
require_once './libraries/mysql_charsets.lib.php';
|
||||
require_once './libraries/data_mysql.inc.php';
|
||||
|
||||
@ -20,432 +19,20 @@ require_once './libraries/data_mysql.inc.php';
|
||||
*/
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
|
||||
$GLOBALS['js_include'][] = 'jquery/timepicker.js';
|
||||
$GLOBALS['js_include'][] = 'db_routines.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';
|
||||
|
||||
/**
|
||||
* Create labels for the list
|
||||
* Include all other files
|
||||
*/
|
||||
$titles = PMA_buildActionTitles();
|
||||
|
||||
if ($GLOBALS['is_ajax_request'] != true) {
|
||||
/**
|
||||
* Displays the header
|
||||
*/
|
||||
require_once './libraries/db_common.inc.php';
|
||||
/**
|
||||
* Displays the tabs
|
||||
*/
|
||||
require_once './libraries/db_info.inc.php';
|
||||
} else {
|
||||
if (strlen($db)) {
|
||||
PMA_DBI_select_db($db);
|
||||
if (! isset($url_query)) {
|
||||
$url_query = PMA_generate_common_url($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
require_once './libraries/rte/rte_routines.lib.php';
|
||||
|
||||
/**
|
||||
* Process all requests
|
||||
* Do the magic
|
||||
*/
|
||||
|
||||
// Some definitions
|
||||
$param_directions = array('IN',
|
||||
'OUT',
|
||||
'INOUT');
|
||||
$param_opts_num = array('UNSIGNED',
|
||||
'ZEROFILL',
|
||||
'UNSIGNED ZEROFILL');
|
||||
$param_sqldataaccess = array('NO SQL',
|
||||
'CONTAINS SQL',
|
||||
'READS SQL DATA',
|
||||
'MODIFIES SQL DATA');
|
||||
|
||||
/**
|
||||
* Generate the conditional classes that will be used to attach jQuery events to links.
|
||||
*/
|
||||
$ajax_class = array(
|
||||
'add' => '',
|
||||
'edit' => '',
|
||||
'exec' => '',
|
||||
'drop' => '',
|
||||
'export' => ''
|
||||
);
|
||||
if ($GLOBALS['cfg']['AjaxEnable']) {
|
||||
$ajax_class['add'] = 'class="add_routine_anchor"';
|
||||
$ajax_class['edit'] = 'class="edit_routine_anchor"';
|
||||
$ajax_class['exec'] = 'class="exec_routine_anchor"';
|
||||
$ajax_class['drop'] = 'class="drop_routine_anchor"';
|
||||
$ajax_class['export'] = 'class="export_routine_anchor"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep a list of errors that occured while processing an 'Add' or 'Edit' operation.
|
||||
*/
|
||||
$routine_errors = array();
|
||||
|
||||
/**
|
||||
* Handle all user requests other than the default of listing routines
|
||||
*/
|
||||
if (! empty($_REQUEST['execute_routine']) && ! empty($_REQUEST['routine_name'])) {
|
||||
// Build the queries
|
||||
$routine = PMA_RTN_getRoutineDataFromName($db, $_REQUEST['routine_name'], false);
|
||||
if ($routine !== false) {
|
||||
$queries = array();
|
||||
$end_query = array();
|
||||
$args = array();
|
||||
for ($i=0; $i<$routine['num_params']; $i++) {
|
||||
if (isset($_REQUEST['params'][$routine['param_name'][$i]])) {
|
||||
$value = $_REQUEST['params'][$routine['param_name'][$i]];
|
||||
if (is_array($value)) { // is SET type
|
||||
$value = implode(',', $value);
|
||||
}
|
||||
$value = PMA_sqlAddSlashes($value);
|
||||
if (! empty($_REQUEST['funcs'][$routine['param_name'][$i]])
|
||||
&& in_array($_REQUEST['funcs'][$routine['param_name'][$i]], $cfg['Functions'])) {
|
||||
$queries[] = "SET @p$i={$_REQUEST['funcs'][$routine['param_name'][$i]]}('$value');\n";
|
||||
} else {
|
||||
$queries[] = "SET @p$i='$value';\n";
|
||||
}
|
||||
$args[] = "@p$i";
|
||||
} else {
|
||||
$args[] = "@p$i";
|
||||
}
|
||||
if ($routine['type'] == 'PROCEDURE') {
|
||||
if ($routine['param_dir'][$i] == 'OUT' || $routine['param_dir'][$i] == 'INOUT') {
|
||||
$end_query[] = "@p$i AS " . PMA_backquote($routine['param_name'][$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($routine['type'] == 'PROCEDURE') {
|
||||
$queries[] = "CALL " . PMA_backquote($routine['name'])
|
||||
. "(" . implode(', ', $args) . ");\n";
|
||||
if (count($end_query)) {
|
||||
$queries[] = "SELECT " . implode(', ', $end_query) . ";\n";
|
||||
}
|
||||
} else {
|
||||
$queries[] = "SELECT " . PMA_backquote($routine['name'])
|
||||
. "(" . implode(', ', $args) . ") "
|
||||
. "AS " . PMA_backquote($routine['name']) . ";\n";
|
||||
}
|
||||
// Execute the queries
|
||||
$affected = 0;
|
||||
$result = null;
|
||||
$outcome = true;
|
||||
foreach ($queries as $num => $query) {
|
||||
$resource = PMA_DBI_try_query($query);
|
||||
if ($resource === false) {
|
||||
$outcome = false;
|
||||
break;
|
||||
}
|
||||
while (true) {
|
||||
if(! PMA_DBI_more_results()) {
|
||||
break;
|
||||
}
|
||||
PMA_DBI_next_result();
|
||||
}
|
||||
if (substr($query, 0, 6) == 'SELECT') {
|
||||
$result = $resource;
|
||||
} else if (substr($query, 0, 4) == 'CALL') {
|
||||
$affected = PMA_DBI_affected_rows() - PMA_DBI_num_rows($resource);
|
||||
}
|
||||
}
|
||||
// Generate output
|
||||
if ($outcome) {
|
||||
$message = __('Your SQL query has been executed successfully');
|
||||
if ($routine['type'] == 'PROCEDURE') {
|
||||
$message .= '<br />';
|
||||
$message .= sprintf(_ngettext('%d row affected by the last statement inside the procedure', '%d rows affected by the last statement inside the procedure', $affected), $affected);
|
||||
}
|
||||
$message = PMA_message::success($message);
|
||||
// Pass the SQL queries through the "pretty printer"
|
||||
$output = '<code class="sql" style="margin-bottom: 1em;">';
|
||||
$output .= PMA_SQP_formatHtml(PMA_SQP_parse(implode($queries)));
|
||||
$output .= '</code>';
|
||||
// Display results
|
||||
if ($result) {
|
||||
$output .= "<fieldset><legend>";
|
||||
$output .= sprintf(__('Execution results of routine %s'),
|
||||
PMA_backquote(htmlspecialchars($routine['name'])));
|
||||
$output .= "</legend>";
|
||||
$output .= "<table><tr>";
|
||||
foreach (PMA_DBI_get_fields_meta($result) as $key => $field) {
|
||||
$output .= "<th>" . htmlspecialchars($field->name) . "</th>";
|
||||
}
|
||||
$output .= "</tr>";
|
||||
// Stored routines can only ever return ONE ROW.
|
||||
$data = PMA_DBI_fetch_single_row($result);
|
||||
foreach ($data as $key => $value) {
|
||||
if ($value === null) {
|
||||
$value = '<i>NULL</i>';
|
||||
} else {
|
||||
$value = htmlspecialchars($value);
|
||||
}
|
||||
$output .= "<td class='odd'>" . $value . "</td>";
|
||||
}
|
||||
$output .= "</table></fieldset>";
|
||||
} else {
|
||||
$notice = __('MySQL returned an empty result set (i.e. zero rows).');
|
||||
$output .= PMA_message::notice($notice)->getDisplay();
|
||||
}
|
||||
} else {
|
||||
$output = '';
|
||||
$message = PMA_message::error(sprintf(__('The following query has failed: "%s"'), $query) . '<br /><br />'
|
||||
. __('MySQL said: ') . PMA_DBI_getError(null));
|
||||
}
|
||||
// Print/send output
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
$extra_data = array('dialog' => false);
|
||||
PMA_ajaxResponse($message->getDisplay() . $output, $message->isSuccess(), $extra_data);
|
||||
} else {
|
||||
echo $message->getDisplay() . $output;
|
||||
if ($message->isError()) {
|
||||
// At least one query has failed, so shouldn't
|
||||
// execute any more queries, so we quit.
|
||||
exit;
|
||||
}
|
||||
unset($_POST);
|
||||
// Now deliberately fall through to displaying the routines list
|
||||
}
|
||||
} else {
|
||||
$message = __('Error in processing request') . ' : '
|
||||
. sprintf(__('No routine with name %1$s found in database %2$s'),
|
||||
htmlspecialchars(PMA_backquote($_REQUEST['routine_name'])),
|
||||
htmlspecialchars(PMA_backquote($db)));
|
||||
$message = PMA_message::error($message);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
PMA_ajaxResponse($message, $message->isSuccess());
|
||||
} else {
|
||||
echo $message->getDisplay();
|
||||
unset($_POST);
|
||||
}
|
||||
}
|
||||
} else if (! empty($_GET['execute_dialog']) && ! empty($_GET['routine_name'])) {
|
||||
/**
|
||||
* Display the execute form for a routine.
|
||||
*/
|
||||
$routine = PMA_RTN_getRoutineDataFromName($db, $_GET['routine_name'], false);
|
||||
if ($routine !== false) {
|
||||
$form = PMA_RTN_getExecuteForm($routine, $GLOBALS['is_ajax_request']);
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
$extra_data = array();
|
||||
$extra_data['dialog'] = true;
|
||||
$extra_data['title'] = __("Execute routine") . " ";
|
||||
$extra_data['title'] .= PMA_backquote(htmlentities($_GET['routine_name'], ENT_QUOTES));
|
||||
PMA_ajaxResponse($form, true, $extra_data);
|
||||
} else {
|
||||
echo "\n\n<h2>" . __("Execute routine") . "</h2>\n\n";
|
||||
echo $form;
|
||||
require './libraries/footer.inc.php';
|
||||
// exit;
|
||||
}
|
||||
} else if (($GLOBALS['is_ajax_request'] == true)) {
|
||||
$message = __('Error in processing request') . ' : '
|
||||
. sprintf(__('No routine with name %1$s found in database %2$s'),
|
||||
htmlspecialchars(PMA_backquote($_REQUEST['routine_name'])),
|
||||
htmlspecialchars(PMA_backquote($db)));
|
||||
$message = PMA_message::error($message);
|
||||
PMA_ajaxResponse($message, false);
|
||||
}
|
||||
} else if (! empty($_GET['exportroutine']) && ! empty($_GET['routine_name'])) {
|
||||
/**
|
||||
* Display the export for a routine.
|
||||
*/
|
||||
$routine_name = htmlspecialchars(PMA_backquote($_GET['routine_name']));
|
||||
$routine_type = PMA_DBI_fetch_value("SELECT ROUTINE_TYPE "
|
||||
. "FROM INFORMATION_SCHEMA.ROUTINES "
|
||||
. "WHERE ROUTINE_SCHEMA='" . PMA_sqlAddSlashes($db) . "' "
|
||||
. "AND SPECIFIC_NAME='" . PMA_sqlAddSlashes($_GET['routine_name']) . "';");
|
||||
if (! empty($routine_type) && $create_proc = PMA_DBI_get_definition($db, $routine_type, $_GET['routine_name'])) {
|
||||
$create_proc = '<textarea cols="40" rows="15" style="width: 100%;">' . htmlspecialchars($create_proc) . '</textarea>';
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
$extra_data = array('title' => sprintf(__('Export of routine %s'), $routine_name));
|
||||
PMA_ajaxResponse($create_proc, true, $extra_data);
|
||||
} else {
|
||||
echo '<fieldset>' . "\n"
|
||||
. ' <legend>' . sprintf(__('Export of routine %s'), $routine_name) . '</legend>' . "\n"
|
||||
. $create_proc . "\n"
|
||||
. '</fieldset>';
|
||||
}
|
||||
} else {
|
||||
$response = __('Error in processing request') . ' : '
|
||||
. sprintf(__('No routine with name %1$s found in database %2$s'),
|
||||
$routine_name, htmlspecialchars(PMA_backquote($db)));
|
||||
$response = PMA_message::error($response);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
PMA_ajaxResponse($response, false);
|
||||
} else {
|
||||
$response->display();
|
||||
}
|
||||
}
|
||||
} else if (! empty($_REQUEST['routine_process_addroutine']) || ! empty($_REQUEST['routine_process_editroutine'])) {
|
||||
/**
|
||||
* Handle a request to create/edit a routine
|
||||
*/
|
||||
$sql_query = '';
|
||||
$routine_query = PMA_RTN_getQueryFromRequest();
|
||||
if (! count($routine_errors)) { // set by PMA_RTN_getQueryFromRequest()
|
||||
// Execute the created query
|
||||
if (! empty($_REQUEST['routine_process_editroutine'])) {
|
||||
if (! in_array($_REQUEST['routine_original_type'], array('PROCEDURE', 'FUNCTION'))) {
|
||||
$routine_errors[] = sprintf(__('Invalid routine type: "%s"'), htmlspecialchars($_REQUEST['routine_original_type']));
|
||||
} else {
|
||||
// Backup the old routine, in case something goes wrong
|
||||
$create_routine = PMA_DBI_get_definition($db, $_REQUEST['routine_original_type'], $_REQUEST['routine_original_name']);
|
||||
$drop_routine = "DROP {$_REQUEST['routine_original_type']} " . PMA_backquote($_REQUEST['routine_original_name']) . ";\n";
|
||||
$result = PMA_DBI_try_query($drop_routine);
|
||||
if (! $result) {
|
||||
$routine_errors[] = sprintf(__('The following query has failed: "%s"'), $drop_routine) . '<br />'
|
||||
. __('MySQL said: ') . PMA_DBI_getError(null);
|
||||
} else {
|
||||
$result = PMA_DBI_try_query($routine_query);
|
||||
if (! $result) {
|
||||
$routine_errors[] = sprintf(__('The following query has failed: "%s"'), $routine_query) . '<br />'
|
||||
. __('MySQL said: ') . PMA_DBI_getError(null);
|
||||
// We dropped the old routine, but were unable to create the new one
|
||||
// Try to restore the backup query
|
||||
$result = PMA_DBI_try_query($create_routine);
|
||||
if (! $result) {
|
||||
// OMG, this is really bad! We dropped the query, failed to create a new one
|
||||
// and now even the backup query does not execute!
|
||||
// This should not happen, but we better handle this just in case.
|
||||
$routine_errors[] = __('Sorry, we failed to restore the dropped routine.') . '<br />'
|
||||
. __('The backed up query was:') . "\"$create_routine\"" . '<br />'
|
||||
. __('MySQL said: ') . PMA_DBI_getError(null);
|
||||
}
|
||||
} else {
|
||||
$message = PMA_Message::success(__('Routine %1$s has been modified.'));
|
||||
$message->addParam(PMA_backquote($_REQUEST['routine_name']));
|
||||
$sql_query = $drop_routine . $routine_query;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 'Add a new routine' mode
|
||||
$result = PMA_DBI_try_query($routine_query);
|
||||
if (! $result) {
|
||||
$routine_errors[] = sprintf(__('The following query has failed: "%s"'), $routine_query) . '<br /><br />'
|
||||
. __('MySQL said: ') . PMA_DBI_getError(null);
|
||||
} else {
|
||||
$message = PMA_Message::success(__('Routine %1$s has been created.'));
|
||||
$message->addParam(PMA_backquote($_REQUEST['routine_name']));
|
||||
$sql_query = $routine_query;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($routine_errors)) {
|
||||
$message = PMA_Message::error(__('<b>One or more errors have occured while processing your request:</b>'));
|
||||
$message->addString('<ul>');
|
||||
foreach ($routine_errors as $num => $string) {
|
||||
$message->addString('<li>' . $string . '</li>');
|
||||
}
|
||||
$message->addString('</ul>');
|
||||
}
|
||||
|
||||
$output = PMA_showMessage($message, $sql_query);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
$extra_data = array();
|
||||
if ($message->isSuccess()) {
|
||||
$columns = "`SPECIFIC_NAME`, `ROUTINE_NAME`, `ROUTINE_TYPE`, `DTD_IDENTIFIER`, `ROUTINE_DEFINITION`";
|
||||
$where = "ROUTINE_SCHEMA='" . PMA_sqlAddSlashes($db) . "' AND ROUTINE_NAME='" . PMA_sqlAddSlashes($_REQUEST['routine_name']) . "'";
|
||||
$routine = PMA_DBI_fetch_single_row("SELECT $columns FROM `INFORMATION_SCHEMA`.`ROUTINES` WHERE $where;");
|
||||
$extra_data['name'] = htmlspecialchars(strtoupper($_REQUEST['routine_name']));
|
||||
$extra_data['new_row'] = PMA_RTN_getRowForRoutinesList($routine, 0, true);
|
||||
$response = $output;
|
||||
} else {
|
||||
$response = $message;
|
||||
}
|
||||
PMA_ajaxResponse($response, $message->isSuccess(), $extra_data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a form used to add/edit a routine, if necessary
|
||||
*/
|
||||
if (count($routine_errors) || ( empty($_REQUEST['routine_process_addroutine']) && empty($_REQUEST['routine_process_editroutine']) &&
|
||||
(! empty($_REQUEST['addroutine']) || ! empty($_REQUEST['editroutine'])
|
||||
|| ! empty($_REQUEST['routine_addparameter']) || ! empty($_REQUEST['routine_removeparameter'])
|
||||
|| ! empty($_REQUEST['routine_changetype'])))) { // FIXME: this must be simpler than that
|
||||
// Handle requests to add/remove parameters and changing routine type
|
||||
// This is necessary when JS is disabled
|
||||
$operation = '';
|
||||
if (! empty($_REQUEST['routine_addparameter'])) {
|
||||
$operation = 'add';
|
||||
} else if (! empty($_REQUEST['routine_removeparameter'])) {
|
||||
$operation = 'remove';
|
||||
} else if (! empty($_REQUEST['routine_changetype'])) {
|
||||
$operation = 'change';
|
||||
}
|
||||
// Get the data for the form (if any)
|
||||
if (! empty($_REQUEST['addroutine'])) {
|
||||
$title = __("Create routine");
|
||||
$routine = PMA_RTN_getRoutineDataFromRequest();
|
||||
$mode = 'add';
|
||||
} else if (! empty($_REQUEST['editroutine'])) {
|
||||
$title = __("Edit routine");
|
||||
if (! $operation && ! empty($_REQUEST['routine_name']) && empty($_REQUEST['routine_process_editroutine'])) {
|
||||
$routine = PMA_RTN_getRoutineDataFromName($db, $_REQUEST['routine_name']);
|
||||
if ($routine !== false) {
|
||||
$routine['original_name'] = $routine['name'];
|
||||
$routine['original_type'] = $routine['type'];
|
||||
}
|
||||
} else {
|
||||
$routine = PMA_RTN_getRoutineDataFromRequest();
|
||||
}
|
||||
$mode = 'edit';
|
||||
}
|
||||
if ($routine !== false) {
|
||||
// Show form
|
||||
$editor = PMA_RTN_getEditorForm($mode, $operation, $routine, $routine_errors, $GLOBALS['is_ajax_request']);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
$template = PMA_RTN_getParameterRow();
|
||||
$extra_data = array('title' => $title, 'param_template' => $template, 'type' => $routine['type']);
|
||||
PMA_ajaxResponse($editor, true, $extra_data);
|
||||
}
|
||||
echo "\n\n<h2>$title</h2>\n\n$editor";
|
||||
require './libraries/footer.inc.php';
|
||||
// exit;
|
||||
} else {
|
||||
$message = __('Error in processing request') . ' : '
|
||||
. sprintf(__('No routine with name %1$s found in database %2$s'),
|
||||
htmlspecialchars(PMA_backquote($_REQUEST['routine_name'])),
|
||||
htmlspecialchars(PMA_backquote($db)));
|
||||
$message = PMA_message::error($message);
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
PMA_ajaxResponse($message, false);
|
||||
} else {
|
||||
$message->display();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a list of available routines
|
||||
*/
|
||||
echo PMA_RTN_getRoutinesList();
|
||||
|
||||
/**
|
||||
* Display the form for adding a new routine, if the user has the privileges.
|
||||
*/
|
||||
echo PMA_RTN_getAddRoutineLink();
|
||||
|
||||
/**
|
||||
* Display a warning for users with PHP's old "mysql" extension.
|
||||
*/
|
||||
if ($GLOBALS['cfg']['Server']['extension'] === 'mysql') {
|
||||
trigger_error(__('You are using PHP\'s deprecated \'mysql\' extension, '
|
||||
. 'which is not capable of handling multi queries. '
|
||||
. '<b>The execution of some stored routines may fail!</b> '
|
||||
. 'Please use the improved \'mysqli\' extension to '
|
||||
. 'avoid any problems.'), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if ($GLOBALS['is_ajax_request'] != true) {
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require './libraries/footer.inc.php';
|
||||
}
|
||||
$_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';
|
||||
|
||||
@ -13,6 +13,7 @@ require_once './libraries/common.inc.php';
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
|
||||
$GLOBALS['js_include'][] = 'db_structure.js';
|
||||
$GLOBALS['js_include'][] = 'tbl_change.js';
|
||||
$GLOBALS['js_include'][] = 'jquery/timepicker.js';
|
||||
|
||||
/**
|
||||
* Prepares the tables list if the user where not redirected to this script
|
||||
@ -283,9 +284,9 @@ foreach ($tables as $keyname => $each_table) {
|
||||
$tracking_icon = '';
|
||||
if (PMA_Tracker::isActive()) {
|
||||
if (PMA_Tracker::isTracked($GLOBALS["db"], $truename)) {
|
||||
$tracking_icon = '<a href="tbl_tracking.php?' . $url_query.'&table=' . $truename . '"><img class="icon" width="14" height="14" src="' . $pmaThemeImage . 'eye.png" alt="' . __('Tracking is active.') . '" title="' . __('Tracking is active.') . '" /></a>';
|
||||
$tracking_icon = '<a href="tbl_tracking.php?' . $url_query.'&table=' . $truename . '"><img class="icon ic_eye" src="themes/dot.gif" alt="' . __('Tracking is active.') . '" title="' . __('Tracking is active.') . '" /></a>';
|
||||
} elseif (PMA_Tracker::getVersion($GLOBALS["db"], $truename) > 0) {
|
||||
$tracking_icon = '<a href="tbl_tracking.php?' . $url_query . '&table=' . $truename . '"><img class="icon" width="14" height="14" src="' . $pmaThemeImage . 'eye_grey.png" alt="' . __('Tracking is not active.') . '" title="' . __('Tracking is not active.') . '" /></a>';
|
||||
$tracking_icon = '<a href="tbl_tracking.php?' . $url_query . '&table=' . $truename . '"><img class="icon ic_eye" src="themes/dot.gif" alt="' . __('Tracking is not active.') . '" title="' . __('Tracking is not active.') . '" /></a>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -340,7 +341,7 @@ foreach ($tables as $keyname => $each_table) {
|
||||
<th><?php echo $browse_table_label; ?>
|
||||
<?php echo (! empty($tracking_icon) ? $tracking_icon : ''); ?>
|
||||
</th>
|
||||
<?php if ($server_slave_status) { ?><td align="center"><?php echo $ignored ? ' <img class="icon" src="' . $pmaThemeImage . 's_cancel.png" width="16" height="16" alt="NOT REPLICATED" />' : ''. $do ? ' <img class="icon" src="' . $pmaThemeImage . 's_success.png" width="16" height="16" alt="REPLICATED" />' : ''; ?></td><?php } ?>
|
||||
<?php if ($server_slave_status) { ?><td align="center"><?php echo $ignored ? ' <img class="icon ic_s_cancel" src="themes/dot.gif" alt="NOT REPLICATED" />' : ''. $do ? ' <img class="icon ic_s_success" src="themes/dot.gif" alt="REPLICATED" />' : ''; ?></td><?php } ?>
|
||||
<td align="center"><?php echo $browse_table; ?></td>
|
||||
<td align="center">
|
||||
<a href="tbl_structure.php?<?php echo $tbl_url_query; ?>">
|
||||
@ -547,15 +548,13 @@ PMA_listNavigator($total_num_tables, $pos, $_url_params, 'db_structure.php', 'fr
|
||||
echo '<p>';
|
||||
echo '<a href="db_printview.php?' . $url_query . '">';
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img class="icon" src="' . $pmaThemeImage
|
||||
.'b_print.png" width="16" height="16" alt="" />';
|
||||
echo '<img class="icon ic_b_print" src="themes/dot.gif" alt="" />';
|
||||
}
|
||||
echo __('Print view') . '</a> ';
|
||||
|
||||
echo '<a href="./db_datadict.php?' . $url_query . '">';
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img class="icon" src="' . $pmaThemeImage
|
||||
.'b_tblanalyse.png" width="16" height="16" alt="" />';
|
||||
echo '<img class="icon ic_b_tblanalyse" src="themes/dot.gif" alt="" />';
|
||||
}
|
||||
echo __('Data Dictionary') . '</a>';
|
||||
echo '</p>';
|
||||
|
||||
@ -98,7 +98,7 @@ if (PMA_DBI_num_rows($all_tables_result) > 0) {
|
||||
|
||||
$drop_image_or_text = '';
|
||||
if (true == $GLOBALS['cfg']['PropertiesIconic']) {
|
||||
$drop_image_or_text .= '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_drop.png" alt="' . __('Delete tracking data for this table') . '" title="' . __('Delete tracking data for this table') . '" />';
|
||||
$drop_image_or_text .= '<img class="icon ic_b_drop" src="themes/dot.gif" alt="' . __('Delete tracking data for this table') . '" title="' . __('Delete tracking data for this table') . '" />';
|
||||
}
|
||||
if ('both' === $GLOBALS['cfg']['PropertiesIconic'] || false === $GLOBALS['cfg']['PropertiesIconic']) {
|
||||
$drop_image_or_text .= __('Drop');
|
||||
@ -198,7 +198,7 @@ if (isset($my_tables)) {
|
||||
$my_link = '<a href="tbl_tracking.php?' . $url_query . '&table=' . htmlspecialchars($tablename) .'">';
|
||||
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
$my_link .= '<img class="icon" src="' . $pmaThemeImage . 'eye.png" width="16" height="16" alt="' . __('Track table') . '" /> ';
|
||||
$my_link .= '<img class="icon ic_eye" src="themes/dot.gif" alt="' . __('Track table') . '" /> ';
|
||||
}
|
||||
$my_link .= __('Track table') . '</a>';
|
||||
?>
|
||||
|
||||
@ -1,38 +1,35 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Triggers management.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Include required files
|
||||
*/
|
||||
require_once './libraries/common.inc.php';
|
||||
require_once './libraries/common.lib.php';
|
||||
|
||||
/**
|
||||
* Include JavaScript libraries
|
||||
*/
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
|
||||
$GLOBALS['js_include'][] = 'display_triggers.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';
|
||||
|
||||
/**
|
||||
* Create labels for the list
|
||||
* Include all other files
|
||||
*/
|
||||
$titles = PMA_buildActionTitles();
|
||||
require_once './libraries/rte/rte_triggers.lib.php';
|
||||
|
||||
/**
|
||||
* Displays the header
|
||||
* Do the magic
|
||||
*/
|
||||
require_once './libraries/db_common.inc.php';
|
||||
|
||||
/**
|
||||
* Displays the tabs
|
||||
*/
|
||||
require_once './libraries/db_info.inc.php';
|
||||
|
||||
/**
|
||||
* Displays the list of triggers
|
||||
*/
|
||||
require_once './libraries/display_triggers.inc.php';
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require './libraries/footer.inc.php';
|
||||
|
||||
$_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))));
|
||||
|
||||
@ -125,8 +125,7 @@ $time_start = time();
|
||||
* Output handler for all exports, if needed buffering, it stores data into
|
||||
* $dump_buffer, otherwise it prints thems out.
|
||||
*
|
||||
* @param string the insert statement
|
||||
*
|
||||
* @param string $line the insert statement
|
||||
* @return bool Whether output suceeded
|
||||
*/
|
||||
function PMA_exportOutputHandler($line)
|
||||
@ -401,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>';
|
||||
@ -493,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)) {
|
||||
@ -512,7 +511,7 @@ if ($export_type == 'server') {
|
||||
}
|
||||
|
||||
if (function_exists('PMA_exportRoutines') && strpos($GLOBALS['sql_structure_or_data'], 'structure') !== false && isset($GLOBALS['sql_procedure_function'])) {
|
||||
PMA_exportRoutines($db);
|
||||
PMA_exportRoutines($db);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
||||
@ -264,7 +264,7 @@ if ($import_file != 'none' && !$error) {
|
||||
$file_to_unlink = $import_file_new;
|
||||
}
|
||||
|
||||
$size = filesize($import_file);
|
||||
$size = filesize($import_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
72
js/common.js
72
js/common.js
@ -14,78 +14,6 @@ var querywindow = '';
|
||||
*/
|
||||
var query_to_load = '';
|
||||
|
||||
/**
|
||||
* attach a function to object event
|
||||
*
|
||||
* <code>
|
||||
* addEvent(window, 'load', PMA_initPage);
|
||||
* </code>
|
||||
* @param object or id
|
||||
* @param string event type (load, mouseover, focus, ...)
|
||||
* @param function to be attached
|
||||
*/
|
||||
function addEvent(obj, type, fn)
|
||||
{
|
||||
if (obj.attachEvent) {
|
||||
obj['e' + type + fn] = fn;
|
||||
obj[type + fn] = function() {obj['e' + type + fn](window.event);}
|
||||
obj.attachEvent('on' + type, obj[type + fn]);
|
||||
} else {
|
||||
obj.addEventListener(type, fn, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* detach/remove a function from an object event
|
||||
*
|
||||
* @param object or id
|
||||
* @param event type (load, mouseover, focus, ...)
|
||||
* @param function naem of function to be attached
|
||||
*/
|
||||
function removeEvent(obj, type, fn)
|
||||
{
|
||||
if (obj.detachEvent) {
|
||||
obj.detachEvent('on' + type, obj[type + fn]);
|
||||
obj[type + fn] = null;
|
||||
} else {
|
||||
obj.removeEventListener(type, fn, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get DOM elements by html class
|
||||
*
|
||||
* @param string class_name - name of class
|
||||
* @param node node - search only sub nodes of this node (optional)
|
||||
* @param string tag - search only these tags (optional)
|
||||
*/
|
||||
function getElementsByClassName(class_name, node, tag)
|
||||
{
|
||||
var classElements = new Array();
|
||||
|
||||
if (node == null) {
|
||||
node = document;
|
||||
}
|
||||
if (tag == null) {
|
||||
tag = '*';
|
||||
}
|
||||
|
||||
var j = 0, teststr;
|
||||
var els = node.getElementsByTagName(tag);
|
||||
var elsLen = els.length;
|
||||
|
||||
for (i = 0; i < elsLen; i++) {
|
||||
if (els[i].className.indexOf(class_name) != -1) {
|
||||
teststr = "," + els[i].className.split(" ").join(",") + ",";
|
||||
if (teststr.indexOf("," + class_name + ",") != -1) {
|
||||
classElements[j] = els[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return classElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets current selected db
|
||||
*
|
||||
|
||||
@ -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
|
||||
@ -87,7 +87,7 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
/** Hide the table link in the initial search result */
|
||||
$("#table-info").prepend('<img id="table-image" src="./themes/original/img/s_tbl.png" />').hide();
|
||||
$("#table-info").prepend('<img id="table-image" class="icon ic_s_tbl" src="./themes/dot.gif" />').hide();
|
||||
|
||||
/** Hide the browse and deleted results in the new search criteria */
|
||||
$('#buttonGo').click(function(){
|
||||
|
||||
@ -57,16 +57,19 @@ $(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);
|
||||
var url = $(this).attr("href");
|
||||
if (url.substring(0, 15) == "tbl_change.php?") {
|
||||
url = url.substring(15);
|
||||
current_insert_table = $(this);
|
||||
var $url = $(this).attr("href");
|
||||
if ($url.substring(0, 15) == "tbl_change.php?") {
|
||||
$url = $url.substring(15);
|
||||
}
|
||||
|
||||
var div = $('<div id="insert_table_dialog"></div>');
|
||||
if ($("#insert_table_dialog").length > 0) {
|
||||
$("#insert_table_dialog").remove();
|
||||
}
|
||||
var $div = $('<div id="insert_table_dialog"></div>');
|
||||
var target = "tbl_change.php";
|
||||
|
||||
/**
|
||||
@ -75,40 +78,47 @@ $(document).ready(function() {
|
||||
*/
|
||||
var button_options = {};
|
||||
// in the following function we need to use $(this)
|
||||
button_options[PMA_messages['strCancel']] = function() {$(this).parent().dialog('close').remove();}
|
||||
button_options[PMA_messages['strCancel']] = function() {$(this).dialog('close').remove();}
|
||||
|
||||
var button_options_error = {};
|
||||
button_options_error[PMA_messages['strOK']] = function() {$(this).parent().dialog('close').remove();}
|
||||
button_options_error[PMA_messages['strOK']] = function() {$(this).dialog('close').remove();}
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
$.get( target , url+"&ajax_request=true" , function(data) {
|
||||
$.get( target , $url+"&ajax_request=true" , function(data) {
|
||||
//in the case of an error, show the error message returned.
|
||||
if (data.success != undefined && data.success == false) {
|
||||
div
|
||||
$div
|
||||
.append(data.error)
|
||||
.dialog({
|
||||
title: PMA_messages['strInsertTable'],
|
||||
height: 230,
|
||||
width: 900,
|
||||
modal: true,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options_error
|
||||
})// end dialog options
|
||||
} else {
|
||||
div
|
||||
.append(data)
|
||||
.dialog({
|
||||
title: PMA_messages['strInsertTable'],
|
||||
height: 600,
|
||||
width: 900,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options
|
||||
})
|
||||
var $dialog = $div
|
||||
.append(data)
|
||||
.dialog({
|
||||
title: PMA_messages['strInsertTable'],
|
||||
height: 600,
|
||||
width: 900,
|
||||
modal: true,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options
|
||||
});// end dialog options
|
||||
//Remove the top menu container from the dialog
|
||||
.find("#topmenucontainer").hide()
|
||||
; // end dialog options
|
||||
$dialog.find("#topmenucontainer").hide();
|
||||
//Adding the datetime pikers for the dialog
|
||||
$dialog.find('.datefield, .datetimefield').each(function () {
|
||||
PMA_addDatepicker($(this));
|
||||
});
|
||||
$(".insertRowTable").addClass("ajax");
|
||||
$("#buttonYes").addClass("ajax");
|
||||
$div = $("#insert_table_dialog");
|
||||
PMA_convertFootnotesToTooltips($div);
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.get()
|
||||
@ -134,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"
|
||||
|
||||
@ -160,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 {
|
||||
@ -170,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()
|
||||
});
|
||||
|
||||
@ -208,7 +218,7 @@ $(document).ready(function() {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
//Fetch inner span of this anchor
|
||||
//and replace the icon with its disabled version
|
||||
var span = $this_anchor.html().replace(/b_empty.png/, 'bd_empty.png');
|
||||
var span = $this_anchor.html().replace(/ic_b_empty/, 'ic_bd_empty');
|
||||
PMA_adjustTotals($this_anchor);
|
||||
|
||||
//To disable further attempts to truncate the table,
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
|
||||
490
js/functions.js
490
js/functions.js
@ -135,14 +135,13 @@ function displayPasswordGenerateButton() {
|
||||
*
|
||||
* @param object $this_element a jQuery object pointing to the element
|
||||
*/
|
||||
function PMA_addDatepicker($this_element) {
|
||||
function PMA_addDatepicker($this_element, options) {
|
||||
var showTimeOption = false;
|
||||
if ($this_element.is('.datetimefield')) {
|
||||
showTimeOption = true;
|
||||
}
|
||||
|
||||
$this_element
|
||||
.datepicker({
|
||||
|
||||
var defaultOptions = {
|
||||
showOn: 'button',
|
||||
buttonImage: themeCalendarImage, // defined in js/messages.php
|
||||
buttonImageOnly: true,
|
||||
@ -157,9 +156,16 @@ function PMA_addDatepicker($this_element) {
|
||||
// Remember that we came from the datepicker; this is used
|
||||
// in tbl_change.js by verificationsAfterFieldChange()
|
||||
$this_element.data('comes_from', 'datepicker');
|
||||
|
||||
// Fix wrong timepicker z-index, doesn't work without timeout
|
||||
setTimeout(function() {
|
||||
$('#ui-timepicker-div').css('z-index',$('#ui-datepicker-div').css('z-index'))
|
||||
},0);
|
||||
},
|
||||
constrainInput: false
|
||||
});
|
||||
};
|
||||
|
||||
$this_element.datepicker($.extend(defaultOptions, options));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -723,13 +729,13 @@ var last_shift_clicked_row = -1;
|
||||
* Row highlighting in horizontal mode (use "live"
|
||||
* so that it works also for pages reached via AJAX)
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
/*$(document).ready(function() {
|
||||
$('tr.odd, tr.even').live('hover',function(event) {
|
||||
var $tr = $(this);
|
||||
$tr.toggleClass('hover',event.type=='mouseover');
|
||||
$tr.children().toggleClass('hover',event.type=='mouseover');
|
||||
});
|
||||
})
|
||||
})*/
|
||||
|
||||
/**
|
||||
* This array is used to remember mark status of rows in browse mode
|
||||
@ -1217,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();
|
||||
@ -1232,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"
|
||||
@ -1459,20 +1467,26 @@ function PMA_createChart(passedSettings) {
|
||||
chart: {
|
||||
type: 'spline',
|
||||
marginRight: 10,
|
||||
backgroundColor: 'transparent',
|
||||
events: {
|
||||
/* Live charting support */
|
||||
load: function() {
|
||||
var thisChart = this;
|
||||
var lastValue = null, curValue = null;
|
||||
var numLoadedPoints = 0, otherSum = 0;
|
||||
var diff;
|
||||
// No realtime updates for graphs that are being exported, and disabled when no callback is set
|
||||
|
||||
// No realtime updates for graphs that are being exported, and disabled when realtime is not set
|
||||
// Also don't do live charting if we don't have the server time
|
||||
if(thisChart.options.chart.forExport == true ||
|
||||
! passedSettings.realtime ||
|
||||
! passedSettings.realtime.callback) return;
|
||||
! thisChart.options.realtime ||
|
||||
! thisChart.options.realtime.callback ||
|
||||
! server_time_diff) return;
|
||||
|
||||
thisChart.options.realtime.timeoutCallBack = function() {
|
||||
$.post(passedSettings.realtime.url,
|
||||
{ ajax_request: true, chart_data: 1, type: passedSettings.realtime.type },
|
||||
thisChart.options.realtime.postRequest = $.post(
|
||||
thisChart.options.realtime.url,
|
||||
thisChart.options.realtime.postData,
|
||||
function(data) {
|
||||
curValue = jQuery.parseJSON(data);
|
||||
|
||||
@ -1485,13 +1499,13 @@ function PMA_createChart(passedSettings) {
|
||||
false
|
||||
);
|
||||
|
||||
passedSettings.realtime.callback(thisChart,curValue,lastValue,numLoadedPoints);
|
||||
thisChart.options.realtime.callback(thisChart,curValue,lastValue,numLoadedPoints);
|
||||
|
||||
lastValue = curValue;
|
||||
numLoadedPoints++;
|
||||
|
||||
// Timeout has been cleared => don't start a new timeout
|
||||
if(chart_activeTimeouts[container]==null) return;
|
||||
if(chart_activeTimeouts[container] == null) return;
|
||||
|
||||
chart_activeTimeouts[container] = setTimeout(
|
||||
thisChart.options.realtime.timeoutCallBack,
|
||||
@ -1500,7 +1514,7 @@ function PMA_createChart(passedSettings) {
|
||||
});
|
||||
}
|
||||
|
||||
chart_activeTimeouts[container] = setTimeout(thisChart.options.realtime.timeoutCallBack, 0);
|
||||
chart_activeTimeouts[container] = setTimeout(thisChart.options.realtime.timeoutCallBack, 5);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1542,15 +1556,20 @@ function PMA_createChart(passedSettings) {
|
||||
}
|
||||
|
||||
/* Set/Get realtime chart default values */
|
||||
if(passedSettings.realtime) {
|
||||
if(passedSettings.realtime) {
|
||||
if(!passedSettings.realtime.refreshRate)
|
||||
passedSettings.realtime.refreshRate = 5000;
|
||||
|
||||
if(!passedSettings.realtime.numMaxPoints)
|
||||
passedSettings.realtime.numMaxPoints = 30;
|
||||
|
||||
settings.xAxis.min = new Date().getTime() - passedSettings.realtime.numMaxPoints * passedSettings.realtime.refreshRate;
|
||||
settings.xAxis.max = new Date().getTime() + passedSettings.realtime.refreshRate / 4;
|
||||
// Allow custom POST vars to be added
|
||||
passedSettings.realtime.postData = $.extend(false,{ ajax_request: true, chart_data: 1, type: passedSettings.realtime.type },passedSettings.realtime.postData);
|
||||
|
||||
if(server_time_diff) {
|
||||
settings.xAxis.min = new Date().getTime() - server_time_diff - passedSettings.realtime.numMaxPoints * passedSettings.realtime.refreshRate;
|
||||
settings.xAxis.max = new Date().getTime() - server_time_diff + passedSettings.realtime.refreshRate;
|
||||
}
|
||||
}
|
||||
|
||||
// Overwrite/Merge default settings with passedsettings
|
||||
@ -1816,6 +1835,76 @@ $(document).ready(function() {
|
||||
|
||||
}, 'top.frame_content'); //end $(document).ready for 'Create Table'
|
||||
|
||||
/**
|
||||
* jQuery coding for 'Change Table'. Used on tbl_structure.php *
|
||||
* Attach Ajax Event handlers for Change Table
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
/**
|
||||
*Ajax action for submitting the column change form
|
||||
**/
|
||||
$("#append_fields_form input[name=do_save_data]").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var the_form object referring to the export form
|
||||
*/
|
||||
var $form = $("#append_fields_form");
|
||||
|
||||
/*
|
||||
* First validate the form; if there is a problem, avoid submitting it
|
||||
*
|
||||
* checkTableEditForm() needs a pure element and not a jQuery object,
|
||||
* this is why we pass $form[0] as a parameter (the jQuery object
|
||||
* is actually an array of DOM elements)
|
||||
*/
|
||||
if (checkTableEditForm($form[0], $form.find('input[name=orig_num_fields]').val())) {
|
||||
// OK, form passed validation step
|
||||
if ($form.hasClass('ajax')) {
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
//User wants to submit the form
|
||||
$.post($form.attr('action'), $form.serialize()+"&do_save_data=Save", function(data) {
|
||||
if ($("#sqlqueryresults").length != 0) {
|
||||
$("#sqlqueryresults").remove();
|
||||
} else if ($(".error").length != 0) {
|
||||
$(".error").remove();
|
||||
}
|
||||
if (data.success == true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$("<div id='sqlqueryresults'></div>").insertAfter("#topmenucontainer");
|
||||
$("#sqlqueryresults").html(data.sql_query);
|
||||
$("#result_query .notice").remove();
|
||||
$("#result_query").prepend((data.message));
|
||||
if ($("#change_column_dialog").length > 0) {
|
||||
$("#change_column_dialog").dialog("close").remove();
|
||||
}
|
||||
/*Reload the field form*/
|
||||
$.post($("#fieldsForm").attr('action'), $("#fieldsForm").serialize()+"&ajax_request=true", function(form_data) {
|
||||
$("#fieldsForm").remove();
|
||||
var $temp_div = $("<div id='temp_div'><div>").append(form_data);
|
||||
if ($("#sqlqueryresults").length != 0) {
|
||||
$temp_div.find("#fieldsForm").insertAfter("#sqlqueryresults");
|
||||
} else {
|
||||
$temp_div.find("#fieldsForm").insertAfter(".error");
|
||||
}
|
||||
/*Call the function to display the more options in table*/
|
||||
displayMoreTableOpts();
|
||||
});
|
||||
} else {
|
||||
var $temp_div = $("<div id='temp_div'><div>").append(data);
|
||||
var $error = $temp_div.find(".error code").addClass("error");
|
||||
PMA_ajaxShowMessage($error);
|
||||
}
|
||||
}) // end $.post()
|
||||
} else {
|
||||
// non-Ajax submit
|
||||
$form.append('<input type="hidden" name="do_save_data" value="Save" />');
|
||||
$form.submit();
|
||||
}
|
||||
}
|
||||
}) // end change table button "do_save_data"
|
||||
|
||||
}, 'top.frame_content'); //end $(document).ready for 'Change Table'
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for Drop Database. Moved here from db_structure.js
|
||||
* as it was also required on db_create.php
|
||||
@ -2152,29 +2241,93 @@ function displayMoreTableOpts() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
$(document).ready(initTooltips);
|
||||
|
||||
/* Displays tooltips */
|
||||
function initTooltips() {
|
||||
}
|
||||
$(document).ready(function(){
|
||||
PMA_convertFootnotesToTooltips();
|
||||
});
|
||||
|
||||
/**
|
||||
* Ensures indexes names are valid according to their type and, for a primary
|
||||
* key, lock index name to 'PRIMARY'
|
||||
* @param string form_id Variable which parses the form name as
|
||||
* the input
|
||||
* @return boolean false if there is no index form, true else
|
||||
*/
|
||||
function checkIndexName(form_id)
|
||||
{
|
||||
if ($("#"+form_id).length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Gets the elements pointers
|
||||
var $the_idx_name = $("#input_index_name");
|
||||
var $the_idx_type = $("#select_index_type");
|
||||
|
||||
// Index is a primary key
|
||||
if ($the_idx_type.find("option:selected").attr("value") == 'PRIMARY') {
|
||||
$the_idx_name.attr("value", 'PRIMARY');
|
||||
$the_idx_name.attr("disabled", true);
|
||||
}
|
||||
|
||||
// Other cases
|
||||
else {
|
||||
if ($the_idx_name.attr("value") == 'PRIMARY') {
|
||||
$the_idx_name.attr("value", '');
|
||||
}
|
||||
$the_idx_name.attr("disabled", false);
|
||||
}
|
||||
|
||||
return true;
|
||||
} // end of the 'checkIndexName()' function
|
||||
|
||||
/**
|
||||
* 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 },
|
||||
@ -2257,7 +2410,7 @@ $(function() {
|
||||
});
|
||||
var img = topmenu.find('li:first-child img');
|
||||
if (img.length) {
|
||||
img.clone().attr('src', img.attr('src').replace(/\/[^\/]+$/, '/b_more.png')).prependTo(link);
|
||||
img.clone().attr('class', 'icon ic_b_more').prependTo(link);
|
||||
}
|
||||
var submenu = $('<li />', {'class': 'submenu'})
|
||||
.append(link)
|
||||
@ -2319,6 +2472,136 @@ function PMA_init_slider() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* var toggleButton This is a function that creates a toggle
|
||||
* sliding button given a jQuery reference
|
||||
* to the correct DOM element
|
||||
*/
|
||||
var toggleButton = function ($obj) {
|
||||
// In rtl mode the toggle switch is flipped horizontally
|
||||
// so we need to take that into account
|
||||
if ($('.text_direction', $obj).text() == 'ltr') {
|
||||
var right = 'right';
|
||||
} else {
|
||||
var right = 'left';
|
||||
}
|
||||
/**
|
||||
* var h Height of the button, used to scale the
|
||||
* background image and position the layers
|
||||
*/
|
||||
var h = $obj.height();
|
||||
$('img', $obj).height(h);
|
||||
$('table', $obj).css('bottom', h-1);
|
||||
/**
|
||||
* var on Width of the "ON" part of the toggle switch
|
||||
* var off Width of the "OFF" part of the toggle switch
|
||||
*/
|
||||
var on = $('.toggleOn', $obj).width();
|
||||
var off = $('.toggleOff', $obj).width();
|
||||
// Make the "ON" and "OFF" parts of the switch the same size
|
||||
$('.toggleOn > div', $obj).width(Math.max(on, off));
|
||||
$('.toggleOff > div', $obj).width(Math.max(on, off));
|
||||
/**
|
||||
* var w Width of the central part of the switch
|
||||
*/
|
||||
var w = parseInt(($('img', $obj).height() / 16) * 22, 10);
|
||||
// Resize the central part of the switch on the top
|
||||
// layer to match the background
|
||||
$('table td:nth-child(2) > div', $obj).width(w);
|
||||
/**
|
||||
* var imgw Width of the background image
|
||||
* var tblw Width of the foreground layer
|
||||
* var offset By how many pixels to move the background
|
||||
* image, so that it matches the top layer
|
||||
*/
|
||||
var imgw = $('img', $obj).width();
|
||||
var tblw = $('table', $obj).width();
|
||||
var offset = parseInt(((imgw - tblw) / 2), 10);
|
||||
// Move the background to match the layout of the top layer
|
||||
$obj.find('img').css(right, offset);
|
||||
/**
|
||||
* var offw Outer width of the "ON" part of the toggle switch
|
||||
* var btnw Outer width of the central part of the switch
|
||||
*/
|
||||
var offw = $('.toggleOff', $obj).outerWidth();
|
||||
var btnw = $('table td:nth-child(2)', $obj).outerWidth();
|
||||
// Resize the main div so that exactly one side of
|
||||
// the switch plus the central part fit into it.
|
||||
$obj.width(offw + btnw + 2);
|
||||
/**
|
||||
* var move How many pixels to move the
|
||||
* switch by when toggling
|
||||
*/
|
||||
var move = $('.toggleOff', $obj).outerWidth();
|
||||
// If the switch is initialized to the
|
||||
// OFF state we need to move it now.
|
||||
if ($('.container', $obj).hasClass('off')) {
|
||||
if (right == 'right') {
|
||||
$('table, img', $obj).animate({'left': '-=' + move + 'px'}, 0);
|
||||
} else {
|
||||
$('table, img', $obj).animate({'left': '+=' + move + 'px'}, 0);
|
||||
}
|
||||
}
|
||||
// Attach an 'onclick' event to the switch
|
||||
$('.container', $obj).click(function () {
|
||||
if ($(this).hasClass('isActive')) {
|
||||
return false;
|
||||
} else {
|
||||
$(this).addClass('isActive');
|
||||
}
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages['strLoading']);
|
||||
var $container = $(this);
|
||||
var callback = $('.callback', this).text();
|
||||
// Perform the actual toggle
|
||||
if ($(this).hasClass('on')) {
|
||||
if (right == 'right') {
|
||||
var operator = '-=';
|
||||
} else {
|
||||
var operator = '+=';
|
||||
}
|
||||
var url = $(this).find('.toggleOff > span').text();
|
||||
var removeClass = 'on';
|
||||
var addClass = 'off';
|
||||
} else {
|
||||
if (right == 'right') {
|
||||
var operator = '+=';
|
||||
} else {
|
||||
var operator = '-=';
|
||||
}
|
||||
var url = $(this).find('.toggleOn > span').text();
|
||||
var removeClass = 'off';
|
||||
var addClass = 'on';
|
||||
}
|
||||
$.post(url, {'ajax_request': true}, function(data) {
|
||||
if(data.success == true) {
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
$container
|
||||
.removeClass(removeClass)
|
||||
.addClass(addClass)
|
||||
.animate({'left': operator + move + 'px'}, function () {
|
||||
$container.removeClass('isActive');
|
||||
});
|
||||
eval(callback);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
$container.removeClass('isActive');
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialise all toggle buttons
|
||||
*/
|
||||
$(window).load(function () {
|
||||
$('.toggleAjax').each(function () {
|
||||
$(this)
|
||||
.show()
|
||||
.find('.toggleButton')
|
||||
toggleButton($(this));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Vertical pointer
|
||||
*/
|
||||
@ -2326,10 +2609,10 @@ $(document).ready(function() {
|
||||
$('.vpointer').live('hover',
|
||||
//handlerInOut
|
||||
function(e) {
|
||||
var $this_td = $(this);
|
||||
var row_num = PMA_getRowNumber($this_td.attr('class'));
|
||||
// for all td of the same vertical row, toggle hover
|
||||
$('.vpointer').filter('.row_' + row_num).toggleClass('hover');
|
||||
var $this_td = $(this);
|
||||
var row_num = PMA_getRowNumber($this_td.attr('class'));
|
||||
// for all td of the same vertical row, toggle hover
|
||||
$('.vpointer').filter('.row_' + row_num).toggleClass('hover');
|
||||
}
|
||||
);
|
||||
}) // end of $(document).ready() for vertical pointer
|
||||
@ -2339,11 +2622,35 @@ $(document).ready(function() {
|
||||
* Vertical marker
|
||||
*/
|
||||
$('.vmarker').live('click', function(e) {
|
||||
// do not trigger when clicked on anchor
|
||||
if ($(e.target).is('a, img, a *')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $this_td = $(this);
|
||||
var row_num = PMA_getRowNumber($this_td.attr('class'));
|
||||
// for all td of the same vertical row, toggle the marked class
|
||||
$('.vmarker').filter('.row_' + row_num).toggleClass('marked');
|
||||
});
|
||||
|
||||
// XXX: FF fires two click events for <label> (label and checkbox), so we need to handle this differently
|
||||
var $tr = $(this);
|
||||
var $checkbox = $('.vmarker').filter('.row_' + row_num + ':first').find(':checkbox');
|
||||
if ($checkbox.length) {
|
||||
// checkbox in a row, add or remove class depending on checkbox state
|
||||
var checked = $checkbox.attr('checked');
|
||||
if (!$(e.target).is(':checkbox, label')) {
|
||||
checked = !checked;
|
||||
$checkbox.attr('checked', checked);
|
||||
}
|
||||
// for all td of the same vertical row, toggle the marked class
|
||||
if (checked) {
|
||||
$('.vmarker').filter('.row_' + row_num).addClass('marked');
|
||||
} else {
|
||||
$('.vmarker').filter('.row_' + row_num).removeClass('marked');
|
||||
}
|
||||
} else {
|
||||
// normaln data table, just toggle class
|
||||
$('.vmarker').filter('.row_' + row_num).toggleClass('marked');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Reveal visual builder anchor
|
||||
@ -2422,44 +2729,6 @@ $(document).ready(function() {
|
||||
|
||||
}) // end of $(document).ready()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for Export of Routines, Triggers and Events.
|
||||
*
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
* @uses PMA_ajaxRemoveMessage()
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
$('.export_routine_anchor, .export_trigger_anchor, .export_event_anchor').live('click', function(event) {
|
||||
event.preventDefault();
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages['strLoading']);
|
||||
$.get($(this).attr('href'), {'ajax_request': true}, function(data) {
|
||||
if(data.success == true) {
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
/**
|
||||
* @var button_options Object containing options for jQueryUI dialog buttons
|
||||
*/
|
||||
var button_options = {};
|
||||
button_options[PMA_messages['strClose']] = function() {$(this).dialog("close").remove();}
|
||||
/**
|
||||
* Display the dialog to the user
|
||||
*/
|
||||
var $ajaxDialog = $('<div>'+data.message+'</div>').dialog({
|
||||
width: 500,
|
||||
buttons: button_options,
|
||||
title: data.title
|
||||
});
|
||||
// Attach syntax highlited editor to export dialog
|
||||
var elm = $ajaxDialog.find('textarea');
|
||||
CodeMirror.fromTextArea(elm[0], {lineNumbers: true, matchBrackets: true, indentUnit: 4, mode: "text/x-mysql"});
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
}) // end $.get()
|
||||
}); // end $.live()
|
||||
}); // end of $(document).ready() for Export of Routines, Triggers and Events.
|
||||
|
||||
/**
|
||||
* Creates a message inside an object with a sliding effect
|
||||
*
|
||||
@ -2537,69 +2806,6 @@ function PMA_slidingMessage(msg, $obj) {
|
||||
return true;
|
||||
} // end PMA_slidingMessage()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for Drop functionality of Routines, Triggers and Events.
|
||||
*
|
||||
* @uses $.PMA_confirm()
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
$('.drop_routine_anchor, .drop_trigger_anchor, .drop_event_anchor').live('click', function(event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var $curr_row Object containing reference to the current row
|
||||
*/
|
||||
var $curr_row = $(this).parents('tr');
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = $('<div></div>').text($curr_row.children('td').children('.drop_sql').html());
|
||||
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
|
||||
/**
|
||||
* @var $msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user.
|
||||
*/
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
|
||||
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) {
|
||||
if(data.success == true) {
|
||||
/**
|
||||
* @var $table Object containing reference to the main list of elements.
|
||||
*/
|
||||
var $table = $curr_row.parent();
|
||||
if ($table.find('tr').length == 2) {
|
||||
$table.hide("slow", function () {
|
||||
$(this).find('tr.even, tr.odd').remove();
|
||||
$('#nothing2display').show("slow");
|
||||
});
|
||||
} else {
|
||||
$curr_row.hide("slow", function () {
|
||||
$(this).remove();
|
||||
// Now we have removed the row from the list, but maybe
|
||||
// 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.find('tr').has('td').each(function() {
|
||||
rowclass = (ct % 2 == 0) ? 'even' : 'odd';
|
||||
$(this).removeClass().addClass(rowclass);
|
||||
ct++;
|
||||
});
|
||||
});
|
||||
}
|
||||
// Show the query that we just executed
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
PMA_slidingMessage(data.sql_query);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error);
|
||||
}
|
||||
}) // end $.get()
|
||||
}) // end $.PMA_confirm()
|
||||
}); // end $.live()
|
||||
}); //end $(document).ready() for Drop functionality of Routines, Triggers and Events.
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for Drop Table.
|
||||
*
|
||||
|
||||
@ -46,7 +46,7 @@ var HC = Highcharts,
|
||||
downloadPDF: 'Download PDF document',
|
||||
downloadSVG: 'Download SVG vector image',
|
||||
exportButtonTitle: 'Export to raster or vector image',
|
||||
printButtonTitle: 'Print the chart'
|
||||
printButton: 'Print the chart'
|
||||
}
|
||||
});
|
||||
|
||||
@ -106,7 +106,7 @@ defaultOptions.exporting = {
|
||||
type: 'image/png',
|
||||
url: 'chart_export.php',
|
||||
width: 800,
|
||||
buttons: {
|
||||
buttons: {
|
||||
exportButton: {
|
||||
//enabled: true,
|
||||
symbol: 'exportIcon',
|
||||
@ -114,54 +114,26 @@ defaultOptions.exporting = {
|
||||
symbolFill: '#A8BF77',
|
||||
hoverSymbolFill: '#768F3E',
|
||||
_titleKey: 'exportButtonTitle',
|
||||
menuName: 'export',
|
||||
menuItems: [{
|
||||
textKey: 'downloadPNG',
|
||||
onclick: function() {
|
||||
this.exportChart();
|
||||
}
|
||||
},/* {
|
||||
textKey: 'downloadJPEG',
|
||||
onclick: function() {
|
||||
this.exportChart({
|
||||
type: 'image/jpeg'
|
||||
});
|
||||
}
|
||||
}, {
|
||||
textKey: 'downloadPDF',
|
||||
onclick: function() {
|
||||
this.exportChart({
|
||||
type: 'application/pdf'
|
||||
});
|
||||
}
|
||||
}, */{
|
||||
},{
|
||||
textKey: 'downloadSVG',
|
||||
onclick: function() {
|
||||
this.exportChart({
|
||||
type: 'image/svg+xml'
|
||||
});
|
||||
}
|
||||
}/*, {
|
||||
text: 'View SVG',
|
||||
},{
|
||||
textKey: 'printButton',
|
||||
onclick: function() {
|
||||
var svg = this.getSVG()
|
||||
.replace(/</g, '\n<')
|
||||
.replace(/>/g, '>');
|
||||
|
||||
doc.body.innerHTML = '<pre>'+ svg +'</pre>';
|
||||
}
|
||||
}*/]
|
||||
this.print();
|
||||
}
|
||||
}]
|
||||
|
||||
},
|
||||
printButton: {
|
||||
//enabled: true,
|
||||
symbol: 'printIcon',
|
||||
x: -36,
|
||||
symbolFill: '#B5C9DF',
|
||||
hoverSymbolFill: '#779ABF',
|
||||
_titleKey: 'printButtonTitle',
|
||||
onclick: function() {
|
||||
this.print();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -522,8 +494,8 @@ extend(Chart.prototype, {
|
||||
btnOptions = merge(chart.options.navigation.buttonOptions, options),
|
||||
onclick = btnOptions.onclick,
|
||||
menuItems = btnOptions.menuItems,
|
||||
/*position = chart.getAlignment(btnOptions),
|
||||
buttonLeft = position.x,
|
||||
//position = chart.getAlignment(btnOptions),
|
||||
/*buttonLeft = position.x,
|
||||
buttonTop = position.y,*/
|
||||
buttonWidth = btnOptions.width,
|
||||
buttonHeight = btnOptions.height,
|
||||
@ -543,7 +515,7 @@ extend(Chart.prototype, {
|
||||
if (btnOptions.enabled === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// element to capture the click
|
||||
function revert() {
|
||||
symbol.attr(symbolAttr);
|
||||
@ -603,7 +575,7 @@ extend(Chart.prototype, {
|
||||
onclick = function(e) {
|
||||
revert();
|
||||
var bBox = button.getBBox();
|
||||
chart.contextMenu('export-menu', menuItems, bBox.x, bBox.y, buttonWidth, buttonHeight);
|
||||
chart.contextMenu(btnOptions.menuName, menuItems, bBox.x, bBox.y, buttonWidth, buttonHeight);
|
||||
};
|
||||
}
|
||||
/*addEvent(button.element, 'click', function() {
|
||||
@ -612,7 +584,7 @@ extend(Chart.prototype, {
|
||||
button.on('click', function() {
|
||||
onclick.apply(chart, arguments);
|
||||
});
|
||||
|
||||
|
||||
// the icon
|
||||
symbol = renderer.symbol(
|
||||
btnOptions.symbol,
|
||||
@ -653,33 +625,6 @@ HC.Renderer.prototype.symbols.exportIcon = function(x, y, radius) {
|
||||
'Z'
|
||||
];
|
||||
};
|
||||
// Create the print icon
|
||||
HC.Renderer.prototype.symbols.printIcon = function(x, y, radius) {
|
||||
return [
|
||||
M, // the printer
|
||||
x - radius, y + radius * 0.5,
|
||||
L,
|
||||
x + radius, y + radius * 0.5,
|
||||
x + radius, y - radius / 3,
|
||||
x - radius, y - radius / 3,
|
||||
'Z',
|
||||
M, // the upper sheet
|
||||
x - radius * 0.5, y - radius / 3,
|
||||
L,
|
||||
x - radius * 0.5, y - radius,
|
||||
x + radius * 0.5, y - radius,
|
||||
x + radius * 0.5, y - radius / 3,
|
||||
'Z',
|
||||
M, // the lower sheet
|
||||
x - radius * 0.5, y + radius * 0.5,
|
||||
L,
|
||||
x - radius * 0.75, y + radius,
|
||||
x + radius * 0.75, y + radius,
|
||||
x + radius * 0.5, y + radius * 0.5,
|
||||
'Z'
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
// Add the buttons on chart load
|
||||
Chart.prototype.callbacks.push(function(chart) {
|
||||
@ -692,6 +637,10 @@ Chart.prototype.callbacks.push(function(chart) {
|
||||
for (n in buttons) {
|
||||
chart.addButton(buttons[n]);
|
||||
}
|
||||
for (n in chart.options.buttons) {
|
||||
chart.addButton(chart.options.buttons[n]);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -4,45 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Ensures indexes names are valid according to their type and, for a primary
|
||||
* key, lock index name to 'PRIMARY'
|
||||
*
|
||||
* @return boolean false if there is no index form, true else
|
||||
*/
|
||||
function checkIndexName()
|
||||
{
|
||||
if (typeof(document.forms['index_frm']) == 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Gets the elements pointers
|
||||
var the_idx_name = document.forms['index_frm'].elements['index[Key_name]'];
|
||||
var the_idx_type = document.forms['index_frm'].elements['index[Index_type]'];
|
||||
|
||||
// Index is a primary key
|
||||
if (the_idx_type.options[0].value == 'PRIMARY' && the_idx_type.options[0].selected) {
|
||||
document.forms['index_frm'].elements['index[Key_name]'].value = 'PRIMARY';
|
||||
if (typeof(the_idx_name.disabled) != 'undefined') {
|
||||
document.forms['index_frm'].elements['index[Key_name]'].disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Other cases
|
||||
else {
|
||||
if (the_idx_name.value == 'PRIMARY') {
|
||||
document.forms['index_frm'].elements['index[Key_name]'].value = '';
|
||||
}
|
||||
if (typeof(the_idx_name.disabled) != 'undefined') {
|
||||
document.forms['index_frm'].elements['index[Key_name]'].disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} // end of the 'checkIndexName()' function
|
||||
|
||||
onload = checkIndexName;
|
||||
|
||||
/**
|
||||
* Hides/shows the inputs and submits appropriately depending
|
||||
* on whether the index type chosen is 'SPATIAL' or not.
|
||||
@ -56,7 +17,7 @@ function checkIndexType()
|
||||
/**
|
||||
* @var Object Table header for the size column.
|
||||
*/
|
||||
$size_header = $('thead tr th:nth-child(2)');
|
||||
$size_header = $('#index_columns thead tr th:nth-child(2)');
|
||||
/**
|
||||
* @var Object Inputs to specify the columns for the index.
|
||||
*/
|
||||
@ -132,7 +93,12 @@ function checkIndexType()
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
checkIndexType();
|
||||
$('#select_index_type').bind('change', checkIndexType);
|
||||
checkIndexName("index_frm");
|
||||
$('#select_index_type').live('change', function(event){
|
||||
event.preventDefault();
|
||||
checkIndexType();
|
||||
checkIndexName("index_frm");
|
||||
});
|
||||
});
|
||||
|
||||
/**#@- */
|
||||
|
||||
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
262
js/jquery/jquery.sortableTable.js
Normal file
262
js/jquery/jquery.sortableTable.js
Normal file
@ -0,0 +1,262 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* @fileoverview A jquery plugin that allows drag&drop sorting in tables.
|
||||
* Coded because JQuery UI sortable doesn't support tables. Also it has no animation
|
||||
*
|
||||
* @name Sortable Table JQuery plugin
|
||||
*
|
||||
* @requires jQuery
|
||||
*
|
||||
*/
|
||||
|
||||
/* Options:
|
||||
$('table').sortableTable({
|
||||
ignoreRect: { top, left, width, height } - relative coordinates on each element. If the user clicks
|
||||
in this area, it is not seen as a drag&drop request. Useful for toolbars etc.
|
||||
events: {
|
||||
start: callback function when the user starts dragging
|
||||
drop: callback function after an element has been dropped
|
||||
}
|
||||
})
|
||||
*/
|
||||
|
||||
/* Commands:
|
||||
$('table').sortableTable('init') - equivalent to $('table').sortableTable()
|
||||
$('table').sortableTable('refresh') - if the table has been changed, refresh correctly assigns all events again
|
||||
$('table').sortableTable('destroy') - removes all events from the table
|
||||
*/
|
||||
(function($) {
|
||||
jQuery.fn.sortableTable = function(method) {
|
||||
|
||||
var methods = {
|
||||
init : function(options) {
|
||||
var tb = new sortableTableInstance(this, options);
|
||||
tb.init();
|
||||
$(this).data('sortableTable',tb);
|
||||
},
|
||||
refresh : function( ) {
|
||||
$(this).data('sortableTable').refresh();
|
||||
},
|
||||
destroy : function( ) {
|
||||
$(this).data('sortableTable').destroy();
|
||||
},
|
||||
};
|
||||
|
||||
if ( methods[method] ) {
|
||||
return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
||||
} else if ( typeof method === 'object' || ! method ) {
|
||||
return methods.init.apply( this, arguments );
|
||||
} else {
|
||||
$.error( 'Method ' + method + ' does not exist on jQuery.sortableTable' );
|
||||
}
|
||||
|
||||
function sortableTableInstance(table, options) {
|
||||
var down = false;
|
||||
var $draggedEl, oldCell, previewMove, id;
|
||||
|
||||
if(!options) options = {};
|
||||
|
||||
/* Mouse handlers on the child elements */
|
||||
var onMouseUp = function(e) {
|
||||
dropAt(e.pageX, e.pageY);
|
||||
}
|
||||
|
||||
var onMouseDown = function(e) {
|
||||
$draggedEl = $(this).children();
|
||||
if($draggedEl.length == 0) return;
|
||||
if(options.ignoreRect && insideRect({x: e.pageX - $draggedEl.offset().left, y: e.pageY - $draggedEl.offset().top}, options.ignoreRect)) return;
|
||||
|
||||
down = true;
|
||||
oldCell = this;
|
||||
//move(e.pageX,e.pageY);
|
||||
|
||||
if(options.events && options.events.start)
|
||||
options.events.start(this);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var globalMouseMove = function(e) {
|
||||
if(down) {
|
||||
move(e.pageX,e.pageY);
|
||||
|
||||
if(inside($(oldCell), e.pageX, e.pageY)) {
|
||||
if(previewMove != null) {
|
||||
moveTo(previewMove);
|
||||
previewMove = null;
|
||||
}
|
||||
} else
|
||||
$(table).find('td').each(function() {
|
||||
if(inside($(this), e.pageX, e.pageY)) {
|
||||
if($(previewMove).attr('class') != $(this).children().first().attr('class')) {
|
||||
if(previewMove != null) moveTo(previewMove);
|
||||
previewMove = $(this).children().first();
|
||||
if(previewMove.length > 0)
|
||||
moveTo($(previewMove), { pos: {
|
||||
top: $(oldCell).offset().top - $(previewMove).parent().offset().top,
|
||||
left: $(oldCell).offset().left - $(previewMove).parent().offset().left
|
||||
} });
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var globalMouseOut = function() {
|
||||
if(down) {
|
||||
down = false;
|
||||
if(previewMove) moveTo(previewMove);
|
||||
moveTo($draggedEl);
|
||||
previewMove = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize sortable table
|
||||
this.init = function() {
|
||||
id = 1;
|
||||
// Add some required css to each child element in the <td>s
|
||||
$(table).find('td').children().each(function() {
|
||||
// Remove any old occurences of our added draggable-num class
|
||||
$(this).attr('class',$(this).attr('class').replace(/\s*draggable\-\d+/g,''));
|
||||
$(this).addClass('draggable-' + (id++));
|
||||
});
|
||||
|
||||
// Mouse events
|
||||
$(table).find('td').bind('mouseup',onMouseUp);
|
||||
$(table).find('td').bind('mousedown',onMouseDown);
|
||||
|
||||
$(document).mousemove(globalMouseMove);
|
||||
$(document).bind('mouseleave', globalMouseOut);
|
||||
}
|
||||
|
||||
// Call this when the table has been updated
|
||||
this.refresh = function() {
|
||||
this.destroy();
|
||||
this.init();
|
||||
}
|
||||
|
||||
this.destroy = function() {
|
||||
// Add some required css to each child element in the <td>s
|
||||
$(table).find('td').children().each(function() {
|
||||
// Remove any old occurences of our added draggable-num class
|
||||
$(this).attr('class',$(this).attr('class').replace(/\s*draggable\-\d+/g,''));
|
||||
});
|
||||
|
||||
// Mouse events
|
||||
$(table).find('td').unbind('mouseup',onMouseUp)
|
||||
$(table).find('td').unbind('mousedown',onMouseDown);
|
||||
|
||||
$(document).unbind('mousemove',globalMouseMove);
|
||||
$(document).unbind('mouseleave',globalMouseOut);
|
||||
}
|
||||
|
||||
function switchElement(drag, dropTo) {
|
||||
var dragPosDiff = {
|
||||
left: $(drag).children().first().offset().left - $(dropTo).offset().left,
|
||||
top: $(drag).children().first().offset().top - $(dropTo).offset().top
|
||||
};
|
||||
|
||||
var dropPosDiff = null;
|
||||
if($(dropTo).children().length > 0) {
|
||||
dropPosDiff = {
|
||||
left: $(dropTo).children().first().offset().left - $(drag).offset().left,
|
||||
top: $(dropTo).children().first().offset().top - $(drag).offset().top
|
||||
};
|
||||
}
|
||||
|
||||
/* I love you append(). It moves the DOM Elements so gracefully <3 */
|
||||
// Put the element in the way to old place
|
||||
$(drag).append($(dropTo).children().first()).children()
|
||||
.stop(true,true)
|
||||
.bind('mouseup',onMouseUp);
|
||||
|
||||
if(dropPosDiff)
|
||||
$(drag).append($(dropTo).children().first()).children()
|
||||
.css('left',dropPosDiff.left + 'px')
|
||||
.css('top',dropPosDiff.top + 'px');
|
||||
|
||||
// Put our dragged element into the space we just freed up
|
||||
$(dropTo).append($(drag).children().first()).children()
|
||||
.bind('mouseup',onMouseUp)
|
||||
.css('left',dragPosDiff.left + 'px')
|
||||
.css('top',dragPosDiff.top + 'px');
|
||||
|
||||
moveTo($(dropTo).children().first(), { duration: 100 });
|
||||
moveTo($(drag).children().first(), { duration: 100 });
|
||||
|
||||
if(options.events && options.events.drop) {
|
||||
// Drop event. The drag child element is moved into the drop element
|
||||
// and vice versa. So the parameters are switched.
|
||||
|
||||
// Calculate row and column index
|
||||
colIdx = $(dropTo).prevAll().length;
|
||||
rowIdx = $(dropTo).parent().prevAll().length;
|
||||
|
||||
options.events.drop(drag,dropTo, { col: colIdx, row: rowIdx });
|
||||
}
|
||||
}
|
||||
|
||||
function move(x,y) {
|
||||
$draggedEl.offset({
|
||||
top: Math.min($(document).height(), Math.max(0, y - $draggedEl.height()/2)),
|
||||
left: Math.min($(document).width(), Math.max(0, x - $draggedEl.width()/2))
|
||||
});
|
||||
}
|
||||
|
||||
function inside($el, x,y) {
|
||||
var off = $el.offset();
|
||||
return y >= off.top && x >= off.left && x < off.left + $el.width() && y < off.top + $el.height();
|
||||
}
|
||||
|
||||
function insideRect(pos, r) {
|
||||
return pos.y > r.top && pos.x > r.left && pos.y < r.top + r.height && pos.x < r.left + r.width;
|
||||
}
|
||||
|
||||
function dropAt(x,y) {
|
||||
if(!down) return;
|
||||
down = false;
|
||||
|
||||
var switched = false;
|
||||
|
||||
$(table).find('td').each(function() {
|
||||
if($(this).children().first().attr('class') != $(oldCell).children().first().attr('class') && inside($(this), x, y)) {
|
||||
switchElement(oldCell, this);
|
||||
switched = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
if(!switched) {
|
||||
if(previewMove) moveTo(previewMove);
|
||||
moveTo($draggedEl);
|
||||
}
|
||||
|
||||
previewMove = null;
|
||||
}
|
||||
|
||||
function moveTo(elem, opts) {
|
||||
if(!opts) opts = {};
|
||||
if(!opts.pos) opts.pos = { left: 0, top: 0 };
|
||||
if(!opts.duration) opts.duration = 200;
|
||||
|
||||
$(elem).css('position','relative');
|
||||
$(elem).animate({ top: opts.pos.top, left: opts.pos.left }, {
|
||||
duration: opts.duration,
|
||||
complete: function() {
|
||||
if(opts.pos.left == 0 && opts.pos.top == 0) {
|
||||
$(elem)
|
||||
.css('position','')
|
||||
.css('left','')
|
||||
.css('top','');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})( jQuery );
|
||||
@ -81,8 +81,9 @@
|
||||
dragMove: function(e) {
|
||||
if (this.colRsz) {
|
||||
var dx = e.pageX - this.colRsz.x0;
|
||||
if (this.colRsz.objWidth + dx > this.minColWidth)
|
||||
if (this.colRsz.objWidth + dx > this.minColWidth) {
|
||||
$(this.colRsz.obj).css('left', this.colRsz.objLeft + dx + 'px');
|
||||
}
|
||||
} else if (this.colMov) {
|
||||
// dragged column animation
|
||||
var dx = e.pageX - this.colMov.x0;
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -81,11 +83,73 @@ $js_messages['strChartServerTraffic'] = __('Server traffic (in KiB)');
|
||||
$js_messages['strChartConnections'] = __('Connections since last refresh');
|
||||
$js_messages['strChartProcesses'] = __('Processes');
|
||||
$js_messages['strChartConnectionsTitle'] = __('Connections / Processes');
|
||||
$js_messages['strChartIssuedQueries'] = __('Issued queries since last refresh');
|
||||
$js_messages['strChartIssuedQueriesTitle'] = __('Issued queries');
|
||||
/* l10n: Questions is the name of a MySQL Status variable */
|
||||
$js_messages['strChartIssuedQueries'] = __('Questions since last refresh');
|
||||
/* l10n: Questions is the name of a MySQL Status variable */
|
||||
$js_messages['strChartIssuedQueriesTitle'] = __('Questions (executed statements by the server)');
|
||||
|
||||
$js_messages['strChartQueryPie'] = __('Query statistics');
|
||||
|
||||
/* server status monitor */
|
||||
$js_messages['strSystemCPUUsage'] = __('System CPU Usage');
|
||||
$js_messages['strSystemMemory'] = __('System memory');
|
||||
$js_messages['strSystemSwap'] = __('System swap');
|
||||
$js_messages['strMiB'] = __('MiB');
|
||||
$js_messages['strKiB'] = __('KiB');
|
||||
|
||||
$js_messages['strAverageLoad'] = __('Average load');
|
||||
/* l10n: Questions is the name of a MySQL Status variable */
|
||||
$js_messages['strQuestions'] = __('Questions');
|
||||
$js_messages['strTraffic'] = __('Traffic');
|
||||
$js_messages['strSettings'] = __('Settings');
|
||||
$js_messages['strRemoveChart'] = __('Remove chart');
|
||||
$js_messages['strEditChart'] = __('Edit labels and series');
|
||||
$js_messages['strAddChart'] = __('Add chart to grid');
|
||||
$js_messages['strClose'] = __('Close');
|
||||
$js_messages['strAddOneSeriesWarning'] = __('Please add at least one variable to the series');
|
||||
$js_messages['strNone'] = __('None');
|
||||
$js_messages['strResumeMonitor'] = __('Resume monitor');
|
||||
$js_messages['strPauseMonitor'] = __('Pause monitor');
|
||||
/* Monitor: Instructions Dialog */
|
||||
$js_messages['strBothLogOn'] = __('general_log and slow_query_log is enabled.');
|
||||
$js_messages['strGenLogOn'] = __('general_log is enabled.');
|
||||
$js_messages['strSlowLogOn'] = __('slow_query_log is enabled.');
|
||||
$js_messages['strBothLogOff'] = __('slow_query_log and general_log is disabled.');
|
||||
$js_messages['strLogOutNotTable'] = __('log_output is not set to TABLE.');
|
||||
$js_messages['strLogOutIsTable'] = __('log_output is set to TABLE.');
|
||||
$js_messages['strSmallerLongQueryTimeAdvice'] = __('slow_query_log is enabled, but the server logs only queries that take longer than %d seconds. It is advisable to set this long_query_time 0-2 seconds, depending on your system.');
|
||||
$js_messages['strLongQueryTimeSet'] = __('long_query_time is set to %d second(s).');
|
||||
$js_messages['strSettingsAppliedGlobal'] = __('Following settings will be applied globally and reset to default on server restart:');
|
||||
/* l10n: %s is FILE or TABLE */
|
||||
$js_messages['strSetLogOutput'] = __('Set log_output to %s');
|
||||
/* l10n: Enable in this context means setting a status variable to ON */
|
||||
$js_messages['strEnableVar'] = __('Enable %s');
|
||||
/* l10n: Disable in this context means setting a status variable to OFF */
|
||||
$js_messages['strDisableVar'] = __('Disable %s');
|
||||
/* l10n: %d seconds */
|
||||
$js_messages['setSetLongQueryTime'] = __('Set long_query_time to %ds');
|
||||
$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');
|
||||
|
||||
$js_messages['strChartTitle'] = __('Chart Title');
|
||||
/* l10n: As in differential values */
|
||||
$js_messages['strDifferential'] = __('Differential');
|
||||
$js_messages['strDividedBy'] = __('Divided by %s:');
|
||||
|
||||
$js_messages['strSelectedTimeRange'] = __('Selected time range:');
|
||||
$js_messages['strGroupInserts'] = __('Group together INSERTs into same table');
|
||||
$js_messages['strLogAnalyseInfo'] = __('<p>Choose from which log you want the statistics to be generated from.</p> Results are grouped by query text.');
|
||||
$js_messages['strFromSlowLog'] = __('From slow log');
|
||||
$js_messages['strFromGeneralLog'] = __('From general log');
|
||||
$js_messages['strAnalysingLogs'] = __('Analysing & loading logs. This may take a while.');
|
||||
$js_messages['strCountColumnExplanation'] = __('This columns shows the amount of identical queries that are grouped together. However only the SQL Text is being compared, thus the queries other attributes such as start time may differ.');
|
||||
$js_messages['strMoreCountColumnExplanation'] = __('Since grouping of INSERTs queries has been selected, INSERT queries into the same table are also being grouped together, disregarding of the inserted data.');
|
||||
$js_messages['strLogDataLoaded'] = __('Log data loaded. Queries executed in this time span:');
|
||||
|
||||
$js_messages['strJumpToTable'] = __('Jump to Log table');
|
||||
$js_messages['strNoDataFound'] = __('Log analysed, but not data found in this time span.');
|
||||
|
||||
/* For inline query editing */
|
||||
$js_messages['strGo'] = __('Go');
|
||||
$js_messages['strCancel'] = __('Cancel');
|
||||
@ -122,7 +186,6 @@ $js_messages['strDeleting'] = __('Deleting');
|
||||
|
||||
/* For db_routines.js */
|
||||
$js_messages['MissingReturn'] = __('The definition of a stored function must contain a RETURN statement!');
|
||||
$js_messages['strValueTooLong'] = __('Value too long in the form!');
|
||||
|
||||
/* For import.js */
|
||||
$js_messages['strImportCSV'] = __('Note: If the file contains multiple tables, they will be combined into one');
|
||||
|
||||
@ -28,13 +28,13 @@ function toggle(id, only_open) {
|
||||
if (el.style.display == 'none' || only_open) {
|
||||
el.style.display = '';
|
||||
if (img) {
|
||||
img.src = image_minus;
|
||||
img.className = 'icon ic_b_minus';
|
||||
img.alt = '-';
|
||||
}
|
||||
} else {
|
||||
el.style.display = 'none';
|
||||
if (img) {
|
||||
img.src = image_plus;
|
||||
img.className = 'icon ic_b_plus';
|
||||
img.alt = '+';
|
||||
}
|
||||
}
|
||||
|
||||
380
js/rte/common.js
Normal file
380
js/rte/common.js
Normal file
@ -0,0 +1,380 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
|
||||
/**
|
||||
* @var RTE a JavaScript namespace containing the functionality
|
||||
* for Routines, Triggers and Events.
|
||||
*
|
||||
* This namespace is extended by the functionality required
|
||||
* to handle a specific item (a routine, trigger or event)
|
||||
* in the relevant javascript files in this folder.
|
||||
*/
|
||||
var RTE = {
|
||||
/**
|
||||
* @var $ajaxDialog jQuery object containing the reference to the
|
||||
* dialog that contains the editor.
|
||||
*/
|
||||
$ajaxDialog: null,
|
||||
/**
|
||||
* @var syntaxHiglighter Reference to the codemirror editor.
|
||||
*/
|
||||
syntaxHiglighter: null,
|
||||
/**
|
||||
* @var buttonOptions Object containing options for
|
||||
* the jQueryUI dialog buttons
|
||||
*/
|
||||
buttonOptions: {},
|
||||
/**
|
||||
* Validate editor form fields.
|
||||
*/
|
||||
validate: function () {
|
||||
/**
|
||||
* @var $elm a jQuery object containing the reference
|
||||
* to an element that is being validated.
|
||||
*/
|
||||
var $elm = null;
|
||||
// Common validation. At the very least the name
|
||||
// and the definition must be provided for an item
|
||||
$elm = $('.rte_table').last().find('input[name=item_name]');
|
||||
if ($elm.val() === '') {
|
||||
$elm.focus();
|
||||
alert(PMA_messages['strFormEmpty']);
|
||||
return false;
|
||||
}
|
||||
$elm = $('.rte_table').find('textarea[name=item_definition]');
|
||||
if ($elm.val() === '') {
|
||||
this.syntaxHiglighter.focus();
|
||||
alert(PMA_messages['strFormEmpty']);
|
||||
return false;
|
||||
}
|
||||
// The validation has so far passed, so now
|
||||
// we can validate item-specific fields.
|
||||
return RTE.validateCustom();
|
||||
}, // end validate()
|
||||
/**
|
||||
* Validate custom editor form fields.
|
||||
* This function can be overridden by
|
||||
* other files in this folder.
|
||||
*/
|
||||
validateCustom: function () {
|
||||
return true;
|
||||
}, // end validateCustom()
|
||||
/**
|
||||
* Execute some code after the ajax
|
||||
* dialog for the ditor is shown.
|
||||
* This function can be overridden by
|
||||
* other files in this folder.
|
||||
*/
|
||||
postDialogShow: function () {
|
||||
// Nothing by default
|
||||
} // end postDialogShow()
|
||||
}; // end RTE namespace
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the Routines, Triggers and Events editor.
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
/**
|
||||
* Attach Ajax event handlers for the Add/Edit functionality.
|
||||
*/
|
||||
$('.ajax_add_anchor, .ajax_edit_anchor').live('click', function (event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var $edit_row jQuery object containing the reference to
|
||||
* the row of the the item being edited
|
||||
* from the list of items .
|
||||
*/
|
||||
var $edit_row = null;
|
||||
if ($(this).hasClass('ajax_edit_anchor')) {
|
||||
// Remeber the row of the item being edited for later,
|
||||
// so that if the edit is successful, we can replace the
|
||||
// row with info about the modified item.
|
||||
$edit_row = $(this).parents('tr');
|
||||
}
|
||||
/**
|
||||
* @var $msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user.
|
||||
*/
|
||||
var $msg = PMA_ajaxShowMessage();
|
||||
$.get($(this).attr('href'), {'ajax_request': true}, function (data) {
|
||||
if (data.success === true) {
|
||||
// We have successfully fetched the editor form
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
// Now define the function that is called when
|
||||
// the user presses the "Go" button
|
||||
RTE.buttonOptions[PMA_messages['strGo']] = function () {
|
||||
// Move the data from the codemirror editor back to the
|
||||
// textarea, where it can be used in the form submission.
|
||||
RTE.syntaxHiglighter.save();
|
||||
// Validate editor and submit request, if passed.
|
||||
if (RTE.validate()) {
|
||||
/**
|
||||
* @var data Form data to be sent in the AJAX request.
|
||||
*/
|
||||
var data = $('.rte_form').last().serialize();
|
||||
$msg = PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
|
||||
$.post($('.rte_form').last().attr('action'), data, function (data) {
|
||||
if (data.success === true) {
|
||||
// Item created successfully
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
PMA_slidingMessage(data.message);
|
||||
RTE.$ajaxDialog.dialog('close');
|
||||
// If we are in 'edit' mode, we must remove the reference to the old row.
|
||||
if (mode === 'edit') {
|
||||
$edit_row.remove();
|
||||
}
|
||||
// Sometimes, like when moving a trigger from a table to
|
||||
// another one, the new row should not be inserted into the
|
||||
// list. In this case "data.insert" will be set to false.
|
||||
if (data.insert) {
|
||||
// Insert the new row at the correct location in the list of items
|
||||
/**
|
||||
* @var text Contains the name of an item 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 item has been inserted
|
||||
* in the list or not.
|
||||
*/
|
||||
var inserted = false;
|
||||
$('table.data').find('tr').each(function () {
|
||||
text = $(this)
|
||||
.children('td')
|
||||
.eq(0)
|
||||
.find('strong')
|
||||
.text()
|
||||
.toUpperCase();
|
||||
text = $.trim(text);
|
||||
if (text !== '' && text > data.name) {
|
||||
$(this).before(data.new_row);
|
||||
inserted = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (! inserted) {
|
||||
// If we didn't manage to insert the row yet,
|
||||
// it must belong at the end of the list,
|
||||
// so we insert it there.
|
||||
$('table.data').append(data.new_row);
|
||||
}
|
||||
// Fade-in the new row
|
||||
$('.ajaxInsert').show('slow').removeClass('ajaxInsert');
|
||||
} else if ($('table.data').find('tr').has('td').length === 0) {
|
||||
// If we are not supposed to insert the new row, we will now
|
||||
// check if the table is empty and needs to be hidden. This
|
||||
// will be the case if we were editing the only item in the
|
||||
// list, which we removed and will not be inserting something
|
||||
// else in its place.
|
||||
$('table.data').hide("slow", function () {
|
||||
$('#nothing2display').show("slow");
|
||||
});
|
||||
}
|
||||
// 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;
|
||||
/**
|
||||
* @var rowclass Class to be attached to the row
|
||||
* that is being processed
|
||||
*/
|
||||
var rowclass = '';
|
||||
$('table.data').find('tr').has('td').each(function () {
|
||||
rowclass = (ct % 2 === 0) ? 'even' : 'odd';
|
||||
$(this).removeClass().addClass(rowclass);
|
||||
ct++;
|
||||
});
|
||||
// If this is the first item being added, remove
|
||||
// the "No items" message and show the list.
|
||||
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 $.post()
|
||||
} // end "if (RTE.validate())"
|
||||
}; // end of function that handles the submission of the Editor
|
||||
RTE.buttonOptions[PMA_messages['strClose']] = function () {
|
||||
$(this).dialog("close");
|
||||
};
|
||||
/**
|
||||
* Display the dialog to the user
|
||||
*/
|
||||
RTE.$ajaxDialog = $('<div>' + data.message + '</div>').dialog({
|
||||
width: 700,
|
||||
height: 555,
|
||||
buttons: RTE.buttonOptions,
|
||||
title: data.title,
|
||||
modal: true,
|
||||
close: function () {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
RTE.$ajaxDialog.find('input[name=item_name]').focus();
|
||||
RTE.$ajaxDialog.find('.datefield, .datetimefield').each(function () {
|
||||
PMA_addDatepicker($(this).css('width', '95%'));
|
||||
});
|
||||
/**
|
||||
* @var mode Used to remeber whether the editor is in
|
||||
* "Edit" or "Add" mode.
|
||||
*/
|
||||
var mode = 'add';
|
||||
if ($('input[name=editor_process_edit]').length > 0) {
|
||||
mode = 'edit';
|
||||
}
|
||||
// Attach syntax highlited editor to the definition
|
||||
/**
|
||||
* @var $elm jQuery object containing the reference to
|
||||
* the Definition textarea.
|
||||
*/
|
||||
var $elm = $('textarea[name=item_definition]').last();
|
||||
/**
|
||||
* @var opts Options to pass to the codemirror editor.
|
||||
*/
|
||||
var opts = {lineNumbers: true, matchBrackets: true, indentUnit: 4, mode: "text/x-mysql"};
|
||||
RTE.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');
|
||||
// Execute item-specific code
|
||||
RTE.postDialogShow(data);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
}); // end $.get()
|
||||
}); // end $.live()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for input fields in the editor
|
||||
* and the routine execution dialog used to submit the Ajax
|
||||
* request when the ENTER key is pressed.
|
||||
*/
|
||||
$('.rte_table').find('input[name^=item], input[name^=params]').live('keydown', function (e) {
|
||||
if (e.which === 13) { // 13 is the ENTER key
|
||||
e.preventDefault();
|
||||
if (typeof RTE.buttonOptions[PMA_messages['strGo']] === 'function') {
|
||||
RTE.buttonOptions[PMA_messages['strGo']].call();
|
||||
}
|
||||
}
|
||||
}); // end $.live()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for Export of Routines, Triggers and Events.
|
||||
*/
|
||||
$('.ajax_export_anchor').live('click', function (event) {
|
||||
event.preventDefault();
|
||||
var $msg = PMA_ajaxShowMessage();
|
||||
// Fire the ajax request straight away
|
||||
$.get($(this).attr('href'), {'ajax_request': true}, function (data) {
|
||||
if (data.success === true) {
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
/**
|
||||
* @var button_options Object containing options for jQueryUI dialog buttons
|
||||
*/
|
||||
var button_options = {};
|
||||
button_options[PMA_messages['strClose']] = function () {
|
||||
$(this).dialog("close").remove();
|
||||
};
|
||||
/**
|
||||
* Display the dialog to the user
|
||||
*/
|
||||
var $ajaxDialog = $('<div>' + data.message + '</div>').dialog({
|
||||
width: 500,
|
||||
buttons: button_options,
|
||||
title: data.title
|
||||
});
|
||||
// Attach syntax highlited editor to export dialog
|
||||
/**
|
||||
* @var $elm jQuery object containing the reference
|
||||
* to the Export textarea.
|
||||
*/
|
||||
var $elm = $ajaxDialog.find('textarea');
|
||||
/**
|
||||
* @var opts Options to pass to the codemirror editor.
|
||||
*/
|
||||
var opts = {lineNumbers: true, matchBrackets: true, indentUnit: 4, mode: "text/x-mysql"};
|
||||
CodeMirror.fromTextArea($elm[0], opts);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
}); // end $.get()
|
||||
}); // end $.live()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for Drop functionality of Routines, Triggers and Events.
|
||||
*/
|
||||
$('.ajax_drop_anchor').live('click', function (event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var $curr_row Object containing reference to the current row
|
||||
*/
|
||||
var $curr_row = $(this).parents('tr');
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = $('<div></div>').text($curr_row.children('td').children('.drop_sql').html());
|
||||
// We ask for confirmation first here, before submitting the ajax request
|
||||
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
|
||||
/**
|
||||
* @var $msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user.
|
||||
*/
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
|
||||
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function (data) {
|
||||
if (data.success === true) {
|
||||
/**
|
||||
* @var $table Object containing reference to the main list of elements.
|
||||
*/
|
||||
var $table = $curr_row.parent();
|
||||
// Check how many rows will be left after we remove
|
||||
// the one that the user has requested us to remove
|
||||
if ($table.find('tr').length === 2) {
|
||||
// If there are two rows left, it means that they are
|
||||
// the header of the table and the rows that we are
|
||||
// about to remove, so after the removal there will be
|
||||
// nothing to show in the table, so we hide it.
|
||||
$table.hide("slow", function () {
|
||||
$(this).find('tr.even, tr.odd').remove();
|
||||
$('#nothing2display').show("slow");
|
||||
});
|
||||
} else {
|
||||
$curr_row.hide("slow", function () {
|
||||
$(this).remove();
|
||||
// Now we have removed the row from the list, but maybe
|
||||
// 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;
|
||||
/**
|
||||
* @var rowclass Class to be attached to the row
|
||||
* that is being processed
|
||||
*/
|
||||
var rowclass = '';
|
||||
$table.find('tr').has('td').each(function () {
|
||||
rowclass = (ct % 2 === 0) ? 'even' : 'odd';
|
||||
$(this).removeClass().addClass(rowclass);
|
||||
ct++;
|
||||
});
|
||||
});
|
||||
}
|
||||
// Get rid of the "Loading" message
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
// Show the query that we just executed
|
||||
PMA_slidingMessage(data.sql_query);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error);
|
||||
}
|
||||
}); // end $.get()
|
||||
}); // end $.PMA_confirm()
|
||||
}); // end $.live()
|
||||
}); // end of $(document).ready()
|
||||
43
js/rte/events.js
Normal file
43
js/rte/events.js
Normal file
@ -0,0 +1,43 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
|
||||
/**
|
||||
* Overriding the validateCustom() function defined in common.js
|
||||
*/
|
||||
RTE.validateCustom = function () {
|
||||
/**
|
||||
* @var $elm a jQuery object containing the reference
|
||||
* to an element that is being validated.
|
||||
*/
|
||||
var $elm = null;
|
||||
if ($('select[name=item_type]').find(':selected').val() === 'RECURRING') {
|
||||
// The interval field must not be empty for recurring events
|
||||
$elm = $('input[name=item_interval_value]');
|
||||
if ($elm.val() === '') {
|
||||
$elm.focus();
|
||||
alert(PMA_messages['strFormEmpty']);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// The execute_at field must not be empty for "once off" events
|
||||
$elm = $('input[name=item_execute_at]');
|
||||
if ($elm.val() === '') {
|
||||
$elm.focus();
|
||||
alert(PMA_messages['strFormEmpty']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}; // end RTE.validateCustom()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the "Change event type"
|
||||
* functionality in the events editor, so that the correct
|
||||
* rows are shown in the editor when changing the event type
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
$('select[name=item_type]').live('change', function () {
|
||||
$('.recurring_event_row, .onetime_event_row').toggle();
|
||||
}); // end $.live()
|
||||
}); // end of $(document).ready()
|
||||
395
js/rte/routines.js
Normal file
395
js/rte/routines.js
Normal file
@ -0,0 +1,395 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
RTE.param_template = '';
|
||||
|
||||
/**
|
||||
* Overriding the postDialogShow() function defined in common.js
|
||||
*
|
||||
* @param data JSON-encoded data from the ajax request
|
||||
*/
|
||||
RTE.postDialogShow = function (data) {
|
||||
// Cache the template for a parameter table row
|
||||
RTE.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 () {
|
||||
RTE.setOptionsForParameter(
|
||||
$(this).find('select[name^=item_param_type]'),
|
||||
$(this).find('input[name^=item_param_length]'),
|
||||
$(this).find('select[name^=item_param_opts_text]'),
|
||||
$(this).find('select[name^=item_param_opts_num]')
|
||||
);
|
||||
});
|
||||
// Enable/disable the 'options' dropdowns for
|
||||
// function return value as necessary
|
||||
RTE.setOptionsForParameter(
|
||||
$('.rte_table').last().find('select[name=item_returntype]'),
|
||||
$('.rte_table').last().find('input[name=item_returnlength]'),
|
||||
$('.rte_table').last().find('select[name=item_returnopts_text]'),
|
||||
$('.rte_table').last().find('select[name=item_returnopts_num]')
|
||||
);
|
||||
}; // end RTE.postDialogShow()
|
||||
|
||||
/**
|
||||
* Overriding the validateCustom() function defined in common.js
|
||||
*/
|
||||
RTE.validateCustom = function () {
|
||||
/**
|
||||
* @var isSuccess Stores the outcome of the validation
|
||||
*/
|
||||
var isSuccess = true;
|
||||
/**
|
||||
* @var inputname The value of the "name" attribute for
|
||||
* the field that is being processed
|
||||
*/
|
||||
var inputname = '';
|
||||
$('.routine_params_table').last().find('tr').each(function () {
|
||||
// Every parameter of a routine must have
|
||||
// a non-empty direction, name and type
|
||||
if (isSuccess) {
|
||||
$(this).find(':input').each(function () {
|
||||
inputname = $(this).attr('name');
|
||||
if (inputname.substr(0, 17) === 'item_param_dir' ||
|
||||
inputname.substr(0, 18) === 'item_param_name' ||
|
||||
inputname.substr(0, 18) === 'item_param_type') {
|
||||
if ($(this).val() === '') {
|
||||
$(this).focus();
|
||||
isSuccess = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (! isSuccess) {
|
||||
alert(PMA_messages['strFormEmpty']);
|
||||
return false;
|
||||
}
|
||||
$('.routine_params_table').last().find('tr').each(function () {
|
||||
// SET, ENUM, VARCHAR and VARBINARY fields must have length/values
|
||||
var $inputtyp = $(this).find('select[name^=item_param_type]');
|
||||
var $inputlen = $(this).find('input[name^=item_param_length]');
|
||||
if ($inputtyp.length && $inputlen.length) {
|
||||
if (($inputtyp.val() === 'ENUM' || $inputtyp.val() === 'SET' || $inputtyp.val().substr(0, 3) === 'VAR')
|
||||
&& $inputlen.val() === '') {
|
||||
$inputlen.focus();
|
||||
isSuccess = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (! isSuccess) {
|
||||
alert(PMA_messages['strFormEmpty']);
|
||||
return false;
|
||||
}
|
||||
if ($('select[name=item_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=item_returntype]');
|
||||
var $returnlen = $('input[name=item_returnlength]');
|
||||
if (($returntyp.val() === 'ENUM' || $returntyp.val() === 'SET' || $returntyp.val().substr(0, 3) === 'VAR')
|
||||
&& $returnlen.val() === '') {
|
||||
$returnlen.focus();
|
||||
alert(PMA_messages['strFormEmpty']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($('select[name=item_type]').find(':selected').val() === 'FUNCTION') {
|
||||
// A function must contain a RETURN statement in its definition
|
||||
if ($('.rte_table').find('textarea[name=item_definition]').val().toUpperCase().indexOf('RETURN') < 0) {
|
||||
RTE.syntaxHiglighter.focus();
|
||||
alert(PMA_messages['MissingReturn']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}; // end RTE.validateCustom()
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
RTE.setOptionsForParameter = function ($type, $len, $text, $num) {
|
||||
/**
|
||||
* @var $no_opts a jQuery object containing the reference
|
||||
* to an element to be displayed when no
|
||||
* options are available
|
||||
*/
|
||||
var $no_opts = $text.parent().parent().find('.no_opts');
|
||||
/**
|
||||
* @var $no_len a jQuery object containing the reference
|
||||
* to an element to be displayed when no
|
||||
* "length/values" field is available
|
||||
*/
|
||||
var $no_len = $len.parent().parent().find('.no_len');
|
||||
|
||||
// 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();
|
||||
$no_opts.hide();
|
||||
break;
|
||||
case 'TINYTEXT':
|
||||
case 'TEXT':
|
||||
case 'MEDIUMTEXT':
|
||||
case 'LONGTEXT':
|
||||
case 'CHAR':
|
||||
case 'VARCHAR':
|
||||
case 'SET':
|
||||
case 'ENUM':
|
||||
$text.parent().show();
|
||||
$num.parent().hide();
|
||||
$no_opts.hide();
|
||||
break;
|
||||
default:
|
||||
$text.parent().hide();
|
||||
$num.parent().hide();
|
||||
$no_opts.show();
|
||||
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.parent().hide();
|
||||
$no_len.show();
|
||||
break;
|
||||
default:
|
||||
$len.parent().show();
|
||||
$no_len.hide();
|
||||
break;
|
||||
}
|
||||
}; // end RTE.setOptionsForParameter()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the Routines functionalities.
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
/**
|
||||
* Attach Ajax event handlers for the "Add parameter to routine" functionality.
|
||||
*/
|
||||
$('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 = RTE.param_template.replace(/%s/g, $routine_params_table.find('tr').length - 1);
|
||||
// Append the new row to the parameters table
|
||||
$routine_params_table.append(new_param_row);
|
||||
// Make sure that the row is correctly shown according to the type of routine
|
||||
if ($('.rte_table').find('select[name=item_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();
|
||||
// Enable/disable the 'options' dropdowns for parameters as necessary
|
||||
RTE.setOptionsForParameter(
|
||||
$newrow.find('select[name^=item_param_type]'),
|
||||
$newrow.find('input[name^=item_param_length]'),
|
||||
$newrow.find('select[name^=item_param_opts_text]'),
|
||||
$newrow.find('select[name^=item_param_opts_num]')
|
||||
);
|
||||
}); // end $.live()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the "Remove parameter from routine" functionality.
|
||||
*/
|
||||
$('.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) === 'item_param_dir') {
|
||||
$(this).attr('name', inputname.substr(0, 17) + '[' + index + ']');
|
||||
} else if (inputname.substr(0, 18) === 'item_param_name') {
|
||||
$(this).attr('name', inputname.substr(0, 18) + '[' + index + ']');
|
||||
} else if (inputname.substr(0, 18) === 'item_param_type') {
|
||||
$(this).attr('name', inputname.substr(0, 18) + '[' + index + ']');
|
||||
} else if (inputname.substr(0, 20) === 'item_param_length') {
|
||||
$(this).attr('name', inputname.substr(0, 20) + '[' + index + ']');
|
||||
} else if (inputname.substr(0, 23) === 'item_param_opts_text') {
|
||||
$(this).attr('name', inputname.substr(0, 23) + '[' + index + ']');
|
||||
} else if (inputname.substr(0, 22) === 'item_param_opts_num') {
|
||||
$(this).attr('name', inputname.substr(0, 22) + '[' + index + ']');
|
||||
}
|
||||
});
|
||||
index++;
|
||||
});
|
||||
}); // end $.live()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the "Change routine type"
|
||||
* functionality in the routines editor, so that the correct
|
||||
* fields are shown in the editor when changing the routine type
|
||||
*/
|
||||
$('select[name=item_type]').live('change', function () {
|
||||
$('.routine_return_row, .routine_direction_cell').toggle();
|
||||
}); // end $.live()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the "Change parameter type"
|
||||
* functionality in the routines editor, so that the correct
|
||||
* option/length fields, if any, are shown when changing
|
||||
* a parameter type
|
||||
*/
|
||||
$('select[name^=item_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();
|
||||
RTE.setOptionsForParameter(
|
||||
$row.find('select[name^=item_param_type]'),
|
||||
$row.find('input[name^=item_param_length]'),
|
||||
$row.find('select[name^=item_param_opts_text]'),
|
||||
$row.find('select[name^=item_param_opts_num]')
|
||||
);
|
||||
}); // end $.live()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the "Change the type of return
|
||||
* variable of function" functionality, so that the correct fields,
|
||||
* if any, are shown when changing the function return type type
|
||||
*/
|
||||
$('select[name=item_returntype]').live('change', function () {
|
||||
RTE.setOptionsForParameter(
|
||||
$('.rte_table').find('select[name=item_returntype]'),
|
||||
$('.rte_table').find('input[name=item_returnlength]'),
|
||||
$('.rte_table').find('select[name=item_returnopts_text]'),
|
||||
$('.rte_table').find('select[name=item_returnopts_num]')
|
||||
);
|
||||
}); // end $.live()
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the Execute routine functionality.
|
||||
*/
|
||||
$('.ajax_exec_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();
|
||||
$.get($(this).attr('href'), {'ajax_request': true}, function (data) {
|
||||
if (data.success === true) {
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
// If 'data.dialog' is true we show a dialog with a form
|
||||
// to get the input parameters for routine, otherwise
|
||||
// we just show the results of the query
|
||||
if (data.dialog) {
|
||||
// Define the function that is called when
|
||||
// the user presses the "Go" button
|
||||
RTE.buttonOptions[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['strProcessingRequest']);
|
||||
$.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);
|
||||
}
|
||||
});
|
||||
};
|
||||
RTE.buttonOptions[PMA_messages['strClose']] = function () {
|
||||
$(this).dialog("close");
|
||||
};
|
||||
/**
|
||||
* Display the dialog to the user
|
||||
*/
|
||||
$ajaxDialog = $('<div>' + data.message + '</div>').dialog({
|
||||
width: 650,
|
||||
buttons: RTE.buttonOptions,
|
||||
title: data.title,
|
||||
modal: true,
|
||||
close: function () {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
$ajaxDialog.find('input[name^=params]').first().focus();
|
||||
/**
|
||||
* Attach the datepickers to the relevant form fields
|
||||
*/
|
||||
$ajaxDialog.find('.datefield, .datetimefield').each(function () {
|
||||
PMA_addDatepicker($(this).css('width', '95%'));
|
||||
});
|
||||
} else {
|
||||
// Routine executed successfully
|
||||
PMA_slidingMessage(data.message);
|
||||
}
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
}); // end $.get()
|
||||
}); // end $.live()
|
||||
}); // end of $(document).ready() for the Routine Functionalities
|
||||
8
js/rte/triggers.js
Normal file
8
js/rte/triggers.js
Normal file
@ -0,0 +1,8 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
|
||||
/**
|
||||
* So far it looks like triggers don't need
|
||||
* any special treatment as far as JavaScript
|
||||
* goes, but leaving this file here in case
|
||||
* the need for custom code will arise.
|
||||
*/
|
||||
@ -210,7 +210,7 @@ $(document).ready(function() {
|
||||
/* post request for get the updated userForm table */
|
||||
$.post($form.attr('action' ), url, function(priv_data) {
|
||||
|
||||
/*Remove the old userForm table*/
|
||||
/*Remove the old userForm table*/
|
||||
if ($('#userFormDiv').length != 0) {
|
||||
$('#userFormDiv').remove();
|
||||
} else {
|
||||
@ -527,6 +527,7 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
displayPasswordGenerateButton();
|
||||
}, 'top.frame_content'); //end $(document).ready()
|
||||
|
||||
/**#@- */
|
||||
|
||||
1261
js/server_status.js
1261
js/server_status.js
File diff suppressed because it is too large
Load Diff
@ -96,7 +96,8 @@ function showDetails(i, update_size, insert_size, remove_size, insert_index, rem
|
||||
insert_rows.align = "center";
|
||||
|
||||
var tick_image = document.createElement("img");
|
||||
tick_image.src = pmaThemeImage + "s_success.png";
|
||||
tick_image.src = 'themes/dot.gif';
|
||||
tick_image.className = "icon ic_s_success";
|
||||
|
||||
if (update_size == '' && insert_size == '' && remove_size == '') {
|
||||
/**
|
||||
|
||||
@ -54,9 +54,9 @@ $(function() {
|
||||
var charWidth;
|
||||
|
||||
// Global vars
|
||||
editLink = '<a href="#" class="editLink" onclick="return editVariable(this);"><img src="'+pma_theme_image+'b_edit.png" alt="" width="16" height="16"> '+PMA_messages['strEdit']+'</a>';
|
||||
saveLink = '<a href="#" class="saveLink"><img src="'+pma_theme_image+'b_save.png" alt="" width="16" height="16"> '+PMA_messages['strSave']+'</a> ';
|
||||
cancelLink = '<a href="#" class="cancelLink"><img src="'+pma_theme_image+'b_close.png" alt="" width="16" height="16"> '+PMA_messages['strCancel']+'</a> ';
|
||||
editLink = '<a href="#" class="editLink" onclick="return editVariable(this);"><img class="icon ic_b_edit" src="themes/dot.gif" alt=""> '+PMA_messages['strEdit']+'</a>';
|
||||
saveLink = '<a href="#" class="saveLink"><img class="icon ic_b_save" src="themes/dot.gif" alt=""> '+PMA_messages['strSave']+'</a> ';
|
||||
cancelLink = '<a href="#" class="cancelLink"><img class="icon ic_b_close" src="themes/dot.gif" alt=""> '+PMA_messages['strCancel']+'</a> ';
|
||||
|
||||
|
||||
$.ajaxSetup({
|
||||
@ -129,7 +129,7 @@ $(function() {
|
||||
|
||||
$('#filterText').keyup(function(e) {
|
||||
if($(this).val().length==0) textFilter=null;
|
||||
else textFilter = new RegExp("(^| )"+$(this).val(),'i');
|
||||
else textFilter = new RegExp("(^| )"+$(this).val().replace('_',' '),'i');
|
||||
filterVariables();
|
||||
});
|
||||
|
||||
|
||||
95
js/sql.js
95
js/sql.js
@ -65,8 +65,8 @@ function appendInlineAnchor() {
|
||||
|
||||
var $img_object = $cloned_anchor.find('img').attr('title', PMA_messages['strInlineEdit']);
|
||||
if ($img_object.length != 0) {
|
||||
var img_src = $img_object.attr('src').replace(/b_edit/,'b_inline_edit');
|
||||
$img_object.attr('src', img_src);
|
||||
var img_class = $img_object.attr('class').replace(/b_edit/,'b_inline_edit');
|
||||
$img_object.attr('class', img_class);
|
||||
$cloned_anchor.find('a').attr('href', '#');
|
||||
var $edit_span = $cloned_anchor.find('span:contains("' + PMA_messages['strEdit'] + '")');
|
||||
var $span = $cloned_anchor.find('a').find('span');
|
||||
@ -85,8 +85,8 @@ function appendInlineAnchor() {
|
||||
// the link was too big so <input type="image"> is there
|
||||
$img_object = $cloned_anchor.find('input:image').attr('title', PMA_messages['strInlineEdit']);
|
||||
if ($img_object.length > 0) {
|
||||
var img_src = $img_object.attr('src').replace(/b_edit/,'b_inline_edit');
|
||||
$img_object.attr('src', img_src);
|
||||
var img_class = $img_object.attr('class').replace(/b_edit/,'b_inline_edit');
|
||||
$img_object.attr('class', img_class);
|
||||
}
|
||||
$cloned_anchor
|
||||
.find('.clickprevimage')
|
||||
@ -143,7 +143,7 @@ $(document).ready(function() {
|
||||
.parent()
|
||||
.toggle($(this).attr('value').length > 0);
|
||||
}).trigger('keyup');
|
||||
|
||||
|
||||
/**
|
||||
* Attach the {@link appendInlineAnchor} function to a custom event, which
|
||||
* will be triggered manually everytime the table of results is reloaded
|
||||
@ -152,7 +152,7 @@ $(document).ready(function() {
|
||||
$("#sqlqueryresults").live('appendAnchor',function() {
|
||||
appendInlineAnchor();
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* Attach the {@link makegrid} function to a custom event, which will be
|
||||
* triggered manually everytime the table of results is reloaded
|
||||
@ -161,7 +161,7 @@ $(document).ready(function() {
|
||||
$("#sqlqueryresults").live('makegrid', function() {
|
||||
$('#table_results').makegrid();
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* Attach the {@link refreshgrid} function to a custom event, which will be
|
||||
* triggered manually everytime the table of results is manipulated (e.g., by inline edit)
|
||||
@ -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,26 @@ $(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()
|
||||
.html(data)
|
||||
.trigger('appendAnchor')
|
||||
.trigger('makegrid');
|
||||
$('#togglequerybox').show();
|
||||
if($("#togglequerybox").siblings(":visible").length > 0) {
|
||||
if ($("#togglequerybox").siblings(":visible").length > 0) {
|
||||
$("#togglequerybox").trigger('click');
|
||||
}
|
||||
PMA_init_slider();
|
||||
@ -315,16 +317,17 @@ $(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" />');
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
|
||||
$.post($the_form.attr('action'), $the_form.serialize(), function(data) {
|
||||
$("#sqlqueryresults").html(data);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
$("#sqlqueryresults").trigger('makegrid');
|
||||
$.post($form.attr('action'), $form.serialize(), function(data) {
|
||||
$("#sqlqueryresults")
|
||||
.html(data)
|
||||
.trigger('appendAnchor')
|
||||
.trigger('makegrid');
|
||||
PMA_init_slider();
|
||||
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
@ -338,22 +341,23 @@ $(document).ready(function() {
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
$("#pageselector").live('change', function(event) {
|
||||
var $the_form = $(this).parent("form");
|
||||
var $form = $(this).parent("form");
|
||||
|
||||
if ($(this).hasClass('ajax')) {
|
||||
event.preventDefault();
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
$.post($the_form.attr('action'), $the_form.serialize() + '&ajax_request=true', function(data) {
|
||||
$("#sqlqueryresults").html(data);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
$("#sqlqueryresults").trigger('makegrid');
|
||||
$.post($form.attr('action'), $form.serialize() + '&ajax_request=true', function(data) {
|
||||
$("#sqlqueryresults")
|
||||
.html(data)
|
||||
.trigger('appendAnchor')
|
||||
.trigger('makegrid');
|
||||
PMA_init_slider();
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.post()
|
||||
} else {
|
||||
$the_form.submit();
|
||||
$form.submit();
|
||||
}
|
||||
|
||||
})// end Paginate results with Page Selector
|
||||
@ -441,8 +445,8 @@ $(document).ready(function() {
|
||||
// If icons are displayed. See $cfg['PropertiesIconic']
|
||||
if ($img_object.length > 0) {
|
||||
$img_object.attr('title', PMA_messages['strSave']);
|
||||
var img_src = $img_object.attr('src').replace(/b_inline_edit/,'b_save');
|
||||
$img_object.attr('src', img_src);
|
||||
var img_class = $img_object.attr('class').replace(/b_inline_edit/,'b_save');
|
||||
$img_object.attr('class', img_class);
|
||||
$this_children.prepend($img_object);
|
||||
}
|
||||
|
||||
@ -461,8 +465,8 @@ $(document).ready(function() {
|
||||
// If icons are displayed. See $cfg['PropertiesIconic']
|
||||
if ($img_object.length > 0) {
|
||||
$img_object.attr('title', PMA_messages['strHide']);
|
||||
var img_src = $img_object.attr('src').replace(/b_save/,'b_close');
|
||||
$img_object.attr('src', img_src);
|
||||
var img_class = $img_object.attr('class').replace(/b_save/,'b_close');
|
||||
$img_object.attr('class', img_class);
|
||||
$hide_span.prepend($img_object);
|
||||
}
|
||||
|
||||
@ -493,7 +497,7 @@ $(document).ready(function() {
|
||||
$(this).prev().prev().remove();
|
||||
$(this).prev().remove();
|
||||
$(this).remove();
|
||||
|
||||
|
||||
// refresh the grid
|
||||
$("#sqlqueryresults").trigger('refreshgrid');
|
||||
});
|
||||
@ -562,7 +566,10 @@ $(document).ready(function() {
|
||||
})
|
||||
} else {
|
||||
$this_field.find('textarea').live('keypress', function(e) {
|
||||
$('.checkbox_null_' + field_name + '_' + this_row_index).attr('checked', false);
|
||||
// FF errorneously triggers for modifier keys such as tab (bug #3357837)
|
||||
if (e.which != 0) {
|
||||
$('.checkbox_null_' + field_name + '_' + this_row_index).attr('checked', false);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -704,10 +711,10 @@ $(document).ready(function() {
|
||||
$this_field.data('original_data', 'NULL');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// refresh the grid
|
||||
$("#sqlqueryresults").trigger('refreshgrid');
|
||||
|
||||
|
||||
}) // End On click, replace the current field with an input/textarea
|
||||
|
||||
/**
|
||||
@ -973,13 +980,13 @@ $(document).ready(function() {
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.get()
|
||||
} else {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages['strNoRowSelected']);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Click action for "Go" button in ajax dialog insertForm -> insertRowTable
|
||||
* Click action for "Go" button in ajax dialog insertForm -> insertRowTable
|
||||
*/
|
||||
$("#insertForm .insertRowTable.ajax input[value=Go]").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
@ -1224,7 +1231,9 @@ $(document).ready(function() {
|
||||
* Profiling Chart
|
||||
*/
|
||||
function createProfilingChart() {
|
||||
if($('#profilingchart').length==0) return;
|
||||
if ($('#profilingchart').length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var cdata = new Array();
|
||||
$.each(jQuery.parseJSON($('#profilingchart').html()),function(key,value) {
|
||||
|
||||
@ -70,21 +70,8 @@ function daysInFebruary (year){
|
||||
//function to convert single digit to double digit
|
||||
function fractionReplace(num)
|
||||
{
|
||||
num=parseInt(num);
|
||||
var res="00";
|
||||
switch(num)
|
||||
{
|
||||
case 1:res= "01";break;
|
||||
case 2:res= "02";break;
|
||||
case 3:res= "03";break;
|
||||
case 4:res= "04";break;
|
||||
case 5:res= "05";break;
|
||||
case 6:res= "06";break;
|
||||
case 7:res= "07";break;
|
||||
case 8:res= "08";break;
|
||||
case 9:res= "09";break;
|
||||
}
|
||||
return res;
|
||||
num = parseInt(num);
|
||||
return num >= 1 && num <= 9 ? '0' + num : '00';
|
||||
}
|
||||
|
||||
/* function to check the validity of date
|
||||
|
||||
@ -3,7 +3,7 @@ var chart_series;
|
||||
var chart_series_index = -1;
|
||||
|
||||
$(document).ready(function() {
|
||||
var currentChart=null;
|
||||
var currentChart = null;
|
||||
var chart_data = jQuery.parseJSON($('#querychart').html());
|
||||
chart_series = 'columns';
|
||||
chart_xaxis_idx = $('select[name="chartXAxis"]').attr('value');
|
||||
@ -26,9 +26,9 @@ $(document).ready(function() {
|
||||
|
||||
var currentSettings = {
|
||||
chart: {
|
||||
type:'line',
|
||||
width:$('#resizer').width()-20,
|
||||
height:$('#resizer').height()-20
|
||||
type: 'line',
|
||||
width: $('#resizer').width() - 20,
|
||||
height: $('#resizer').height() - 20
|
||||
},
|
||||
xAxis: {
|
||||
title: { text: $('input[name="xaxis_label"]').attr('value') }
|
||||
@ -36,7 +36,10 @@ $(document).ready(function() {
|
||||
yAxis: {
|
||||
title: { text: $('input[name="yaxis_label"]').attr('value') }
|
||||
},
|
||||
title: { text: $('input[name="chartTitle"]').attr('value'), margin:20 },
|
||||
title: {
|
||||
text: $('input[name="chartTitle"]').attr('value'),
|
||||
margin:20
|
||||
},
|
||||
plotOptions: {
|
||||
series: {}
|
||||
}
|
||||
@ -45,11 +48,11 @@ $(document).ready(function() {
|
||||
$('#querychart').html('');
|
||||
|
||||
$('input[name="chartType"]').click(function() {
|
||||
currentSettings.chart.type=$(this).attr('value');
|
||||
currentSettings.chart.type = $(this).attr('value');
|
||||
|
||||
drawChart();
|
||||
|
||||
if($(this).attr('value')=='bar' || $(this).attr('value')=='column')
|
||||
if($(this).attr('value') == 'bar' || $(this).attr('value') == 'column')
|
||||
$('span.barStacked').show();
|
||||
else
|
||||
$('span.barStacked').hide();
|
||||
@ -64,9 +67,9 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
$('input[name="chartTitle"]').keyup(function() {
|
||||
var title=$(this).attr('value');
|
||||
if(title.length==0) title=' ';
|
||||
currentChart.setTitle({text: title});
|
||||
var title = $(this).attr('value');
|
||||
if(title.length == 0) title = ' ';
|
||||
currentChart.setTitle({ text: title });
|
||||
});
|
||||
|
||||
$('select[name="chartXAxis"]').change(function() {
|
||||
@ -90,10 +93,10 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
function drawChart(noAnimation) {
|
||||
currentSettings.chart.width=$('#resizer').width()-20;
|
||||
currentSettings.chart.height=$('#resizer').height()-20;
|
||||
currentSettings.chart.width = $('#resizer').width() - 20;
|
||||
currentSettings.chart.height = $('#resizer').height() - 20;
|
||||
|
||||
if(currentChart!=null) currentChart.destroy();
|
||||
if(currentChart != null) currentChart.destroy();
|
||||
|
||||
if(noAnimation) currentSettings.plotOptions.series.animation = false;
|
||||
currentChart = PMA_queryChart(chart_data,currentSettings);
|
||||
@ -101,22 +104,22 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
drawChart();
|
||||
$('#querychart').show();
|
||||
$('#querychart').show();
|
||||
});
|
||||
|
||||
function in_array(element,array) {
|
||||
for(var i=0; i<array.length; i++)
|
||||
if(array[i]==element) return true;
|
||||
return false;
|
||||
for(var i=0; i < array.length; i++)
|
||||
if(array[i] == element) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function PMA_queryChart(data,passedSettings) {
|
||||
if($('#querychart').length==0) return;
|
||||
if($('#querychart').length == 0) return;
|
||||
|
||||
var columnNames = Array();
|
||||
|
||||
var series = new Array();
|
||||
var xaxis = new Object();
|
||||
var xaxis = { type: 'linear' };
|
||||
var yaxis = new Object();
|
||||
|
||||
$.each(data[0],function(index,element) {
|
||||
@ -130,16 +133,17 @@ function PMA_queryChart(data,passedSettings) {
|
||||
case 'bar':
|
||||
xaxis.categories = new Array();
|
||||
|
||||
if(chart_series=='columns') {
|
||||
var j=0;
|
||||
if(chart_series == 'columns') {
|
||||
var j = 0;
|
||||
for(var i=0; i<columnNames.length; i++)
|
||||
if(i!=chart_xaxis_idx) {
|
||||
if(i != chart_xaxis_idx) {
|
||||
series[j] = new Object();
|
||||
series[j].data = new Array();
|
||||
series[j].name = columnNames[i];
|
||||
|
||||
$.each(data,function(key,value) {
|
||||
series[j].data.push(parseFloat(value[columnNames[i]]));
|
||||
if(j==0 && chart_xaxis_idx!=-1 && !xaxis.categories[value[columnNames[chart_xaxis_idx]]])
|
||||
if( j== 0 && chart_xaxis_idx != -1 && ! xaxis.categories[value[columnNames[chart_xaxis_idx]]])
|
||||
xaxis.categories.push(value[columnNames[chart_xaxis_idx]]);
|
||||
});
|
||||
j++;
|
||||
@ -149,9 +153,9 @@ function PMA_queryChart(data,passedSettings) {
|
||||
var seriesIndex = new Object();
|
||||
// Get series types and build series object from the query data
|
||||
$.each(data,function(index,element) {
|
||||
var contains=false;
|
||||
for(var i=0; i<series.length; i++)
|
||||
if(series[i].name == element[chart_series]) contains=true;
|
||||
var contains = false;
|
||||
for(var i=0; i < series.length; i++)
|
||||
if(series[i].name == element[chart_series]) contains = true;
|
||||
|
||||
if(!contains) {
|
||||
seriesIndex[element[chart_series]] = j;
|
||||
@ -167,14 +171,15 @@ function PMA_queryChart(data,passedSettings) {
|
||||
$.each(data,function(key,value) {
|
||||
type = value[chart_series];
|
||||
series[seriesIndex[type]].data.push(parseFloat(value[columnNames[0]]));
|
||||
if(!in_array(value[columnNames[chart_xaxis_idx]],xaxis.categories))
|
||||
xaxis.categories.push(value[columnNames[chart_xaxis_idx]]);
|
||||
|
||||
if( !in_array(value[columnNames[chart_xaxis_idx]],xaxis.categories))
|
||||
xaxis.categories.push(value[columnNames[chart_xaxis_idx]]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(columnNames.length==2)
|
||||
if(columnNames.length == 2)
|
||||
yaxis.title = { text: columnNames[0] };
|
||||
break;
|
||||
|
||||
@ -182,7 +187,10 @@ function PMA_queryChart(data,passedSettings) {
|
||||
series[0] = new Object();
|
||||
series[0].data = new Array();
|
||||
$.each(data,function(key,value) {
|
||||
series[0].data.push({name:value[columnNames[chart_xaxis_idx]],y:parseFloat(value[columnNames[0]])});
|
||||
series[0].data.push({
|
||||
name: value[columnNames[chart_xaxis_idx]],
|
||||
y: parseFloat(value[columnNames[0]])
|
||||
});
|
||||
});
|
||||
break;
|
||||
}
|
||||
@ -192,10 +200,12 @@ function PMA_queryChart(data,passedSettings) {
|
||||
|
||||
var settings = {
|
||||
chart: {
|
||||
renderTo: 'querychart',
|
||||
backgroundColor: $('fieldset').css('background-color')
|
||||
renderTo: 'querychart'
|
||||
},
|
||||
title: {
|
||||
text: '',
|
||||
margin: 0
|
||||
},
|
||||
title: { text:'', margin:0 },
|
||||
series: series,
|
||||
xAxis: xaxis,
|
||||
yAxis: yaxis,
|
||||
@ -212,12 +222,6 @@ function PMA_queryChart(data,passedSettings) {
|
||||
}
|
||||
}
|
||||
},
|
||||
credits: {
|
||||
enabled:false
|
||||
},
|
||||
exporting: {
|
||||
enabled: true
|
||||
},
|
||||
tooltip: {
|
||||
formatter: function() {
|
||||
if(this.point.name) return '<b>'+this.series.name+'</b><br/>'+this.point.name+'<br/>'+this.y;
|
||||
@ -226,11 +230,11 @@ function PMA_queryChart(data,passedSettings) {
|
||||
}
|
||||
};
|
||||
|
||||
if(passedSettings.chart.type=='pie')
|
||||
if(passedSettings.chart.type == 'pie')
|
||||
settings.tooltip.formatter = function() { return '<b>'+columnNames[0]+'</b><br/>'+this.y; }
|
||||
|
||||
// Overwrite/Merge default settings with passedsettings
|
||||
$.extend(true,settings,passedSettings);
|
||||
|
||||
return new Highcharts.Chart(settings);
|
||||
return PMA_createChart(settings);
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
*
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
/**
|
||||
* Attach Event Handler for 'Drop Column'
|
||||
*
|
||||
@ -153,102 +153,33 @@ $(document).ready(function() {
|
||||
event.preventDefault();
|
||||
|
||||
/*Check whether atleast one row is selected for change*/
|
||||
if($("#tablestructure tbody tr").hasClass("marked")){
|
||||
var div = $('<div id="change_column_dialog"></div>');
|
||||
|
||||
/**
|
||||
* @var button_options Object that stores the options passed to jQueryUI
|
||||
* dialog
|
||||
*/
|
||||
var button_options = {};
|
||||
// in the following function we need to use $(this)
|
||||
button_options[PMA_messages['strCancel']] = function() {$(this).parent().dialog('close').remove();}
|
||||
|
||||
var button_options_error = {};
|
||||
button_options_error[PMA_messages['strOK']] = function() {$(this).parent().dialog('close').remove();}
|
||||
if ($("#tablestructure tbody tr").hasClass("marked")) {
|
||||
/*Define the action and $url variabls for the post method*/
|
||||
var $form = $("#fieldsForm");
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
$.get( $form.attr('action') , $form.serialize()+"&ajax_request=true&submit_mult=change" , function(data) {
|
||||
//in the case of an error, show the error message returned.
|
||||
if (data.success != undefined && data.success == false) {
|
||||
div
|
||||
.append(data.error)
|
||||
.dialog({
|
||||
title: PMA_messages['strChangeTbl'],
|
||||
height: 230,
|
||||
width: 900,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options_error
|
||||
})// end dialog options
|
||||
} else {
|
||||
div
|
||||
.append(data)
|
||||
.dialog({
|
||||
title: PMA_messages['strChangeTbl'],
|
||||
height: 600,
|
||||
width: 900,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options
|
||||
})
|
||||
//Remove the top menu container from the dialog
|
||||
.find("#topmenucontainer").hide()
|
||||
; // end dialog options
|
||||
$("#append_fields_form input[name=do_save_data]").addClass("ajax");
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.get()
|
||||
} else {
|
||||
var action = $form.attr('action');
|
||||
var url = $form.serialize()+"&ajax_request=true&submit_mult=change";
|
||||
/*Calling for the changeColumns fucntion*/
|
||||
changeColumns(action,url);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages['strNoRowSelected']);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
*Ajax action for submitting the column change form
|
||||
*Ajax event handler for single column change
|
||||
**/
|
||||
$("#append_fields_form input[name=do_save_data].ajax").live('click', function(event) {
|
||||
$("#fieldsForm.ajax #tablestructure tbody tr td.edit a").live('click', function(event){
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var the_form object referring to the export form
|
||||
*/
|
||||
var $form = $("#append_fields_form");
|
||||
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
//User wants to submit the form
|
||||
$.post($form.attr('action'), $form.serialize()+"&do_save_data=Save", function(data) {
|
||||
if ($("#sqlqueryresults").length != 0) {
|
||||
$("#sqlqueryresults").remove();
|
||||
} else if ($(".error").length != 0) {
|
||||
$(".error").remove();
|
||||
}
|
||||
if (data.success == true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$("<div id='sqlqueryresults'></div>").insertAfter("#topmenucontainer");
|
||||
$("#sqlqueryresults").html(data.sql_query);
|
||||
$("#result_query .notice").remove();
|
||||
$("#result_query").prepend((data.message));
|
||||
if ($("#change_column_dialog").length > 0) {
|
||||
$("#change_column_dialog").dialog("close").remove();
|
||||
}
|
||||
/*Reload the field form*/
|
||||
$.post($("#fieldsForm").attr('action'), $("#fieldsForm").serialize()+"&ajax_request=true", function(form_data) {
|
||||
$("#fieldsForm").remove();
|
||||
var $temp_div = $("<div id='temp_div'><div>").append(form_data);
|
||||
if ($("#sqlqueryresults").length != 0) {
|
||||
$temp_div.find("#fieldsForm").insertAfter("#sqlqueryresults");
|
||||
} else {
|
||||
$temp_div.find("#fieldsForm").insertAfter(".error");
|
||||
}
|
||||
/*Call the function to display the more options in table*/
|
||||
displayMoreTableOpts();
|
||||
});
|
||||
} else {
|
||||
var $temp_div = $("<div id='temp_div'><div>").append(data);
|
||||
var $error = $temp_div.find(".error code").addClass("error");
|
||||
PMA_ajaxShowMessage($error);
|
||||
}
|
||||
}) // end $.post()
|
||||
}) // end insert table button "do_save_data"
|
||||
/*Define the action and $url variabls for the post method*/
|
||||
var action = "tbl_alter.php";
|
||||
var url = $(this).attr('href');
|
||||
if (url.substring(0, 13) == "tbl_alter.php") {
|
||||
url = url.substring(14, url.length);
|
||||
}
|
||||
url = url + "&ajax_request=true";
|
||||
/*Calling for the changeColumns fucntion*/
|
||||
changeColumns(action,url);
|
||||
});
|
||||
|
||||
/**
|
||||
*Ajax event handler for index edit
|
||||
@ -261,7 +192,11 @@ $(document).ready(function() {
|
||||
}
|
||||
url = url + "&ajax_request=true";
|
||||
|
||||
var div = $('<div id="edit_index_dialog"></div>');
|
||||
/*Remove the hidden dialogs if there are*/
|
||||
if ($('#edit_index_dialog').length != 0) {
|
||||
$('#edit_index_dialog').remove();
|
||||
}
|
||||
var $div = $('<div id="edit_index_dialog"></div>');
|
||||
|
||||
/**
|
||||
* @var button_options Object that stores the options passed to jQueryUI
|
||||
@ -269,37 +204,41 @@ $(document).ready(function() {
|
||||
*/
|
||||
var button_options = {};
|
||||
// in the following function we need to use $(this)
|
||||
button_options[PMA_messages['strCancel']] = function() {$(this).parent().dialog('close').remove();}
|
||||
button_options[PMA_messages['strCancel']] = function() {$(this).dialog('close').remove();}
|
||||
|
||||
var button_options_error = {};
|
||||
button_options_error[PMA_messages['strOK']] = function() {$(this).parent().dialog('close').remove();}
|
||||
button_options_error[PMA_messages['strOK']] = function() {$(this).dialog('close').remove();}
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
$.get( "tbl_indexes.php" , url , function(data) {
|
||||
//in the case of an error, show the error message returned.
|
||||
if (data.success != undefined && data.success == false) {
|
||||
div
|
||||
$div
|
||||
.append(data.error)
|
||||
.dialog({
|
||||
title: PMA_messages['strEdit'],
|
||||
height: 230,
|
||||
width: 900,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
modal: true,
|
||||
buttons : button_options_error
|
||||
})// end dialog options
|
||||
} else {
|
||||
div
|
||||
$div
|
||||
.append(data)
|
||||
.dialog({
|
||||
title: PMA_messages['strEdit'],
|
||||
height: 600,
|
||||
width: 900,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
modal: true,
|
||||
buttons : button_options
|
||||
})
|
||||
//Remove the top menu container from the dialog
|
||||
.find("#topmenucontainer").hide()
|
||||
; // end dialog options
|
||||
checkIndexType();
|
||||
checkIndexName("index_frm");
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.get()
|
||||
@ -330,16 +269,22 @@ $(document).ready(function() {
|
||||
|
||||
/*Reload the field form*/
|
||||
$("#table_index").remove();
|
||||
var temp_div = $("<div id='temp_div'><div>").append(data.index_table);
|
||||
$(temp_div).find("#table_index").insertAfter("#index_header");
|
||||
var $temp_div = $("<div id='temp_div'><div>").append(data.index_table);
|
||||
$temp_div.find("#table_index").insertAfter("#index_header");
|
||||
if ($("#edit_index_dialog").length > 0) {
|
||||
$("#edit_index_dialog").dialog("close").remove();
|
||||
}
|
||||
|
||||
} else {
|
||||
var temp_div = $("<div id='temp_div'><div>").append(data.error);
|
||||
var error = $(temp_div).find(".error code").addClass("error");
|
||||
PMA_ajaxShowMessage(error);
|
||||
if(data.error != undefined) {
|
||||
var $temp_div = $("<div id='temp_div'><div>").append(data.error);
|
||||
if ($temp_div.find(".error code").length != 0) {
|
||||
var $error = $temp_div.find(".error code").addClass("error");
|
||||
} else {
|
||||
var $error = $temp_div;
|
||||
}
|
||||
}
|
||||
PMA_ajaxShowMessage($error);
|
||||
}
|
||||
|
||||
}) // end $.post()
|
||||
@ -359,8 +304,8 @@ $(document).ready(function() {
|
||||
//User wants to submit the form
|
||||
$.post($form.attr('action'), $form.serialize()+"&add_fields=Go", function(data) {
|
||||
$("#index_columns").remove();
|
||||
var temp_div = $("<div id='temp_div'><div>").append(data);
|
||||
$(temp_div).find("#index_columns").insertAfter("#index_frm fieldset .error");
|
||||
var $temp_div = $("<div id='temp_div'><div>").append(data);
|
||||
$temp_div.find("#index_columns").appendTo("#index_edit_fields");
|
||||
}) // end $.post()
|
||||
}) // end insert table button "Go"
|
||||
|
||||
@ -393,3 +338,66 @@ $(document).ready(function() {
|
||||
|
||||
|
||||
}) // end $(document).ready()
|
||||
|
||||
/**
|
||||
* Loads the append_fields_form to the Change dialog allowing users
|
||||
* to change the columns
|
||||
* @param string action Variable which parses the name of the
|
||||
* destination file
|
||||
* @param string $url Variable which parses the data for the
|
||||
* post action
|
||||
*/
|
||||
function changeColumns(action,url) {
|
||||
/*Remove the hidden dialogs if there are*/
|
||||
if ($('#change_column_dialog').length != 0) {
|
||||
$('#change_column_dialog').remove();
|
||||
}
|
||||
var $div = $('<div id="change_column_dialog"></div>');
|
||||
|
||||
/**
|
||||
* @var button_options Object that stores the options passed to jQueryUI
|
||||
* dialog
|
||||
*/
|
||||
var button_options = {};
|
||||
// in the following function we need to use $(this)
|
||||
button_options[PMA_messages['strCancel']] = function() {$(this).dialog('close').remove();}
|
||||
|
||||
var button_options_error = {};
|
||||
button_options_error[PMA_messages['strOK']] = function() {$(this).dialog('close').remove();}
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
$.get( action , url , function(data) {
|
||||
//in the case of an error, show the error message returned.
|
||||
if (data.success != undefined && data.success == false) {
|
||||
$div
|
||||
.append(data.error)
|
||||
.dialog({
|
||||
title: PMA_messages['strChangeTbl'],
|
||||
height: 230,
|
||||
width: 900,
|
||||
modal: true,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options_error
|
||||
})// end dialog options
|
||||
} else {
|
||||
$div
|
||||
.append(data)
|
||||
.dialog({
|
||||
title: PMA_messages['strChangeTbl'],
|
||||
height: 600,
|
||||
width: 900,
|
||||
modal: true,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options
|
||||
})
|
||||
//Remove the top menu container from the dialog
|
||||
.find("#topmenucontainer").hide()
|
||||
; // end dialog options
|
||||
$("#append_fields_form input[name=do_save_data]").addClass("ajax");
|
||||
/*changed the z-index of the enum editor to allow the edit*/
|
||||
$("#enum_editor").css("z-index", "1100");
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.get()
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -194,9 +194,10 @@ class PMA_Index
|
||||
// $columns[names][]
|
||||
// $columns[sub_parts][]
|
||||
foreach ($columns['names'] as $key => $name) {
|
||||
$sub_part = isset($columns['sub_parts'][$key]) ? $columns['sub_parts'][$key] : '';
|
||||
$_columns[] = array(
|
||||
'Column_name' => $name,
|
||||
'Sub_part' => $columns['sub_parts'][$key],
|
||||
'Sub_part' => $sub_part,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -336,13 +336,11 @@ class PMA_Table
|
||||
|
||||
$is_timestamp = strpos(strtoupper($type), 'TIMESTAMP') !== false;
|
||||
|
||||
/**
|
||||
* @todo include db-name
|
||||
*/
|
||||
$query = PMA_backquote($name) . ' ' . $type;
|
||||
|
||||
if ($length != ''
|
||||
&& !preg_match('@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT)$@i', $type)) {
|
||||
&& !preg_match('@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT'
|
||||
. '|SERIAL|BOOLEAN)$@i', $type)) {
|
||||
$query .= '(' . $length . ')';
|
||||
}
|
||||
|
||||
@ -1242,8 +1240,8 @@ class PMA_Table
|
||||
$sql_query =
|
||||
" SELECT `prefs` FROM " . $pma_table .
|
||||
" WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'" .
|
||||
" AND `db_name` = '" . $this->db_name . "'" .
|
||||
" AND `table_name` = '" . $this->name . "'";
|
||||
" AND `db_name` = '" . PMA_sqlAddSlashes($this->db_name) . "'" .
|
||||
" AND `table_name` = '" . PMA_sqlAddSlashes($this->name) . "'";
|
||||
|
||||
$row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
|
||||
if (isset($row[0])) {
|
||||
@ -1266,8 +1264,9 @@ class PMA_Table
|
||||
$username = $GLOBALS['cfg']['Server']['user'];
|
||||
$sql_query =
|
||||
" REPLACE INTO " . $pma_table .
|
||||
" VALUES ('" . $username . "', '" . $this->db_name . "', '" .
|
||||
$this->name . "', '" . PMA_sqlAddSlashes(json_encode($this->uiprefs)) . "')";
|
||||
" VALUES ('" . $username . "', '" . PMA_sqlAddSlashes($this->db_name) . "', '" .
|
||||
PMA_sqlAddSlashes($this->name) . "', '" .
|
||||
PMA_sqlAddSlashes(json_encode($this->uiprefs)) . "')";
|
||||
|
||||
$success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);
|
||||
|
||||
@ -1371,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();
|
||||
|
||||
@ -131,7 +131,7 @@ function PMA_auth()
|
||||
// Defines the charset to be used
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
// Defines the "item" image depending on text direction
|
||||
$item_img = $GLOBALS['pmaThemeImage'] . 'item_' . $GLOBALS['text_dir'] . '.png';
|
||||
$item_img = 'ic_item_' . $GLOBALS['text_dir'];
|
||||
|
||||
/* HTML header; do not show here the PMA version to improve security */
|
||||
$page_title = 'phpMyAdmin ';
|
||||
@ -198,7 +198,7 @@ if (top != self) {
|
||||
echo '<a href="./Documentation.html" target="documentation" ' .
|
||||
'title="' . __('phpMyAdmin documentation') . '">';
|
||||
if ($GLOBALS['cfg']['ReplaceHelpImg']) {
|
||||
echo '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . __('phpMyAdmin documentation') . '" />';
|
||||
echo '<img class="icon ic_b_help_s" src="themes/dot.gif" alt="' . __('phpMyAdmin documentation') . '" />';
|
||||
} else {
|
||||
echo '(*)';
|
||||
}
|
||||
@ -332,7 +332,7 @@ function PMA_auth_check()
|
||||
// END Swekey Integration
|
||||
|
||||
if (defined('PMA_CLEAR_COOKIES')) {
|
||||
foreach($GLOBALS['cfg']['Servers'] as $key => $val) {
|
||||
foreach ($GLOBALS['cfg']['Servers'] as $key => $val) {
|
||||
$GLOBALS['PMA_Config']->removeCookie('pmaPass-' . $key);
|
||||
$GLOBALS['PMA_Config']->removeCookie('pmaServer-' . $key);
|
||||
$GLOBALS['PMA_Config']->removeCookie('pmaUser-' . $key);
|
||||
@ -352,7 +352,7 @@ function PMA_auth_check()
|
||||
session_destroy();
|
||||
// -> delete password cookie(s)
|
||||
if ($GLOBALS['cfg']['LoginCookieDeleteAll']) {
|
||||
foreach($GLOBALS['cfg']['Servers'] as $key => $val) {
|
||||
foreach ($GLOBALS['cfg']['Servers'] as $key => $val) {
|
||||
$GLOBALS['PMA_Config']->removeCookie('pmaPass-' . $key);
|
||||
if (isset($_COOKIE['pmaPass-' . $key])) {
|
||||
unset($_COOKIE['pmaPass-' . $key]);
|
||||
|
||||
@ -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();
|
||||
@ -363,6 +363,7 @@ $goto_whitelist = array(
|
||||
'db_create.php',
|
||||
'db_datadict.php',
|
||||
'db_sql.php',
|
||||
'db_events.php',
|
||||
'db_export.php',
|
||||
'db_importdocsql.php',
|
||||
'db_qbe.php',
|
||||
|
||||
@ -9,10 +9,10 @@
|
||||
/**
|
||||
* Exponential expression / raise number into power
|
||||
*
|
||||
* @param string $base
|
||||
* @param string $exp
|
||||
* @param mixed $use_function pow function to use, or false for auto-detect
|
||||
* @return mixed string or float
|
||||
* @param string $base base to raise
|
||||
* @param string $exp exponent to use
|
||||
* @param mixed $use_function pow function to use, or false for auto-detect
|
||||
* @return mixed string or float
|
||||
*/
|
||||
function PMA_pow($base, $exp, $use_function = false)
|
||||
{
|
||||
@ -62,10 +62,10 @@ function PMA_pow($base, $exp, $use_function = false)
|
||||
/**
|
||||
* string PMA_getIcon(string $icon)
|
||||
*
|
||||
* @param string $icon name of icon file
|
||||
* @param string $alternate alternate text
|
||||
* @param boolean $container include in container
|
||||
* @param boolean $force_text whether to force alternate text to be displayed
|
||||
* @param string $icon name of icon file
|
||||
* @param string $alternate alternate text
|
||||
* @param boolean $container include in container
|
||||
* @param boolean $force_text whether to force alternate text to be displayed
|
||||
* @return html img tag
|
||||
*/
|
||||
function PMA_getIcon($icon, $alternate = '', $container = false, $force_text = false)
|
||||
@ -97,9 +97,9 @@ function PMA_getIcon($icon, $alternate = '', $container = false, $force_text = f
|
||||
$button .= '<span class="nowrap">';
|
||||
|
||||
if ($include_icon) {
|
||||
$button .= '<img src="' . $GLOBALS['pmaThemeImage'] . $icon . '"'
|
||||
$button .= '<img src="themes/dot.gif"'
|
||||
. ' title="' . $alternate . '" alt="' . $alternate . '"'
|
||||
. ' class="icon" width="16" height="16" />';
|
||||
. ' class="icon ic_' . str_replace('.png','',$icon) . '" />';
|
||||
}
|
||||
|
||||
if ($include_icon && $include_text) {
|
||||
@ -118,8 +118,8 @@ function PMA_getIcon($icon, $alternate = '', $container = false, $force_text = f
|
||||
/**
|
||||
* Displays the maximum size for an upload
|
||||
*
|
||||
* @param integer $max_upload_size the size
|
||||
* @return string the message
|
||||
* @param integer $max_upload_size the size
|
||||
* @return string the message
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
@ -135,27 +135,27 @@ 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
|
||||
*/
|
||||
function PMA_generateHiddenMaxFileSize($max_size)
|
||||
{
|
||||
return '<input type="hidden" name="MAX_FILE_SIZE" value="' .$max_size . '" />';
|
||||
}
|
||||
function PMA_generateHiddenMaxFileSize($max_size)
|
||||
{
|
||||
return '<input type="hidden" name="MAX_FILE_SIZE" value="' .$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
|
||||
*
|
||||
@ -377,7 +377,7 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $ju
|
||||
$mysql = '5.1';
|
||||
/* l10n: Language to use for MySQL 5.1 documentation, please use only languages which do exist in official documentation. */
|
||||
$lang = _pgettext('MySQL 5.1 documentation language', 'en');
|
||||
} elseif (PMA_MYSQL_INT_VERSION >= 50000) {
|
||||
} else {
|
||||
$mysql = '5.0';
|
||||
/* l10n: Language to use for MySQL 5.0 documentation, please use only languages which do exist in official documentation. */
|
||||
$lang = _pgettext('MySQL 5.0 documentation language', 'en');
|
||||
@ -393,9 +393,9 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $ju
|
||||
if ($just_open) {
|
||||
return '<a href="' . PMA_linkURL($url) . '" target="mysql_doc">';
|
||||
} elseif ($big_icon) {
|
||||
return '<a href="' . PMA_linkURL($url) . '" target="mysql_doc"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_sqlhelp.png" width="16" height="16" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
|
||||
return '<a href="' . PMA_linkURL($url) . '" target="mysql_doc"><img class="icon ic_b_sqlhelp" src="themes/dot.gif" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
|
||||
} elseif ($GLOBALS['cfg']['ReplaceHelpImg']) {
|
||||
return '<a href="' . PMA_linkURL($url) . '" target="mysql_doc"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
|
||||
return '<a href="' . PMA_linkURL($url) . '" target="mysql_doc"><img class="icon ic_b_help_s" src="themes/dot.gif" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
|
||||
} else {
|
||||
return '[<a href="' . PMA_linkURL($url) . '" target="mysql_doc">' . __('Documentation') . '</a>]';
|
||||
}
|
||||
@ -412,7 +412,7 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $ju
|
||||
*/
|
||||
function PMA_showDocu($anchor) {
|
||||
if ($GLOBALS['cfg']['ReplaceHelpImg']) {
|
||||
return '<a href="Documentation.html#' . $anchor . '" target="documentation"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
|
||||
return '<a href="Documentation.html#' . $anchor . '" target="documentation"><img class="icon ic_b_help_s" src="themes/dot.gif" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
|
||||
} else {
|
||||
return '[<a href="Documentation.html#' . $anchor . '" target="documentation">' . __('Documentation') . '</a>]';
|
||||
}
|
||||
@ -430,7 +430,7 @@ function PMA_showPHPDocu($target) {
|
||||
$url = PMA_getPHPDocLink($target);
|
||||
|
||||
if ($GLOBALS['cfg']['ReplaceHelpImg']) {
|
||||
return '<a href="' . $url . '" target="documentation"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
|
||||
return '<a href="' . $url . '" target="documentation"><img class="icon ic_b_help_s" src="themes/dot.gif" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
|
||||
} else {
|
||||
return '[<a href="' . $url . '" target="documentation">' . __('Documentation') . '</a>]';
|
||||
}
|
||||
@ -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,8 +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" id="footnote_' . $nr . '_' . $instance . '" src="' .
|
||||
$GLOBALS['pmaThemeImage'] . 'b_help.png" alt="" />';
|
||||
'<img class="footnotemarker ic_b_help footnote_' . $nr . '" src="themes/dot.gif" alt="" />';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -707,7 +701,7 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count =
|
||||
$group_name_full = '';
|
||||
$parts_cnt = count($parts) - 1;
|
||||
while ($i < $parts_cnt
|
||||
&& $i < $GLOBALS['cfg']['LeftFrameTableLevel']) {
|
||||
&& $i < $GLOBALS['cfg']['LeftFrameTableLevel']) {
|
||||
$group_name = $parts[$i] . $sep;
|
||||
$group_name_full .= $group_name;
|
||||
|
||||
@ -739,7 +733,7 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count =
|
||||
|
||||
|
||||
if ($GLOBALS['cfg']['ShowTooltipAliasTB']
|
||||
&& $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested') {
|
||||
&& $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested') {
|
||||
// switch tooltip and name
|
||||
$table['Comment'] = $table['Name'];
|
||||
$table['disp_name'] = $table['Comment'];
|
||||
@ -807,8 +801,6 @@ function PMA_backquote($a_name, $do_it = true)
|
||||
*/
|
||||
function PMA_whichCrlf()
|
||||
{
|
||||
$the_crlf = "\n";
|
||||
|
||||
// The 'PMA_USR_OS' constant is defined in "./libraries/Config.class.php"
|
||||
// Win case
|
||||
if (PMA_USR_OS == 'Win') {
|
||||
@ -825,15 +817,12 @@ function PMA_whichCrlf()
|
||||
/**
|
||||
* Reloads navigation if needed.
|
||||
*
|
||||
* @param $jsonly prints out pure JavaScript
|
||||
* @global array configuration
|
||||
* @param bool $jsonly prints out pure JavaScript
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_reloadNavigation($jsonly=false)
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
// Reloads the navigation frame via JavaScript if required
|
||||
if (isset($GLOBALS['reload']) && $GLOBALS['reload']) {
|
||||
// one of the reasons for a reload is when a table is dropped
|
||||
@ -869,7 +858,7 @@ if (!$jsonly)
|
||||
* @param string $sql_query the query to display
|
||||
* @param string $type the type (level) of the message
|
||||
* @param boolean $is_view is this a message after a VIEW operation?
|
||||
* @global array the configuration array
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view = false)
|
||||
@ -1218,6 +1207,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
|
||||
ob_end_clean();
|
||||
return $buffer_contents;
|
||||
}
|
||||
return null;
|
||||
} // end of the 'PMA_showMessage()' function
|
||||
|
||||
/**
|
||||
@ -1225,7 +1215,6 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
|
||||
*
|
||||
* @access public
|
||||
* @return boolean whether profiling is supported
|
||||
*
|
||||
*/
|
||||
function PMA_profilingSupported()
|
||||
{
|
||||
@ -1250,7 +1239,6 @@ function PMA_profilingSupported()
|
||||
*
|
||||
* @param string $sql_query
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
function PMA_profilingCheckbox($sql_query)
|
||||
{
|
||||
@ -1345,24 +1333,22 @@ 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
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @version 1.1.0 - 2005-10-27
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1396,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
|
||||
@ -1405,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;
|
||||
@ -1519,7 +1505,7 @@ function PMA_localisedDate($timestamp = -1, $format = '')
|
||||
* @return string html code for one tab, a link if valid otherwise a span
|
||||
* @access public
|
||||
*/
|
||||
function PMA_generate_html_tab($tab, $url_params = array())
|
||||
function PMA_generate_html_tab($tab, $url_params = array(), $base_dir='')
|
||||
{
|
||||
// default values
|
||||
$defaults = array(
|
||||
@ -1581,8 +1567,8 @@ function PMA_generate_html_tab($tab, $url_params = array())
|
||||
// avoid generating an alt tag, because it only illustrates
|
||||
// the text that follows and if browser does not display
|
||||
// images, the text is duplicated
|
||||
$image = '<img class="icon" src="' . htmlentities($GLOBALS['pmaThemeImage'])
|
||||
.'%1$s" width="16" height="16" alt="" />%2$s';
|
||||
$image = '<img class="icon %1$s" src="' . $base_dir . 'themes/dot.gif"'
|
||||
.' width="16" height="16" alt="" />%2$s';
|
||||
$tab['text'] = sprintf($image, htmlentities($tab['icon']), $tab['text']);
|
||||
}
|
||||
// check to not display an empty link-text
|
||||
@ -1617,7 +1603,7 @@ function PMA_generate_html_tab($tab, $url_params = array())
|
||||
* @param string $url_params
|
||||
* @return string html-code for tab-navigation
|
||||
*/
|
||||
function PMA_generate_html_tabs($tabs, $url_params)
|
||||
function PMA_generate_html_tabs($tabs, $url_params, $base_dir='')
|
||||
{
|
||||
$tag_id = 'topmenu';
|
||||
$tab_navigation =
|
||||
@ -1625,7 +1611,7 @@ function PMA_generate_html_tabs($tabs, $url_params)
|
||||
.'<ul id="' . htmlentities($tag_id) . '">' . "\n";
|
||||
|
||||
foreach ($tabs as $tab) {
|
||||
$tab_navigation .= PMA_generate_html_tab($tab, $url_params);
|
||||
$tab_navigation .= PMA_generate_html_tab($tab, $url_params, $base_dir);
|
||||
}
|
||||
|
||||
$tab_navigation .=
|
||||
@ -1769,7 +1755,7 @@ function PMA_linkOrButton($url, $message, $tag_params = array(),
|
||||
}
|
||||
} // end if... else...
|
||||
|
||||
return $ret;
|
||||
return $ret;
|
||||
} // end of the 'PMA_linkOrButton()' function
|
||||
|
||||
|
||||
@ -1843,7 +1829,6 @@ function PMA_flipstring($string, $Separator = "<br />\n")
|
||||
return $format_string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function added to avoid path disclosures.
|
||||
* Called by each script that needs parameters, it displays
|
||||
@ -1852,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?
|
||||
@ -1883,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;
|
||||
@ -1930,9 +1915,8 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row, $force
|
||||
$meta->orgname = $meta->name;
|
||||
|
||||
if (isset($GLOBALS['analyzed_sql'][0]['select_expr'])
|
||||
&& is_array($GLOBALS['analyzed_sql'][0]['select_expr'])) {
|
||||
foreach ($GLOBALS['analyzed_sql'][0]['select_expr']
|
||||
as $select_expr) {
|
||||
&& is_array($GLOBALS['analyzed_sql'][0]['select_expr'])) {
|
||||
foreach ($GLOBALS['analyzed_sql'][0]['select_expr'] as $select_expr) {
|
||||
// need (string) === (string)
|
||||
// '' !== 0 but '' == 0
|
||||
if ((string) $select_expr['alias'] === (string) $meta->name) {
|
||||
@ -1980,18 +1964,18 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row, $force
|
||||
$condition .= '= ' . $row[$i] . ' AND';
|
||||
} elseif (($meta->type == 'blob' || $meta->type == 'string')
|
||||
// hexify only if this is a true not empty BLOB or a BINARY
|
||||
&& stristr($field_flags, 'BINARY')
|
||||
&& !empty($row[$i])) {
|
||||
// do not waste memory building a too big condition
|
||||
if (strlen($row[$i]) < 1000) {
|
||||
// use a CAST if possible, to avoid problems
|
||||
// if the field contains wildcard characters % or _
|
||||
$condition .= '= CAST(0x' . bin2hex($row[$i])
|
||||
. ' AS BINARY) AND';
|
||||
} else {
|
||||
// this blob won't be part of the final condition
|
||||
$condition = '';
|
||||
}
|
||||
&& stristr($field_flags, 'BINARY')
|
||||
&& !empty($row[$i])) {
|
||||
// do not waste memory building a too big condition
|
||||
if (strlen($row[$i]) < 1000) {
|
||||
// use a CAST if possible, to avoid problems
|
||||
// if the field contains wildcard characters % or _
|
||||
$condition .= '= CAST(0x' . bin2hex($row[$i])
|
||||
. ' AS BINARY) AND';
|
||||
} else {
|
||||
// this blob won't be part of the final condition
|
||||
$condition = '';
|
||||
}
|
||||
} elseif ($meta->type == 'bit') {
|
||||
$condition .= "= b'" . PMA_printable_bit_value($row[$i], $meta->length) . "' AND";
|
||||
} else {
|
||||
@ -2167,12 +2151,12 @@ function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1,
|
||||
* Generate navigation for a list
|
||||
*
|
||||
* @todo use $pos from $_url_params
|
||||
* @param integer number of elements in the list
|
||||
* @param integer current position in the list
|
||||
* @param array url parameters
|
||||
* @param string script name for form target
|
||||
* @param string target frame
|
||||
* @param integer maximum number of elements to display from the list
|
||||
* @param int $count number of elements in the list
|
||||
* @param int $pos current position in the list
|
||||
* @param array $_url_params url parameters
|
||||
* @param string $script script name for form target
|
||||
* @param string $frame target frame
|
||||
* @param int $max_count maximum number of elements to display from the list
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
@ -2354,10 +2338,11 @@ function PMA_display_html_radio($html_field_name, $choices, $checked_choice = ''
|
||||
* Generates and returns an HTML dropdown
|
||||
*
|
||||
* @param string $select_name
|
||||
* @param array $choices the choices values
|
||||
* @param string $active_choice the choice to select by default
|
||||
* @param string $id the id of the select element; can be different in case
|
||||
* the dropdown is present more than once on the page
|
||||
* @param array $choices choices values
|
||||
* @param string $active_choice the choice to select by default
|
||||
* @param string $id id of the select element; can be different in case
|
||||
* the dropdown is present more than once on the page
|
||||
* @return string
|
||||
* @todo support titles
|
||||
*/
|
||||
function PMA_generate_html_dropdown($select_name, $choices, $active_choice, $id)
|
||||
@ -2401,6 +2386,87 @@ function PMA_generate_slider_effect($id, $message)
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an AJAX sliding toggle button (or and equivalent form when AJAX is disabled)
|
||||
*
|
||||
* @param string $action The URL for the request to be executed
|
||||
* @param string $select_name The name for the dropdown box
|
||||
* @param array $options An array of options (see rte_footer.lib.php)
|
||||
* @param string $callback A JS snippet to execute when the request is
|
||||
* successfully processed
|
||||
*
|
||||
* @return string HTML code for the toggle button
|
||||
*/
|
||||
function PMA_toggleButton($action, $select_name, $options, $callback)
|
||||
{
|
||||
// Do the logic first
|
||||
$link_on = "$action&$select_name=" . urlencode($options[1]['value']);
|
||||
$link_off = "$action&$select_name=" . urlencode($options[0]['value']);
|
||||
if ($options[1]['selected'] == true) {
|
||||
$state = 'on';
|
||||
} else if ($options[0]['selected'] == true) {
|
||||
$state = 'off';
|
||||
} else {
|
||||
$state = 'on';
|
||||
}
|
||||
$selected1 = '';
|
||||
$selected0 = '';
|
||||
if ($options[1]['selected'] == true) {
|
||||
$selected1 = " selected='selected'";
|
||||
} else if ($options[0]['selected'] == true) {
|
||||
$selected0 = " selected='selected'";
|
||||
}
|
||||
// Generate output
|
||||
$retval = "<!-- TOGGLE START -->\n";
|
||||
if ($GLOBALS['cfg']['AjaxEnable']) {
|
||||
$retval .= "<noscript>\n";
|
||||
}
|
||||
$retval .= "<div class='wrapper'>\n";
|
||||
$retval .= " <form action='$action' method='post'>\n";
|
||||
$retval .= " <select name='$select_name'>\n";
|
||||
$retval .= " <option value='{$options[1]['value']}'$selected1>";
|
||||
$retval .= " {$options[1]['label']}\n";
|
||||
$retval .= " </option>\n";
|
||||
$retval .= " <option value='{$options[0]['value']}'$selected0>";
|
||||
$retval .= " {$options[0]['label']}\n";
|
||||
$retval .= " </option>\n";
|
||||
$retval .= " </select>\n";
|
||||
$retval .= " <input type='submit' value='" . __('Change') . "'/>\n";
|
||||
$retval .= " </form>\n";
|
||||
$retval .= "</div>\n";
|
||||
if ($GLOBALS['cfg']['AjaxEnable']) {
|
||||
$retval .= "</noscript>\n";
|
||||
$retval .= "<div class='wrapper toggleAjax hide'>\n";
|
||||
$retval .= " <div class='toggleButton'>\n";
|
||||
$retval .= " <div title='" . __('Click to toggle') . "' class='container $state'>\n";
|
||||
$retval .= " <img src='{$GLOBALS['pmaThemeImage']}toggle-{$GLOBALS['text_dir']}.png'\n";
|
||||
$retval .= " alt='' />\n";
|
||||
$retval .= " <table cellspacing='0' cellpadding='0'><tr>\n";
|
||||
$retval .= " <tbody>\n";
|
||||
$retval .= " <td class='toggleOn'>\n";
|
||||
$retval .= " <span class='hide'>$link_on</span>\n";
|
||||
$retval .= " <div>";
|
||||
$retval .= str_replace(' ', ' ', $options[1]['label']) . "</div>\n";
|
||||
$retval .= " </td>\n";
|
||||
$retval .= " <td><div> </div></td>\n";
|
||||
$retval .= " <td class='toggleOff'>\n";
|
||||
$retval .= " <span class='hide'>$link_off</span>\n";
|
||||
$retval .= " <div>";
|
||||
$retval .= str_replace(' ', ' ', $options[0]['label']) . "</div>\n";
|
||||
$retval .= " </div>\n";
|
||||
$retval .= " </tbody>\n";
|
||||
$retval .= " </tr></table>\n";
|
||||
$retval .= " <span class='hide callback'>$callback</span>\n";
|
||||
$retval .= " <span class='hide text_direction'>{$GLOBALS['text_dir']}</span>\n";
|
||||
$retval .= " </div>\n";
|
||||
$retval .= " </div>\n";
|
||||
$retval .= "</div>\n";
|
||||
}
|
||||
$retval .= "<!-- TOGGLE END -->";
|
||||
|
||||
return $retval;
|
||||
} // end PMA_toggleButton()
|
||||
|
||||
/**
|
||||
* Clears cache content which needs to be refreshed on user change.
|
||||
*/
|
||||
@ -2411,8 +2477,8 @@ function PMA_clearUserCache() {
|
||||
/**
|
||||
* Verifies if something is cached in the session
|
||||
*
|
||||
* @param string $var
|
||||
* @param scalar $server
|
||||
* @param string $var
|
||||
* @param int|true $server
|
||||
* @return boolean
|
||||
*/
|
||||
function PMA_cacheExists($var, $server = 0)
|
||||
@ -2426,8 +2492,8 @@ function PMA_cacheExists($var, $server = 0)
|
||||
/**
|
||||
* Gets cached information from the session
|
||||
*
|
||||
* @param string $var
|
||||
* @param scalar $server
|
||||
* @param string $var
|
||||
* @param int|true $server
|
||||
* @return mixed
|
||||
*/
|
||||
function PMA_cacheGet($var, $server = 0)
|
||||
@ -2445,9 +2511,9 @@ function PMA_cacheGet($var, $server = 0)
|
||||
/**
|
||||
* Caches information in the session
|
||||
*
|
||||
* @param string $var
|
||||
* @param mixed $val
|
||||
* @param integer $server
|
||||
* @param string $var
|
||||
* @param mixed $val
|
||||
* @param int|true $server
|
||||
* @return mixed
|
||||
*/
|
||||
function PMA_cacheSet($var, $val = null, $server = 0)
|
||||
@ -2461,8 +2527,8 @@ function PMA_cacheSet($var, $val = null, $server = 0)
|
||||
/**
|
||||
* Removes cached information from the session
|
||||
*
|
||||
* @param string $var
|
||||
* @param scalar $server
|
||||
* @param string $var
|
||||
* @param int|true $server
|
||||
*/
|
||||
function PMA_cacheUnset($var, $server = 0)
|
||||
{
|
||||
@ -2677,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;
|
||||
}
|
||||
|
||||
@ -2701,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);
|
||||
}
|
||||
}
|
||||
@ -2774,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3049,6 +3117,7 @@ function PMA_getFunctionsForField($field, $insert_mode)
|
||||
* string, db name where to also check for privileges
|
||||
* @param mixed $tbl null, to only check global privileges
|
||||
* string, db name where to also check for privileges
|
||||
* @return bool
|
||||
*/
|
||||
function PMA_currentUserHasPrivilege($priv, $db = null, $tbl = null)
|
||||
{
|
||||
|
||||
@ -2315,7 +2315,7 @@ $cfg['ShowPropertyComments']= true;
|
||||
/**
|
||||
* shows table display direction.
|
||||
*/
|
||||
$cfg['ShowDisplayDir'] = false;
|
||||
$cfg['ShowDisplayDirection'] = false;
|
||||
|
||||
/**
|
||||
* repeat header names every X cells? (0 = deactivate)
|
||||
|
||||
@ -159,8 +159,8 @@ function display_input($path, $name, $description = '', $type, $value, $value_is
|
||||
<label for="<?php echo htmlspecialchars($path) ?>"><?php echo $name ?></label>
|
||||
<?php if (!empty($opts['doc']) || !empty($opts['wiki'])) { ?>
|
||||
<span class="doc">
|
||||
<?php if (!empty($opts['doc'])) { ?><a href="<?php echo $base_dir . $opts['doc'] ?>" target="documentation"><img class="icon" src="<?php echo $img_path ?>b_help.png" width="11" height="11" alt="Doc" title="<?php echo __('Documentation') ?>" /></a><?php } ?>
|
||||
<?php if (!empty($opts['wiki'])){ ?><a href="<?php echo $opts['wiki'] ?>" target="wiki"><img class="icon" src="<?php echo $img_path ?>b_info.png" width="11" height="11" alt="Wiki" title="Wiki" /></a><?php } ?>
|
||||
<?php if (!empty($opts['doc'])) { ?><a href="<?php echo $base_dir . $opts['doc'] ?>" target="documentation"><img class="icon ic_b_help_s" src="<?php echo $base_dir; ?>themes/dot.gif" alt="Doc" title="<?php echo __('Documentation') ?>" /></a><?php } ?>
|
||||
<?php if (!empty($opts['wiki'])){ ?><a href="<?php echo $opts['wiki'] ?>" target="wiki"><img class="icon ic_b_info" src="<?php echo $base_dir; ?>themes/dot.gif" alt="Wiki" title="Wiki" /></a><?php } ?>
|
||||
</span>
|
||||
<?php } ?>
|
||||
<?php if ($option_is_disabled) { ?>
|
||||
@ -234,17 +234,17 @@ function display_input($path, $name, $description = '', $type, $value, $value_is
|
||||
}
|
||||
if ($is_setup_script && isset($opts['userprefs_comment']) && $opts['userprefs_comment']) {
|
||||
?>
|
||||
<a class="userprefs-comment" title="<?php echo htmlspecialchars($opts['userprefs_comment']) ?>"><img alt="comment" src="<?php echo $img_path ?>b_tblops.png" width="16" height="16" /></a>
|
||||
<a class="userprefs-comment" title="<?php echo htmlspecialchars($opts['userprefs_comment']) ?>"><img alt="comment" class="icon ic_b_tblops" src="<?php echo $base_dir; ?>themes/dot.gif" /></a>
|
||||
<?php
|
||||
}
|
||||
if (isset($opts['setvalue']) && $opts['setvalue']) {
|
||||
?>
|
||||
<a class="set-value" href="#<?php echo htmlspecialchars("$path={$opts['setvalue']}") ?>" title="<?php echo sprintf(__('Set value: %s'), htmlspecialchars($opts['setvalue'])) ?>" style="display:none"><img alt="set-value" src="<?php echo $img_path ?>b_edit.png" width="16" height="16" /></a>
|
||||
<a class="set-value" href="#<?php echo htmlspecialchars("$path={$opts['setvalue']}") ?>" title="<?php echo sprintf(__('Set value: %s'), htmlspecialchars($opts['setvalue'])) ?>" style="display:none"><img alt="set-value" class="icon ic_b_edit" src="<?php echo $base_dir; ?>themes/dot.gif" /></a>
|
||||
<?php
|
||||
}
|
||||
if (isset($opts['show_restore_default']) && $opts['show_restore_default']) {
|
||||
?>
|
||||
<a class="restore-default" href="#<?php echo $path ?>" title="<?php echo __('Restore default value') ?>" style="display:none"><img alt="restore-default" src="<?php echo $img_path ?>s_reload.png" width="16" height="16" /></a>
|
||||
<a class="restore-default" href="#<?php echo $path ?>" title="<?php echo __('Restore default value') ?>" style="display:none"><img alt="restore-default" class="icon ic_s_reload" src="<?php echo $base_dir; ?>themes/dot.gif" /></a>
|
||||
<?php
|
||||
}
|
||||
// this must match with displayErrors() in scripts/config.js
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
/**
|
||||
* Messages for phpMyAdmin.
|
||||
*
|
||||
* This file is here for easy transition to Gettext. You should not add any
|
||||
* new messages here, use instead gettext directly in your template/PHP
|
||||
* file.
|
||||
* This file defines variables in a special format suited for the
|
||||
* configuration subsystem, with $strConfig as a prefix, _desc or _name
|
||||
* as a suffix, and the directive name in between.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
@ -450,8 +450,8 @@ $strConfigShowAll_name = __('Allow to display all the rows');
|
||||
$strConfigShowChgPassword_desc = __('Please note that enabling this has no effect with [kbd]config[/kbd] authentication mode because the password is hard coded in the configuration file; this does not limit the ability to execute the same command directly');
|
||||
$strConfigShowChgPassword_name = __('Show password change form');
|
||||
$strConfigShowCreateDb_name = __('Show create database form');
|
||||
$strConfigShowDisplayDir_desc = __('Defines whether or not type display direction option is shown when browsing a table');
|
||||
$strConfigShowDisplayDir_name = __('Show display direction');
|
||||
$strConfigShowDisplayDirection_desc = __('Defines whether or not type display direction option is shown when browsing a table');
|
||||
$strConfigShowDisplayDirection_name = __('Show display direction');
|
||||
$strConfigShowFieldTypesInDataEditView_desc = __('Defines whether or not type fields should be initially displayed in edit/insert mode');
|
||||
$strConfigShowFieldTypesInDataEditView_name = __('Show field types');
|
||||
$strConfigShowFunctionFields_desc = __('Display the function fields in edit/insert mode');
|
||||
|
||||
@ -198,7 +198,7 @@ $forms['Main_frame']['Browse'] = array(
|
||||
'Order',
|
||||
'BrowsePointerEnable',
|
||||
'BrowseMarkerEnable',
|
||||
'ShowDisplayDir',
|
||||
'ShowDisplayDirection',
|
||||
'RepeatCells',
|
||||
'LimitChars',
|
||||
'RowActionLinks',
|
||||
|
||||
@ -108,7 +108,7 @@ $forms['Main_frame']['Browse'] = array(
|
||||
'DisplayBinaryAsHex',
|
||||
'BrowsePointerEnable',
|
||||
'BrowseMarkerEnable',
|
||||
'ShowDisplayDir',
|
||||
'ShowDisplayDirection',
|
||||
'RepeatCells',
|
||||
'LimitChars',
|
||||
'RowActionLinks',
|
||||
|
||||
@ -224,8 +224,10 @@ function PMA_fatalError($error_message, $message_args = null)
|
||||
}
|
||||
|
||||
require('./libraries/error.inc.php');
|
||||
|
||||
exit;
|
||||
|
||||
if (!defined('TESTSUITE')) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -253,7 +255,13 @@ function PMA_getPHPDocLink($target) {
|
||||
*/
|
||||
function PMA_warnMissingExtension($extension, $fatal = false, $extra = '')
|
||||
{
|
||||
$message = sprintf(__('The %s extension is missing. Please check your PHP configuration.'),
|
||||
/* Gettext does not have to be loaded yet here */
|
||||
if (function_exists('__')) {
|
||||
$message = __('The %s extension is missing. Please check your PHP configuration.');
|
||||
} else {
|
||||
$message = 'The %s extension is missing. Please check your PHP configuration.';
|
||||
}
|
||||
$message = sprintf($message,
|
||||
'[a@' . PMA_getPHPDocLink('book.' . $extension . '.php') . '@Documentation][em]' . $extension . '[/em][/a]');
|
||||
if ($extra != '') {
|
||||
$message .= ' ' . $extra;
|
||||
|
||||
@ -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);
|
||||
@ -1300,7 +1300,7 @@ function PMA_DBI_get_triggers($db, $table = '', $delimiter = '//')
|
||||
// Note: in http://dev.mysql.com/doc/refman/5.0/en/faqs-triggers.html
|
||||
// their example uses WHERE TRIGGER_SCHEMA='dbname' so let's use this
|
||||
// instead of WHERE EVENT_OBJECT_SCHEMA='dbname'
|
||||
$query = "SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA= '" . PMA_sqlAddSlashes($db,true) . "';";
|
||||
$query = "SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA= '" . PMA_sqlAddSlashes($db,true) . "';";
|
||||
if (! empty($table)) {
|
||||
$query .= " AND EVENT_OBJECT_TABLE = '" . PMA_sqlAddSlashes($table, true) . "';";
|
||||
}
|
||||
@ -1319,12 +1319,15 @@ function PMA_DBI_get_triggers($db, $table = '', $delimiter = '//')
|
||||
$trigger['EVENT_MANIPULATION'] = $trigger['Event'];
|
||||
$trigger['EVENT_OBJECT_TABLE'] = $trigger['Table'];
|
||||
$trigger['ACTION_STATEMENT'] = $trigger['Statement'];
|
||||
$trigger['DEFINER'] = $trigger['Definer'];
|
||||
}
|
||||
$one_result = array();
|
||||
$one_result['name'] = $trigger['TRIGGER_NAME'];
|
||||
$one_result['table'] = $trigger['EVENT_OBJECT_TABLE'];
|
||||
$one_result['action_timing'] = $trigger['ACTION_TIMING'];
|
||||
$one_result['event_manipulation'] = $trigger['EVENT_MANIPULATION'];
|
||||
$one_result['definition'] = $trigger['ACTION_STATEMENT'];
|
||||
$one_result['definer'] = $trigger['DEFINER'];
|
||||
|
||||
// do not prepend the schema name; this way, importing the
|
||||
// definition into another schema will work
|
||||
@ -1335,6 +1338,14 @@ function PMA_DBI_get_triggers($db, $table = '', $delimiter = '//')
|
||||
$result[] = $one_result;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort results by name
|
||||
$name = array();
|
||||
foreach ($result as $key => $value) {
|
||||
$name[] = $value['name'];
|
||||
}
|
||||
array_multisort($name, SORT_ASC, $result);
|
||||
|
||||
return($result);
|
||||
}
|
||||
|
||||
|
||||
@ -1,150 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$events = PMA_DBI_fetch_result('SELECT EVENT_NAME, EVENT_TYPE FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' . PMA_sqlAddSlashes($db,true) . '\';');
|
||||
|
||||
$conditional_class_add = '';
|
||||
$conditional_class_drop = '';
|
||||
$conditional_class_export = '';
|
||||
if ($GLOBALS['cfg']['AjaxEnable']) {
|
||||
$conditional_class_add = 'class="add_event_anchor"';
|
||||
$conditional_class_drop = 'class="drop_event_anchor"';
|
||||
$conditional_class_export = 'class="export_event_anchor"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the export for a event. This is for when JS is disabled.
|
||||
*/
|
||||
if (! empty($_GET['exportevent']) && ! empty($_GET['eventname'])) {
|
||||
$event_name = htmlspecialchars(PMA_backquote($_GET['eventname']));
|
||||
if ($create_event = PMA_DBI_get_definition($db, 'EVENT', $_GET['eventname'])) {
|
||||
$create_event = '<textarea cols="40" rows="15" style="width: 100%;">' . $create_event . '</textarea>';
|
||||
if (! empty($_REQUEST['ajax_request'])) {
|
||||
$extra_data = array('title' => sprintf(__('Export of event %s'), $event_name));
|
||||
PMA_ajaxResponse($create_event, true, $extra_data);
|
||||
} else {
|
||||
echo '<fieldset>' . "\n"
|
||||
. ' <legend>' . sprintf(__('Export of event "%s"'), $event_name) . '</legend>' . "\n"
|
||||
. $create_event
|
||||
. '</fieldset>';
|
||||
}
|
||||
} else {
|
||||
$response = __('Error in Processing Request') . ' : '
|
||||
. sprintf(__('No event with name %s found in database %s'),
|
||||
$event_name, htmlspecialchars(PMA_backquote($db)));
|
||||
$response = PMA_message::error($response);
|
||||
if (! empty($_REQUEST['ajax_request'])) {
|
||||
PMA_ajaxResponse($response, false);
|
||||
} else {
|
||||
$response->display();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a list of available events
|
||||
*/
|
||||
echo "\n\n<span id='js_query_display'></span>\n\n";
|
||||
echo '<fieldset>' . "\n";
|
||||
echo ' <legend>' . __('Events') . '</legend>' . "\n";
|
||||
if (! $events) {
|
||||
echo __('There are no events to display.');
|
||||
} else {
|
||||
echo '<div class="hide" id="nothing2display">' . __('There are no events to display.') . '</div>';
|
||||
echo '<table class="data">';
|
||||
echo sprintf('<tr>
|
||||
<th>%s</th>
|
||||
<th colspan="3">%s</th>
|
||||
<th>%s</th>
|
||||
</tr>',
|
||||
__('Name'),
|
||||
__('Action'),
|
||||
__('Type'));
|
||||
$ct=0;
|
||||
$delimiter = '//';
|
||||
foreach ($events as $event) {
|
||||
|
||||
// information_schema (at least in MySQL 5.1.22) does not return
|
||||
// the full CREATE EVENT statement in a way that could be useful for us
|
||||
// so we rely on PMA_DBI_get_definition() which uses SHOW CREATE EVENT
|
||||
|
||||
$create_event = PMA_DBI_get_definition($db, 'EVENT', $event['EVENT_NAME']);
|
||||
$definition = 'DROP EVENT IF EXISTS ' . PMA_backquote($event['EVENT_NAME'])
|
||||
. $delimiter . "\n" . $create_event . "\n";
|
||||
|
||||
$sqlDrop = 'DROP EVENT ' . PMA_backquote($event['EVENT_NAME']);
|
||||
echo sprintf('<tr class="%s">
|
||||
<td><span class="drop_sql" style="display:none;">%s</span><strong>%s</strong></td>
|
||||
<td>%s</td>
|
||||
<td><div class="create_sql" style="display: none;">%s</div>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
</tr>',
|
||||
($ct%2 == 0) ? 'even' : 'odd',
|
||||
$sqlDrop,
|
||||
$event['EVENT_NAME'],
|
||||
! empty($definition) ? PMA_linkOrButton('db_sql.php?' . $url_query . '&sql_query=' . urlencode($definition) . '&show_query=1&db_query_force=1&delimiter=' . urlencode($delimiter), $titles['Edit']) : ' ',
|
||||
$create_event,
|
||||
'<a ' . $conditional_class_export . ' href="db_events.php?' . $url_query
|
||||
. '&exportevent=1'
|
||||
. '&eventname=' . urlencode($event['EVENT_NAME'])
|
||||
. '">' . $titles['Export'] . '</a>',
|
||||
'<a ' . $conditional_class_drop . ' href="sql.php?' . $url_query . '&sql_query=' . urlencode($sqlDrop) . '" >' . $titles['Drop'] . '</a>',
|
||||
$event['EVENT_TYPE']);
|
||||
$ct++;
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
echo '</fieldset>' . "\n";
|
||||
|
||||
/**
|
||||
* If there has been a request to change the state
|
||||
* of the event scheduler, process it now.
|
||||
*/
|
||||
if (! empty($_GET['toggle_scheduler'])) {
|
||||
$new_scheduler_state = $_GET['toggle_scheduler'];
|
||||
if ($new_scheduler_state === 'ON' || $new_scheduler_state === 'OFF') {
|
||||
PMA_DBI_query("SET GLOBAL event_scheduler='$new_scheduler_state'");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare to show the event scheduler fieldset, if necessary
|
||||
*/
|
||||
$tableStart = '';
|
||||
$schedulerFieldset = '';
|
||||
$es_state = PMA_DBI_fetch_value("SHOW GLOBAL VARIABLES LIKE 'event_scheduler'", 0, 1);
|
||||
if ($es_state === 'ON' || $es_state === 'OFF') {
|
||||
$es_change = ($es_state == 'ON') ? 'OFF' : 'ON';
|
||||
$tableStart = '<table style="width: 100%;"><tr><td style="width: 50%;">';
|
||||
$schedulerFieldset = '</td><td><fieldset style="margin: 1em 0;">' . "\n"
|
||||
. PMA_getIcon('b_events.png')
|
||||
. ($es_state === 'ON' ? __('The event scheduler is enabled') : __('The event scheduler is disabled')) . ':'
|
||||
. ' <a href="db_events.php?' . $url_query . '&toggle_scheduler=' . $es_change . '">'
|
||||
. ($es_change === 'ON' ? __('Turn it on') : __('Turn it off'))
|
||||
. '</a>' . "\n"
|
||||
. '</fieldset></td></tr></table>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the form for adding a new event
|
||||
*/
|
||||
echo $tableStart . '<fieldset style="margin: 1em 0;">' . "\n"
|
||||
. ' <a href="db_events.php?' . $url_query . '&addevent=1" ' . $conditional_class_add . '>' . "\n"
|
||||
. PMA_getIcon('b_event_add.png') . __('Add an event') . '</a>' . "\n"
|
||||
. '</fieldset>' . "\n";
|
||||
|
||||
/**
|
||||
* Display the state of the event scheduler
|
||||
* and offer an option to toggle it.
|
||||
*/
|
||||
echo $schedulerFieldset;
|
||||
|
||||
?>
|
||||
@ -46,64 +46,64 @@ if ($num_tables == 0) {
|
||||
|
||||
$tab_structure['link'] = 'db_structure.php';
|
||||
$tab_structure['text'] = __('Structure');
|
||||
$tab_structure['icon'] = 'b_props.png';
|
||||
$tab_structure['icon'] = 'ic_b_props';
|
||||
|
||||
$tab_sql['link'] = 'db_sql.php';
|
||||
$tab_sql['args']['db_query_force'] = 1;
|
||||
$tab_sql['text'] = __('SQL');
|
||||
$tab_sql['icon'] = 'b_sql.png';
|
||||
$tab_sql['icon'] = 'ic_b_sql';
|
||||
|
||||
$tab_export['text'] = __('Export');
|
||||
$tab_export['icon'] = 'b_export.png';
|
||||
$tab_export['icon'] = 'ic_b_export';
|
||||
$tab_export['link'] = 'db_export.php';
|
||||
|
||||
$tab_search['text'] = __('Search');
|
||||
$tab_search['icon'] = 'b_search.png';
|
||||
$tab_search['icon'] = 'ic_b_search';
|
||||
$tab_search['link'] = 'db_search.php';
|
||||
|
||||
if(PMA_Tracker::isActive())
|
||||
{
|
||||
$tab_tracking['text'] = __('Tracking');
|
||||
$tab_tracking['icon'] = 'eye.png';
|
||||
$tab_tracking['icon'] = 'ic_eye';
|
||||
$tab_tracking['link'] = 'db_tracking.php';
|
||||
}
|
||||
|
||||
$tab_qbe['text'] = __('Query');
|
||||
$tab_qbe['icon'] = 's_db.png';
|
||||
$tab_qbe['icon'] = 'ic_s_db';
|
||||
$tab_qbe['link'] = 'db_qbe.php';
|
||||
|
||||
if ($cfgRelation['designerwork']) {
|
||||
$tab_designer['text'] = __('Designer');
|
||||
$tab_designer['icon'] = 'b_relations.png';
|
||||
$tab_designer['icon'] = 'ic_b_relations';
|
||||
$tab_designer['link'] = 'pmd_general.php';
|
||||
}
|
||||
|
||||
if (! $db_is_information_schema) {
|
||||
$tab_import['link'] = 'db_import.php';
|
||||
$tab_import['text'] = __('Import');
|
||||
$tab_import['icon'] = 'b_import.png';
|
||||
$tab_import['icon'] = 'ic_b_import';
|
||||
$tab_operation['link'] = 'db_operations.php';
|
||||
$tab_operation['text'] = __('Operations');
|
||||
$tab_operation['icon'] = 'b_tblops.png';
|
||||
$tab_operation['icon'] = 'ic_b_tblops';
|
||||
if ($is_superuser) {
|
||||
$tab_privileges['link'] = 'server_privileges.php';
|
||||
$tab_privileges['args']['checkprivs'] = $db;
|
||||
// stay on database view
|
||||
$tab_privileges['args']['viewing_mode'] = 'db';
|
||||
$tab_privileges['text'] = __('Privileges');
|
||||
$tab_privileges['icon'] = 's_rights.png';
|
||||
$tab_privileges['icon'] = 'ic_s_rights';
|
||||
}
|
||||
$tab_routines['link'] = 'db_routines.php';
|
||||
$tab_routines['text'] = __('Routines');
|
||||
$tab_routines['icon'] = 'b_routines.png';
|
||||
$tab_routines['icon'] = 'ic_b_routines';
|
||||
|
||||
$tab_events['link'] = 'db_events.php';
|
||||
$tab_events['text'] = __('Events');
|
||||
$tab_events['icon'] = 'b_events.png';
|
||||
$tab_events['icon'] = 'ic_b_events';
|
||||
|
||||
$tab_triggers['link'] = 'db_triggers.php';
|
||||
$tab_triggers['text'] = __('Triggers');
|
||||
$tab_triggers['icon'] = 'b_triggers.png';
|
||||
$tab_triggers['icon'] = 'ic_b_triggers';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,16 +121,18 @@ if (! $db_is_information_schema) {
|
||||
if ($is_superuser) {
|
||||
$tabs[] =& $tab_privileges;
|
||||
}
|
||||
if (PMA_MYSQL_INT_VERSION >= 50002 && ! PMA_DRIZZLE) {
|
||||
if (!PMA_DRIZZLE) {
|
||||
$tabs[] =& $tab_routines;
|
||||
}
|
||||
if (PMA_MYSQL_INT_VERSION >= 50106 && ! PMA_DRIZZLE) {
|
||||
// Temporarily hiding this unfinished feature
|
||||
// $tabs[] =& $tab_events;
|
||||
if (PMA_currentUserHasPrivilege('EVENT', $db)) {
|
||||
$tabs[] =& $tab_events;
|
||||
}
|
||||
}
|
||||
if (PMA_MYSQL_INT_VERSION >= 50002 && ! PMA_DRIZZLE) {
|
||||
// Temporarily hiding this unfinished feature
|
||||
// $tabs[] =& $tab_triggers;
|
||||
if (!PMA_DRIZZLE) {
|
||||
if (PMA_currentUserHasPrivilege('TRIGGER', $db)) {
|
||||
$tabs[] =& $tab_triggers;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (PMA_Tracker::isActive()) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -94,19 +94,19 @@ function PMA_SortableTableHeader($title, $sort, $initial_sort_order = 'ASC')
|
||||
if ($requested_sort_order == 'ASC') {
|
||||
$future_sort_order = 'DESC';
|
||||
// current sort order is ASC
|
||||
$order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" width="11" height="9" alt="'. __('Ascending') . '" title="'. __('Ascending') . '" id="sort_arrow" />';
|
||||
$order_img = ' <img class="icon ic_s_asc" src="themes/dot.gif" alt="'. __('Ascending') . '" title="'. __('Ascending') . '" id="sort_arrow" />';
|
||||
// but on mouse over, show the reverse order (DESC)
|
||||
$order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
|
||||
$order_link_params['onmouseover'] = 'if($(\'#sort_arrow\').length > 0) { $(\'#sort_arrow\').attr(\'class\',\'icon ic_s_desc\'); }';
|
||||
// on mouse out, show current sort order (ASC)
|
||||
$order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
|
||||
$order_link_params['onmouseout'] = 'if($(\'#sort_arrow\').length > 0) { $(\'#sort_arrow\').attr(\'class\',\'icon ic_s_asc\'); }';
|
||||
} else {
|
||||
$future_sort_order = 'ASC';
|
||||
// current sort order is DESC
|
||||
$order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" width="11" height="9" alt="'. __('Descending') . '" title="'. __('Descending') . '" id="sort_arrow" />';
|
||||
$order_img = ' <img class="icon ic_s_desc" src="themes/dot.gif" alt="'. __('Descending') . '" title="'. __('Descending') . '" id="sort_arrow" />';
|
||||
// but on mouse over, show the reverse order (ASC)
|
||||
$order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
|
||||
$order_link_params['onmouseover'] = 'if($(\'#sort_arrow\').length > 0) { $(\'#sort_arrow\').attr(\'class\',\'icon ic_s_asc\'); }';
|
||||
// on mouse out, show current sort order (DESC)
|
||||
$order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
|
||||
$order_link_params['onmouseout'] = 'if($(\'#sort_arrow\').length > 0) { $(\'#sort_arrow\').attr(\'class\',\'icon ic_s_desc\'); }';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ if ($is_create_db_priv) {
|
||||
<strong><?php echo __('Create database') . ': ' . PMA_showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE'); ?></strong><br />
|
||||
<?php
|
||||
echo '<span class="noPrivileges">'
|
||||
. ($cfg['ErrorIconic'] ? '<img src="' . $pmaThemeImage . 's_error2.png" alt="" width="11" height="11" hspace="2" border="0" align="middle" />' : '')
|
||||
. ($cfg['ErrorIconic'] ? '<img class="icon ic_s_error2" src="themes/dot.gif" alt="" hspace="2" border="0" align="middle" />' : '')
|
||||
. '' . __('No Privileges') .'</span>';
|
||||
} // end create db form or message
|
||||
?>
|
||||
|
||||
@ -41,7 +41,7 @@ $is_create_table_priv = true;
|
||||
<legend>
|
||||
<?php
|
||||
if ($GLOBALS['cfg']['PropertiesIconic']) {
|
||||
echo '<img class="icon" src="' . $pmaThemeImage . 'b_newtbl.png" width="16" height="16" alt="" />';
|
||||
echo '<img class="icon ic_b_newtbl" src="themes/dot.gif" alt="" />';
|
||||
}
|
||||
echo sprintf(__('Create table on database %s'), PMA_getDbLink());
|
||||
?>
|
||||
|
||||
@ -74,7 +74,7 @@ if(isset($_GET['sql_query'])) {
|
||||
|
||||
<div class="exportoptions" id="header">
|
||||
<h2>
|
||||
<img src="<?php echo $GLOBALS['pmaThemeImage'];?>b_export.png" alt="export" />
|
||||
<img class="icon ic_b_export" src="themes/dot.gif" alt="export" />
|
||||
<?php
|
||||
if($export_type == 'server') {
|
||||
echo __('Exporting databases from the current server');
|
||||
|
||||
@ -123,7 +123,7 @@ if ($_SESSION[$SESSION_KEY]["handler"]!="noplugin") {
|
||||
|
||||
<div class="exportoptions" id="header">
|
||||
<h2>
|
||||
<img src="<?php echo $GLOBALS['pmaThemeImage'];?>b_import.png" alt="import" />
|
||||
<img class="icon ic_b_import" src="themes/dot.gif" alt="import" />
|
||||
<?php
|
||||
if($import_type == 'server') {
|
||||
echo __('Importing into the current server');
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
?>
|
||||
@ -445,7 +442,7 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di
|
||||
<?php echo __('Number of rows') . ': ' . "\n"; ?>
|
||||
<input type="text" name="session_max_rows" size="3" value="<?php echo (($_SESSION['tmp_user_values']['max_rows'] != 'all') ? $_SESSION['tmp_user_values']['max_rows'] : $GLOBALS['cfg']['MaxRows']); ?>" class="textfield" onfocus="this.select()" />
|
||||
<?php
|
||||
if ($GLOBALS['cfg']['ShowDisplayDir']) {
|
||||
if ($GLOBALS['cfg']['ShowDisplayDirection']) {
|
||||
// Display mode (horizontal/vertical and repeat headers)
|
||||
echo __('Mode') . ': ' . "\n";
|
||||
$choices = array(
|
||||
@ -899,10 +896,10 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
|
||||
$order_img = '';
|
||||
} elseif ('DESC' == $sort_direction) {
|
||||
$sort_order .= ' ASC';
|
||||
$order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" width="11" height="9" alt="'. __('Descending') . '" title="'. __('Descending') . '" id="soimg' . $i . '" />';
|
||||
$order_img = ' <img class="icon ic_s_desc" src="themes/dot.gif" alt="'. __('Descending') . '" title="'. __('Descending') . '" id="soimg' . $i . '" />';
|
||||
} else {
|
||||
$sort_order .= ' DESC';
|
||||
$order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" width="11" height="9" alt="'. __('Ascending') . '" title="'. __('Ascending') . '" id="soimg' . $i . '" />';
|
||||
$order_img = ' <img class="icon ic_s_asc" src="themes/dot.gif" alt="'. __('Ascending') . '" title="'. __('Ascending') . '" id="soimg' . $i . '" />';
|
||||
}
|
||||
|
||||
if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@is', $unsorted_sql_query, $regs3)) {
|
||||
@ -923,11 +920,11 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
|
||||
$order_link_params = array();
|
||||
if (isset($order_img) && $order_img!='') {
|
||||
if (strstr($order_img, 'asc')) {
|
||||
$order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
|
||||
$order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
|
||||
$order_link_params['onmouseover'] = 'if($(\'#soimg' . $i . '\').length > 0) { $(\'#soimg' . $i . '\').attr(\'class\', \'icon ic_s_desc\'); }';
|
||||
$order_link_params['onmouseout'] = 'if($(\'#soimg' . $i . '\').length > 0) { $(\'#soimg' . $i . '\').attr(\'class\', \'icon ic_s_asc\'); }';
|
||||
} elseif (strstr($order_img, 'desc')) {
|
||||
$order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
|
||||
$order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
|
||||
$order_link_params['onmouseover'] = 'if($(\'#soimg' . $i . '\').length > 0) { $(\'#soimg' . $i . '\').attr(\'class\', \'icon ic_s_asc\'); }';
|
||||
$order_link_params['onmouseout'] = 'if($(\'#soimg' . $i . '\').length > 0) { $(\'#soimg' . $i . '\').attr(\'class\', \'icon ic_s_desc\'); }';
|
||||
}
|
||||
}
|
||||
if ($GLOBALS['cfg']['HeaderFlipType'] == 'auto') {
|
||||
@ -1398,7 +1395,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 . ' ' . $alternating_color_class . ' ' . $relation_class . ' ' . $hide_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.
|
||||
@ -2146,7 +2143,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";
|
||||
|
||||
?>
|
||||
@ -46,18 +46,6 @@ if (isset($plugin_list)) {
|
||||
* Set of functions used to build exports of tables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -85,8 +73,7 @@ function PMA_exportHeader()
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -99,8 +86,7 @@ function PMA_exportDBHeader($db)
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -111,10 +97,9 @@ function PMA_exportDBFooter($db)
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -127,24 +112,23 @@ function PMA_exportDBCreate($db)
|
||||
/**
|
||||
* Outputs the content of a table in NHibernate format
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -154,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($db)."\" assembly=\"".ucfirst($db)."\">";
|
||||
$lines[] = " <class name=\"".ucfirst($table)."\" table=\"".$table."\">";
|
||||
$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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -35,17 +35,6 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -107,8 +96,7 @@ function PMA_exportHeader() {
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -120,8 +108,7 @@ function PMA_exportDBHeader($db) {
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -131,10 +118,9 @@ function PMA_exportDBFooter($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -146,12 +132,11 @@ function PMA_exportDBCreate($db) {
|
||||
/**
|
||||
* Outputs the content of a table in CSV format
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
|
||||
@ -34,17 +34,6 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -80,21 +69,19 @@ xmlns="http://www.w3.org/TR/REC-html40">
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
return PMA_exportOutputHandler('<h1>' . __('Database') . ' ' . $db . '</h1>');
|
||||
return PMA_exportOutputHandler('<h1>' . __('Database') . ' ' . htmlspecialchars($db) . '</h1>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -104,10 +91,9 @@ function PMA_exportDBFooter($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -117,14 +103,13 @@ function PMA_exportDBCreate($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in CSV format
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
* Outputs the content of a table in HTML (Microsoft Word) format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -133,7 +118,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
global $what;
|
||||
|
||||
if (! PMA_exportOutputHandler('<h2>' . __('Dumping data for table') . ' ' . $table . '</h2>')) {
|
||||
if (! PMA_exportOutputHandler('<h2>' . __('Dumping data for table') . ' ' . htmlspecialchars($table) . '</h2>')) {
|
||||
return false;
|
||||
}
|
||||
if (! PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
|
||||
@ -182,11 +167,32 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
return true;
|
||||
}
|
||||
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $dummy)
|
||||
/**
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
global $cfgRelation;
|
||||
|
||||
if (! PMA_exportOutputHandler('<h2>' . __('Table structure for table') . ' ' .$table . '</h2>')) {
|
||||
if (! PMA_exportOutputHandler('<h2>' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</h2>')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -207,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'])) {
|
||||
@ -266,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)) {
|
||||
@ -289,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) {
|
||||
@ -303,30 +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';
|
||||
}
|
||||
} 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 = '<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>';
|
||||
@ -344,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>');
|
||||
}
|
||||
|
||||
@ -34,19 +34,6 @@ if (isset($plugin_list)) {
|
||||
* Set of functions used to build exports of tables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text)
|
||||
{
|
||||
PMA_exportOutputHandler('/* ' . $text . ' */' . $GLOBALS['crlf']);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -80,23 +67,21 @@ function PMA_exportHeader()
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
PMA_exportOutputHandler('/* Database \'' . $db . '\' */ ' . $GLOBALS['crlf'] );
|
||||
PMA_exportOutputHandler('// Database \'' . $db . '\'' . $GLOBALS['crlf'] );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -107,10 +92,9 @@ function PMA_exportDBFooter($db)
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -121,14 +105,13 @@ function PMA_exportDBCreate($db)
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in YAML format
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
* Outputs the content of a table in JSON format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -151,7 +134,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
|
||||
// Output table name as comment if this is the first record of the table
|
||||
if ($record_cnt == 1) {
|
||||
$buffer .= '/* ' . $db . '.' . $table . ' */' . $crlf . $crlf;
|
||||
$buffer .= '// ' . $db . '.' . $table . $crlf . $crlf;
|
||||
$buffer .= '[{';
|
||||
} else {
|
||||
$buffer .= ', {';
|
||||
@ -164,18 +147,20 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
$column = $columns[$i];
|
||||
|
||||
if (is_null($record[$i])) {
|
||||
$buffer .= '"' . $column . '": null' . (! $isLastLine ? ',' : '');
|
||||
$buffer .= '"' . addslashes($column) . '": null' . (! $isLastLine ? ',' : '');
|
||||
} elseif (is_numeric($record[$i])) {
|
||||
$buffer .= '"' . $column . '": ' . $record[$i] . (! $isLastLine ? ',' : '');
|
||||
$buffer .= '"' . addslashes($column) . '": ' . $record[$i] . (! $isLastLine ? ',' : '');
|
||||
} else {
|
||||
$buffer .= '"' . $column . '": "' . addslashes($record[$i]) . '"' . (! $isLastLine ? ',' : '');
|
||||
$buffer .= '"' . addslashes($column) . '": "' . addslashes($record[$i]) . '"' . (! $isLastLine ? ',' : '');
|
||||
}
|
||||
}
|
||||
|
||||
$buffer .= '}';
|
||||
}
|
||||
|
||||
$buffer .= ']';
|
||||
if ($record_cnt) {
|
||||
$buffer .= ']';
|
||||
}
|
||||
if (! PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -100,17 +100,6 @@ function PMA_texEscape($string) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text) {
|
||||
return PMA_exportOutputHandler('% ' . $text . $GLOBALS['crlf']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -143,7 +132,7 @@ function PMA_exportHeader() {
|
||||
}
|
||||
$head .= $crlf
|
||||
. '% ' . __('Generation Time') . ': ' . PMA_localisedDate() . $crlf
|
||||
. '% ' . __('Server version') . ': ' . substr(PMA_MYSQL_INT_VERSION, 0, 1) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 1, 2) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 3) . $crlf
|
||||
. '% ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf
|
||||
. '% ' . __('PHP Version') . ': ' . phpversion() . $crlf;
|
||||
return PMA_exportOutputHandler($head);
|
||||
}
|
||||
@ -151,8 +140,7 @@ function PMA_exportHeader() {
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -168,8 +156,7 @@ function PMA_exportDBHeader($db) {
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -179,10 +166,9 @@ function PMA_exportDBFooter($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -194,12 +180,11 @@ function PMA_exportDBCreate($db) {
|
||||
/**
|
||||
* Outputs the content of a table in LaTeX table/sideways table environment
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -290,23 +275,27 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
} // end getTableLaTeX
|
||||
|
||||
/**
|
||||
* Returns $table's structure as LaTeX
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param boolean whether to include relation comments
|
||||
* @param boolean whether to include column comments
|
||||
* @param boolean whether to include mime comments
|
||||
* @param string future feature: support view dependencies
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
// @@@ Table structure
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $dummy)
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
global $cfgRelation;
|
||||
|
||||
@ -327,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'])) {
|
||||
@ -385,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))
|
||||
@ -405,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
|
||||
@ -435,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'];
|
||||
@ -479,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);
|
||||
|
||||
@ -24,17 +24,6 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -60,8 +49,7 @@ function PMA_exportHeader() {
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -73,8 +61,7 @@ function PMA_exportDBHeader($db) {
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -84,10 +71,9 @@ function PMA_exportDBFooter($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -99,29 +85,26 @@ function PMA_exportDBCreate($db) {
|
||||
/**
|
||||
* Outputs the content of a table in MediaWiki format
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @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";
|
||||
}
|
||||
@ -131,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";
|
||||
}
|
||||
@ -141,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";
|
||||
}
|
||||
@ -151,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";
|
||||
}
|
||||
@ -161,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";
|
||||
}
|
||||
|
||||
@ -33,17 +33,6 @@ if (isset($plugin_list)) {
|
||||
$GLOBALS['ods_buffer'] = '';
|
||||
require_once './libraries/opendocument.lib.php';
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -113,8 +102,7 @@ function PMA_exportHeader() {
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -126,8 +114,7 @@ function PMA_exportDBHeader($db) {
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -137,10 +124,9 @@ function PMA_exportDBFooter($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -150,14 +136,13 @@ function PMA_exportDBCreate($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in CSV format
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
* Outputs the content of a table in ODS format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
|
||||
@ -65,17 +65,6 @@ if (isset($plugin_list)) {
|
||||
$GLOBALS['odt_buffer'] = '';
|
||||
require_once './libraries/opendocument.lib.php';
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -111,8 +100,7 @@ function PMA_exportHeader() {
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -125,8 +113,7 @@ function PMA_exportDBHeader($db) {
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -136,10 +123,9 @@ function PMA_exportDBFooter($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -149,14 +135,13 @@ function PMA_exportDBCreate($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in CSV format
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
* Outputs the content of a table in ODT format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -222,23 +207,27 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns $table's structure as Open Document Text
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param boolean whether to include relation comments
|
||||
* @param boolean whether to include column comments
|
||||
* @param boolean whether to include mime comments
|
||||
* @param string future feature: support view dependencies
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
// @@@ Table structure
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $dummy)
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
global $cfgRelation;
|
||||
|
||||
@ -262,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'])) {
|
||||
@ -329,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]) . ')';
|
||||
@ -356,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) {
|
||||
@ -410,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;
|
||||
|
||||
@ -358,18 +358,6 @@ class PMA_PDF extends TCPDF
|
||||
|
||||
$pdf = new PMA_PDF('L', 'pt', 'A3');
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalize the pdf.
|
||||
*
|
||||
@ -420,8 +408,7 @@ function PMA_exportHeader()
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -434,8 +421,7 @@ function PMA_exportDBHeader($db)
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -446,10 +432,9 @@ function PMA_exportDBFooter($db)
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -462,13 +447,11 @@ function PMA_exportDBCreate($db)
|
||||
/**
|
||||
* Outputs the content of a table in PDF format
|
||||
*
|
||||
* @todo user-defined page orientation, paper size
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
|
||||
@ -34,19 +34,6 @@ if (isset($plugin_list)) {
|
||||
* Set of functions used to build exports of tables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text)
|
||||
{
|
||||
PMA_exportOutputHandler('// ' . $text . $GLOBALS['crlf']);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -81,8 +68,7 @@ function PMA_exportHeader()
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -96,8 +82,7 @@ function PMA_exportDBHeader($db)
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -108,10 +93,9 @@ function PMA_exportDBFooter($db)
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -122,14 +106,13 @@ function PMA_exportDBCreate($db)
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in YAML format
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
* Outputs the content of a table as a fragment of PHP code
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
|
||||
@ -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);
|
||||
}
|
||||
@ -128,7 +135,7 @@ if (isset($plugin_list)) {
|
||||
$plugin_list['sql']['options'][] = array('type' => 'end_group');
|
||||
|
||||
/* begin Structure options */
|
||||
if (!$hide_structure) {
|
||||
if (!$hide_structure) {
|
||||
$plugin_list['sql']['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'structure',
|
||||
@ -144,7 +151,7 @@ if (isset($plugin_list)) {
|
||||
'name' => 'add_statements',
|
||||
'text' => __('Add statements:')
|
||||
));
|
||||
if ($plugin_param['export_type'] == 'table') {
|
||||
if ($plugin_param['export_type'] == 'table') {
|
||||
if (PMA_Table::isView($GLOBALS['db'], $GLOBALS['table'])) {
|
||||
$drop_clause = '<code>DROP VIEW</code>';
|
||||
} else {
|
||||
@ -297,9 +304,10 @@ if (! isset($sql_backquotes)) {
|
||||
/**
|
||||
* Exports routines (procedures and functions)
|
||||
*
|
||||
* @param string $db
|
||||
* @param string $db
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportRoutines($db) {
|
||||
global $crlf;
|
||||
@ -312,7 +320,7 @@ function PMA_exportRoutines($db) {
|
||||
|
||||
if ($procedure_names || $function_names) {
|
||||
$text .= $crlf
|
||||
. 'DELIMITER ' . $delimiter . $crlf;
|
||||
. 'DELIMITER ' . $delimiter . $crlf;
|
||||
}
|
||||
|
||||
if ($procedure_names) {
|
||||
@ -321,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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -335,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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -357,9 +371,10 @@ function PMA_exportRoutines($db) {
|
||||
/**
|
||||
* Possibly outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @param string $text Text of comment
|
||||
* @return string The formatted comment
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function PMA_exportComment($text = '')
|
||||
{
|
||||
@ -375,10 +390,11 @@ function PMA_exportComment($text = '')
|
||||
* Possibly outputs CRLF
|
||||
*
|
||||
* @return string $crlf or nothing
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function PMA_possibleCRLF()
|
||||
{
|
||||
|
||||
if (isset($GLOBALS['sql_include_comments']) && $GLOBALS['sql_include_comments']) {
|
||||
return $GLOBALS['crlf'];
|
||||
} else {
|
||||
@ -412,9 +428,9 @@ function PMA_exportFooter()
|
||||
$charset_of_file = isset($GLOBALS['charset_of_file']) ? $GLOBALS['charset_of_file'] : '';
|
||||
if (!empty($GLOBALS['asfile']) && isset($mysql_charset_map[$charset_of_file])) {
|
||||
$foot .= $crlf
|
||||
. '/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;' . $crlf
|
||||
. '/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;' . $crlf
|
||||
. '/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;' . $crlf;
|
||||
. '/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;' . $crlf
|
||||
. '/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;' . $crlf
|
||||
. '/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;' . $crlf;
|
||||
}
|
||||
|
||||
/* Restore timezone */
|
||||
@ -455,35 +471,35 @@ function PMA_exportHeader()
|
||||
$host_string .= ':' . $cfg['Server']['port'];
|
||||
}
|
||||
$head .= PMA_exportComment($host_string);
|
||||
$head .= PMA_exportComment(__('Generation Time')
|
||||
. ': ' . PMA_localisedDate())
|
||||
. PMA_exportComment(__('Server version') . ': ' . substr(PMA_MYSQL_INT_VERSION, 0, 1) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 1, 2) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 3))
|
||||
. PMA_exportComment(__('PHP Version') . ': ' . phpversion())
|
||||
. PMA_possibleCRLF();
|
||||
$head .= PMA_exportComment(__('Generation Time')
|
||||
. ': ' . PMA_localisedDate())
|
||||
. PMA_exportComment(__('Server version') . ': ' . PMA_MYSQL_STR_VERSION)
|
||||
. PMA_exportComment(__('PHP Version') . ': ' . phpversion())
|
||||
. PMA_possibleCRLF();
|
||||
|
||||
if (isset($GLOBALS['sql_header_comment']) && !empty($GLOBALS['sql_header_comment'])) {
|
||||
// '\n' is not a newline (like "\n" would be), it's the characters
|
||||
// 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();
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['sql_disable_fk'])) {
|
||||
$head .= 'SET FOREIGN_KEY_CHECKS=0;' . $crlf;
|
||||
$head .= 'SET FOREIGN_KEY_CHECKS=0;' . $crlf;
|
||||
}
|
||||
|
||||
/* We want exported AUTO_INCREMENT fields to have still same value, do this only for recent MySQL exports */
|
||||
if (!isset($GLOBALS['sql_compatibility']) || $GLOBALS['sql_compatibility'] == 'NONE') {
|
||||
$head .= 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' . $crlf;
|
||||
$head .= 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' . $crlf;
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['sql_use_transaction'])) {
|
||||
$head .= 'SET AUTOCOMMIT=0;' . $crlf
|
||||
. 'START TRANSACTION;' . $crlf;
|
||||
$head .= 'SET AUTOCOMMIT=0;' . $crlf
|
||||
. 'START TRANSACTION;' . $crlf;
|
||||
}
|
||||
|
||||
|
||||
@ -518,10 +534,9 @@ function PMA_exportHeader()
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -557,8 +572,7 @@ function PMA_exportDBCreate($db)
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -574,8 +588,7 @@ function PMA_exportDBHeader($db)
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -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;
|
||||
}
|
||||
@ -626,15 +639,13 @@ function PMA_exportDBFooter($db)
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a stand-in CREATE definition to resolve view dependencies
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the view name
|
||||
* @param string the end of line sequence
|
||||
*
|
||||
* @return string resulting definition
|
||||
* @param string $db the database name
|
||||
* @param string $view the view name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @return string resulting definition
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
@ -652,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) . ');';
|
||||
@ -662,20 +673,15 @@ function PMA_getTableDefStandIn($db, $view, $crlf) {
|
||||
/**
|
||||
* Returns $table's CREATE definition
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param boolean whether to include creation/update/check dates
|
||||
* @param boolean whether to add semicolon and end-of-line at the end
|
||||
* @param boolean whether we're handling view
|
||||
*
|
||||
* @param string $db the database name
|
||||
* @param string $table the table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $show_dates whether to include creation/update/check dates
|
||||
* @param bool $add_semicolon whether to add semicolon and end-of-line at the end
|
||||
* @param bool $view whether we're handling a view
|
||||
* @return string resulting schema
|
||||
*
|
||||
* @global boolean whether to add 'drop' statements or not
|
||||
* @global boolean whether to use backquotes to allow the use of special
|
||||
* characters in database, table and fields names or not
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false, $add_semicolon = true, $view = false)
|
||||
@ -814,9 +820,9 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false, $a
|
||||
// comments for current table
|
||||
if (!isset($GLOBALS['no_constraints_comments'])) {
|
||||
$sql_constraints .= $crlf
|
||||
. PMA_exportComment()
|
||||
. PMA_exportComment(__('Constraints for table') . ' ' . PMA_backquote($table))
|
||||
. PMA_exportComment();
|
||||
. PMA_exportComment()
|
||||
. PMA_exportComment(__('Constraints for table') . ' ' . PMA_backquote($table))
|
||||
. PMA_exportComment();
|
||||
}
|
||||
|
||||
// let's do the work
|
||||
@ -869,21 +875,19 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false, $a
|
||||
return $schema_create . ($add_semicolon ? ';' . $crlf : '');
|
||||
} // end of the 'PMA_getTableDef()' function
|
||||
|
||||
|
||||
/**
|
||||
* Returns $table's comments, relations etc.
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param boolean whether to include relation comments
|
||||
* @param boolean whether to include mime comments
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf end of line sequence
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @return string resulting comments
|
||||
*
|
||||
* @access public
|
||||
* @access private
|
||||
*/
|
||||
function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_mime = false)
|
||||
function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_mime = false)
|
||||
{
|
||||
global $cfgRelation;
|
||||
global $sql_backquotes;
|
||||
@ -943,21 +947,21 @@ function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_mim
|
||||
/**
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param boolean whether to include relation comments
|
||||
* @param boolean whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param boolean whether to include mime comments
|
||||
* @param string 'stand_in', 'create_table', 'create_view'
|
||||
* @param string 'server', 'database', 'table'
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $relation whether to include relation comments
|
||||
* @param bool $comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
@ -973,8 +977,8 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = false,
|
||||
|
||||
switch($export_mode) {
|
||||
case 'create_table':
|
||||
$dump .= PMA_exportComment(__('Table structure for table') . ' ' . $formatted_table_name)
|
||||
. PMA_exportComment();
|
||||
$dump .= PMA_exportComment(__('Table structure for table') . ' ' . $formatted_table_name);
|
||||
$dump .= PMA_exportComment();
|
||||
$dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates);
|
||||
$dump .= PMA_getTableComments($db, $table, $crlf, $relation, $mime);
|
||||
break;
|
||||
@ -983,9 +987,9 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = false,
|
||||
$triggers = PMA_DBI_get_triggers($db, $table);
|
||||
if ($triggers) {
|
||||
$dump .= PMA_possibleCRLF()
|
||||
. PMA_exportComment()
|
||||
. PMA_exportComment(__('Triggers') . ' ' . $formatted_table_name)
|
||||
. PMA_exportComment();
|
||||
. PMA_exportComment()
|
||||
. PMA_exportComment(__('Triggers') . ' ' . $formatted_table_name)
|
||||
. PMA_exportComment();
|
||||
$delimiter = '//';
|
||||
foreach ($triggers as $trigger) {
|
||||
$dump .= $trigger['drop'] . ';' . $crlf;
|
||||
@ -997,7 +1001,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = false,
|
||||
break;
|
||||
case 'create_view':
|
||||
$dump .= PMA_exportComment(__('Structure for view') . ' ' . $formatted_table_name)
|
||||
. PMA_exportComment();
|
||||
. PMA_exportComment();
|
||||
// delete the stand-in table previously created (if any)
|
||||
if ($export_type != 'table') {
|
||||
$dump .= 'DROP TABLE IF EXISTS ' . PMA_backquote($table) . ';' . $crlf;
|
||||
@ -1006,7 +1010,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = false,
|
||||
break;
|
||||
case 'stand_in':
|
||||
$dump .= PMA_exportComment(__('Stand-in structure for view') . ' ' . $formatted_table_name)
|
||||
. PMA_exportComment();
|
||||
. PMA_exportComment();
|
||||
// export a stand-in definition to resolve view dependencies
|
||||
$dump .= PMA_getTableDefStandIn($db, $table, $crlf);
|
||||
} // end switch
|
||||
@ -1019,26 +1023,16 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = false,
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches between the versions of 'getTableContent' to use depending
|
||||
* on the php version
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
* Outputs the content of a table in SQL format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @global boolean whether to use backquotes to allow the use of special
|
||||
* characters in database, table and fields names or not
|
||||
* @global integer the number of records
|
||||
* @global integer the current record position
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @see PMA_getTableContentFast(), PMA_getTableContentOld()
|
||||
*
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
@ -1070,7 +1064,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
// are used, we did not get the true column name in case of aliases)
|
||||
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($sql_query));
|
||||
|
||||
$result = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$result = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
// a possible error: the table has crashed
|
||||
$tmp_error = PMA_DBI_getError();
|
||||
if ($tmp_error) {
|
||||
@ -1078,11 +1072,11 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
}
|
||||
|
||||
if ($result != false) {
|
||||
$fields_cnt = PMA_DBI_num_fields($result);
|
||||
$fields_cnt = PMA_DBI_num_fields($result);
|
||||
|
||||
// Get field information
|
||||
$fields_meta = PMA_DBI_get_fields_meta($result);
|
||||
$field_flags = array();
|
||||
$fields_meta = PMA_DBI_get_fields_meta($result);
|
||||
$field_flags = array();
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
$field_flags[$j] = PMA_DBI_field_flags($result, $j);
|
||||
}
|
||||
@ -1106,9 +1100,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
} else {
|
||||
// insert or replace
|
||||
if (isset($GLOBALS['sql_type']) && $GLOBALS['sql_type'] == 'REPLACE') {
|
||||
$sql_command = 'REPLACE';
|
||||
$sql_command = 'REPLACE';
|
||||
} else {
|
||||
$sql_command = 'INSERT';
|
||||
$sql_command = 'INSERT';
|
||||
}
|
||||
|
||||
// delayed inserts?
|
||||
@ -1135,10 +1129,10 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
}
|
||||
}
|
||||
|
||||
$search = array("\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required
|
||||
$replace = array('\0', '\n', '\r', '\Z');
|
||||
$current_row = 0;
|
||||
$query_size = 0;
|
||||
$search = array("\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required
|
||||
$replace = array('\0', '\n', '\r', '\Z');
|
||||
$current_row = 0;
|
||||
$query_size = 0;
|
||||
if (($GLOBALS['sql_insert_syntax'] == 'extended' || $GLOBALS['sql_insert_syntax'] == 'both') && (!isset($GLOBALS['sql_type']) || $GLOBALS['sql_type'] != 'UPDATE')) {
|
||||
$separator = ',';
|
||||
$schema_insert .= $crlf;
|
||||
@ -1161,7 +1155,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
// NULL
|
||||
if (!isset($row[$j]) || is_null($row[$j])) {
|
||||
$values[] = 'NULL';
|
||||
$values[] = 'NULL';
|
||||
// a number
|
||||
// timestamp is numeric on some MySQL 4.1, BLOBs are sometimes numeric
|
||||
} elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp'
|
||||
@ -1231,7 +1225,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
}
|
||||
// Other inserts case
|
||||
else {
|
||||
$insert_line = $schema_insert . '(' . implode(', ', $values) . ')';
|
||||
$insert_line = $schema_insert . '(' . implode(', ', $values) . ')';
|
||||
}
|
||||
}
|
||||
unset($values);
|
||||
|
||||
@ -32,17 +32,6 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -68,8 +57,7 @@ function PMA_exportHeader() {
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -81,8 +69,7 @@ function PMA_exportDBHeader($db) {
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -92,10 +79,9 @@ function PMA_exportDBFooter($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -105,14 +91,13 @@ function PMA_exportDBCreate($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in CSV format
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
* Outputs the content of a table in Texy format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -164,7 +149,28 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
return true;
|
||||
}
|
||||
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $dummy)
|
||||
/**
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
global $cfgRelation;
|
||||
|
||||
@ -189,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'])) {
|
||||
@ -245,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)) {
|
||||
@ -268,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) {
|
||||
@ -282,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'] . ')') : '');
|
||||
@ -323,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;
|
||||
}
|
||||
|
||||
@ -36,17 +36,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PH
|
||||
require_once './libraries/PHPExcel/PHPExcel.php';
|
||||
require_once './libraries/PHPExcel/PHPExcel/Writer/Excel5.php';
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -102,8 +91,7 @@ function PMA_exportHeader() {
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -117,8 +105,7 @@ function PMA_exportDBHeader($db) {
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -128,10 +115,9 @@ function PMA_exportDBFooter($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -143,12 +129,11 @@ function PMA_exportDBCreate($db) {
|
||||
/**
|
||||
* Outputs the content of a table in XLS format
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
|
||||
@ -36,17 +36,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PH
|
||||
require_once './libraries/PHPExcel/PHPExcel.php';
|
||||
require_once './libraries/PHPExcel/PHPExcel/Writer/Excel2007.php';
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -101,8 +90,7 @@ function PMA_exportHeader() {
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -116,8 +104,7 @@ function PMA_exportDBHeader($db) {
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -127,10 +114,9 @@ function PMA_exportDBFooter($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -142,12 +128,11 @@ function PMA_exportDBCreate($db) {
|
||||
/**
|
||||
* Outputs the content of a table in XLSX format
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
|
||||
@ -48,17 +48,6 @@ if (isset($plugin_list)) {
|
||||
$plugin_list['xml']['options'][] = array('type' => 'end_group');
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text) {
|
||||
return PMA_exportOutputHandler('<!-- ' . $text . ' -->' . $GLOBALS['crlf']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -82,13 +71,14 @@ function PMA_exportFooter() {
|
||||
function PMA_exportHeader() {
|
||||
global $crlf;
|
||||
global $cfg;
|
||||
global $what;
|
||||
global $db;
|
||||
global $table;
|
||||
global $tables;
|
||||
|
||||
$export_struct = isset($GLOBALS[$what . '_export_struc']) ? true : false;
|
||||
$export_data = isset($GLOBALS[$what . '_export_contents']) ? true : false;
|
||||
|
||||
$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']);
|
||||
$export_data = isset($GLOBALS['xml_export_contents']) ? true : false;
|
||||
|
||||
if ($GLOBALS['output_charset_conversion']) {
|
||||
$charset = $GLOBALS['charset_of_file'];
|
||||
@ -108,14 +98,14 @@ function PMA_exportHeader() {
|
||||
}
|
||||
$head .= $crlf
|
||||
. '- ' . __('Generation Time') . ': ' . PMA_localisedDate() . $crlf
|
||||
. '- ' . __('Server version') . ': ' . substr(PMA_MYSQL_INT_VERSION, 0, 1) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 1, 2) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 3) . $crlf
|
||||
. '- ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf
|
||||
. '- ' . __('PHP Version') . ': ' . phpversion() . $crlf
|
||||
. '-->' . $crlf . $crlf;
|
||||
|
||||
$head .= '<pma_xml_export version="1.0"' . (($export_struct) ? ' xmlns:pma="http://www.phpmyadmin.net/some_doc_url/"' : '') . '>' . $crlf;
|
||||
|
||||
if ($export_struct) {
|
||||
$result = PMA_DBI_fetch_result('SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME` = \''.$db.'\' LIMIT 1');
|
||||
$result = PMA_DBI_fetch_result('SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME` = \''.PMA_sqlAddSlashes($db).'\' LIMIT 1');
|
||||
$db_collation = $result[0]['DEFAULT_COLLATION_NAME'];
|
||||
$db_charset = $result[0]['DEFAULT_CHARACTER_SET_NAME'];
|
||||
|
||||
@ -123,8 +113,8 @@ function PMA_exportHeader() {
|
||||
$head .= ' - Structure schemas' . $crlf;
|
||||
$head .= ' -->' . $crlf;
|
||||
$head .= ' <pma:structure_schemas>' . $crlf;
|
||||
$head .= ' <pma:database name="' . $db . '" collation="' . $db_collation . '" charset="' . $db_charset . '">' . $crlf;
|
||||
|
||||
$head .= ' <pma:database name="' . htmlspecialchars($db) . '" collation="' . $db_collation . '" charset="' . $db_charset . '">' . $crlf;
|
||||
|
||||
if (count($tables) == 0) {
|
||||
$tables[] = $table;
|
||||
}
|
||||
@ -141,24 +131,24 @@ function PMA_exportHeader() {
|
||||
} else {
|
||||
$type = 'table';
|
||||
}
|
||||
|
||||
if ($is_view && ! isset($GLOBALS[$what . '_export_views'])) {
|
||||
|
||||
if ($is_view && ! isset($GLOBALS['xml_export_views'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! $is_view && ! isset($GLOBALS[$what . '_export_tables'])) {
|
||||
|
||||
if (! $is_view && ! isset($GLOBALS['xml_export_tables'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$head .= ' <pma:' . $type . ' name="' . $table . '">' . $crlf;
|
||||
|
||||
$tbl = " " . $tbl;
|
||||
|
||||
$tbl = " " . htmlspecialchars($tbl);
|
||||
$tbl = str_replace("\n", "\n ", $tbl);
|
||||
|
||||
$head .= $tbl . ';' . $crlf;
|
||||
$head .= ' </pma:' . $type . '>' . $crlf;
|
||||
|
||||
if (isset($GLOBALS[$what . '_export_triggers']) && $GLOBALS[$what . '_export_triggers']) {
|
||||
|
||||
if (isset($GLOBALS['xml_export_triggers']) && $GLOBALS['xml_export_triggers']) {
|
||||
// Export triggers
|
||||
$triggers = PMA_DBI_get_triggers($db, $table);
|
||||
if ($triggers) {
|
||||
@ -168,7 +158,7 @@ function PMA_exportHeader() {
|
||||
|
||||
// Do some formatting
|
||||
$code = substr(rtrim($code), 0, -3);
|
||||
$code = " " . $code;
|
||||
$code = " " . htmlspecialchars($code);
|
||||
$code = str_replace("\n", "\n ", $code);
|
||||
|
||||
$head .= $code . $crlf;
|
||||
@ -180,8 +170,8 @@ function PMA_exportHeader() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($GLOBALS[$what . '_export_functions']) && $GLOBALS[$what . '_export_functions']) {
|
||||
|
||||
if (isset($GLOBALS['xml_export_functions']) && $GLOBALS['xml_export_functions']) {
|
||||
// Export functions
|
||||
$functions = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
|
||||
if ($functions) {
|
||||
@ -191,7 +181,7 @@ function PMA_exportHeader() {
|
||||
// Do some formatting
|
||||
$sql = PMA_DBI_get_definition($db, 'FUNCTION', $function);
|
||||
$sql = rtrim($sql);
|
||||
$sql = " " . $sql;
|
||||
$sql = " " . htmlspecialchars($sql);
|
||||
$sql = str_replace("\n", "\n ", $sql);
|
||||
|
||||
$head .= $sql . $crlf;
|
||||
@ -203,8 +193,8 @@ function PMA_exportHeader() {
|
||||
unset($functions);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($GLOBALS[$what . '_export_procedures']) && $GLOBALS[$what . '_export_procedures']) {
|
||||
|
||||
if (isset($GLOBALS['xml_export_procedures']) && $GLOBALS['xml_export_procedures']) {
|
||||
// Export procedures
|
||||
$procedures = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
|
||||
if ($procedures) {
|
||||
@ -214,7 +204,7 @@ function PMA_exportHeader() {
|
||||
// Do some formatting
|
||||
$sql = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure);
|
||||
$sql = rtrim($sql);
|
||||
$sql = " " . $sql;
|
||||
$sql = " " . htmlspecialchars($sql);
|
||||
$sql = str_replace("\n", "\n ", $sql);
|
||||
|
||||
$head .= $sql . $crlf;
|
||||
@ -243,22 +233,20 @@ function PMA_exportHeader() {
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
global $crlf;
|
||||
global $what;
|
||||
|
||||
if (isset($GLOBALS[$what . '_export_contents']) && $GLOBALS[$what . '_export_contents']) {
|
||||
|
||||
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="' . $db . '">' . $crlf;
|
||||
|
||||
. ' <database name="' . htmlspecialchars($db) . '">' . $crlf;
|
||||
|
||||
return PMA_exportOutputHandler($head);
|
||||
}
|
||||
else
|
||||
@ -270,17 +258,15 @@ function PMA_exportDBHeader($db) {
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
global $crlf;
|
||||
global $what;
|
||||
|
||||
if (isset($GLOBALS[$what . '_export_contents']) && $GLOBALS[$what . '_export_contents']) {
|
||||
|
||||
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
|
||||
return PMA_exportOutputHandler(' </database>' . $crlf);
|
||||
}
|
||||
else
|
||||
@ -290,10 +276,9 @@ function PMA_exportDBFooter($db) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -302,27 +287,25 @@ function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Outputs the content of a table
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
* Outputs the content of a table in XML format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
global $what;
|
||||
|
||||
if (isset($GLOBALS[$what . '_export_contents']) && $GLOBALS[$what . '_export_contents']) {
|
||||
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
$columns = array();
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$columns[$i] = stripslashes(str_replace(' ', '_', PMA_DBI_field_name($result, $i)));
|
||||
}
|
||||
@ -340,7 +323,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
if (!isset($record[$i]) || is_null($record[$i])) {
|
||||
$record[$i] = 'NULL';
|
||||
}
|
||||
$buffer .= ' <column name="' . $columns[$i] . '">' . htmlspecialchars((string)$record[$i])
|
||||
$buffer .= ' <column name="' . htmlspecialchars($columns[$i]) . '">' . htmlspecialchars((string)$record[$i])
|
||||
. '</column>' . $crlf;
|
||||
}
|
||||
$buffer .= ' </table>' . $crlf;
|
||||
|
||||
@ -35,19 +35,6 @@ if (isset($plugin_list)) {
|
||||
* Set of functions used to build exports of tables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Outputs comment
|
||||
*
|
||||
* @param string Text of comment
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*/
|
||||
function PMA_exportComment($text)
|
||||
{
|
||||
PMA_exportOutputHandler('# ' . $text . $GLOBALS['crlf']);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
@ -77,8 +64,7 @@ function PMA_exportHeader()
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -91,8 +77,7 @@ function PMA_exportDBHeader($db)
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string Database name
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -103,10 +88,9 @@ function PMA_exportDBFooter($db)
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs create database database
|
||||
*
|
||||
* @param string Database name
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
@ -119,12 +103,11 @@ function PMA_exportDBCreate($db)
|
||||
/**
|
||||
* Outputs the content of a table in YAML format
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @param string the end of line sequence
|
||||
* @param string the url to go back in case of error
|
||||
* @param string SQL query for obtaining data
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
|
||||
@ -162,7 +162,7 @@ setURLHash("<?php echo PMA_generate_common_url($url_params, 'text', ''); ?>");
|
||||
echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"'
|
||||
. ' title="' . __('Open new phpMyAdmin window') . '" target="_blank">';
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic']) {
|
||||
echo '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'window-new.png"'
|
||||
echo '<img class="icon ic_window-new" src="themes/dot.gif"'
|
||||
. ' alt="' . __('Open new phpMyAdmin window') . '" />';
|
||||
}
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Factory class that handles the creation of geometric objects.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
* @package phpMyAdmin-GIS
|
||||
*/
|
||||
class PMA_GIS_Factory
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Base class for all GIS data type classes.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
* @package phpMyAdmin-GIS
|
||||
*/
|
||||
abstract class PMA_GIS_Geometry
|
||||
{
|
||||
@ -36,26 +36,27 @@ abstract class PMA_GIS_Geometry
|
||||
*
|
||||
* @param string $spatial GIS data object
|
||||
* @param string $label Label for the GIS data object
|
||||
* @param string $line_color Color for the GIS data object
|
||||
* @param string $color Color for the GIS data object
|
||||
* @param array $scale_data Array containing data related to scaling
|
||||
* @param image $pdf TCPDF instance
|
||||
*
|
||||
* @return the modified TCPDF instance
|
||||
*/
|
||||
public abstract function prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf);
|
||||
public abstract function prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
|
||||
/**
|
||||
* Prepares the JavaScript related to a row in the GIS dataset to visualize it with OpenLayers.
|
||||
* Prepares the JavaScript related to a row in the GIS dataset
|
||||
* to visualize it with OpenLayers.
|
||||
*
|
||||
* @param string $spatial GIS data object
|
||||
* @param int $srid Spatial reference ID
|
||||
* @param string $label Label for the GIS data object
|
||||
* @param string $point_color Color for the GIS data object
|
||||
* @param array $scale_data Array containing data related to scaling
|
||||
* @param string $spatial GIS data object
|
||||
* @param int $srid Spatial reference ID
|
||||
* @param string $label Label for the GIS data object
|
||||
* @param string $color Color for the GIS data object
|
||||
* @param array $scale_data Array containing data related to scaling
|
||||
*
|
||||
* @return the JavaScript related to a row in the GIS dataset
|
||||
*/
|
||||
public abstract function prepareRowAsOl($spatial, $srid, $label, $point_color, $scale_data);
|
||||
public abstract function prepareRowAsOl($spatial, $srid, $label, $color, $scale_data);
|
||||
|
||||
/**
|
||||
* Scales each row.
|
||||
@ -77,9 +78,11 @@ abstract class PMA_GIS_Geometry
|
||||
protected function getBoundsForOl($srid, $scale_data)
|
||||
{
|
||||
return 'bound = new OpenLayers.Bounds(); bound.extend(new OpenLayers.LonLat('
|
||||
. $scale_data['minX'] . ', ' . $scale_data['minY'] . ').transform(new OpenLayers.Projection("EPSG:'
|
||||
. $scale_data['minX'] . ', ' . $scale_data['minY']
|
||||
. ').transform(new OpenLayers.Projection("EPSG:'
|
||||
. $srid . '"), map.getProjectionObject())); bound.extend(new OpenLayers.LonLat('
|
||||
. $scale_data['maxX'] . ', ' . $scale_data['maxY'] . ').transform(new OpenLayers.Projection("EPSG:'
|
||||
. $scale_data['maxX'] . ', ' . $scale_data['maxY']
|
||||
. ').transform(new OpenLayers.Projection("EPSG:'
|
||||
. $srid . '"), map.getProjectionObject()));';
|
||||
}
|
||||
|
||||
@ -152,10 +155,53 @@ abstract class PMA_GIS_Geometry
|
||||
$points_arr[] = $x;
|
||||
$points_arr[] = $y;
|
||||
}
|
||||
unset($cordinate_arr);
|
||||
}
|
||||
|
||||
return $points_arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates JavaScriipt for adding points for OpenLayers polygon.
|
||||
*
|
||||
* @param string $polygon points of a polygon in WKT form
|
||||
* @param string $srid spatial reference id
|
||||
*
|
||||
* @return JavaScriipt for adding points for OpenLayers polygon
|
||||
*/
|
||||
protected function addPointsForOpenLayersPolygon($polygon, $srid)
|
||||
{
|
||||
$row = 'new OpenLayers.Geometry.Polygon(new Array(';
|
||||
// If the polygon doesnt have an inner polygon
|
||||
if (strpos($polygon, "),(") === false) {
|
||||
$points_arr = $this->extractPoints($polygon, null);
|
||||
$row .= 'new OpenLayers.Geometry.LinearRing(new Array(';
|
||||
foreach ($points_arr as $point) {
|
||||
$row .= '(new OpenLayers.Geometry.Point('
|
||||
. $point[0] . ', ' . $point[1] . '))'
|
||||
. '.transform(new OpenLayers.Projection("EPSG:'
|
||||
. $srid . '"), map.getProjectionObject()), ';
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
$row .= '))';
|
||||
} else {
|
||||
// Seperate outer and inner polygons
|
||||
$parts = explode("),(", $polygon);
|
||||
foreach ($parts as $ring) {
|
||||
$points_arr = $this->extractPoints($ring, null);
|
||||
$row .= 'new OpenLayers.Geometry.LinearRing(new Array(';
|
||||
foreach ($points_arr as $point) {
|
||||
$row .= '(new OpenLayers.Geometry.Point('
|
||||
. $point[0] . ', ' . $point[1] . '))'
|
||||
. '.transform(new OpenLayers.Projection("EPSG:'
|
||||
. $srid . '"), map.getProjectionObject()), ';
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
$row .= ')), ';
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
}
|
||||
$row .= ')), ';
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Handles the visualization of GIS GEOMETRYCOLLECTION objects.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
* @package phpMyAdmin-GIS
|
||||
*/
|
||||
class PMA_GIS_Geometrycollection extends PMA_GIS_Geometry
|
||||
{
|
||||
@ -24,8 +24,8 @@ class PMA_GIS_Geometrycollection extends PMA_GIS_Geometry
|
||||
public static function singleton()
|
||||
{
|
||||
if (!isset(self::$_instance)) {
|
||||
$c = __CLASS__;
|
||||
self::$_instance = new $c;
|
||||
$class = __CLASS__;
|
||||
self::$_instance = new $class;
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
@ -130,7 +130,7 @@ class PMA_GIS_Geometrycollection extends PMA_GIS_Geometry
|
||||
$type = substr($sub_part, 0, $type_pos);
|
||||
|
||||
$gis_obj = PMA_GIS_Factory::factory($type);
|
||||
$image = $gis_obj->prepareRowAsPdf($sub_part, $label, $color, $scale_data, $pdf);
|
||||
$pdf = $gis_obj->prepareRowAsPdf($sub_part, $label, $color, $scale_data, $pdf);
|
||||
}
|
||||
return $pdf;
|
||||
}
|
||||
@ -165,7 +165,8 @@ class PMA_GIS_Geometrycollection extends PMA_GIS_Geometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares JavaScript related to a row in the GIS dataset to visualize it with OpenLayers.
|
||||
* Prepares JavaScript related to a row in the GIS dataset
|
||||
* to visualize it with OpenLayers.
|
||||
*
|
||||
* @param string $spatial GIS GEOMETRYCOLLECTION object
|
||||
* @param int $srid Spatial reference ID
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Handles the visualization of GIS LINESTRING objects.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
* @package phpMyAdmin-GIS
|
||||
*/
|
||||
class PMA_GIS_Linestring extends PMA_GIS_Geometry
|
||||
{
|
||||
@ -24,8 +24,8 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry
|
||||
public static function singleton()
|
||||
{
|
||||
if (!isset(self::$_instance)) {
|
||||
$c = __CLASS__;
|
||||
self::$_instance = new $c;
|
||||
$class = __CLASS__;
|
||||
self::$_instance = new $class;
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
@ -59,10 +59,10 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry
|
||||
public function prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image)
|
||||
{
|
||||
// allocate colors
|
||||
$r = hexdec(substr($line_color, 1, 2));
|
||||
$g = hexdec(substr($line_color, 3, 2));
|
||||
$b = hexdec(substr($line_color, 4, 2));
|
||||
$color = imagecolorallocate($image, $r, $g, $b);
|
||||
$red = hexdec(substr($line_color, 1, 2));
|
||||
$green = hexdec(substr($line_color, 3, 2));
|
||||
$blue = hexdec(substr($line_color, 4, 2));
|
||||
$color = imagecolorallocate($image, $red, $green, $blue);
|
||||
|
||||
// Trim to remove leading 'LINESTRING(' and trailing ')'
|
||||
$linesrting = substr($spatial, 11, (strlen($spatial) - 12));
|
||||
@ -94,10 +94,10 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry
|
||||
public function prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf)
|
||||
{
|
||||
// allocate colors
|
||||
$r = hexdec(substr($line_color, 1, 2));
|
||||
$g = hexdec(substr($line_color, 3, 2));
|
||||
$b = hexdec(substr($line_color, 4, 2));
|
||||
$line = array('width' => 1.5, 'color' => array($r, $g, $b));
|
||||
$red = hexdec(substr($line_color, 1, 2));
|
||||
$green = hexdec(substr($line_color, 3, 2));
|
||||
$blue = hexdec(substr($line_color, 4, 2));
|
||||
$line = array('width' => 1.5, 'color' => array($red, $green, $blue));
|
||||
|
||||
// Trim to remove leading 'LINESTRING(' and trailing ')'
|
||||
$linesrting = substr($spatial, 11, (strlen($spatial) - 12));
|
||||
@ -154,7 +154,8 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares JavaScript related to a row in the GIS dataset to visualize it with OpenLayers.
|
||||
* Prepares JavaScript related to a row in the GIS dataset
|
||||
* to visualize it with OpenLayers.
|
||||
*
|
||||
* @param string $spatial GIS LINESTRING object
|
||||
* @param int $srid Spatial reference ID
|
||||
@ -183,8 +184,9 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry
|
||||
|
||||
$row = 'new Array(';
|
||||
foreach ($points_arr as $point) {
|
||||
$row .= '(new OpenLayers.Geometry.Point(' . $point[0] . ', ' . $point[1] . '))'
|
||||
. '.transform(new OpenLayers.Projection("EPSG:' . $srid . '"), map.getProjectionObject()), ';
|
||||
$row .= '(new OpenLayers.Geometry.Point(' . $point[0] . ', '
|
||||
. $point[1] . ')).transform(new OpenLayers.Projection("EPSG:'
|
||||
. $srid . '"), map.getProjectionObject()), ';
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
$row .= ')';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Handles the visualization of GIS MULTILINESTRING objects.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
* @package phpMyAdmin-GIS
|
||||
*/
|
||||
class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
|
||||
{
|
||||
@ -24,8 +24,8 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
|
||||
public static function singleton()
|
||||
{
|
||||
if (!isset(self::$_instance)) {
|
||||
$c = __CLASS__;
|
||||
self::$_instance = new $c;
|
||||
$class = __CLASS__;
|
||||
self::$_instance = new $class;
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
@ -68,10 +68,10 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
|
||||
public function prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image)
|
||||
{
|
||||
// allocate colors
|
||||
$r = hexdec(substr($line_color, 1, 2));
|
||||
$g = hexdec(substr($line_color, 3, 2));
|
||||
$b = hexdec(substr($line_color, 4, 2));
|
||||
$color = imagecolorallocate($image, $r, $g, $b);
|
||||
$red = hexdec(substr($line_color, 1, 2));
|
||||
$green = hexdec(substr($line_color, 3, 2));
|
||||
$blue = hexdec(substr($line_color, 4, 2));
|
||||
$color = imagecolorallocate($image, $red, $green, $blue);
|
||||
|
||||
// Trim to remove leading 'MULTILINESTRING((' and trailing '))'
|
||||
$multilinestirng = substr($spatial, 17, (strlen($spatial) - 19));
|
||||
@ -108,10 +108,10 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
|
||||
public function prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf)
|
||||
{
|
||||
// allocate colors
|
||||
$r = hexdec(substr($line_color, 1, 2));
|
||||
$g = hexdec(substr($line_color, 3, 2));
|
||||
$b = hexdec(substr($line_color, 4, 2));
|
||||
$line = array('width' => 1.5, 'color' => array($r, $g, $b));
|
||||
$red = hexdec(substr($line_color, 1, 2));
|
||||
$green = hexdec(substr($line_color, 3, 2));
|
||||
$blue = hexdec(substr($line_color, 4, 2));
|
||||
$line = array('width' => 1.5, 'color' => array($red, $green, $blue));
|
||||
|
||||
// Trim to remove leading 'MULTILINESTRING((' and trailing '))'
|
||||
$multilinestirng = substr($spatial, 17, (strlen($spatial) - 19));
|
||||
@ -179,7 +179,8 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares JavaScript related to a row in the GIS dataset to visualize it with OpenLayers.
|
||||
* Prepares JavaScript related to a row in the GIS dataset
|
||||
* to visualize it with OpenLayers.
|
||||
*
|
||||
* @param string $spatial GIS MULTILINESTRING object
|
||||
* @param int $srid Spatial reference ID
|
||||
@ -213,8 +214,9 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
|
||||
$points_arr = $this->extractPoints($linestring, null);
|
||||
$row .= 'new OpenLayers.Geometry.LineString(new Array(';
|
||||
foreach ($points_arr as $point) {
|
||||
$row .= '(new OpenLayers.Geometry.Point(' . $point[0] . ', ' . $point[1] . '))'
|
||||
. '.transform(new OpenLayers.Projection("EPSG:' . $srid . '"), map.getProjectionObject()), ';
|
||||
$row .= '(new OpenLayers.Geometry.Point(' . $point[0] . ', '
|
||||
. $point[1] . ')).transform(new OpenLayers.Projection("EPSG:'
|
||||
. $srid . '"), map.getProjectionObject()), ';
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
$row .= ')), ';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Handles the visualization of GIS MULTIPOINT objects.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
* @package phpMyAdmin-GIS
|
||||
*/
|
||||
class PMA_GIS_Multipoint extends PMA_GIS_Geometry
|
||||
{
|
||||
@ -24,8 +24,8 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
|
||||
public static function singleton()
|
||||
{
|
||||
if (!isset(self::$_instance)) {
|
||||
$c = __CLASS__;
|
||||
self::$_instance = new $c;
|
||||
$class = __CLASS__;
|
||||
self::$_instance = new $class;
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
@ -48,21 +48,21 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
|
||||
/**
|
||||
* Adds to the PNG image object, the data related to a row in the GIS dataset.
|
||||
*
|
||||
* @param string $spatial GIS MULTIPOINT object
|
||||
* @param string $label Label for the GIS MULTIPOINT object
|
||||
* @param string $line_color Color for the GIS MULTIPOINT object
|
||||
* @param array $scale_data Array containing data related to scaling
|
||||
* @param image $image Image object
|
||||
* @param string $spatial GIS MULTIPOINT object
|
||||
* @param string $label Label for the GIS MULTIPOINT object
|
||||
* @param string $point_color Color for the GIS MULTIPOINT object
|
||||
* @param array $scale_data Array containing data related to scaling
|
||||
* @param image $image Image object
|
||||
*
|
||||
* @return the modified image object
|
||||
*/
|
||||
public function prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image)
|
||||
public function prepareRowAsPng($spatial, $label, $point_color, $scale_data, $image)
|
||||
{
|
||||
// allocate colors
|
||||
$r = hexdec(substr($line_color, 1, 2));
|
||||
$g = hexdec(substr($line_color, 3, 2));
|
||||
$b = hexdec(substr($line_color, 4, 2));
|
||||
$color = imagecolorallocate($image, $r, $g, $b);
|
||||
$red = hexdec(substr($point_color, 1, 2));
|
||||
$green = hexdec(substr($point_color, 3, 2));
|
||||
$blue = hexdec(substr($point_color, 4, 2));
|
||||
$color = imagecolorallocate($image, $red, $green, $blue);
|
||||
|
||||
// Trim to remove leading 'MULTIPOINT(' and trailing ')'
|
||||
$multipoint = substr($spatial, 11, (strlen($spatial) - 12));
|
||||
@ -78,21 +78,21 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
|
||||
/**
|
||||
* Adds to the TCPDF instance, the data related to a row in the GIS dataset.
|
||||
*
|
||||
* @param string $spatial GIS MULTIPOINT object
|
||||
* @param string $label Label for the GIS MULTIPOINT object
|
||||
* @param string $line_color Color for the GIS MULTIPOINT object
|
||||
* @param array $scale_data Array containing data related to scaling
|
||||
* @param image $pdf TCPDF instance
|
||||
* @param string $spatial GIS MULTIPOINT object
|
||||
* @param string $label Label for the GIS MULTIPOINT object
|
||||
* @param string $point_color Color for the GIS MULTIPOINT object
|
||||
* @param array $scale_data Array containing data related to scaling
|
||||
* @param image $pdf TCPDF instance
|
||||
*
|
||||
* @return the modified TCPDF instance
|
||||
*/
|
||||
public function prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf)
|
||||
public function prepareRowAsPdf($spatial, $label, $point_color, $scale_data, $pdf)
|
||||
{
|
||||
// allocate colors
|
||||
$r = hexdec(substr($line_color, 1, 2));
|
||||
$g = hexdec(substr($line_color, 3, 2));
|
||||
$b = hexdec(substr($line_color, 4, 2));
|
||||
$line = array('width' => 1.25, 'color' => array($r, $g, $b));
|
||||
$red = hexdec(substr($point_color, 1, 2));
|
||||
$green = hexdec(substr($point_color, 3, 2));
|
||||
$blue = hexdec(substr($point_color, 4, 2));
|
||||
$line = array('width' => 1.25, 'color' => array($red, $green, $blue));
|
||||
|
||||
// Trim to remove leading 'MULTIPOINT(' and trailing ')'
|
||||
$multipoint = substr($spatial, 11, (strlen($spatial) - 12));
|
||||
@ -143,7 +143,8 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares JavaScript related to a row in the GIS dataset to visualize it with OpenLayers.
|
||||
* Prepares JavaScript related to a row in the GIS dataset
|
||||
* to visualize it with OpenLayers.
|
||||
*
|
||||
* @param string $spatial GIS MULTIPOINT object
|
||||
* @param int $srid Spatial reference ID
|
||||
@ -175,8 +176,9 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
|
||||
|
||||
$row = 'new Array(';
|
||||
foreach ($points_arr as $point) {
|
||||
$row .= '(new OpenLayers.Geometry.Point(' . $point[0] . ', ' . $point[1] . '))'
|
||||
. '.transform(new OpenLayers.Projection("EPSG:' . $srid . '"), map.getProjectionObject()), ';
|
||||
$row .= '(new OpenLayers.Geometry.Point(' . $point[0] . ', ' . $point[1]
|
||||
. ')).transform(new OpenLayers.Projection("EPSG:' . $srid
|
||||
. '"), map.getProjectionObject()), ';
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
$row .= ')';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Handles the visualization of GIS MULTIPOLYGON objects.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
* @package phpMyAdmin-GIS
|
||||
*/
|
||||
class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
{
|
||||
@ -24,8 +24,8 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
public static function singleton()
|
||||
{
|
||||
if (!isset(self::$_instance)) {
|
||||
$c = __CLASS__;
|
||||
self::$_instance = new $c;
|
||||
$class = __CLASS__;
|
||||
self::$_instance = new $class;
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
@ -82,10 +82,10 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
public function prepareRowAsPng($spatial, $label, $fill_color, $scale_data, $image)
|
||||
{
|
||||
// allocate colors
|
||||
$r = hexdec(substr($fill_color, 1, 2));
|
||||
$g = hexdec(substr($fill_color, 3, 2));
|
||||
$b = hexdec(substr($fill_color, 4, 2));
|
||||
$color = imagecolorallocate($image, $r, $g, $b);
|
||||
$red = hexdec(substr($fill_color, 1, 2));
|
||||
$green = hexdec(substr($fill_color, 3, 2));
|
||||
$blue = hexdec(substr($fill_color, 4, 2));
|
||||
$color = imagecolorallocate($image, $red, $green, $blue);
|
||||
|
||||
// Trim to remove leading 'MULTIPOLYGON(((' and trailing ')))'
|
||||
$multipolygon = substr($spatial, 15, (strlen($spatial) - 18));
|
||||
@ -130,10 +130,10 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
public function prepareRowAsPdf($spatial, $label, $fill_color, $scale_data, $pdf)
|
||||
{
|
||||
// allocate colors
|
||||
$r = hexdec(substr($fill_color, 1, 2));
|
||||
$g = hexdec(substr($fill_color, 3, 2));
|
||||
$b = hexdec(substr($fill_color, 4, 2));
|
||||
$color = array($r, $g, $b);
|
||||
$red = hexdec(substr($fill_color, 1, 2));
|
||||
$green = hexdec(substr($fill_color, 3, 2));
|
||||
$blue = hexdec(substr($fill_color, 4, 2));
|
||||
$color = array($red, $green, $blue);
|
||||
|
||||
// Trim to remove leading 'MULTIPOLYGON(((' and trailing ')))'
|
||||
$multipolygon = substr($spatial, 15, (strlen($spatial) - 18));
|
||||
@ -154,7 +154,8 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
|
||||
foreach ($inner as $inner_poly) {
|
||||
$points_arr = array_merge(
|
||||
$points_arr, $this->extractPoints($inner_poly, $scale_data, true)
|
||||
$points_arr,
|
||||
$this->extractPoints($inner_poly, $scale_data, true)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -223,7 +224,8 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares JavaScript related to a row in the GIS dataset to visualize it with OpenLayers.
|
||||
* Prepares JavaScript related to a row in the GIS dataset
|
||||
* to visualize it with OpenLayers.
|
||||
*
|
||||
* @param string $spatial GIS MULTIPOLYGON object
|
||||
* @param int $srid Spatial reference ID
|
||||
@ -257,33 +259,7 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
. 'new OpenLayers.Geometry.MultiPolygon(new Array(';
|
||||
|
||||
foreach ($polygons as $polygon) {
|
||||
$row .= 'new OpenLayers.Geometry.Polygon(new Array(';
|
||||
// If the polygon doesnt have an inner polygon
|
||||
if (strpos($polygon, "),(") === false) {
|
||||
$points_arr = $this->extractPoints($polygon, null);
|
||||
$row .= 'new OpenLayers.Geometry.LinearRing(new Array(';
|
||||
foreach ($points_arr as $point) {
|
||||
$row .= '(new OpenLayers.Geometry.Point(' . $point[0] . ', ' . $point[1] . '))'
|
||||
. '.transform(new OpenLayers.Projection("EPSG:' . $srid . '"), map.getProjectionObject()), ';
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
$row .= '))';
|
||||
} else {
|
||||
// Seperate outer and inner polygons
|
||||
$parts = explode("),(", $polygon);
|
||||
foreach ($parts as $ring) {
|
||||
$points_arr = $this->extractPoints($ring, null);
|
||||
$row .= 'new OpenLayers.Geometry.LinearRing(new Array(';
|
||||
foreach ($points_arr as $point) {
|
||||
$row .= '(new OpenLayers.Geometry.Point(' . $point[0] . ', ' . $point[1] . '))'
|
||||
. '.transform(new OpenLayers.Projection("EPSG:' . $srid . '"), map.getProjectionObject()), ';
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
$row .= ')), ';
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
}
|
||||
$row .= ')), ';
|
||||
$row .= $this->addPointsForOpenLayersPolygon($polygon, $srid);
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
$row .= ')), null, ' . json_encode($style_options) . '));';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Handles the visualization of GIS POINT objects.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
* @package phpMyAdmin-GIS
|
||||
*/
|
||||
class PMA_GIS_Point extends PMA_GIS_Geometry
|
||||
{
|
||||
@ -24,8 +24,8 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
|
||||
public static function singleton()
|
||||
{
|
||||
if (!isset(self::$_instance)) {
|
||||
$c = __CLASS__;
|
||||
self::$_instance = new $c;
|
||||
$class = __CLASS__;
|
||||
self::$_instance = new $class;
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
@ -48,21 +48,21 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
|
||||
/**
|
||||
* Adds to the PNG image object, the data related to a row in the GIS dataset.
|
||||
*
|
||||
* @param string $spatial GIS POINT object
|
||||
* @param string $label Label for the GIS POINT object
|
||||
* @param string $line_color Color for the GIS POINT object
|
||||
* @param array $scale_data Array containing data related to scaling
|
||||
* @param image $image Image object
|
||||
* @param string $spatial GIS POINT object
|
||||
* @param string $label Label for the GIS POINT object
|
||||
* @param string $point_color Color for the GIS POINT object
|
||||
* @param array $scale_data Array containing data related to scaling
|
||||
* @param image $image Image object
|
||||
*
|
||||
* @return the modified image object
|
||||
*/
|
||||
public function prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image)
|
||||
public function prepareRowAsPng($spatial, $label, $point_color, $scale_data, $image)
|
||||
{
|
||||
// allocate colors
|
||||
$r = hexdec(substr($line_color, 1, 2));
|
||||
$g = hexdec(substr($line_color, 3, 2));
|
||||
$b = hexdec(substr($line_color, 4, 2));
|
||||
$color = imagecolorallocate($image, $r, $g, $b);
|
||||
$red = hexdec(substr($point_color, 1, 2));
|
||||
$green = hexdec(substr($point_color, 3, 2));
|
||||
$blue = hexdec(substr($point_color, 4, 2));
|
||||
$color = imagecolorallocate($image, $red, $green, $blue);
|
||||
|
||||
// Trim to remove leading 'POINT(' and trailing ')'
|
||||
$point = substr($spatial, 6, (strlen($spatial) - 7));
|
||||
@ -76,21 +76,21 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
|
||||
/**
|
||||
* Adds to the TCPDF instance, the data related to a row in the GIS dataset.
|
||||
*
|
||||
* @param string $spatial GIS POINT object
|
||||
* @param string $label Label for the GIS POINT object
|
||||
* @param string $line_color Color for the GIS POINT object
|
||||
* @param array $scale_data Array containing data related to scaling
|
||||
* @param image $pdf TCPDF instance
|
||||
* @param string $spatial GIS POINT object
|
||||
* @param string $label Label for the GIS POINT object
|
||||
* @param string $point_color Color for the GIS POINT object
|
||||
* @param array $scale_data Array containing data related to scaling
|
||||
* @param image $pdf TCPDF instance
|
||||
*
|
||||
* @return the modified TCPDF instance
|
||||
*/
|
||||
public function prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf)
|
||||
public function prepareRowAsPdf($spatial, $label, $point_color, $scale_data, $pdf)
|
||||
{
|
||||
// allocate colors
|
||||
$r = hexdec(substr($line_color, 1, 2));
|
||||
$g = hexdec(substr($line_color, 3, 2));
|
||||
$b = hexdec(substr($line_color, 4, 2));
|
||||
$line = array('width' => 1.25, 'color' => array($r, $g, $b));
|
||||
$red = hexdec(substr($point_color, 1, 2));
|
||||
$green = hexdec(substr($point_color, 3, 2));
|
||||
$blue = hexdec(substr($point_color, 4, 2));
|
||||
$line = array('width' => 1.25, 'color' => array($red, $green, $blue));
|
||||
|
||||
// Trim to remove leading 'POINT(' and trailing ')'
|
||||
$point = substr($spatial, 6, (strlen($spatial) - 7));
|
||||
@ -136,7 +136,8 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares JavaScript related to a row in the GIS dataset to visualize it with OpenLayers.
|
||||
* Prepares JavaScript related to a row in the GIS dataset
|
||||
* to visualize it with OpenLayers.
|
||||
*
|
||||
* @param string $spatial GIS POINT object
|
||||
* @param int $srid Spatial reference ID
|
||||
@ -167,9 +168,10 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
|
||||
$points_arr = $this->extractPoints($point, null);
|
||||
|
||||
$result .= 'vectorLayer.addFeatures(new OpenLayers.Feature.Vector(('
|
||||
. 'new OpenLayers.Geometry.Point(' . $points_arr[0][0] . ', ' . $points_arr[0][1] . ')'
|
||||
. '.transform(new OpenLayers.Projection("EPSG:' . $srid . '"), map.getProjectionObject())),'
|
||||
. ' null, ' . json_encode($style_options) . '));';
|
||||
. 'new OpenLayers.Geometry.Point(' . $points_arr[0][0] . ', '
|
||||
. $points_arr[0][1] . ').transform(new OpenLayers.Projection("EPSG:'
|
||||
. $srid . '"), map.getProjectionObject())), null, '
|
||||
. json_encode($style_options) . '));';
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Handles the visualization of GIS POLYGON objects.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
* @package phpMyAdmin-GIS
|
||||
*/
|
||||
class PMA_GIS_Polygon extends PMA_GIS_Geometry
|
||||
{
|
||||
@ -24,8 +24,8 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
|
||||
public static function singleton()
|
||||
{
|
||||
if (!isset(self::$_instance)) {
|
||||
$c = __CLASS__;
|
||||
self::$_instance = new $c;
|
||||
$class = __CLASS__;
|
||||
self::$_instance = new $class;
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
@ -77,10 +77,10 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
|
||||
public function prepareRowAsPng($spatial, $label, $fill_color, $scale_data, $image)
|
||||
{
|
||||
// allocate colors
|
||||
$r = hexdec(substr($fill_color, 1, 2));
|
||||
$g = hexdec(substr($fill_color, 3, 2));
|
||||
$b = hexdec(substr($fill_color, 4, 2));
|
||||
$color = imagecolorallocate($image, $r, $g, $b);
|
||||
$red = hexdec(substr($fill_color, 1, 2));
|
||||
$green = hexdec(substr($fill_color, 3, 2));
|
||||
$blue = hexdec(substr($fill_color, 4, 2));
|
||||
$color = imagecolorallocate($image, $red, $green, $blue);
|
||||
|
||||
// Trim to remove leading 'POLYGON((' and trailing '))'
|
||||
$polygon = substr($spatial, 9, (strlen($spatial) - 11));
|
||||
@ -122,10 +122,10 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
|
||||
public function prepareRowAsPdf($spatial, $label, $fill_color, $scale_data, $pdf)
|
||||
{
|
||||
// allocate colors
|
||||
$r = hexdec(substr($fill_color, 1, 2));
|
||||
$g = hexdec(substr($fill_color, 3, 2));
|
||||
$b = hexdec(substr($fill_color, 4, 2));
|
||||
$color = array($r, $g, $b);
|
||||
$red = hexdec(substr($fill_color, 1, 2));
|
||||
$green = hexdec(substr($fill_color, 3, 2));
|
||||
$blue = hexdec(substr($fill_color, 4, 2));
|
||||
$color = array($red, $green, $blue);
|
||||
|
||||
// Trim to remove leading 'POLYGON((' and trailing '))'
|
||||
$polygon = substr($spatial, 9, (strlen($spatial) - 11));
|
||||
@ -206,7 +206,8 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares JavaScript related to a row in the GIS dataset to visualize it with OpenLayers.
|
||||
* Prepares JavaScript related to a row in the GIS dataset
|
||||
* to visualize it with OpenLayers.
|
||||
*
|
||||
* @param string $spatial GIS POLYGON object
|
||||
* @param int $srid Spatial reference ID
|
||||
@ -234,34 +235,9 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
|
||||
// Trim to remove leading 'POLYGON((' and trailing '))'
|
||||
$polygon = substr($spatial, 9, (strlen($spatial) - 11));
|
||||
|
||||
$row .= 'vectorLayer.addFeatures(new OpenLayers.Feature.Vector('
|
||||
. 'new OpenLayers.Geometry.Polygon(new Array(';
|
||||
// If the polygon doesnt have an inner polygon
|
||||
if (strpos($polygon, "),(") === false) {
|
||||
$points_arr = $this->extractPoints($polygon, null);
|
||||
$row .= 'new OpenLayers.Geometry.LinearRing(new Array(';
|
||||
foreach ($points_arr as $point) {
|
||||
$row .= '(new OpenLayers.Geometry.Point(' . $point[0] . ', ' . $point[1] . '))'
|
||||
. '.transform(new OpenLayers.Projection("EPSG:' . $srid . '"), map.getProjectionObject()), ';
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
$row .= '))';
|
||||
} else {
|
||||
// Seperate outer and inner polygons
|
||||
$parts = explode("),(", $polygon);
|
||||
foreach ($parts as $ring) {
|
||||
$points_arr = $this->extractPoints($ring, null);
|
||||
$row .= 'new OpenLayers.Geometry.LinearRing(new Array(';
|
||||
foreach ($points_arr as $point) {
|
||||
$row .= '(new OpenLayers.Geometry.Point(' . $point[0] . ', ' . $point[1] . '))'
|
||||
. '.transform(new OpenLayers.Projection("EPSG:' . $srid . '"), map.getProjectionObject()), ';
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
$row .= ')), ';
|
||||
}
|
||||
$row = substr($row, 0, strlen($row) - 2);
|
||||
}
|
||||
$row .= ')), null, ' . json_encode($style_options) . '));';
|
||||
$row .= 'vectorLayer.addFeatures(new OpenLayers.Feature.Vector(';
|
||||
$row .= $this->addPointsForOpenLayersPolygon($polygon, $srid);
|
||||
$row .= 'null, ' . json_encode($style_options) . '));';
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Generates the JavaScripts needed to visualize GIS data.
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
* @package phpMyAdmin-GIS
|
||||
*/
|
||||
class PMA_GIS_Visualization
|
||||
{
|
||||
@ -74,6 +74,8 @@ class PMA_GIS_Visualization
|
||||
|
||||
/**
|
||||
* All the variable initialization, options handling has to be done here.
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
protected function init()
|
||||
{
|
||||
@ -83,6 +85,8 @@ class PMA_GIS_Visualization
|
||||
/**
|
||||
* A function which handles passed parameters. Useful if desired
|
||||
* chart needs to be a little bit different from the default one.
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
private function _handleOptions()
|
||||
{
|
||||
@ -121,6 +125,8 @@ class PMA_GIS_Visualization
|
||||
* @param string $file_name file name
|
||||
* @param string $type mime type
|
||||
* @param string $ext extension of the file
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
private function _toFile($file_name, $type, $ext)
|
||||
{
|
||||
@ -179,6 +185,8 @@ class PMA_GIS_Visualization
|
||||
* Saves as a SVG image to a file.
|
||||
*
|
||||
* @param string $file_name File name
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
public function toFileAsSvg($file_name)
|
||||
{
|
||||
@ -201,7 +209,10 @@ class PMA_GIS_Visualization
|
||||
|
||||
// fill the background
|
||||
$bg = imagecolorallocate($image, 229, 229, 229);
|
||||
imagefilledrectangle($image, 0, 0, $this->_settings['width'] - 1, $this->_settings['height'] - 1, $bg);
|
||||
imagefilledrectangle(
|
||||
$image, 0, 0, $this->_settings['width'] - 1,
|
||||
$this->_settings['height'] - 1, $bg
|
||||
);
|
||||
|
||||
$scale_data = $this->_scaleDataSet($this->_data);
|
||||
$image = $this->_prepareDataSet($this->_data, 0, $scale_data, 'png', $image);
|
||||
@ -234,6 +245,8 @@ class PMA_GIS_Visualization
|
||||
* Saves as a PNG image to a file.
|
||||
*
|
||||
* @param string $file_name File name
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
public function toFileAsPng($file_name)
|
||||
{
|
||||
@ -260,6 +273,8 @@ class PMA_GIS_Visualization
|
||||
* Saves as a PDF to a file.
|
||||
*
|
||||
* @param string $file_name File name
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
public function toFileAsPdf($file_name)
|
||||
{
|
||||
|
||||
@ -110,8 +110,8 @@ if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
|
||||
);
|
||||
$item = '<a href="%1$s?%2$s" class="item">';
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic']) {
|
||||
$separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_' . $GLOBALS['text_dir'] . '.png" width="5" height="9" alt="-" /></span>' . "\n";
|
||||
$item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
|
||||
$separator = ' <span class="separator"><img class="icon ic_item_' . $GLOBALS['text_dir'] . '" src="themes/dot.gif" alt="-" /></span>' . "\n";
|
||||
$item .= ' <img class="icon %5$s" src="themes/dot.gif" alt="" /> ' . "\n";
|
||||
} else {
|
||||
$separator = ' <span class="separator"> - </span>' . "\n";
|
||||
}
|
||||
@ -127,7 +127,7 @@ if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
|
||||
PMA_generate_common_url(),
|
||||
htmlspecialchars($server_info),
|
||||
__('Server'),
|
||||
's_host.png');
|
||||
'ic_s_host');
|
||||
|
||||
if (strlen($GLOBALS['db'])) {
|
||||
|
||||
@ -137,11 +137,10 @@ if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
|
||||
PMA_generate_common_url($GLOBALS['db']),
|
||||
htmlspecialchars($GLOBALS['db']),
|
||||
__('Database'),
|
||||
's_db.png');
|
||||
// if the table is being dropped, $_REQUEST['purge'] is set
|
||||
// (it always contains "1")
|
||||
'ic_s_db');
|
||||
// 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;
|
||||
@ -150,7 +149,7 @@ if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
|
||||
PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
|
||||
str_replace(' ', ' ', htmlspecialchars($GLOBALS['table'])),
|
||||
(isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? __('View') : __('Table')),
|
||||
(isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png');
|
||||
(isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'ic_b_views' : 'ic_s_tbl'));
|
||||
|
||||
/**
|
||||
* Displays table comment
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user