Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
9ba19188ab
@ -142,7 +142,6 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
|
||||
"sql",
|
||||
'libraries/plugins/export/',
|
||||
array(
|
||||
'export_type' => $export_type,
|
||||
'single_table' => isset($single_table)
|
||||
)
|
||||
);
|
||||
|
||||
1049
db_qbe.php
1049
db_qbe.php
File diff suppressed because it is too large
Load Diff
17
export.php
17
export.php
@ -42,8 +42,6 @@ $type = $what;
|
||||
// Check export type
|
||||
if (! isset($export_plugin)) {
|
||||
PMA_fatalError(__('Bad type!'));
|
||||
} else {
|
||||
$export_plugin_properties = $export_plugin->getProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,9 +90,10 @@ if ($_REQUEST['output_format'] == 'astext') {
|
||||
}
|
||||
|
||||
// Does export require to be into file?
|
||||
if (isset($export_plugin_properties['force_file']) && ! $asfile) {
|
||||
|
||||
$message = PMA_Message::error(__('Selected export type has to be saved in file!'));
|
||||
if ($export_plugin->getProperties()->getForceFile() != null && ! $asfile) {
|
||||
$message = PMA_Message::error(
|
||||
__('Selected export type has to be saved in file!')
|
||||
);
|
||||
if ($export_type == 'server') {
|
||||
$active_page = 'server_export.php';
|
||||
include 'server_export.php';
|
||||
@ -326,13 +325,15 @@ if ($asfile) {
|
||||
|
||||
// Grab basic dump extension and mime type
|
||||
// Check if the user already added extension; get the substring where the extension would be if it was included
|
||||
$extension_start_pos = strlen($filename) - strlen($export_plugin_properties['extension']) - 1;
|
||||
$extension_start_pos = strlen($filename) - strlen(
|
||||
$export_plugin->getProperties()->getExtension()
|
||||
) - 1;
|
||||
$user_extension = substr($filename, $extension_start_pos, strlen($filename));
|
||||
$required_extension = "." . $export_plugin_properties['extension'];
|
||||
$required_extension = "." . $export_plugin->getProperties()->getExtension();
|
||||
if (strtolower($user_extension) != $required_extension) {
|
||||
$filename .= $required_extension;
|
||||
}
|
||||
$mime_type = $export_plugin_properties['mime_type'];
|
||||
$mime_type = $export_plugin->getProperties()->getMimeType();
|
||||
|
||||
// If dump is going to be compressed, set correct mime_type and add
|
||||
// compression to extension
|
||||
|
||||
12
import.php
12
import.php
@ -49,6 +49,12 @@ $_SESSION['Import_message']['go_back_url'] = null;
|
||||
// default values
|
||||
$GLOBALS['reload'] = false;
|
||||
|
||||
// Use to identify curren cycle is executing
|
||||
// a multiquery statement or stored routine
|
||||
if (!isset($_SESSION['is_multi_query'])) {
|
||||
$_SESSION['is_multi_query'] = false;
|
||||
}
|
||||
|
||||
// Are we just executing plain query or sql file?
|
||||
// (eg. non import, but query box/window run)
|
||||
if (! empty($sql_query)) {
|
||||
@ -430,6 +436,10 @@ if (! $error && isset($skip)) {
|
||||
unset($skip);
|
||||
}
|
||||
|
||||
// This array contain the data like numberof valid sql queries in the statement
|
||||
// and complete valid sql statement (which affected for rows)
|
||||
$sql_data = array('valid_sql' => array(), 'valid_queries' => 0);
|
||||
|
||||
if (! $error) {
|
||||
// Check for file existance
|
||||
require_once("libraries/plugin_interface.lib.php");
|
||||
@ -445,7 +455,7 @@ if (! $error) {
|
||||
);
|
||||
} else {
|
||||
// Do the real import
|
||||
$import_plugin->doImport();
|
||||
$import_plugin->doImport($sql_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3541,8 +3541,7 @@ class PMA_CommonFunctions
|
||||
if (! empty($extensions)) {
|
||||
$extensions .= '|';
|
||||
}
|
||||
$properties = $import_plugin->getProperties();
|
||||
$extensions .= $properties['extension'];
|
||||
$extensions .= $import_plugin->getProperties()->getExtension();
|
||||
}
|
||||
|
||||
$matcher = '@\.(' . $extensions . ')(\.('
|
||||
|
||||
1278
libraries/DBQbe.class.php
Normal file
1278
libraries/DBQbe.class.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -485,6 +485,10 @@ class PMA_DisplayResults
|
||||
*/
|
||||
private function _isSelect($analyzed_sql)
|
||||
{
|
||||
if (!isset($analyzed_sql[0]['select_expr'])) {
|
||||
$analyzed_sql[0]['select_expr'] = 0;
|
||||
}
|
||||
|
||||
return ! ($this->__get('_is_count') || $this->__get('_is_export')
|
||||
|| $this->__get('_is_func') || $this->__get('_is_analyse'))
|
||||
&& (count($analyzed_sql[0]['select_expr']) == 0)
|
||||
@ -940,7 +944,7 @@ class PMA_DisplayResults
|
||||
private function _getTableHeaders(
|
||||
&$is_display, $analyzed_sql = '',
|
||||
$sort_expression = '', $sort_expression_nodirection = '',
|
||||
$sort_direction = ''
|
||||
$sort_direction = '', $is_limited_display = false
|
||||
) {
|
||||
|
||||
$table_headers_html = '';
|
||||
@ -954,8 +958,9 @@ class PMA_DisplayResults
|
||||
// required to generate sort links that will remember whether the
|
||||
// "Show all" button has been clicked
|
||||
$sql_md5 = md5($this->__get('_sql_query'));
|
||||
$session_max_rows
|
||||
= $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'];
|
||||
$session_max_rows = $is_limited_display
|
||||
? 0
|
||||
: $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'];
|
||||
|
||||
$direction = isset($_SESSION['tmp_user_values']['disp_direction'])
|
||||
? $_SESSION['tmp_user_values']['disp_direction']
|
||||
@ -1002,7 +1007,7 @@ class PMA_DisplayResults
|
||||
$this->__set('_vertical_display', $vertical_display);
|
||||
|
||||
// Display options (if we are not in print view)
|
||||
if (! (isset($printview) && ($printview == '1'))) {
|
||||
if (! (isset($printview) && ($printview == '1')) && ! $is_limited_display) {
|
||||
|
||||
$table_headers_html .= $this->_getOptionsBlock();
|
||||
|
||||
@ -1069,7 +1074,7 @@ class PMA_DisplayResults
|
||||
|
||||
$vertical_display = $this->__get('_vertical_display');
|
||||
|
||||
if ($is_display['sort_lnk'] == '1') {
|
||||
if (($is_display['sort_lnk'] == '1') && ! $is_limited_display) {
|
||||
|
||||
list($order_link, $sorted_headrer_html)
|
||||
= $this->_getOrderLinkAndSortedHeaderHtml(
|
||||
@ -1426,7 +1431,7 @@ class PMA_DisplayResults
|
||||
&& ($direction != self::DISP_DIR_HORIZONTAL_FLIPPED)
|
||||
) {
|
||||
$comments_map = array();
|
||||
if (isset($analyzed_sql[0]) && is_array($analyzed_sql[0])) {
|
||||
if (isset($analyzed_sql[0]) && is_array($analyzed_sql[0]) && isset($analyzed_sql[0]['table_ref'])) {
|
||||
foreach ($analyzed_sql[0]['table_ref'] as $tbl) {
|
||||
$tb = $tbl['table_true_name'];
|
||||
$comments_map[$tb] = PMA_getComments($this->__get('_db'), $tb);
|
||||
@ -2422,8 +2427,9 @@ class PMA_DisplayResults
|
||||
*
|
||||
* @see getTable()
|
||||
*/
|
||||
private function _getTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
|
||||
{
|
||||
private function _getTableBody(
|
||||
&$dt_result, &$is_display, $map, $analyzed_sql, $is_limited_display = false
|
||||
) {
|
||||
|
||||
global $row; // mostly because of browser transformations,
|
||||
// to make the row-data accessible in a plugin
|
||||
@ -2447,8 +2453,9 @@ class PMA_DisplayResults
|
||||
$vertical_display['data'] = array();
|
||||
$vertical_display['row_delete'] = array();
|
||||
$this->__set('_vertical_display', $vertical_display);
|
||||
|
||||
// name of the class added to all grid editable elements
|
||||
$grid_edit_class = 'grid_edit';
|
||||
$grid_edit_class = $is_limited_display ? '' : 'grid_edit';
|
||||
|
||||
// prepare to get the column order, if available
|
||||
list($col_order, $col_visib) = $this->_getColumnParams($analyzed_sql);
|
||||
@ -4246,9 +4253,10 @@ class PMA_DisplayResults
|
||||
*
|
||||
* @see sql.php file
|
||||
*/
|
||||
public function getTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
|
||||
{
|
||||
|
||||
public function getTable(
|
||||
&$dt_result, &$the_disp_mode, $analyzed_sql, $is_limited_display = false
|
||||
) {
|
||||
|
||||
$table_html = '';
|
||||
// Following variable are needed for use in isset/empty or
|
||||
// use with array indexes/safe use in foreach
|
||||
@ -4295,6 +4303,9 @@ class PMA_DisplayResults
|
||||
if ($is_display['nav_bar'] == '1') {
|
||||
list($pos_next, $pos_prev) = $this->_getOffsets();
|
||||
} // end if
|
||||
if (!isset($analyzed_sql[0]['order_by_clause'])) {
|
||||
$analyzed_sql[0]['order_by_clause'] = "";
|
||||
}
|
||||
|
||||
// 1.3 Find the sort expression
|
||||
// we need $sort_expression and $sort_expression_nodirection
|
||||
@ -4394,13 +4405,13 @@ class PMA_DisplayResults
|
||||
// 3. ----- Prepare the results table -----
|
||||
$table_html .= $this->_getTableHeaders(
|
||||
$is_display, $analyzed_sql, $sort_expression,
|
||||
$sort_expression_nodirection, $sort_direction
|
||||
$sort_expression_nodirection, $sort_direction, $is_limited_display
|
||||
)
|
||||
. '<tbody>' . "\n";
|
||||
|
||||
$url_query = '';
|
||||
$table_html .= $this->_getTableBody(
|
||||
$dt_result, $is_display, $map, $analyzed_sql
|
||||
$dt_result, $is_display, $map, $analyzed_sql, $is_limited_display
|
||||
);
|
||||
|
||||
// vertical output case
|
||||
@ -4439,7 +4450,7 @@ class PMA_DisplayResults
|
||||
|
||||
|
||||
// 6. ----- Prepare "Query results operations"
|
||||
if (! isset($printview) || ($printview != '1')) {
|
||||
if ((! isset($printview) || ($printview != '1')) && ! $is_limited_display) {
|
||||
$table_html .= $this->_getResultsOperations(
|
||||
$the_disp_mode, $analyzed_sql
|
||||
);
|
||||
|
||||
@ -319,6 +319,11 @@ class PMA_Table
|
||||
static public function sGetStatusInfo($db, $table, $info = null,
|
||||
$force_read = false, $disable_error = false
|
||||
) {
|
||||
|
||||
if ($_SESSION['is_multi_query']) {
|
||||
$disable_error = true;
|
||||
}
|
||||
|
||||
if (! isset(PMA_Table::$cache[$db][$table]) || $force_read) {
|
||||
PMA_DBI_get_tables_full($db, $table);
|
||||
}
|
||||
|
||||
@ -2490,14 +2490,14 @@ $cfg['BrowseMIME'] = true;
|
||||
*
|
||||
* @global integer $cfg['MaxExactCount']
|
||||
*/
|
||||
$cfg['MaxExactCount'] = 20000;
|
||||
$cfg['MaxExactCount'] = 0;
|
||||
|
||||
/**
|
||||
* Zero means that no row count is done for views; see the doc
|
||||
*
|
||||
* @global integer $cfg['MaxExactCountViews']
|
||||
*/
|
||||
$cfg['MaxExactCountViews'] = 100000;
|
||||
$cfg['MaxExactCountViews'] = 0;
|
||||
|
||||
/**
|
||||
* Sort table and database in natural order
|
||||
|
||||
@ -177,6 +177,29 @@ function PMA_DBI_try_query($query, $link = null, $options = 0,
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run multi query statement and return results
|
||||
*
|
||||
* @param string $multi_query multi query statement to execute
|
||||
* @param mysqli $link mysqli object
|
||||
*
|
||||
* @return mysqli_result collection | boolean(false)
|
||||
*/
|
||||
function PMA_DBI_try_multi_query($multi_query = '', $link = null)
|
||||
{
|
||||
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return PMA_DBI_real_multi_query($link, $multi_query);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* converts charset of a mysql message, usually coming from mysql_error(),
|
||||
* into PMA charset, usally UTF-8
|
||||
|
||||
@ -53,6 +53,24 @@ function PMA_DBI_real_connect($server, $user, $password, $client_flags, $persist
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the multi query and output the results
|
||||
*
|
||||
* @param mysqli $link mysqli object
|
||||
* @param string $query multi query statement to execute
|
||||
*
|
||||
* @return boolean false always false since mysql extention not support
|
||||
* for multi query executions
|
||||
*/
|
||||
function PMA_DBI_real_multi_query($link, $query)
|
||||
{
|
||||
// N.B.: PHP's 'mysql' extension does not support
|
||||
// multi_queries so this function will always
|
||||
// return false. Use the 'mysqli' extension, if
|
||||
// you need support for multi_queries.
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* connects to the database server
|
||||
*
|
||||
|
||||
@ -253,6 +253,19 @@ function PMA_DBI_real_query($query, $link, $options)
|
||||
return mysqli_query($link, $query, $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the multi query and output the results
|
||||
*
|
||||
* @param mysqli $link mysqli object
|
||||
* @param string $query multi query statement to execute
|
||||
*
|
||||
* @return mysqli_result collection | boolean(false)
|
||||
*/
|
||||
function PMA_DBI_real_multi_query($link, $query)
|
||||
{
|
||||
return mysqli_multi_query($link, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns array of rows with associative and numeric keys from $result
|
||||
*
|
||||
@ -354,6 +367,23 @@ function PMA_DBI_next_result($link = null)
|
||||
return mysqli_next_result($link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the result returned from multi query
|
||||
*
|
||||
* @return mixed false when empty results / result set when not empty
|
||||
*/
|
||||
function PMA_DBI_store_result()
|
||||
{
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return mysqli_store_result($link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representing the type of connection used
|
||||
*
|
||||
|
||||
@ -81,7 +81,7 @@ function PMA_detectCompression($filepath)
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
|
||||
function PMA_importRunQuery($sql = '', $full = '', $controluser = false, &$sql_data = array())
|
||||
{
|
||||
global $import_run_buffer, $go_sql, $complete_query, $display_query,
|
||||
$sql_query, $my_die, $error, $reload,
|
||||
@ -97,6 +97,14 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
|
||||
if (! empty($import_run_buffer['sql'])
|
||||
&& trim($import_run_buffer['sql']) != ''
|
||||
) {
|
||||
|
||||
// USE query changes the database, son need to track
|
||||
// while running multiple queries
|
||||
$is_use_query
|
||||
= (stripos($import_run_buffer['sql'], "use ") !== false)
|
||||
? true
|
||||
: false;
|
||||
|
||||
$max_sql_len = max($max_sql_len, strlen($import_run_buffer['sql']));
|
||||
if (! $sql_query_disabled) {
|
||||
$sql_query .= $import_run_buffer['full'];
|
||||
@ -108,7 +116,9 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
|
||||
$GLOBALS['message'] = PMA_Message::error(__('"DROP DATABASE" statements are disabled.'));
|
||||
$error = true;
|
||||
} else {
|
||||
|
||||
$executed_queries++;
|
||||
|
||||
if ($run_query
|
||||
&& $GLOBALS['finished']
|
||||
&& empty($sql)
|
||||
@ -126,6 +136,9 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
|
||||
$display_query = '';
|
||||
}
|
||||
$sql_query = $import_run_buffer['sql'];
|
||||
$sql_data['valid_sql'][] = $import_run_buffer['sql'];
|
||||
$sql_data['valid_queries']++;
|
||||
|
||||
// If a 'USE <db>' SQL-clause was found,
|
||||
// set our current $db to the new one
|
||||
list($db, $reload) = PMA_lookForUse(
|
||||
@ -134,6 +147,7 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
|
||||
$reload
|
||||
);
|
||||
} elseif ($run_query) {
|
||||
|
||||
if ($controluser) {
|
||||
$result = PMA_queryAsControlUser(
|
||||
$import_run_buffer['sql']
|
||||
@ -141,6 +155,7 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
|
||||
} else {
|
||||
$result = PMA_DBI_try_query($import_run_buffer['sql']);
|
||||
}
|
||||
|
||||
$msg = '# ';
|
||||
if ($result === false) { // execution failed
|
||||
if (! isset($my_die)) {
|
||||
@ -169,6 +184,12 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
|
||||
} else {
|
||||
$msg .= __('MySQL returned an empty result set (i.e. zero rows).');
|
||||
}
|
||||
|
||||
if (($a_num_rows > 0) || $is_use_query) {
|
||||
$sql_data['valid_sql'][] = $import_run_buffer['sql'];
|
||||
$sql_data['valid_queries']++;
|
||||
}
|
||||
|
||||
}
|
||||
if (! $sql_query_disabled) {
|
||||
$sql_query .= $msg . "\n";
|
||||
|
||||
@ -129,14 +129,21 @@ function PMA_pluginCheckboxCheck($section, $opt)
|
||||
*/
|
||||
function PMA_pluginGetDefault($section, $opt)
|
||||
{
|
||||
if (isset($_GET[$opt])) { // If the form is being repopulated using $_GET data, that is priority
|
||||
if (isset($_GET[$opt])) {
|
||||
// If the form is being repopulated using $_GET data, that is priority
|
||||
return htmlspecialchars($_GET[$opt]);
|
||||
} elseif (isset($GLOBALS['timeout_passed']) && $GLOBALS['timeout_passed'] && isset($_REQUEST[$opt])) {
|
||||
} elseif (isset($GLOBALS['timeout_passed'])
|
||||
&& $GLOBALS['timeout_passed']
|
||||
&& isset($_REQUEST[$opt])) {
|
||||
return htmlspecialchars($_REQUEST[$opt]);
|
||||
} elseif (isset($GLOBALS['cfg'][$section][$opt])) {
|
||||
$matches = array();
|
||||
/* Possibly replace localised texts */
|
||||
if (preg_match_all('/(str[A-Z][A-Za-z0-9]*)/', $GLOBALS['cfg'][$section][$opt], $matches)) {
|
||||
if (preg_match_all(
|
||||
'/(str[A-Z][A-Za-z0-9]*)/',
|
||||
$GLOBALS['cfg'][$section][$opt],
|
||||
$matches
|
||||
)) {
|
||||
$val = $GLOBALS['cfg'][$section][$opt];
|
||||
foreach ($matches[0] as $match) {
|
||||
if (isset($GLOBALS[$match])) {
|
||||
@ -172,7 +179,6 @@ function PMA_pluginGetChoice($section, $name, &$list, $cfgname = null)
|
||||
$default = PMA_pluginGetDefault($section, $cfgname);
|
||||
foreach ($list as $plugin) {
|
||||
$plugin_name = strtolower(substr(get_class($plugin), strlen($section)));
|
||||
$properties = $plugin->getProperties();
|
||||
$ret .= '<option';
|
||||
// If the form is being repopulated using $_GET data, that is priority
|
||||
if (isset($_GET[$name])
|
||||
@ -183,7 +189,7 @@ function PMA_pluginGetChoice($section, $name, &$list, $cfgname = null)
|
||||
$ret .= ' selected="selected"';
|
||||
}
|
||||
$ret .= ' value="' . $plugin_name . '">'
|
||||
. PMA_getString($properties['text'])
|
||||
. PMA_getString($plugin->getProperties()->getText())
|
||||
. '</option>' . "\n";
|
||||
}
|
||||
$ret .= '</select>' . "\n";
|
||||
@ -191,9 +197,9 @@ function PMA_pluginGetChoice($section, $name, &$list, $cfgname = null)
|
||||
// Whether each plugin has to be saved as a file
|
||||
foreach ($list as $plugin) {
|
||||
$plugin_name = strtolower(substr(get_class($plugin), strlen($section)));
|
||||
$properties = $plugin->getProperties();
|
||||
$ret .= '<input type="hidden" id="force_file_' . $plugin_name . '" value="';
|
||||
if (isset($properties['force_file'])) {
|
||||
$ret .= '<input type="hidden" id="force_file_' . $plugin_name
|
||||
. '" value="';
|
||||
if ($plugin->getProperties()->getForceFile() != null) {
|
||||
$ret .= 'true';
|
||||
} else {
|
||||
$ret .= 'false';
|
||||
@ -206,108 +212,207 @@ function PMA_pluginGetChoice($section, $name, &$list, $cfgname = null)
|
||||
/**
|
||||
* Returns single option in a list element
|
||||
*
|
||||
* @param string $section name of config section in
|
||||
* $GLOBALS['cfg'][$section] for plugin
|
||||
* @param string $plugin_name unique plugin name
|
||||
* @param string $id option id
|
||||
* @param array &$opt plugin option details
|
||||
* @param string $section name of config section in
|
||||
* $GLOBALS['cfg'][$section] for plugin
|
||||
* @param string $plugin_name unique plugin name
|
||||
* @param array &$propertyGroup options property main group instance
|
||||
*
|
||||
* @return string table row with option
|
||||
*/
|
||||
function PMA_pluginGetOneOption($section, $plugin_name, $id, &$opt)
|
||||
{
|
||||
function PMA_pluginGetOneOption(
|
||||
$section,
|
||||
$plugin_name,
|
||||
&$propertyGroup,
|
||||
$is_subgroup = false
|
||||
) {
|
||||
$ret = "\n";
|
||||
if ($opt['type'] == 'bool') {
|
||||
$ret .= '<li>' . "\n";
|
||||
$ret .= '<input type="checkbox" name="' . $plugin_name . '_' . $opt['name'] . '"'
|
||||
. ' value="something" id="checkbox_' . $plugin_name . '_' . $opt['name'] . '"'
|
||||
. ' ' . PMA_pluginCheckboxCheck($section, $plugin_name . '_' . $opt['name']);
|
||||
if (isset($opt['force'])) {
|
||||
/* Same code is also few lines lower, update both if needed */
|
||||
$ret .= ' onclick="if (!this.checked && '
|
||||
. '(!document.getElementById(\'checkbox_' . $plugin_name . '_' .$opt['force'] . '\') '
|
||||
. '|| !document.getElementById(\'checkbox_' . $plugin_name . '_' .$opt['force'] . '\').checked)) '
|
||||
. 'return false; else return true;"';
|
||||
}
|
||||
$ret .= ' />';
|
||||
$ret .= '<label for="checkbox_' . $plugin_name . '_' . $opt['name'] . '">'
|
||||
. PMA_getString($opt['text']) . '</label>';
|
||||
} elseif ($opt['type'] == 'text') {
|
||||
$ret .= '<li>' . "\n";
|
||||
$ret .= '<label for="text_' . $plugin_name . '_' . $opt['name'] . '" class="desc">'
|
||||
. PMA_getString($opt['text']) . '</label>';
|
||||
$ret .= '<input type="text" name="' . $plugin_name . '_' . $opt['name'] . '"'
|
||||
. ' value="' . PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']) . '"'
|
||||
. ' id="text_' . $plugin_name . '_' . $opt['name'] . '"'
|
||||
. (isset($opt['size']) ? ' size="' . $opt['size'] . '"' : '')
|
||||
. (isset($opt['len']) ? ' maxlength="' . $opt['len'] . '"' : '') . ' />';
|
||||
} elseif ($opt['type'] == 'message_only') {
|
||||
$ret .= '<li>' . "\n";
|
||||
$ret .= '<p>' . PMA_getString($opt['text']) . '</p>';
|
||||
} elseif ($opt['type'] == 'select') {
|
||||
$ret .= '<li>' . "\n";
|
||||
$ret .= '<label for="select_' . $plugin_name . '_' . $opt['name'] . '" class="desc">'
|
||||
. PMA_getString($opt['text']) . '</label>';
|
||||
$ret .= '<select name="' . $plugin_name . '_' . $opt['name'] . '"'
|
||||
. ' id="select_' . $plugin_name . '_' . $opt['name'] . '">';
|
||||
$default = PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']);
|
||||
foreach ($opt['values'] as $key => $val) {
|
||||
$ret .= '<option value="' . $key . '"';
|
||||
if ($key == $default) {
|
||||
$ret .= ' selected="selected"';
|
||||
}
|
||||
$ret .= '>' . PMA_getString($val) . '</option>';
|
||||
}
|
||||
$ret .= '</select>';
|
||||
} elseif ($opt['type'] == 'radio') {
|
||||
$default = PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']);
|
||||
foreach ($opt['values'] as $key => $val) {
|
||||
$ret .= '<li><input type="radio" name="' . $plugin_name . '_' . $opt['name'] . '" value="' . $key
|
||||
. '" id="radio_' . $plugin_name . '_' . $opt['name'] . '_' . $key . '"';
|
||||
if ($key == $default) {
|
||||
$ret .= ' checked="checked"';
|
||||
}
|
||||
$ret .= ' />' . '<label for="radio_' . $plugin_name . '_' . $opt['name'] . '_' . $key . '">'
|
||||
. PMA_getString($val) . '</label></li>';
|
||||
}
|
||||
} elseif ($opt['type'] == 'hidden') {
|
||||
$ret .= '<li><input type="hidden" name="' . $plugin_name . '_' . $opt['name'] . '"'
|
||||
. ' value="' . PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']) . '"' . ' /></li>';
|
||||
} elseif ($opt['type'] == 'begin_group') {
|
||||
$ret .= '<div class="export_sub_options" id="' . $plugin_name . '_' . $opt['name'] . '">';
|
||||
if (isset($opt['text'])) {
|
||||
$ret .= '<h4>' . PMA_getString($opt['text']) . '</h4>';
|
||||
}
|
||||
$ret .= '<ul>';
|
||||
} elseif ($opt['type'] == 'end_group') {
|
||||
$ret .= '</ul></div>';
|
||||
} elseif ($opt['type'] == 'begin_subgroup') {
|
||||
/* each subgroup can have a header, which may also be a form element */
|
||||
$ret .= PMA_pluginGetOneOption($section, $plugin_name, $id, $opt['subgroup_header']) . '<li class="subgroup"><ul';
|
||||
if (isset($opt['subgroup_header']['name'])) {
|
||||
$ret .= ' id="ul_' . $opt['subgroup_header']['name'] . '">';
|
||||
|
||||
if (! $is_subgroup) {
|
||||
// for subgroup headers
|
||||
if (strpos(get_class($propertyGroup), "PropertyItem")) {
|
||||
$properties = array($propertyGroup);
|
||||
} else {
|
||||
$ret .= '>';
|
||||
}
|
||||
} elseif ($opt['type'] == 'end_subgroup') {
|
||||
$ret .= '</ul></li>';
|
||||
} else {
|
||||
/* This should be seen only by plugin writers, so I do not thing this
|
||||
* needs translation. */
|
||||
$ret .= 'UNKNOWN OPTION ' . $opt['type'] . ' IN IMPORT PLUGIN ' . $plugin_name . '!';
|
||||
}
|
||||
if (isset($opt['doc'])) {
|
||||
if (count($opt['doc']) == 3) {
|
||||
$ret .= PMA_CommonFunctions::getInstance()->showMySQLDocu($opt['doc'][0], $opt['doc'][1], false, $opt['doc'][2]);
|
||||
} elseif (count($opt['doc']) == 1) {
|
||||
$ret .= PMA_CommonFunctions::getInstance()->showDocu($opt['doc'][0]);
|
||||
} else {
|
||||
$ret .= PMA_CommonFunctions::getInstance()->showMySQLDocu($opt['doc'][0], $opt['doc'][1]);
|
||||
// for main groups
|
||||
$ret .= '<div class="export_sub_options" id="' . $plugin_name . '_'
|
||||
. $propertyGroup->getName() . '">';
|
||||
if ($propertyGroup->getText() != null) {
|
||||
$ret .= '<h4>' . PMA_getString($propertyGroup->getText()) . '</h4>';
|
||||
}
|
||||
$ret .= '<ul>';
|
||||
}
|
||||
}
|
||||
|
||||
// Close the list element after $opt['doc'] link is displayed
|
||||
if ($opt['type'] == 'bool' || $opt['type'] == 'text' || $opt['type'] == 'message_only' || $opt['type'] == 'select') {
|
||||
|
||||
if ($properties == null) {
|
||||
$not_subgroup_header = true;
|
||||
$properties = $propertyGroup->getProperties();
|
||||
}
|
||||
foreach ($properties as $propertyItem) {
|
||||
$property_class = get_class($propertyItem);
|
||||
// if the property is a subgroup, we deal with it recursively
|
||||
if (strpos($property_class, "Subgroup")) {
|
||||
// for subgroups
|
||||
// each subgroup can have a header, which may also be a form element
|
||||
$subgroup_header = $propertyItem->getSubgroupHeader();
|
||||
if (isset($subgroup_header)) {
|
||||
$ret .= PMA_pluginGetOneOption(
|
||||
$section,
|
||||
$plugin_name,
|
||||
$subgroup_header
|
||||
);
|
||||
}
|
||||
|
||||
$ret .= '<li class="subgroup"><ul';
|
||||
if (isset($subgroup_header)) {
|
||||
$ret .= ' id="ul_' . $subgroup_header->getName() . '">';
|
||||
} else {
|
||||
$ret .= '>';
|
||||
}
|
||||
|
||||
$ret .= PMA_pluginGetOneOption(
|
||||
$section,
|
||||
$plugin_name,
|
||||
$propertyItem,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
// single property item
|
||||
switch ($property_class) {
|
||||
case "BoolPropertyItem":
|
||||
$ret .= '<li>' . "\n";
|
||||
$ret .= '<input type="checkbox" name="' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '"'
|
||||
. ' value="something" id="checkbox_' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '"'
|
||||
. ' ' . PMA_pluginCheckboxCheck($section, $plugin_name . '_'
|
||||
. $propertyItem->getName());
|
||||
|
||||
if ($propertyItem->getForce() != null) {
|
||||
// Same code is also few lines lower, update both if needed
|
||||
$ret .= ' onclick="if (!this.checked && '
|
||||
. '(!document.getElementById(\'checkbox_' . $plugin_name
|
||||
. '_' . $propertyItem->getForce() . '\') '
|
||||
. '|| !document.getElementById(\'checkbox_'
|
||||
. $plugin_name . '_' . $propertyItem->getForce()
|
||||
. '\').checked)) '
|
||||
. 'return false; else return true;"';
|
||||
}
|
||||
$ret .= ' />';
|
||||
$ret .= '<label for="checkbox_' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '">'
|
||||
. PMA_getString($propertyItem->getText()) . '</label>';
|
||||
break;
|
||||
case "DocPropertyItem":
|
||||
echo "DocPropertyItem";
|
||||
break;
|
||||
case "HiddenPropertyItem":
|
||||
$ret .= '<li><input type="hidden" name="' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '"'
|
||||
. ' value="' . PMA_pluginGetDefault($section, $plugin_name
|
||||
. '_' . $propertyItem->getName()) . '"' . ' /></li>';
|
||||
break;
|
||||
case "MessageOnlyPropertyItem":
|
||||
$ret .= '<li>' . "\n";
|
||||
$ret .= '<p>' . PMA_getString($propertyItem->getText()) . '</p>';
|
||||
break;
|
||||
case "RadioPropertyItem":
|
||||
$default = PMA_pluginGetDefault($section, $plugin_name . '_'
|
||||
. $propertyItem->getName());
|
||||
foreach ($propertyItem->getValues() as $key => $val) {
|
||||
$ret .= '<li><input type="radio" name="' . $plugin_name
|
||||
. '_' . $propertyItem->getName() . '" value="' . $key
|
||||
. '" id="radio_' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '_' . $key . '"';
|
||||
if ($key == $default) {
|
||||
$ret .= ' checked="checked"';
|
||||
}
|
||||
$ret .= ' />' . '<label for="radio_' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '_' . $key . '">'
|
||||
. PMA_getString($val) . '</label></li>';
|
||||
}
|
||||
break;
|
||||
case "SelectPropertyItem":
|
||||
$ret .= '<li>' . "\n";
|
||||
$ret .= '<label for="select_' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '" class="desc">'
|
||||
. PMA_getString($propertyItem->getText()) . '</label>';
|
||||
$ret .= '<select name="' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '"'
|
||||
. ' id="select_' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '">';
|
||||
$default = PMA_pluginGetDefault(
|
||||
$section,
|
||||
$plugin_name . '_' . $propertyItem->getName()
|
||||
);
|
||||
foreach ($propertyItem->getValues() as $key => $val) {
|
||||
$ret .= '<option value="' . $key . '"';
|
||||
if ($key == $default) {
|
||||
$ret .= ' selected="selected"';
|
||||
}
|
||||
$ret .= '>' . PMA_getString($val) . '</option>';
|
||||
}
|
||||
$ret .= '</select>';
|
||||
break;
|
||||
case "TextPropertyItem":
|
||||
$ret .= '<li>' . "\n";
|
||||
$ret .= '<label for="text_' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '" class="desc">'
|
||||
. PMA_getString($propertyItem->getText()) . '</label>';
|
||||
$ret .= '<input type="text" name="' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '"'
|
||||
. ' value="' . PMA_pluginGetDefault($section, $plugin_name
|
||||
. '_' . $propertyItem->getName()) . '"'
|
||||
. ' id="text_' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '"'
|
||||
. ($propertyItem->getSize() != null
|
||||
? ' size="' . $propertyItem->getSize() . '"'
|
||||
: '')
|
||||
. ($propertyItem->getLen() != null
|
||||
? ' maxlength="' . $propertyItem->getLen() . '"'
|
||||
: '')
|
||||
. ' />';
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_subgroup) {
|
||||
// end subgroup
|
||||
$ret .= '</ul></li>';
|
||||
} else {
|
||||
// end main group
|
||||
if ($not_subgroup_header)
|
||||
$ret .= '</ul></div>';
|
||||
}
|
||||
|
||||
if (method_exists($propertyGroup, "getDoc")){
|
||||
$doc = $propertyGroup->getDoc();
|
||||
if ($doc != null) {
|
||||
if (count($doc) == 3) {
|
||||
$ret .= PMA_CommonFunctions::getInstance()->showMySQLDocu(
|
||||
$doc[0],
|
||||
$doc[1],
|
||||
false,
|
||||
$doc[2]
|
||||
);
|
||||
} elseif (count($doc) == 1) {
|
||||
$ret .= PMA_CommonFunctions::getInstance()->showDocu($doc[0]);
|
||||
} else {
|
||||
$ret .= PMA_CommonFunctions::getInstance()->showMySQLDocu(
|
||||
$doc[0],
|
||||
$doc[1]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Close the list element after $doc link is displayed
|
||||
if ($property_class == 'BoolPropertyItem'
|
||||
|| $property_class == 'MessageOnlyPropertyItem'
|
||||
|| $property_class == 'SelectPropertyItem'
|
||||
|| $property_class == 'TextPropertyItem'
|
||||
) {
|
||||
$ret .= '</li>';
|
||||
}
|
||||
$ret .= "\n";
|
||||
@ -329,27 +434,38 @@ function PMA_pluginGetOptions($section, &$list)
|
||||
// Options for plugins that support them
|
||||
foreach ($list as $plugin) {
|
||||
$plugin_name = strtolower(substr(get_class($plugin), strlen($section)));
|
||||
$properties = $plugin->getProperties();
|
||||
$ret .= '<div id="' . $plugin_name . '_options" class="format_specific_options">';
|
||||
$count = 0;
|
||||
$ret .= '<h3>' . PMA_getString($properties['text']) . '</h3>';
|
||||
if (isset($properties['options']) && count($properties['options']) > 0) {
|
||||
foreach ($properties['options'] as $id => $opt) {
|
||||
if ($opt['type'] != 'hidden'
|
||||
&& $opt['type'] != 'begin_group'
|
||||
&& $opt['type'] != 'end_group'
|
||||
&& $opt['type'] != 'begin_subgroup'
|
||||
&& $opt['type'] != 'end_subgroup'
|
||||
) {
|
||||
$count++;
|
||||
$ret .= '<div id="' . $plugin_name
|
||||
. '_options" class="format_specific_options">';
|
||||
$ret .= '<h3>' . PMA_getString($plugin->getProperties()->getText())
|
||||
. '</h3>';
|
||||
|
||||
if ($plugin->getProperties()->getOptions() != null
|
||||
&& count($plugin->getProperties()->getOptions()) > 0
|
||||
) {
|
||||
foreach ($plugin->getProperties()->getOptions()->getProperties()
|
||||
as $propertyMainGroup
|
||||
) {
|
||||
// check for hidden properties
|
||||
$no_options = true;
|
||||
foreach ($propertyMainGroup->getProperties() as $propertyItem) {
|
||||
if (strcmp("HiddenPropertyItem", get_class($propertyItem))) {
|
||||
$no_options = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$ret .= PMA_pluginGetOneOption($section, $plugin_name, $id, $opt);
|
||||
|
||||
$ret .= PMA_pluginGetOneOption(
|
||||
$section,
|
||||
$plugin_name,
|
||||
$propertyMainGroup
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($count == 0) {
|
||||
|
||||
if ($no_options) {
|
||||
$ret .= '<p>' . __('This format has no options') . '</p>';
|
||||
}
|
||||
$ret .= '</div>';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
@ -75,33 +75,43 @@ class ExportCodegen extends ExportPlugin
|
||||
*/
|
||||
protected function setProperties()
|
||||
{
|
||||
$this->properties = array(
|
||||
'text' => 'CodeGen',
|
||||
'extension' => 'cs',
|
||||
'mime_type' => 'text/cs',
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/HiddenPropertyItem.class.php";
|
||||
require_once "$props/options/items/SelectPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'] = array(
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts'
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'structure_or_data'
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'format',
|
||||
'text' => __('Format:'),
|
||||
'values' => $this->_getCgFormats()
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
)
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('CodeGen');
|
||||
$exportPluginProperties->setExtension('cs');
|
||||
$exportPluginProperties->setMimeType('text/cs');
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// general options main group
|
||||
$generalOptions = new OptionsPropertyMainGroup();
|
||||
$generalOptions->setName("general_opts");
|
||||
// create primary items and add them to the group
|
||||
$leaf = new HiddenPropertyItem();
|
||||
$leaf->setName("structure_or_data");
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new SelectPropertyItem();
|
||||
$leaf->setName("format");
|
||||
$leaf->setText(__('Format:'));
|
||||
$leaf->setValues($this->_getCgFormats());
|
||||
$generalOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($generalOptions);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -83,64 +83,68 @@ class ExportCsv extends ExportPlugin
|
||||
*/
|
||||
protected function setProperties()
|
||||
{
|
||||
$this->properties = array(
|
||||
'text' => __('CSV'),
|
||||
'extension' => 'csv',
|
||||
'mime_type' => 'text/comma-separated-values',
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/TextPropertyItem.class.php";
|
||||
require_once "$props/options/items/BoolPropertyItem.class.php";
|
||||
require_once "$props/options/items/HiddenPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'] = array(
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'separator',
|
||||
'text' => __('Columns separated with:')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'enclosed',
|
||||
'text' => __('Columns enclosed with:')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'escaped',
|
||||
'text' => __('Columns escaped with:')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'terminated',
|
||||
'text' => __('Lines terminated with:')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'null',
|
||||
'text' => __('Replace NULL with:')
|
||||
),
|
||||
array(
|
||||
'type' => 'bool',
|
||||
'name' => 'removeCRLF',
|
||||
'text' => __(
|
||||
'Remove carriage return/line feed characters within columns'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'bool',
|
||||
'name' => 'columns',
|
||||
'text' => __('Put columns names in the first row')
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'structure_or_data'
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
)
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('CSV');
|
||||
$exportPluginProperties->setExtension('csv');
|
||||
$exportPluginProperties->setMimeType('text/comma-separated-values');
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// general options main group
|
||||
$generalOptions = new OptionsPropertyMainGroup();
|
||||
$generalOptions->setName("general_opts");
|
||||
// create leaf items and add them to the group
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("separator");
|
||||
$leaf->setText(__('Columns separated with:'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("enclosed");
|
||||
$leaf->setText(__('Columns enclosed with:'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("escaped");
|
||||
$leaf->setText(__('Columns escaped with:'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("terminated");
|
||||
$leaf->setText(__('Lines terminated with:'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName('null');
|
||||
$leaf->setText(__('Replace NULL with:'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('removeCRLF');
|
||||
$leaf->setText(__(
|
||||
'Remove carriage return/line feed characters within columns'
|
||||
));
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('columns');
|
||||
$leaf->setText(__('Put columns names in the first row'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new HiddenPropertyItem();
|
||||
$leaf->setName('structure_or_data');
|
||||
$generalOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($generalOptions);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -27,53 +27,62 @@ class ExportExcel extends ExportCsv
|
||||
*/
|
||||
protected function setProperties()
|
||||
{
|
||||
$this->properties = array(
|
||||
'text' => __('CSV for MS Excel'),
|
||||
'extension' => 'csv',
|
||||
'mime_type' => 'text/comma-separated-values',
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/TextPropertyItem.class.php";
|
||||
require_once "$props/options/items/BoolPropertyItem.class.php";
|
||||
require_once "$props/options/items/SelectPropertyItem.class.php";
|
||||
require_once "$props/options/items/HiddenPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'] = array(
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'null',
|
||||
'text' => __('Replace NULL with:')
|
||||
),
|
||||
array(
|
||||
'type' => 'bool',
|
||||
'name' => 'removeCRLF',
|
||||
'text' => __(
|
||||
'Remove carriage return/line feed characters within columns'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'bool',
|
||||
'name' => 'columns',
|
||||
'text' => __('Put columns names in the first row')
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'edition',
|
||||
'values' => array(
|
||||
'win' => 'Windows',
|
||||
'mac_excel2003' => 'Excel 2003 / Macintosh',
|
||||
'mac_excel2008' => 'Excel 2008 / Macintosh'),
|
||||
'text' => __('Excel edition:')
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'structure_or_data'
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
)
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('CSV for MS Excel');
|
||||
$exportPluginProperties->setExtension('csv');
|
||||
$exportPluginProperties->setMimeType('text/comma-separated-values');
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// general options main group
|
||||
$generalOptions = new OptionsPropertyMainGroup();
|
||||
$generalOptions->setName("general_opts");
|
||||
// create primary items and add them to the group
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName('null');
|
||||
$leaf->setText(__('Replace NULL with:'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('removeCRLF');
|
||||
$leaf->setText(__(
|
||||
'Remove carriage return/line feed characters within columns'
|
||||
));
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('columns');
|
||||
$leaf->setText(__('Put columns names in the first row'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new SelectPropertyItem();
|
||||
$leaf->setName('edition');
|
||||
$leaf->setValues(array(
|
||||
'win' => 'Windows',
|
||||
'mac_excel2003' => 'Excel 2003 / Macintosh',
|
||||
'mac_excel2008' => 'Excel 2008 / Macintosh'
|
||||
));
|
||||
$leaf->setText(__('Excel edition:'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new HiddenPropertyItem();
|
||||
$leaf->setName('structure_or_data');
|
||||
$generalOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($generalOptions);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -35,56 +35,63 @@ class ExportHtmlword extends ExportPlugin
|
||||
*/
|
||||
protected function setProperties()
|
||||
{
|
||||
$this->properties = array(
|
||||
'text' => __('Microsoft Word 2000'),
|
||||
'extension' => 'doc',
|
||||
'mime_type' => 'application/vnd.ms-word',
|
||||
'force_file' => true,
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/RadioPropertyItem.class.php";
|
||||
require_once "$props/options/items/TextPropertyItem.class.php";
|
||||
require_once "$props/options/items/BoolPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'] = array(
|
||||
/* what to dump (structure/data/both) */
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'dump_what',
|
||||
'text' => __('Dump table')
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'name' => 'structure_or_data',
|
||||
'values' => array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
),
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('Microsoft Word 2000');
|
||||
$exportPluginProperties->setExtension('doc');
|
||||
$exportPluginProperties->setMimeType('application/vnd.ms-word');
|
||||
$exportPluginProperties->setForceFile(true);
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
/* data options */
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'data',
|
||||
'text' => __('Data dump options'),
|
||||
'force' => 'structure'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'null',
|
||||
'text' => __('Replace NULL with:')
|
||||
),
|
||||
array(
|
||||
'type' => 'bool',
|
||||
'name' => 'columns',
|
||||
'text' => __('Put columns names in the first row')
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
)
|
||||
);
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// what to dump (structure/data/both)
|
||||
$dumpWhat = new OptionsPropertyMainGroup();
|
||||
$dumpWhat->setName("dump_what");
|
||||
$dumpWhat->setText(__('Dump table'));
|
||||
// create primary items and add them to the group
|
||||
$leaf = new RadioPropertyItem();
|
||||
$leaf->setName("structure_or_data");
|
||||
$leaf->setValues(array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
));
|
||||
$dumpWhat->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($dumpWhat);
|
||||
|
||||
// data options main group
|
||||
$dataOptions = new OptionsPropertyMainGroup();
|
||||
$dataOptions->setName("dump_what");
|
||||
$dataOptions->setText(__('Data dump options'));
|
||||
$dataOptions->setForce('structure');
|
||||
// create primary items and add them to the group
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("null");
|
||||
$leaf->setText(__('Replace NULL with:'));
|
||||
$dataOptions->addProperty($leaf);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("columns");
|
||||
$leaf->setText(__('Put columns names in the first row'));
|
||||
$dataOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($dataOptions);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -590,10 +597,10 @@ class ExportHtmlword extends ExportPlugin
|
||||
$column, $unique_keys
|
||||
) {
|
||||
$definition = '<tr class="print-category">';
|
||||
|
||||
|
||||
$extracted_columnspec
|
||||
= PMA_CommonFunctions::getInstance()->extractColumnSpec($column['Type']);
|
||||
|
||||
|
||||
$type = htmlspecialchars($extracted_columnspec['print_type']);
|
||||
if (empty($type)) {
|
||||
$type = ' ';
|
||||
|
||||
@ -35,27 +35,37 @@ class ExportJson extends ExportPlugin
|
||||
*/
|
||||
protected function setProperties()
|
||||
{
|
||||
$this->properties = array(
|
||||
'text' => 'JSON',
|
||||
'extension' => 'json',
|
||||
'mime_type' => 'text/plain',
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/HiddenPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'] = array(
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts'
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'structure_or_data',
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
)
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('JSON');
|
||||
$exportPluginProperties->setExtension('json');
|
||||
$exportPluginProperties->setMimeType('text/plain');
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// general options main group
|
||||
$generalOptions = new OptionsPropertyMainGroup();
|
||||
$generalOptions->setName("general_opts");
|
||||
// create primary items and add them to the group
|
||||
$leaf = new HiddenPropertyItem();
|
||||
$leaf->setName("structure_or_data");
|
||||
$generalOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($generalOptions);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -59,136 +59,130 @@ class ExportLatex extends ExportPlugin
|
||||
$hide_structure = true;
|
||||
}
|
||||
|
||||
$this->properties = array(
|
||||
'text' => __('LaTeX'),
|
||||
'extension' => 'tex',
|
||||
'mime_type' => 'application/x-tex',
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/BoolPropertyItem.class.php";
|
||||
require_once "$props/options/items/RadioPropertyItem.class.php";
|
||||
require_once "$props/options/items/TextPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'] = array(
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts'
|
||||
),
|
||||
array(
|
||||
'type' => 'bool',
|
||||
'name' => 'caption',
|
||||
'text' => __('Include table caption')
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
)
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('LaTeX');
|
||||
$exportPluginProperties->setExtension('tex');
|
||||
$exportPluginProperties->setMimeType('application/x-tex');
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
/* what to dump (structure/data/both) */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'dump_what',
|
||||
'text' => __('Dump table')
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'radio',
|
||||
'name' => 'structure_or_data',
|
||||
'values' => array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
)
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_group'
|
||||
);
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
/* Structure options */
|
||||
// general options main group
|
||||
$generalOptions = new OptionsPropertyMainGroup();
|
||||
$generalOptions->setName("general_opts");
|
||||
// create primary items and add them to the group
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("caption");
|
||||
$leaf->setText(__('Include table caption'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($generalOptions);
|
||||
|
||||
// what to dump (structure/data/both) main group
|
||||
$dumpWhat = new OptionsPropertyMainGroup();
|
||||
$dumpWhat->setName("dump_what");
|
||||
$dumpWhat->setText(__('Dump table'));
|
||||
// create primary items and add them to the group
|
||||
$leaf = new RadioPropertyItem();
|
||||
$leaf->setName("structure_or_data");
|
||||
$leaf->setValues(array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
));
|
||||
$dumpWhat->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($dumpWhat);
|
||||
|
||||
// structure options main group
|
||||
if (! $hide_structure) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'structure',
|
||||
'text' => __('Object creation options'),
|
||||
'force' => 'data'
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'text',
|
||||
'name' => 'structure_caption',
|
||||
'text' => __('Table caption'),
|
||||
'doc' => 'faq6_27'
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'text',
|
||||
'name' => 'structure_continued_caption',
|
||||
'text' => __('Table caption (continued)'),
|
||||
'doc' => 'faq6_27'
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'text',
|
||||
'name' => 'structure_label',
|
||||
'text' => __('Label key'),
|
||||
'doc' => 'faq6_27'
|
||||
);
|
||||
$structureOptions = new OptionsPropertyMainGroup();
|
||||
$structureOptions->setName("structure");
|
||||
$structureOptions->setText(__('Object creation options'));
|
||||
$structureOptions->setForce('data');
|
||||
// create primary items and add them to the group
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("structure_caption");
|
||||
$leaf->setText(__('Table caption'));
|
||||
$leaf->setDoc('faq6_27');
|
||||
$structureOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("structure_continued_caption");
|
||||
$leaf->setText(__('Table caption (continued)'));
|
||||
$leaf->setDoc('faq6_27');
|
||||
$structureOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("structure_label");
|
||||
$leaf->setText(__('Label key'));
|
||||
$leaf->setDoc('faq6_27');
|
||||
$structureOptions->addProperty($leaf);
|
||||
if (! empty($GLOBALS['cfgRelation']['relation'])) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'relation',
|
||||
'text' => __('Display foreign key relationships')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("relation");
|
||||
$leaf->setText(__('Display foreign key relationships'));
|
||||
$structureOptions->addProperty($leaf);
|
||||
}
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'comments',
|
||||
'text' => __('Display comments')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("comments");
|
||||
$leaf->setText(__('Display comments'));
|
||||
$structureOptions->addProperty($leaf);
|
||||
if (! empty($GLOBALS['cfgRelation']['mimework'])) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'mime',
|
||||
'text' => __('Display MIME types')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("mime");
|
||||
$leaf->setText(__('Display MIME types'));
|
||||
$structureOptions->addProperty($leaf);
|
||||
}
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_group'
|
||||
);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($structureOptions);
|
||||
}
|
||||
|
||||
/* Data */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'data',
|
||||
'text' => __('Data dump options'),
|
||||
'force' => 'structure'
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'columns',
|
||||
'text' => __('Put columns names in the first row')
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'text',
|
||||
'name' => 'data_caption',
|
||||
'text' => __('Table caption'),
|
||||
'doc' => 'faq6_27'
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'text',
|
||||
'name' => 'data_continued_caption',
|
||||
'text' => __('Table caption (continued)'),
|
||||
'doc' => 'faq6_27'
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'text',
|
||||
'name' => 'data_label',
|
||||
'text' => __('Label key'),
|
||||
'doc' => 'faq6_27'
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'text',
|
||||
'name' => 'null',
|
||||
'text' => __('Replace NULL with:')
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_group'
|
||||
);
|
||||
// data options main group
|
||||
$dataOptions = new OptionsPropertyMainGroup();
|
||||
$dataOptions->setName("data");
|
||||
$dataOptions->setText(__('Data dump options'));
|
||||
$dataOptions->setForce('structure');
|
||||
// create primary items and add them to the group
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("columns");
|
||||
$leaf->setText(__('Put columns names in the first row'));
|
||||
$dataOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("data_caption");
|
||||
$leaf->setText(__('Table caption'));
|
||||
$leaf->setDoc('faq6_27');
|
||||
$dataOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("data_continued_caption");
|
||||
$leaf->setText(__('Table caption (continued)'));
|
||||
$leaf->setDoc('faq6_27');
|
||||
$dataOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("data_label");
|
||||
$leaf->setText(__('Label key'));
|
||||
$leaf->setDoc('faq6_27');
|
||||
$dataOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName('null');
|
||||
$leaf->setText(__('Replace NULL with:'));
|
||||
$dataOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($dataOptions);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -442,7 +436,7 @@ class ExportLatex extends ExportPlugin
|
||||
$dates = false
|
||||
) {
|
||||
global $cfgRelation;
|
||||
|
||||
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
$this->setCfgRelation($cfgRelation);
|
||||
|
||||
|
||||
@ -35,59 +35,63 @@ class ExportMediawiki extends ExportPlugin
|
||||
*/
|
||||
protected function setProperties()
|
||||
{
|
||||
$this->properties = array(
|
||||
'text' => __('MediaWiki Table'),
|
||||
'extension' => 'mediawiki',
|
||||
'mime_type' => 'text/plain',
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertySubgroup.class.php";
|
||||
require_once "$props/options/items/MessageOnlyPropertyItem.class.php";
|
||||
require_once "$props/options/items/RadioPropertyItem.class.php";
|
||||
require_once "$props/options/items/BoolPropertyItem.class.php";
|
||||
|
||||
// general options
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts'
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('MediaWiki Table');
|
||||
$exportPluginProperties->setExtension('mediawiki');
|
||||
$exportPluginProperties->setMimeType('text/plain');
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// general options main group
|
||||
$generalOptions = new OptionsPropertyMainGroup();
|
||||
$generalOptions->setName("general_opts");
|
||||
$generalOptions->setText(__('Dump table'));
|
||||
|
||||
// what to dump (structure/data/both)
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_subgroup',
|
||||
'subgroup_header' => array(
|
||||
'type' => 'message_only',
|
||||
'text' => __('Dump table')
|
||||
)
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'radio',
|
||||
'name' => 'structure_or_data',
|
||||
'values' => array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
)
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_subgroup'
|
||||
);
|
||||
$subgroup = new OptionsPropertySubgroup();
|
||||
$subgroup->setName("dump_table");
|
||||
$subgroup->setText("Dump table");
|
||||
$leaf = new RadioPropertyItem();
|
||||
$leaf->setName('structure_or_data');
|
||||
$leaf->setValues(array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
));
|
||||
$subgroup->setSubgroupHeader($leaf);
|
||||
$generalOptions->addProperty($subgroup);
|
||||
|
||||
// export table name
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'caption',
|
||||
'text' => __('Export table names')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("caption");
|
||||
$leaf->setText(__('Export table names'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
|
||||
// export table headers
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'headers',
|
||||
'text' => __('Export table headers')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("caption");
|
||||
$leaf->setText(__('Export table headers'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
//add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($generalOptions);
|
||||
|
||||
// end general options
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_group'
|
||||
);
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -38,38 +38,48 @@ class ExportOds extends ExportPlugin
|
||||
*/
|
||||
protected function setProperties()
|
||||
{
|
||||
$this->properties = array(
|
||||
'text' => __('Open Document Spreadsheet'),
|
||||
'extension' => 'ods',
|
||||
'mime_type' => 'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'force_file' => true,
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/TextPropertyItem.class.php";
|
||||
require_once "$props/options/items/BoolPropertyItem.class.php";
|
||||
require_once "$props/options/items/HiddenPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'] = array(
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'null',
|
||||
'text' => __('Replace NULL with:')
|
||||
),
|
||||
array(
|
||||
'type' => 'bool',
|
||||
'name' => 'columns',
|
||||
'text' => __('Put columns names in the first row')
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'structure_or_data'
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
)
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('Open Document Spreadsheet');
|
||||
$exportPluginProperties->setExtension('ods');
|
||||
$exportPluginProperties->setMimeType('application/vnd.oasis.opendocument.spreadsheet');
|
||||
$exportPluginProperties->setForceFile(true);
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// general options main group
|
||||
$generalOptions = new OptionsPropertyMainGroup();
|
||||
$generalOptions->setName("general_opts");
|
||||
// create primary items and add them to the group
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("null");
|
||||
$leaf->setText(__('Replace NULL with:'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("columns");
|
||||
$leaf->setText(__('Put columns names in the first row'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new HiddenPropertyItem();
|
||||
$leaf->setName("structure_or_data");
|
||||
$generalOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($generalOptions);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -46,86 +46,91 @@ class ExportOdt extends ExportPlugin
|
||||
$hide_structure = true;
|
||||
}
|
||||
|
||||
$this->properties = array(
|
||||
'text' => __('Open Document Text'),
|
||||
'extension' => 'odt',
|
||||
'mime_type' => 'application/vnd.oasis.opendocument.text',
|
||||
'force_file' => true,
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/TextPropertyItem.class.php";
|
||||
require_once "$props/options/items/BoolPropertyItem.class.php";
|
||||
require_once "$props/options/items/HiddenPropertyItem.class.php";
|
||||
|
||||
/* what to dump (structure/data/both) */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'text' => __('Dump table'),
|
||||
'name' => 'general_opts'
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'radio',
|
||||
'name' => 'structure_or_data',
|
||||
'values' => array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
)
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_group'
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('Open Document Text');
|
||||
$exportPluginProperties->setExtension('odt');
|
||||
$exportPluginProperties->setMimeType('application/vnd.oasis.opendocument.text');
|
||||
$exportPluginProperties->setForceFile(true);
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
/* Structure options */
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// what to dump (structure/data/both) main group
|
||||
$dumpWhat = new OptionsPropertyMainGroup();
|
||||
$dumpWhat->setName("general_opts");
|
||||
$dumpWhat->setText(__('Dump table'));
|
||||
// create primary items and add them to the group
|
||||
$leaf = new RadioPropertyItem();
|
||||
$leaf->setName("structure_or_data");
|
||||
$leaf->setValues(array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
));
|
||||
$dumpWhat->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($dumpWhat);
|
||||
|
||||
|
||||
// structure options main group
|
||||
if (! $hide_structure) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'structure',
|
||||
'text' => __('Object creation options'),
|
||||
'force' => 'data'
|
||||
);
|
||||
$structureOptions = new OptionsPropertyMainGroup();
|
||||
$structureOptions->setName("structure");
|
||||
$structureOptions->setText(__('Object creation options'));
|
||||
$structureOptions->setForce('data');
|
||||
// create primary items and add them to the group
|
||||
if (! empty($GLOBALS['cfgRelation']['relation'])) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'relation',
|
||||
'text' => __('Display foreign key relationships')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("relation");
|
||||
$leaf->setText(__('Display foreign key relationships'));
|
||||
$structureOptions->addProperty($leaf);
|
||||
}
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'comments',
|
||||
'text' => __('Display comments')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("comments");
|
||||
$leaf->setText(__('Display comments'));
|
||||
$structureOptions->addProperty($leaf);
|
||||
if (! empty($GLOBALS['cfgRelation']['mimework'])) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'mime',
|
||||
'text' => __('Display MIME types')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("mime");
|
||||
$leaf->setText(__('Display MIME types'));
|
||||
$structureOptions->addProperty($leaf);
|
||||
}
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_group'
|
||||
);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($structureOptions);
|
||||
}
|
||||
|
||||
/* Data */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'data',
|
||||
'text' => __('Data dump options'),
|
||||
'force' => 'structure'
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'columns',
|
||||
'text' => __('Put columns names in the first row')
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'text',
|
||||
'name' => 'null',
|
||||
'text' => __('Replace NULL with:')
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_group'
|
||||
);
|
||||
// data options main group
|
||||
$dataOptions = new OptionsPropertyMainGroup();
|
||||
$dataOptions->setName("data");
|
||||
$dataOptions->setText(__('Data dump options'));
|
||||
$dataOptions->setForce('structure');
|
||||
// create primary items and add them to the group
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("columns");
|
||||
$leaf->setText(__('Put columns names in the first row'));
|
||||
$dataOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName('null');
|
||||
$leaf->setText(__('Replace NULL with:'));
|
||||
$dataOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($dataOptions);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -386,7 +391,7 @@ class ExportOdt extends ExportPlugin
|
||||
* @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 bool true
|
||||
*/
|
||||
public function getTableDef(
|
||||
|
||||
@ -65,40 +65,50 @@ class ExportPdf extends ExportPlugin
|
||||
*/
|
||||
protected function setProperties()
|
||||
{
|
||||
$this->properties = array(
|
||||
'text' => __('PDF'),
|
||||
'extension' => 'pdf',
|
||||
'mime_type' => 'application/pdf',
|
||||
'force_file' => true,
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/MessageOnlyPropertyItem.class.php";
|
||||
require_once "$props/options/items/TextPropertyItem.class.php";
|
||||
require_once "$props/options/items/HiddenPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'] = array(
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts'
|
||||
),
|
||||
array(
|
||||
'type' => 'message_only',
|
||||
'name' => 'explanation',
|
||||
'text' => __(
|
||||
'(Generates a report containing the data of a single table)'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'report_title',
|
||||
'text' => __('Report title:')
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'structure_or_data'
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
)
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('PDF');
|
||||
$exportPluginProperties->setExtension('pdf');
|
||||
$exportPluginProperties->setMimeType('application/pdf');
|
||||
$exportPluginProperties->setForceFile(true);
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// general options main group
|
||||
$generalOptions = new OptionsPropertyMainGroup();
|
||||
$generalOptions->setName("general_opts");
|
||||
// create primary items and add them to the group
|
||||
$leaf = new MessageOnlyPropertyItem();
|
||||
$leaf->setName("explanation");
|
||||
$leaf->setText(__(
|
||||
'(Generates a report containing the data of a single table)'
|
||||
));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("report_title");
|
||||
$leaf->setText(__('Report title:'));
|
||||
$generalOptions->addProperty($leaf);
|
||||
$leaf = new HiddenPropertyItem();
|
||||
$leaf->setName("structure_or_data");
|
||||
$generalOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($generalOptions);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -35,27 +35,37 @@ class ExportPhparray extends ExportPlugin
|
||||
*/
|
||||
protected function setProperties()
|
||||
{
|
||||
$this->properties = array(
|
||||
'text' => __('PHP array'),
|
||||
'extension' => 'php',
|
||||
'mime_type' => 'text/plain',
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/HiddenPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'] = array(
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts'
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'structure_or_data',
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
)
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('PHP array');
|
||||
$exportPluginProperties->setExtension('php');
|
||||
$exportPluginProperties->setMimeType('text/plain');
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// general options main group
|
||||
$generalOptions = new OptionsPropertyMainGroup();
|
||||
$generalOptions->setName("general_opts");
|
||||
// create primary items and add them to the group
|
||||
$leaf = new HiddenPropertyItem();
|
||||
$leaf->setName("structure_or_data");
|
||||
$generalOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($generalOptions);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -128,165 +128,160 @@ class ExportSql extends ExportPlugin
|
||||
$hide_structure = true;
|
||||
$hide_sql = true;
|
||||
}
|
||||
|
||||
if (! $hide_sql) {
|
||||
$this->properties = array(
|
||||
'text' => __('SQL'),
|
||||
'extension' => 'sql',
|
||||
'mime_type' => 'text/x-sql',
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertySubgroup.class.php";
|
||||
require_once "$props/options/items/BoolPropertyItem.class.php";
|
||||
require_once "$props/options/items/MessageOnlyPropertyItem.class.php";
|
||||
require_once "$props/options/items/RadioPropertyItem.class.php";
|
||||
require_once "$props/options/items/SelectPropertyItem.class.php";
|
||||
require_once "$props/options/items/TextPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts'
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('SQL');
|
||||
$exportPluginProperties->setExtension('sql');
|
||||
$exportPluginProperties->setMimeType('text/x-sql');
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
/* comments */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_subgroup',
|
||||
'subgroup_header' => array(
|
||||
'type' => 'bool',
|
||||
'name' => 'include_comments',
|
||||
'text' => __(
|
||||
'Display comments <i>(includes info such as export'
|
||||
. ' timestamp, PHP version, and server version)</i>'
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'text',
|
||||
'name' => 'header_comment',
|
||||
'text' => __('Additional custom header comment (\n splits lines):')
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'dates',
|
||||
'text' => __(
|
||||
'Include a timestamp of when databases were created, last'
|
||||
. ' updated, and last checked'
|
||||
)
|
||||
);
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// general options main group
|
||||
$generalOptions = new OptionsPropertyMainGroup();
|
||||
$generalOptions->setName("general_opts");
|
||||
|
||||
// comments
|
||||
$subgroup = new OptionsPropertySubgroup();
|
||||
$subgroup->setName("include_comments");
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('include_comments');
|
||||
$leaf->setText(__(
|
||||
'Display comments <i>(includes info such as export'
|
||||
. ' timestamp, PHP version, and server version)</i>'
|
||||
));
|
||||
$subgroup->setSubgroupHeader($leaf);
|
||||
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName('header_comment');
|
||||
$leaf->setText(__(
|
||||
'Additional custom header comment (\n splits lines):'
|
||||
));
|
||||
$subgroup->addProperty($leaf);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('dates');
|
||||
$leaf->setText(__(
|
||||
'Include a timestamp of when databases were created, last'
|
||||
. ' updated, and last checked'
|
||||
));
|
||||
$subgroup->addProperty($leaf);
|
||||
if (! empty($GLOBALS['cfgRelation']['relation'])) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'relation',
|
||||
'text' => __('Display foreign key relationships')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('relation');
|
||||
$leaf->setText(__('Display foreign key relationships'));
|
||||
$subgroup->addProperty($leaf);
|
||||
}
|
||||
if (! empty($GLOBALS['cfgRelation']['mimework'])) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'mime',
|
||||
'text' => __('Display MIME types')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('mime');
|
||||
$leaf->setText(__('Display MIME types'));
|
||||
$subgroup->addProperty($leaf);
|
||||
}
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_subgroup'
|
||||
);
|
||||
/* end comments */
|
||||
$generalOptions->addProperty($subgroup);
|
||||
|
||||
/* enclose in a transaction */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'use_transaction',
|
||||
'text' => __('Enclose export in a transaction'),
|
||||
'doc' => array(
|
||||
'programs',
|
||||
'mysqldump',
|
||||
'option_mysqldump_single-transaction'
|
||||
)
|
||||
);
|
||||
// enclose in a transaction
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("use_transaction");
|
||||
$leaf->setText(__('Enclose export in a transaction'));
|
||||
$leaf->setDoc(array(
|
||||
'programs',
|
||||
'mysqldump',
|
||||
'option_mysqldump_single-transaction'
|
||||
));
|
||||
$generalOptions->addProperty($leaf);
|
||||
|
||||
/* disable foreign key checks */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'disable_fk',
|
||||
'text' => __('Disable foreign key checks'),
|
||||
'doc' => array(
|
||||
'manual_MySQL_Database_Administration',
|
||||
'server-system-variables',
|
||||
'sysvar_foreign_key_checks'
|
||||
)
|
||||
);
|
||||
// disable foreign key checks
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("disable_fk");
|
||||
$leaf->setText(__('Disable foreign key checks'));
|
||||
$leaf->setDoc(array(
|
||||
'manual_MySQL_Database_Administration',
|
||||
'server-system-variables',
|
||||
'sysvar_foreign_key_checks'
|
||||
));
|
||||
$generalOptions->addProperty($leaf);
|
||||
|
||||
/* compatibility maximization */
|
||||
// compatibility maximization
|
||||
$compats = PMA_DBI_getCompatibilities();
|
||||
if (count($compats) > 0) {
|
||||
$values = array();
|
||||
foreach ($compats as $val) {
|
||||
$values[$val] = $val;
|
||||
}
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'select',
|
||||
'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'
|
||||
)
|
||||
);
|
||||
|
||||
$leaf = new SelectPropertyItem();
|
||||
$leaf->setName("compatibility");
|
||||
$leaf->setText(__(
|
||||
'Database system or older MySQL server to maximize output'
|
||||
. ' compatibility with:'
|
||||
));
|
||||
$leaf->setValues($values);
|
||||
$leaf->setDoc(array(
|
||||
'manual_MySQL_Database_Administration',
|
||||
'Server_SQL_mode'
|
||||
));
|
||||
$generalOptions->addProperty($leaf);
|
||||
|
||||
unset($values);
|
||||
}
|
||||
|
||||
/* server export options */
|
||||
// server export options
|
||||
if ($plugin_param['export_type'] == 'server') {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'drop_database',
|
||||
'text' => sprintf(
|
||||
__('Add %s statement'), '<code>DROP DATABASE</code>'
|
||||
)
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("drop_database");
|
||||
$leaf->setText(sprintf(
|
||||
__('Add %s statement'), '<code>DROP DATABASE</code>'
|
||||
));
|
||||
$generalOptions->addProperty($leaf);
|
||||
}
|
||||
|
||||
/* what to dump (structure/data/both) */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_subgroup',
|
||||
'subgroup_header' => array(
|
||||
'type' => 'message_only',
|
||||
'text' => __('Dump table')
|
||||
)
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'radio',
|
||||
'name' => 'structure_or_data',
|
||||
'values' => array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
)
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_subgroup'
|
||||
);
|
||||
// what to dump (structure/data/both)
|
||||
$subgroup = new OptionsPropertySubgroup();
|
||||
$subgroup->setName("dump_table");
|
||||
$subgroup->setText("Dump table");
|
||||
$leaf = new RadioPropertyItem();
|
||||
$leaf->setName('structure_or_data');
|
||||
$leaf->setValues(array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
));
|
||||
$subgroup->setSubgroupHeader($leaf);
|
||||
$generalOptions->addProperty($subgroup);
|
||||
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_group'
|
||||
);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($generalOptions);
|
||||
|
||||
/* begin Structure options */
|
||||
|
||||
// structure options main group
|
||||
if (! $hide_structure) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'structure',
|
||||
'text' => __('Object creation options'),
|
||||
'force' => 'data'
|
||||
);
|
||||
$structureOptions = new OptionsPropertyMainGroup();
|
||||
$structureOptions->setName("structure");
|
||||
$structureOptions->setText(__('Object creation options'));
|
||||
$structureOptions->setForce('data');
|
||||
|
||||
/* begin SQL Statements */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_subgroup',
|
||||
'subgroup_header' => array(
|
||||
'type' => 'message_only',
|
||||
'name' => 'add_statements',
|
||||
'text' => __('Add statements:')
|
||||
)
|
||||
);
|
||||
// begin SQL Statements
|
||||
$subgroup = new OptionsPropertySubgroup();
|
||||
$leaf = new MessageOnlyPropertyItem();
|
||||
$leaf->setName('add_statements');
|
||||
$leaf->setText(__('Add statements:'));
|
||||
$subgroup->setSubgroupHeader($leaf);
|
||||
if ($plugin_param['export_type'] == 'table') {
|
||||
if (PMA_Table::isView($GLOBALS['db'], $GLOBALS['table'])) {
|
||||
$drop_clause = '<code>DROP VIEW</code>';
|
||||
@ -304,200 +299,168 @@ class ExportSql extends ExportPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'drop_table',
|
||||
'text' => sprintf(__('Add %s statement'), $drop_clause)
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('drop_table');
|
||||
$leaf->setText(sprintf(__('Add %s statement'), $drop_clause));
|
||||
$subgroup->addProperty($leaf);
|
||||
// Drizzle doesn't support procedures and functions
|
||||
if (! PMA_DRIZZLE) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'procedure_function',
|
||||
'text' => sprintf(
|
||||
__('Add %s statement'),
|
||||
'<code>CREATE PROCEDURE / FUNCTION'
|
||||
. (PMA_MYSQL_INT_VERSION > 50100
|
||||
? ' / EVENT</code>' : '</code>')
|
||||
)
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('procedure_function');
|
||||
$leaf->setText(sprintf(
|
||||
__('Add %s statement'),
|
||||
'<code>CREATE PROCEDURE / FUNCTION'
|
||||
. (PMA_MYSQL_INT_VERSION > 50100
|
||||
? ' / EVENT</code>' : '</code>')
|
||||
));
|
||||
$subgroup->addProperty($leaf);
|
||||
}
|
||||
|
||||
/* begin CREATE TABLE statements*/
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_subgroup',
|
||||
'subgroup_header' => array(
|
||||
'type' => 'bool',
|
||||
'name' => 'create_table_statements',
|
||||
'text' => __('<code>CREATE TABLE</code> options:')
|
||||
)
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'if_not_exists',
|
||||
'text' => '<code>IF NOT EXISTS</code>'
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'auto_increment',
|
||||
'text' => '<code>AUTO_INCREMENT</code>'
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_subgroup'
|
||||
);
|
||||
/* end CREATE TABLE statements */
|
||||
// begin CREATE TABLE statements
|
||||
$subgroup_create_table = new OptionsPropertySubgroup();
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('create_table_statements');
|
||||
$leaf->setText(__('<code>CREATE TABLE</code> options:'));
|
||||
$subgroup_create_table->setSubgroupHeader($leaf);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('if_not_exists');
|
||||
$leaf->setText('<code>IF NOT EXISTS</code>');
|
||||
$subgroup_create_table->addProperty($leaf);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('auto_increment');
|
||||
$leaf->setText('<code>AUTO_INCREMENT</code>');
|
||||
$subgroup_create_table->addProperty($leaf);
|
||||
$subgroup->addProperty($subgroup_create_table);
|
||||
$structureOptions->addProperty($subgroup);
|
||||
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_subgroup'
|
||||
);
|
||||
/* end SQL statements */
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("backquotes");
|
||||
$leaf->setText(__(
|
||||
'Enclose table and column names with backquotes '
|
||||
. '<i>(Protects column and table names formed with'
|
||||
. ' special characters or keywords)</i>'
|
||||
));
|
||||
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'backquotes',
|
||||
'text' => __(
|
||||
'Enclose table and column names with backquotes '
|
||||
. '<i>(Protects column and table names formed with'
|
||||
. ' special characters or keywords)</i>'
|
||||
)
|
||||
);
|
||||
$structureOptions->addProperty($leaf);
|
||||
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_group'
|
||||
);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($structureOptions);
|
||||
}
|
||||
/* end Structure options */
|
||||
|
||||
/* begin Data options */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'data',
|
||||
'text' => __('Data dump options'),
|
||||
'force' => 'structure'
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'truncate',
|
||||
'text' => __('Truncate table before insert')
|
||||
);
|
||||
/* begin SQL statements */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_subgroup',
|
||||
'subgroup_header' => array(
|
||||
'type' => 'message_only',
|
||||
'text' => __('Instead of <code>INSERT</code> statements, use:')
|
||||
)
|
||||
);
|
||||
|
||||
// begin Data options
|
||||
$dataOptions = new OptionsPropertyMainGroup();
|
||||
$dataOptions->setName("data");
|
||||
$dataOptions->setText(__('Data creation options'));
|
||||
$dataOptions->setForce('structure');
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("truncate");
|
||||
$leaf->setText(__('Truncate table before insert'));
|
||||
$dataOptions->addProperty($leaf);
|
||||
|
||||
// begin SQL Statements
|
||||
$subgroup = new OptionsPropertySubgroup();
|
||||
$leaf = new MessageOnlyPropertyItem();
|
||||
$leaf->setText(__('Instead of <code>INSERT</code> statements, use:'));
|
||||
$subgroup->setSubgroupHeader($leaf);
|
||||
// Not supported in Drizzle
|
||||
if (! PMA_DRIZZLE) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'delayed',
|
||||
'text' => __('<code>INSERT DELAYED</code> statements'),
|
||||
'doc' => array(
|
||||
'manual_MySQL_Database_Administration',
|
||||
'insert_delayed'
|
||||
)
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("delayed");
|
||||
$leaf->setText(__('<code>INSERT DELAYED</code> statements'));
|
||||
$leaf->setDoc(array(
|
||||
'manual_MySQL_Database_Administration',
|
||||
'insert_delayed'
|
||||
));
|
||||
$subgroup->addProperty($leaf);
|
||||
}
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'ignore',
|
||||
'text' => __('<code>INSERT IGNORE</code> statements'),
|
||||
'doc' => array(
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("ignore");
|
||||
$leaf->setText(__('<code>INSERT IGNORE</code> statements'));
|
||||
$leaf->setDoc(array(
|
||||
'manual_MySQL_Database_Administration',
|
||||
'insert'
|
||||
)
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_subgroup'
|
||||
);
|
||||
/* end SQL statements */
|
||||
));
|
||||
$subgroup->addProperty($leaf);
|
||||
$dataOptions->addProperty($subgroup);
|
||||
|
||||
/* Function to use when dumping data */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'select',
|
||||
'name' => 'type',
|
||||
'text' => __('Function to use when dumping data:'),
|
||||
'values' => array(
|
||||
'INSERT' => 'INSERT',
|
||||
'UPDATE' => 'UPDATE',
|
||||
'REPLACE' => 'REPLACE'
|
||||
)
|
||||
);
|
||||
// Function to use when dumping dat
|
||||
$leaf = new SelectPropertyItem();
|
||||
$leaf->setName("type");
|
||||
$leaf->setText(__('Function to use when dumping data:'));
|
||||
$leaf->setValues(array(
|
||||
'INSERT' => 'INSERT',
|
||||
'UPDATE' => 'UPDATE',
|
||||
'REPLACE' => 'REPLACE'
|
||||
));
|
||||
$dataOptions->addProperty($leaf);
|
||||
|
||||
/* Syntax to use when inserting data */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_subgroup',
|
||||
'subgroup_header' => array(
|
||||
'type' => 'message_only',
|
||||
'text' => __('Syntax to use when inserting data:')
|
||||
$subgroup = new OptionsPropertySubgroup();
|
||||
$leaf = new MessageOnlyPropertyItem();
|
||||
$leaf->setText(__('Syntax to use when inserting data:'));
|
||||
$subgroup->setSubgroupHeader($leaf);
|
||||
$leaf = new RadioPropertyItem();
|
||||
$leaf->setName("insert_syntax");
|
||||
$leaf->setText(__('<code>INSERT IGNORE</code> statements'));
|
||||
$leaf->setValues(array(
|
||||
'complete' => __(
|
||||
'include column names in every <code>INSERT</code> statement'
|
||||
. ' <br /> Example: <code>INSERT INTO'
|
||||
. ' tbl_name (col_A,col_B,col_C) VALUES (1,2,3)</code>'
|
||||
),
|
||||
'extended' => __(
|
||||
'insert multiple rows in every <code>INSERT</code> statement'
|
||||
. '<br /> Example: <code>INSERT INTO'
|
||||
. ' tbl_name VALUES (1,2,3), (4,5,6), (7,8,9)</code>'
|
||||
),
|
||||
'both' => __(
|
||||
'both of the above<br /> Example:'
|
||||
. ' <code>INSERT INTO tbl_name (col_A,col_B) VALUES (1,2,3),'
|
||||
. ' (4,5,6), (7,8,9)</code>'
|
||||
),
|
||||
'none' => __(
|
||||
'neither of the above<br /> Example:'
|
||||
. ' <code>INSERT INTO tbl_name VALUES (1,2,3)</code>'
|
||||
)
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'radio',
|
||||
'name' => 'insert_syntax',
|
||||
'values' => array(
|
||||
'complete' => __(
|
||||
'include column names in every <code>INSERT</code> statement'
|
||||
. ' <br /> Example: <code>INSERT INTO'
|
||||
. ' tbl_name (col_A,col_B,col_C) VALUES (1,2,3)</code>'
|
||||
),
|
||||
'extended' => __(
|
||||
'insert multiple rows in every <code>INSERT</code> statement'
|
||||
. '<br /> Example: <code>INSERT INTO'
|
||||
. ' tbl_name VALUES (1,2,3), (4,5,6), (7,8,9)</code>'
|
||||
),
|
||||
'both' => __(
|
||||
'both of the above<br /> Example:'
|
||||
. ' <code>INSERT INTO tbl_name (col_A,col_B) VALUES (1,2,3),'
|
||||
. ' (4,5,6), (7,8,9)</code>'
|
||||
),
|
||||
'none' => __(
|
||||
'neither of the above<br /> Example:'
|
||||
. ' <code>INSERT INTO tbl_name VALUES (1,2,3)</code>'
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_subgroup'
|
||||
);
|
||||
));
|
||||
$subgroup->addProperty($leaf);
|
||||
$dataOptions->addProperty($subgroup);
|
||||
|
||||
/* Max length of query */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'text',
|
||||
'name' => 'max_query_size',
|
||||
'text' => __('Maximal length of created query')
|
||||
);
|
||||
// Max length of query
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName("max_query_size");
|
||||
$leaf->setText(__('Maximal length of created query'));
|
||||
$dataOptions->addProperty($leaf);
|
||||
|
||||
/* Dump binary columns in hexadecimal */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'hex_for_blob',
|
||||
'text' => __(
|
||||
'Dump binary columns in hexadecimal notation'
|
||||
. ' <i>(for example, "abc" becomes 0x616263)</i>'
|
||||
)
|
||||
);
|
||||
// Dump binary columns in hexadecimal
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("hex_for_blob");
|
||||
$leaf->setText(__(
|
||||
'Dump binary columns in hexadecimal notation'
|
||||
. ' <i>(for example, "abc" becomes 0x616263)</i>'
|
||||
));
|
||||
$dataOptions->addProperty($leaf);
|
||||
|
||||
// Drizzle works only with UTC timezone
|
||||
if (! PMA_DRIZZLE) {
|
||||
/* Dump time in UTC */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'utc_time',
|
||||
'text' => __(
|
||||
'Dump TIMESTAMP columns in UTC <i>(enables TIMESTAMP columns'
|
||||
. ' to be dumped and reloaded between servers in different'
|
||||
. ' time zones)</i>'
|
||||
)
|
||||
);
|
||||
// Dump time in UTC
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("utc_time");
|
||||
$leaf->setText(__(
|
||||
'Dump TIMESTAMP columns in UTC <i>(enables TIMESTAMP columns'
|
||||
. ' to be dumped and reloaded between servers in different'
|
||||
. ' time zones)</i>'
|
||||
));
|
||||
$dataOptions->addProperty($leaf);
|
||||
}
|
||||
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_group'
|
||||
);
|
||||
/* end Data options */
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($dataOptions);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
}
|
||||
|
||||
@ -781,10 +744,10 @@ class ExportSql extends ExportPlugin
|
||||
public function exportDBCreate($db)
|
||||
{
|
||||
global $crlf;
|
||||
|
||||
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
$this->setCrlf($crlf);
|
||||
|
||||
|
||||
if (isset($GLOBALS['sql_drop_database'])) {
|
||||
if (! PMA_exportOutputHandler(
|
||||
'DROP DATABASE '
|
||||
@ -923,7 +886,7 @@ class ExportSql extends ExportPlugin
|
||||
*/
|
||||
public function getTableDefStandIn($db, $view, $crlf)
|
||||
{
|
||||
|
||||
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
$create_query = '';
|
||||
if (! empty($GLOBALS['sql_drop_table'])) {
|
||||
@ -972,7 +935,7 @@ class ExportSql extends ExportPlugin
|
||||
$view = false
|
||||
) {
|
||||
$this->initSpecificVariables();
|
||||
|
||||
|
||||
$sql_drop_table = $this->_getSqlDropTable();
|
||||
$sql_backquotes = $this->_getSqlBackquotes();
|
||||
$sql_constraints = $this->_getSqlConstraints();
|
||||
@ -1413,9 +1376,9 @@ class ExportSql extends ExportPlugin
|
||||
$mime = false,
|
||||
$dates = false
|
||||
) {
|
||||
|
||||
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
|
||||
|
||||
$formatted_table_name = (isset($GLOBALS['sql_backquotes']))
|
||||
? $common_functions->backquote($table) : '\'' . $table . '\'';
|
||||
$dump = $this->_possibleCRLF()
|
||||
|
||||
@ -35,53 +35,62 @@ class ExportTexytext extends ExportPlugin
|
||||
*/
|
||||
protected function setProperties()
|
||||
{
|
||||
$this->properties = array(
|
||||
'text' => __('Texy! text'),
|
||||
'extension' => 'txt',
|
||||
'mime_type' => 'text/plain',
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/RadioPropertyItem.class.php";
|
||||
require_once "$props/options/items/BoolPropertyItem.class.php";
|
||||
require_once "$props/options/items/TextPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'] = array(
|
||||
/* what to dump (structure/data/both) */
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'text' => __('Dump table'),
|
||||
'name' => 'general_opts'
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'name' => 'structure_or_data',
|
||||
'values' => array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
),
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'data',
|
||||
'text' => __('Data dump options'),
|
||||
'force' => 'structure'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'null',
|
||||
'text' => __('Replace NULL by')
|
||||
),
|
||||
array(
|
||||
'type' => 'bool',
|
||||
'name' => 'columns',
|
||||
'text' => __('Put columns names in the first row')
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
)
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('Texy! text');
|
||||
$exportPluginProperties->setExtension('txt');
|
||||
$exportPluginProperties->setMimeType('text/plain');
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// what to dump (structure/data/both) main group
|
||||
$dumpWhat = new OptionsPropertyMainGroup();
|
||||
$dumpWhat->setName("general_opts");
|
||||
$dumpWhat->setText(__('Dump table'));
|
||||
// create primary items and add them to the group
|
||||
$leaf = new RadioPropertyItem();
|
||||
$leaf->setName("structure_or_data");
|
||||
$leaf->setValues(array(
|
||||
'structure' => __('structure'),
|
||||
'data' => __('data'),
|
||||
'structure_and_data' => __('structure and data')
|
||||
));
|
||||
$dumpWhat->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($dumpWhat);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
|
||||
// data options main group
|
||||
$dataOptions = new OptionsPropertyMainGroup();
|
||||
$dataOptions->setName("data");
|
||||
$dataOptions->setText(__('Data dump options'));
|
||||
$dataOptions->setForce('structure');
|
||||
// create primary items and add them to the group
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("columns");
|
||||
$leaf->setText(__('Put columns names in the first row'));
|
||||
$dataOptions->addProperty($leaf);
|
||||
$leaf = new TextPropertyItem();
|
||||
$leaf->setName('null');
|
||||
$leaf->setText(__('Replace NULL with:'));
|
||||
$dataOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($dataOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -64,81 +64,81 @@ class ExportXml extends ExportPlugin
|
||||
*/
|
||||
protected function setProperties()
|
||||
{
|
||||
$this->properties = array(
|
||||
'text' => __('XML'),
|
||||
'extension' => 'xml',
|
||||
'mime_type' => 'text/xml',
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/HiddenPropertyItem.class.php";
|
||||
require_once "$props/options/items/BoolPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'] = array(
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts'
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'structure_or_data'
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
)
|
||||
);
|
||||
// create the export plugin property item
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('XML');
|
||||
$exportPluginProperties->setExtension('xml');
|
||||
$exportPluginProperties->setMimeType('text/xml');
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
/* Export structure */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'structure',
|
||||
'text' => __('Object creation options (all are recommended)')
|
||||
);
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// general options main group
|
||||
$generalOptions = new OptionsPropertyMainGroup();
|
||||
$generalOptions->setName("general_opts");
|
||||
// create primary items and add them to the group
|
||||
$leaf = new HiddenPropertyItem();
|
||||
$leaf->setName("structure_or_data");
|
||||
$generalOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($generalOptions);
|
||||
|
||||
// export structure main group
|
||||
$structure = new OptionsPropertyMainGroup();
|
||||
$structure->setName("structure");
|
||||
$structure->setText(__('Object creation options (all are recommended)'));
|
||||
// create primary items and add them to the group
|
||||
if (! PMA_DRIZZLE) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'export_functions',
|
||||
'text' => __('Functions')
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'export_procedures',
|
||||
'text' => __('Procedures')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("export_functions");
|
||||
$leaf->setText(__('Functions'));
|
||||
$structure->addProperty($leaf);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("export_procedures");
|
||||
$leaf->setText(__('Procedures'));
|
||||
$structure->addProperty($leaf);
|
||||
}
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'export_tables',
|
||||
'text' => __('Tables')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("export_tables");
|
||||
$leaf->setText(__('Tables'));
|
||||
$structure->addProperty($leaf);
|
||||
if (! PMA_DRIZZLE) {
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'export_triggers',
|
||||
'text' => __('Triggers')
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'export_views',
|
||||
'text' => __('Views')
|
||||
);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("export_triggers");
|
||||
$leaf->setText(__('Triggers'));
|
||||
$structure->addProperty($leaf);
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("export_views");
|
||||
$leaf->setText(__('Views'));
|
||||
$structure->addProperty($leaf);
|
||||
}
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_group'
|
||||
);
|
||||
$exportSpecificOptions->addProperty($structure);
|
||||
|
||||
/* Data */
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'data',
|
||||
'text' => __('Data dump options')
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'bool',
|
||||
'name' => 'export_contents',
|
||||
'text' => __('Export contents')
|
||||
);
|
||||
$this->properties['options'][] = array(
|
||||
'type' => 'end_group'
|
||||
);
|
||||
// data main group
|
||||
$data = new OptionsPropertyMainGroup();
|
||||
$data->setName("data");
|
||||
$data->setText(__('Data dump options'));
|
||||
// create primary items and add them to the group
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName("export_contents");
|
||||
$leaf->setText(__('Export contents'));
|
||||
$data->addProperty($leaf);
|
||||
$exportSpecificOptions->addProperty($data);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -35,28 +35,38 @@ class ExportYaml extends ExportPlugin
|
||||
*/
|
||||
protected function setProperties()
|
||||
{
|
||||
$this->properties = array(
|
||||
'text' => 'YAML',
|
||||
'extension' => 'yml',
|
||||
'mime_type' => 'text/yaml',
|
||||
'force_file' => true,
|
||||
'options' => array(),
|
||||
'options_text' => __('Options')
|
||||
);
|
||||
$props = 'libraries/properties/';
|
||||
require_once "$props/plugins/ExportPluginProperties.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
|
||||
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
|
||||
require_once "$props/options/items/HiddenPropertyItem.class.php";
|
||||
|
||||
$this->properties['options'] = array(
|
||||
array(
|
||||
'type' => 'begin_group',
|
||||
'name' => 'general_opts'
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'structure_or_data',
|
||||
),
|
||||
array(
|
||||
'type' => 'end_group'
|
||||
)
|
||||
);
|
||||
$exportPluginProperties = new ExportPluginProperties();
|
||||
$exportPluginProperties->setText('YAML');
|
||||
$exportPluginProperties->setExtension('yml');
|
||||
$exportPluginProperties->setMimeType('text/yaml');
|
||||
$exportPluginProperties->setForceFile(true);
|
||||
$exportPluginProperties->setOptionsText(__('Options'));
|
||||
|
||||
// create the root group that will be the options field for
|
||||
// $exportPluginProperties
|
||||
// this will be shown as "Format specific options"
|
||||
$exportSpecificOptions = new OptionsPropertyRootGroup();
|
||||
$exportSpecificOptions->setName("Format Specific Options");
|
||||
|
||||
// general options main group
|
||||
$generalOptions = new OptionsPropertyMainGroup();
|
||||
$generalOptions->setName("general_opts");
|
||||
// create primary items and add them to the group
|
||||
$leaf = new HiddenPropertyItem();
|
||||
$leaf->setName("structure_or_data");
|
||||
$generalOptions->addProperty($leaf);
|
||||
// add the main group to the root group
|
||||
$exportSpecificOptions->addProperty($generalOptions);
|
||||
|
||||
// set the options for the export plugin property item
|
||||
$exportPluginProperties->setOptions($exportSpecificOptions);
|
||||
$this->properties = $exportPluginProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -93,10 +93,12 @@ class ImportSql extends ImportPlugin
|
||||
|
||||
/**
|
||||
* Handles the whole import logic
|
||||
*
|
||||
* @param &$sql_data array 2-element array with sql data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function doImport()
|
||||
public function doImport(&$sql_data = array())
|
||||
{
|
||||
global $error, $timeout_passed;
|
||||
|
||||
@ -384,7 +386,9 @@ class ImportSql extends ImportPlugin
|
||||
$sql = $tmp_sql;
|
||||
PMA_importRunQuery(
|
||||
$sql,
|
||||
substr($buffer, 0, $i + strlen($sql_delimiter))
|
||||
substr($buffer, 0, $i + strlen($sql_delimiter)),
|
||||
false,
|
||||
$sql_data
|
||||
);
|
||||
$buffer = substr($buffer, $i + strlen($sql_delimiter));
|
||||
// Reset parser:
|
||||
@ -408,7 +412,7 @@ class ImportSql extends ImportPlugin
|
||||
} // End of parser loop
|
||||
} // End of import loop
|
||||
// Commit any possible data in buffers
|
||||
PMA_importRunQuery('', substr($buffer, 0, $len));
|
||||
PMA_importRunQuery();
|
||||
PMA_importRunQuery('', substr($buffer, 0, $len), false, $sql_data);
|
||||
PMA_importRunQuery('', '', false, $sql_data);
|
||||
}
|
||||
}
|
||||
49
libraries/properties/PropertyItem.class.php
Normal file
49
libraries/properties/PropertyItem.class.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* The top-level class of the object-oriented properties system.
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides an interface for Property classes
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
abstract class PropertyItem
|
||||
{
|
||||
/**
|
||||
* Returns the property type ( either "Options", or "Plugin" ).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public abstract function getPropertyType();
|
||||
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public abstract function getItemType();
|
||||
|
||||
/**
|
||||
* Only overwritten in the OptionsPropertyGroup class:
|
||||
* Used to tell whether we can use the current item as a group by calling
|
||||
* the addProperty() or removeProperty() methods, which are not available
|
||||
* for simple OptionsPropertyOneItem subclasses.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGroup()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
?>
|
||||
102
libraries/properties/options/OptionsPropertyGroup.class.php
Normal file
102
libraries/properties/options/OptionsPropertyGroup.class.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Superclass for the Property Group classes.
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the OptionsPropertyItem class */
|
||||
require_once "OptionsPropertyItem.class.php";
|
||||
|
||||
/**
|
||||
* Parents group property items and provides methods to manage groups of
|
||||
* properties.
|
||||
*
|
||||
* @todo modify descriptions if needed, when the options are integrated
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
abstract class OptionsPropertyGroup extends OptionsPropertyItem
|
||||
{
|
||||
/**
|
||||
* Holds a group of properties (OptionsPropertyItem instances)
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_properties;
|
||||
|
||||
/**
|
||||
* Adds a property to the group of properties
|
||||
*
|
||||
* @param OptionsPropertyItem $property the property instance to be added
|
||||
* to the group
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addProperty($property)
|
||||
{
|
||||
if (! $this->getProperties() == null
|
||||
&& in_array($property, $this->getProperties(), true)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
$this->_properties [] = $property;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a property from the group of properties
|
||||
*
|
||||
* @param OptionsPropertyItem $property the property instance to be removed
|
||||
* from the group
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeProperty($property)
|
||||
{
|
||||
$this->_properties = array_udiff(
|
||||
$this->getProperties(),
|
||||
array($property),
|
||||
function ($a, $b) {
|
||||
return ($a === $b ) ? 0 : 1;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
|
||||
/**
|
||||
* Gets the instance of the class
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getGroup()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the group of properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getProperties()
|
||||
{
|
||||
return $this->_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of properties
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNrOfProperties()
|
||||
{
|
||||
return count($this->_properties);
|
||||
}
|
||||
}
|
||||
?>
|
||||
127
libraries/properties/options/OptionsPropertyItem.class.php
Normal file
127
libraries/properties/options/OptionsPropertyItem.class.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* The top-level class of the "Options" subtree of the object-oriented
|
||||
* properties system (the other subtree is "Plugin").
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the PropertyItem class */
|
||||
require_once "libraries/properties/PropertyItem.class.php";
|
||||
|
||||
/**
|
||||
* Superclass for
|
||||
* - OptionsPropertyOneItem and
|
||||
* - OptionsProperty Group
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
abstract class OptionsPropertyItem extends PropertyItem
|
||||
{
|
||||
/**
|
||||
* Name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_name;
|
||||
|
||||
/**
|
||||
* Text
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_text;
|
||||
|
||||
/**
|
||||
* What to force
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_force;
|
||||
|
||||
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
|
||||
/**
|
||||
* Gets the name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name
|
||||
*
|
||||
* @param string $name name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->_text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text
|
||||
*
|
||||
* @param string $text text
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the force parameter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getForce()
|
||||
{
|
||||
return $this->_force;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the force paramter
|
||||
*
|
||||
* @param string $force force parameter
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setForce($force)
|
||||
{
|
||||
$this->_force = $force;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the property type ( either "options", or "plugin" ).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPropertyType()
|
||||
{
|
||||
return "options";
|
||||
}
|
||||
}
|
||||
?>
|
||||
172
libraries/properties/options/OptionsPropertyOneItem.class.php
Normal file
172
libraries/properties/options/OptionsPropertyOneItem.class.php
Normal file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Superclass for the single Property Item classes.
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the OptionsPropertyItem class */
|
||||
require_once "OptionsPropertyItem.class.php";
|
||||
|
||||
/**
|
||||
* Parents only single property items (not groups).
|
||||
* Defines possible options and getters and setters for them.
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
abstract class OptionsPropertyOneItem extends OptionsPropertyItem
|
||||
{
|
||||
/**
|
||||
* Whether to force or not
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_force;
|
||||
|
||||
/**
|
||||
* Values
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_values;
|
||||
|
||||
/**
|
||||
* Doc
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_doc;
|
||||
|
||||
/**
|
||||
* Length
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_len;
|
||||
|
||||
/**
|
||||
* Size
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_size;
|
||||
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
|
||||
/**
|
||||
* Gets the force parameter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getForce()
|
||||
{
|
||||
return $this->_force;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the force parameter
|
||||
*
|
||||
* @param bool $force force parameter
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setForce($force)
|
||||
{
|
||||
$this->_force = $force;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the values
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
return $this->_values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the values
|
||||
*
|
||||
* @param array $values values
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setValues($values)
|
||||
{
|
||||
$this->_values = $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of the newline character
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDoc()
|
||||
{
|
||||
return $this->_doc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the doc
|
||||
*
|
||||
* @param string $doc doc
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDoc($doc)
|
||||
{
|
||||
$this->_doc = $doc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the length
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLen()
|
||||
{
|
||||
return $this->_len;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the length
|
||||
*
|
||||
* @param int $len length
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLen($len)
|
||||
{
|
||||
$this->_len = $len;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the size
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSize()
|
||||
{
|
||||
return $this->_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the size
|
||||
*
|
||||
* @param int $size size
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSize($size)
|
||||
{
|
||||
$this->_size = $size;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Holds the OptionsPropertyMainGroup class
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the OptionsPropertyGroup class */
|
||||
require_once "libraries/properties/options/OptionsPropertyGroup.class.php";
|
||||
|
||||
/**
|
||||
* Group property item class of type main
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class OptionsPropertyMainGroup extends OptionsPropertyGroup
|
||||
{
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "main";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Holds the OptionsPropertyRootGroup class
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the OptionsPropertyGroup class */
|
||||
require_once "libraries/properties/options/OptionsPropertyGroup.class.php";
|
||||
|
||||
/**
|
||||
* Group property item class of type root
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class OptionsPropertyRootGroup extends OptionsPropertyGroup
|
||||
{
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "root";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Holds the OptionsPropertySubgroup class
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the OptionsPropertyGroup class */
|
||||
require_once "libraries/properties/options/OptionsPropertyGroup.class.php";
|
||||
|
||||
/**
|
||||
* Group property item class of type subgroup
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class OptionsPropertySubgroup extends OptionsPropertyGroup
|
||||
{
|
||||
/**
|
||||
* Subgroup Header
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_subgroupHeader;
|
||||
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "subgroup";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the subgroup header
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubgroupHeader()
|
||||
{
|
||||
return $this->_subgroupHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the subgroup header
|
||||
*
|
||||
* @param string $subgroupHeader subgroup header
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSubgroupHeader($subgroupHeader)
|
||||
{
|
||||
$this->_subgroupHeader = $subgroupHeader;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Holds the BoolPropertyItem class
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the OptionsPropertyOneItem class */
|
||||
require_once "libraries/properties/options/OptionsPropertyOneItem.class.php";
|
||||
|
||||
/**
|
||||
* Single property item class of type bool
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class BoolPropertyItem extends OptionsPropertyOneItem
|
||||
{
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "bool";
|
||||
}
|
||||
}
|
||||
?>
|
||||
35
libraries/properties/options/items/DocPropertyItem.class.php
Normal file
35
libraries/properties/options/items/DocPropertyItem.class.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Holds the DocPropertyItem class
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the OptionsPropertyOneItem class */
|
||||
require_once "libraries/properties/options/OptionsPropertyOneItem.class.php";
|
||||
|
||||
/**
|
||||
* Single property item class of type doc
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class DocPropertyItem extends OptionsPropertyOneItem
|
||||
{
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "doc";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Holds the HiddenPropertyItem class
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the OptionsPropertyOneItem class */
|
||||
require_once "libraries/properties/options/OptionsPropertyOneItem.class.php";
|
||||
|
||||
/**
|
||||
* Single property item class of type hidden
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class HiddenPropertyItem extends OptionsPropertyOneItem
|
||||
{
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "hidden";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Holds the MessageOnlyPropertyItem class
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the OptionsPropertyOneItem class */
|
||||
require_once "libraries/properties/options/OptionsPropertyOneItem.class.php";
|
||||
|
||||
/**
|
||||
* Single property item class of type messageOnly
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class MessageOnlyPropertyItem extends OptionsPropertyOneItem
|
||||
{
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "messageOnly";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Holds the RadioPropertyItem class
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the OptionsPropertyOneItem class */
|
||||
require_once "libraries/properties/options/OptionsPropertyOneItem.class.php";
|
||||
|
||||
/**
|
||||
* Single property item class of type radio
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class RadioPropertyItem extends OptionsPropertyOneItem
|
||||
{
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "radio";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Holds the SelectPropertyItem class
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the OptionsPropertyOneItem class */
|
||||
require_once "libraries/properties/options/OptionsPropertyOneItem.class.php";
|
||||
|
||||
/**
|
||||
* Single property item class of type select
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class SelectPropertyItem extends OptionsPropertyOneItem
|
||||
{
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "select";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Holds the TextPropertyItem class
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the OptionsPropertyOneItem class */
|
||||
require_once "libraries/properties/options/OptionsPropertyOneItem.class.php";
|
||||
|
||||
/**
|
||||
* Single property item class of type text
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class TextPropertyItem extends OptionsPropertyOneItem
|
||||
{
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "text";
|
||||
}
|
||||
}
|
||||
?>
|
||||
215
libraries/properties/plugins/ExportPluginProperties.class.php
Normal file
215
libraries/properties/plugins/ExportPluginProperties.class.php
Normal file
@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Properties class for the export plug-in
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the PluginPropertyItem class */
|
||||
require_once "PluginPropertyItem.class.php";
|
||||
|
||||
/**
|
||||
* Defines possible options and getters and setters for them.
|
||||
*
|
||||
* @todo modify descriptions if needed, when the plug-in properties are integrated
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class ExportPluginProperties extends PluginPropertyItem
|
||||
{
|
||||
/**
|
||||
* Text
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_text;
|
||||
|
||||
/**
|
||||
* Extension
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_extension;
|
||||
|
||||
/**
|
||||
* Options
|
||||
*
|
||||
* @var OptionsPropertyRootGroup
|
||||
*/
|
||||
private $_options;
|
||||
|
||||
/**
|
||||
* Options text
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_optionsText;
|
||||
|
||||
/**
|
||||
* MIME Type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_mimeType;
|
||||
|
||||
|
||||
/**
|
||||
* Whether to force or not
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_forceFile;
|
||||
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "export";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->_text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text
|
||||
*
|
||||
* @param string $text text
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the extension
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExtension()
|
||||
{
|
||||
return $this->_extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the extension
|
||||
*
|
||||
* @param string $extension extension
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setExtension($extension)
|
||||
{
|
||||
$this->_extension = $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the options
|
||||
*
|
||||
* @return OptionsPropertyRootGroup
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the options
|
||||
*
|
||||
* @param OptionsPropertyRootGroup $options options
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
$this->_options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the options text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOptionsText()
|
||||
{
|
||||
return $this->_optionsText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the options text
|
||||
*
|
||||
* @param string $optionsText optionsText
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOptionsText($optionsText)
|
||||
{
|
||||
$this->_optionsText = $optionsText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the MIME type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMimeType()
|
||||
{
|
||||
return $this->_mimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the MIME type
|
||||
*
|
||||
* @param string $mimeType MIME type
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMimeType($mimeType)
|
||||
{
|
||||
$this->_mimeType = $mimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the force file parameter
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getForceFile()
|
||||
{
|
||||
return $this->_forceFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the force file parameter
|
||||
*
|
||||
* @param bool $forceFile the force file parameter
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setForceFile($forceFile)
|
||||
{
|
||||
$this->_forceFile = $forceFile;
|
||||
}
|
||||
}
|
||||
?>
|
||||
156
libraries/properties/plugins/ImportPluginProperties.class.php
Normal file
156
libraries/properties/plugins/ImportPluginProperties.class.php
Normal file
@ -0,0 +1,156 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Properties class for the import plug-in
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the PluginPropertyItem class */
|
||||
require_once "PluginPropertyItem.class.php";
|
||||
|
||||
/**
|
||||
* Defines possible options and getters and setters for them.
|
||||
*
|
||||
* @todo modify descriptions if needed, when the plug-in properties are integrated
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class ImportPluginProperties extends PluginPropertyItem
|
||||
{
|
||||
/**
|
||||
* Text
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_text;
|
||||
|
||||
/**
|
||||
* Extension
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_extension;
|
||||
|
||||
/**
|
||||
* Options
|
||||
*
|
||||
* @var OptionsPropertyRootGroup
|
||||
*/
|
||||
private $_options;
|
||||
|
||||
/**
|
||||
* Options text
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_optionsText;
|
||||
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "import";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->_text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text
|
||||
*
|
||||
* @param string $text text
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the extension
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExtension()
|
||||
{
|
||||
return $this->_extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the extension
|
||||
*
|
||||
* @param string $extension extension
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setExtension($extension)
|
||||
{
|
||||
$this->_extension = $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the options
|
||||
*
|
||||
* @return OptionsPropertyRootGroup
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the options
|
||||
*
|
||||
* @param OptionsPropertyRootGroup $options options
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
$this->_options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the options text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOptionsText()
|
||||
{
|
||||
return $this->_optionsText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the options text
|
||||
*
|
||||
* @param string $optionsText options text
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOptionsText($optionsText)
|
||||
{
|
||||
$this->_optionsText = $optionsText;
|
||||
}
|
||||
}
|
||||
?>
|
||||
36
libraries/properties/plugins/PluginPropertyItem.class.php
Normal file
36
libraries/properties/plugins/PluginPropertyItem.class.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* The top-level class of the "Plugin" subtree of the object-oriented
|
||||
* properties system (the other subtree is "Options").
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the PropertyItem class */
|
||||
require_once "libraries/properties/PropertyItem.class.php";
|
||||
|
||||
/**
|
||||
* Superclass for
|
||||
* - ExportPluginProperties,
|
||||
* - ImportPluginProperties and
|
||||
* - TransformationsPluginProperties
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
abstract class PluginPropertyItem extends PropertyItem
|
||||
{
|
||||
/**
|
||||
* Returns the property type ( either "options", or "plugin" ).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPropertyType()
|
||||
{
|
||||
return "plugin";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Properties class for the transformations plug-in
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* This class extends the PluginPropertyItem class */
|
||||
require_once "PluginPropertyItem.class.php";
|
||||
|
||||
/**
|
||||
* Defines possible options and getters and setters for them.
|
||||
*
|
||||
* @todo modify descriptions if needed, when the plug-in properties are integrated
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class TransformationsPluginProperties extends PluginPropertyItem
|
||||
{
|
||||
/**
|
||||
* Information about the transformations plug-in
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_info;
|
||||
|
||||
/**
|
||||
* MIME Type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_mimeType;
|
||||
|
||||
|
||||
/**
|
||||
* MIME Subtype
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_mimeSubype;
|
||||
|
||||
/**
|
||||
* Name of the transformation
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_transformationName;
|
||||
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
|
||||
/**
|
||||
* Returns the property item type of either an instance of
|
||||
* - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or
|
||||
* - OptionsPropertyGroup ( "root", "main" or "subgroup" )
|
||||
* - PluginPropertyItem ( "export", "import", "transformations" )
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
return "transformations";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information about the transformations plug-in
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInfo()
|
||||
{
|
||||
return $this->_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets information about the transformations plug-in
|
||||
*
|
||||
* @param string $info information about the transformations plug-in
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setInfo($info)
|
||||
{
|
||||
$this->_info = $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the MIME type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMimeType()
|
||||
{
|
||||
return $this->_mimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the MIME type
|
||||
*
|
||||
* @param string $mimeType MIME type
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMimeType($mimeType)
|
||||
{
|
||||
$this->_mimeType = $mimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the MIME subtype
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMimeSubtype()
|
||||
{
|
||||
return $this->_mimeSubype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the MIME subtype
|
||||
*
|
||||
* @param string $mimeSubtype MIME subtype
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMimeSubtype($mimeSubtype)
|
||||
{
|
||||
$this->_mimeSubype = $mimeSubtype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the transformation name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTransformationName()
|
||||
{
|
||||
return $this->_transformationName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the transformation name
|
||||
*
|
||||
* @param string $transformationName transformation name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setTransformationName($transformationName)
|
||||
{
|
||||
$this->_transformationName = $transformationName;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -517,7 +517,10 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both')
|
||||
$foreign = PMA_DBI_fetch_result($rel_query, 'master_field', null, $GLOBALS['controllink']);
|
||||
}
|
||||
|
||||
if (($source == 'both' || $source == 'foreign') && strlen($table)) {
|
||||
if (($source == 'both' || $source == 'foreign') && strlen($table)
|
||||
&& isset($analyzed_sql[0]['foreign_keys'])
|
||||
) {
|
||||
|
||||
$show_create_table_query = 'SHOW CREATE TABLE '
|
||||
. $common_functions->backquote($db) . '.' . $common_functions->backquote($table);
|
||||
$show_create_table = PMA_DBI_fetch_value($show_create_table_query, 0, 1);
|
||||
@ -1161,54 +1164,66 @@ function PMA_getForeignData($foreigners, $field, $override_total, $foreign_filte
|
||||
/**
|
||||
* Finds all related tables
|
||||
*
|
||||
* @param string $from whether to go from master to foreign or vice versa
|
||||
*
|
||||
* @return boolean always true
|
||||
*
|
||||
* @global array $tab_left the list of tables that we still couldn't connect
|
||||
* @global array $tab_know the list of allready connected tables
|
||||
* @global string $fromclause
|
||||
* @param array $all_tables All the involved tables
|
||||
* @param string $master The master table to form the LEFT JOIN clause
|
||||
*
|
||||
* @return string LEFT JOIN
|
||||
* @access private
|
||||
*/
|
||||
function PMA_getRelatives($from)
|
||||
function PMA_getRelatives($all_tables, $master)
|
||||
{
|
||||
global $tab_left, $tab_know, $fromclause;
|
||||
|
||||
$fromclause = '';
|
||||
$emerg = '';
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
|
||||
if ($from == 'master') {
|
||||
$to = 'foreign';
|
||||
} else {
|
||||
$to = 'master';
|
||||
}
|
||||
$in_know = '(\'' . implode('\', \'', $tab_know) . '\')';
|
||||
$in_left = '(\'' . implode('\', \'', $tab_left) . '\')';
|
||||
|
||||
$rel_query = 'SELECT *'
|
||||
. ' FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db'])
|
||||
. '.' . $common_functions->backquote($GLOBALS['cfgRelation']['relation'])
|
||||
. ' WHERE ' . $from . '_db = \'' . $common_functions->sqlAddSlashes($GLOBALS['db']) . '\''
|
||||
. ' AND ' . $to . '_db = \'' . $common_functions->sqlAddSlashes($GLOBALS['db']) . '\''
|
||||
. ' AND ' . $from . '_table IN ' . $in_know
|
||||
. ' AND ' . $to . '_table IN ' . $in_left;
|
||||
$relations = @PMA_DBI_query($rel_query, $GLOBALS['controllink']);
|
||||
while ($row = PMA_DBI_fetch_assoc($relations)) {
|
||||
$found_table = $row[$to . '_table'];
|
||||
if (isset($tab_left[$found_table])) {
|
||||
$fromclause
|
||||
.= "\n" . ' LEFT JOIN '
|
||||
. $common_functions->backquote($GLOBALS['db']) . '.' . $common_functions->backquote($row[$to . '_table']) . ' ON '
|
||||
. $common_functions->backquote($row[$from . '_table']) . '.'
|
||||
. $common_functions->backquote($row[$from . '_field']) . ' = '
|
||||
. $common_functions->backquote($row[$to . '_table']) . '.'
|
||||
. $common_functions->backquote($row[$to . '_field']) . ' ';
|
||||
$tab_know[$found_table] = $found_table;
|
||||
unset($tab_left[$found_table]);
|
||||
// The list of tables that we still couldn't connect
|
||||
$remaining_tables = $all_tables;
|
||||
unset($remaining_tables[$master]);
|
||||
// The list of allready connected tables
|
||||
$known_tables[$master] = $master;
|
||||
$run = 0;
|
||||
while (count($remaining_tables) > 0) {
|
||||
// Whether to go from master to foreign or vice versa
|
||||
if ($run % 2 == 0) {
|
||||
$from = 'master';
|
||||
$to = 'foreign';
|
||||
} else {
|
||||
$from = 'foreign';
|
||||
$to = 'master';
|
||||
}
|
||||
$in_know = '(\'' . implode('\', \'', $known_tables) . '\')';
|
||||
$in_left = '(\'' . implode('\', \'', $remaining_tables) . '\')';
|
||||
$rel_query = 'SELECT *'
|
||||
. ' FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db'])
|
||||
. '.' . $common_functions->backquote($GLOBALS['cfgRelation']['relation'])
|
||||
. ' WHERE ' . $from . '_db = \'' . $common_functions->sqlAddSlashes($GLOBALS['db']) . '\''
|
||||
. ' AND ' . $to . '_db = \'' . $common_functions->sqlAddSlashes($GLOBALS['db']) . '\''
|
||||
. ' AND ' . $from . '_table IN ' . $in_know
|
||||
. ' AND ' . $to . '_table IN ' . $in_left;
|
||||
$relations = @PMA_DBI_query($rel_query, $GLOBALS['controllink']);
|
||||
while ($row = PMA_DBI_fetch_assoc($relations)) {
|
||||
$found_table = $row[$to . '_table'];
|
||||
if (isset($remaining_tables[$found_table])) {
|
||||
$fromclause
|
||||
.= "\n" . ' LEFT JOIN '
|
||||
. $common_functions->backquote($GLOBALS['db']) . '.' . $common_functions->backquote($row[$to . '_table']) . ' ON '
|
||||
. $common_functions->backquote($row[$from . '_table']) . '.'
|
||||
. $common_functions->backquote($row[$from . '_field']) . ' = '
|
||||
. $common_functions->backquote($row[$to . '_table']) . '.'
|
||||
. $common_functions->backquote($row[$to . '_field']) . ' ';
|
||||
$known_tables[$found_table] = $found_table;
|
||||
unset($remaining_tables[$found_table]);
|
||||
}
|
||||
} // end while
|
||||
$run++;
|
||||
if ($run > 5) {
|
||||
foreach ($remaining_tables as $table) {
|
||||
$emerg .= ', ' . $common_functions->backquote($table);
|
||||
unset($remaining_tables[$table]);
|
||||
}
|
||||
}
|
||||
} // end while
|
||||
|
||||
return true;
|
||||
$fromclause = $emerg . $fromclause;
|
||||
return $fromclause;
|
||||
} // end of the "PMA_getRelatives()" function
|
||||
|
||||
/**
|
||||
|
||||
@ -1253,34 +1253,91 @@ function PMA_RTN_handleExecute()
|
||||
. "(" . implode(', ', $args) . ") "
|
||||
. "AS " . $common_functions->backquote($routine['item_name']) . ";\n";
|
||||
}
|
||||
// Execute the queries
|
||||
$affected = 0;
|
||||
$result = null;
|
||||
|
||||
// Get all the queries as one SQL statement
|
||||
$multiple_query = implode("", $queries);
|
||||
|
||||
$outcome = true;
|
||||
foreach ($queries as $query) {
|
||||
$resource = PMA_DBI_try_query($query);
|
||||
if ($resource === false) {
|
||||
$outcome = false;
|
||||
break;
|
||||
}
|
||||
while (true) {
|
||||
$affected = 0;
|
||||
|
||||
// Execute query
|
||||
if (! PMA_DBI_try_multi_query($multiple_query)) {
|
||||
$outcome = false;
|
||||
}
|
||||
|
||||
// Generate output
|
||||
if ($outcome) {
|
||||
|
||||
// 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
|
||||
$output .= "<fieldset><legend>";
|
||||
$output .= sprintf(
|
||||
__('Execution results of routine %s'),
|
||||
$common_functions->backquote(htmlspecialchars($routine['item_name']))
|
||||
);
|
||||
$output .= "</legend>";
|
||||
|
||||
$num_of_rusults_set_to_display = 0;
|
||||
|
||||
do {
|
||||
|
||||
$result = PMA_DBI_store_result();
|
||||
$num_rows = PMA_DBI_num_rows($result);
|
||||
|
||||
if (($result !== false) && ($num_rows > 0)) {
|
||||
|
||||
$output .= "<table><tr>";
|
||||
foreach (PMA_DBI_get_fields_meta($result) as $key => $field) {
|
||||
$output .= "<th>";
|
||||
$output .= htmlspecialchars($field->name);
|
||||
$output .= "</th>";
|
||||
}
|
||||
$output .= "</tr>";
|
||||
|
||||
$color_class = 'odd';
|
||||
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
$output .= "<tr>";
|
||||
foreach ($row as $key => $value) {
|
||||
if ($value === null) {
|
||||
$value = '<i>NULL</i>';
|
||||
} else {
|
||||
$value = htmlspecialchars($value);
|
||||
}
|
||||
$output .= "<td class='" . $color_class . "'>" . $value . "</td>";
|
||||
}
|
||||
$output .= "</tr>";
|
||||
$color_class = ($color_class == 'odd') ? 'even' : 'odd';
|
||||
}
|
||||
|
||||
$output .= "</table>";
|
||||
$num_of_rusults_set_to_display++;
|
||||
$affected = $num_rows;
|
||||
|
||||
}
|
||||
|
||||
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') {
|
||||
$result = $resource ? $resource : $result;
|
||||
$affected = PMA_DBI_affected_rows() - PMA_DBI_num_rows($resource);
|
||||
}
|
||||
}
|
||||
// Generate output
|
||||
if ($outcome) {
|
||||
|
||||
$output .= "<br/>";
|
||||
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
} while (PMA_DBI_next_result());
|
||||
|
||||
$output .= "</fieldset>";
|
||||
|
||||
$message = __('Your SQL query has been executed successfully');
|
||||
if ($routine['item_type'] == 'PROCEDURE') {
|
||||
$message .= '<br />';
|
||||
|
||||
// TODO : message need to be modified according to the
|
||||
// output from the routine
|
||||
$message .= sprintf(
|
||||
_ngettext(
|
||||
'%d row affected by the last statement inside the procedure',
|
||||
@ -1291,40 +1348,12 @@ function PMA_RTN_handleExecute()
|
||||
);
|
||||
}
|
||||
$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'),
|
||||
$common_functions->backquote(htmlspecialchars($routine['item_name']))
|
||||
);
|
||||
$output .= "</legend>";
|
||||
$output .= "<table><tr>";
|
||||
foreach (PMA_DBI_get_fields_meta($result) as $key => $field) {
|
||||
$output .= "<th>";
|
||||
$output .= htmlspecialchars($field->name);
|
||||
$output .= "</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 {
|
||||
|
||||
if ($num_of_rusults_set_to_display == 0) {
|
||||
$notice = __('MySQL returned an empty result set (i.e. zero rows).');
|
||||
$output .= PMA_message::notice($notice)->getDisplay();
|
||||
}
|
||||
|
||||
} else {
|
||||
$output = '';
|
||||
$message = PMA_message::error(
|
||||
@ -1336,6 +1365,7 @@ function PMA_RTN_handleExecute()
|
||||
. __('MySQL said: ') . PMA_DBI_getError(null)
|
||||
);
|
||||
}
|
||||
|
||||
// Print/send output
|
||||
if ($GLOBALS['is_ajax_request']) {
|
||||
$response = PMA_Response::getInstance();
|
||||
|
||||
2197
po/be@latin.po
2197
po/be@latin.po
File diff suppressed because it is too large
Load Diff
2144
po/en_GB.po
2144
po/en_GB.po
File diff suppressed because it is too large
Load Diff
2108
po/phpmyadmin.pot
2108
po/phpmyadmin.pot
File diff suppressed because it is too large
Load Diff
2180
po/pt_BR.po
2180
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user