diff --git a/export.php b/export.php index d638f218d6..abe366d99f 100644 --- a/export.php +++ b/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 diff --git a/import.php b/import.php index a558144242..193a4260f1 100644 --- a/import.php +++ b/import.php @@ -430,6 +430,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 +449,7 @@ if (! $error) { ); } else { // Do the real import - $import_plugin->doImport(); + $import_plugin->doImport($sql_data); } } diff --git a/libraries/CommonFunctions.class.php b/libraries/CommonFunctions.class.php index ab95a6874b..de5a172d42 100644 --- a/libraries/CommonFunctions.class.php +++ b/libraries/CommonFunctions.class.php @@ -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 . ')(\.(' diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index 9fbde32e25..e045f8057e 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -940,7 +940,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 = ''; @@ -1002,7 +1002,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(); @@ -2422,8 +2422,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 +2448,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 +4248,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 @@ -4394,13 +4397,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 ) . '' . "\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 +4442,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 ); diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 3c26c03e99..30b934a697 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -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 diff --git a/libraries/dbi/mysql.dbi.lib.php b/libraries/dbi/mysql.dbi.lib.php index 0e4a5587a1..41d4472556 100644 --- a/libraries/dbi/mysql.dbi.lib.php +++ b/libraries/dbi/mysql.dbi.lib.php @@ -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 * diff --git a/libraries/dbi/mysqli.dbi.lib.php b/libraries/dbi/mysqli.dbi.lib.php index 316796c36c..1bb6a84552 100644 --- a/libraries/dbi/mysqli.dbi.lib.php +++ b/libraries/dbi/mysqli.dbi.lib.php @@ -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 * diff --git a/libraries/import.lib.php b/libraries/import.lib.php index 0160f0bee9..ff8acee258 100644 --- a/libraries/import.lib.php +++ b/libraries/import.lib.php @@ -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 ' 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"; diff --git a/libraries/plugin_interface.lib.php b/libraries/plugin_interface.lib.php index 03d11e22f0..873945ef68 100644 --- a/libraries/plugin_interface.lib.php +++ b/libraries/plugin_interface.lib.php @@ -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 .= '' - . PMA_getString($properties['text']) + . PMA_getString($plugin->getProperties()->getText()) . '' . "\n"; } $ret .= '' . "\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 .= '' - . PMA_getString($opt['text']) . ''; - } elseif ($opt['type'] == 'text') { - $ret .= '
  • ' . "\n"; - $ret .= ''; - $ret .= ''; - } elseif ($opt['type'] == 'message_only') { - $ret .= '
  • ' . "\n"; - $ret .= '

    ' . PMA_getString($opt['text']) . '

    '; - } elseif ($opt['type'] == 'select') { - $ret .= '
  • ' . "\n"; - $ret .= ''; - $ret .= ''; - } elseif ($opt['type'] == 'radio') { - $default = PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']); - foreach ($opt['values'] as $key => $val) { - $ret .= '
  • ' - . PMA_getString($val) . '
  • '; - } - } elseif ($opt['type'] == 'hidden') { - $ret .= '
  • '; - } elseif ($opt['type'] == 'begin_group') { - $ret .= '
    '; - if (isset($opt['text'])) { - $ret .= '

    ' . PMA_getString($opt['text']) . '

    '; + + if (! $is_subgroup) { + // for main groups + $ret .= '
    '; + if ($propertyGroup->getText() != null) { + $ret .= '

    ' . PMA_getString($propertyGroup->getText()) . '

    '; } $ret .= '
      '; - } elseif ($opt['type'] == 'end_group') { - $ret .= '
    '; - } 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']) . '
  • '; - } else { - $ret .= '>'; - } - } elseif ($opt['type'] == 'end_subgroup') { - $ret .= '
  • '; - } 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]); + + foreach ($propertyGroup->getProperties() as $propertyItem) { + $property_class = get_class($propertyItem); + // if the property is a subgroup, we deal with it recursively + if (strpos("group", $property_class)) { + // for subgroups + // each subgroup can have a header, which may also be a form element + $subgroup_header = $propertyItem->getSubgroupHeader(); + $ret .= PMA_pluginGetOneOption( + $section, + $plugin_name, + $propertyItem, + true + ) . '
  • '; + } else { + $ret .= '>'; + } } else { - $ret .= PMA_CommonFunctions::getInstance()->showMySQLDocu($opt['doc'][0], $opt['doc'][1]); + // single property item + switch ($property_class) { + case "BoolPropertyItem": + $ret .= '
  • ' . "\n"; + $ret .= '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 .= ''; + break; + case "DocPropertyItem": + echo "DocPropertyItem"; + break; + case "HiddenPropertyItem": + $ret .= '
  • '; + break; + case "MessageOnlyPropertyItem": + $ret .= '
  • ' . "\n"; + $ret .= '

    ' . PMA_getString($propertyItem->getText()) . '

    '; + break; + case "RadioPropertyItem": + $default = PMA_pluginGetDefault($section, $plugin_name . '_' + . $propertyItem->getName()); + foreach ($propertyItem->getValues() as $key => $val) { + $ret .= '
  • ' + . PMA_getString($val) . '
  • '; + } + break; + case "SelectPropertyItem": + $ret .= '
  • ' . "\n"; + $ret .= ''; + $ret .= ''; + break; + case "TextPropertyItem": + $ret .= '
  • ' . "\n"; + $ret .= ''; + $ret .= 'getSize() != null + ? ' size="' . $propertyItem->getSize() . '"' + : '') + . ($propertyItem->getLen() != null + ? ' maxlength="' . $propertyItem->getLen() . '"' + : '') + . ' />'; + break; + default:; + } } } - // 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 ($is_subgroup) { + // end subgroup + $ret .= '
  • '; + } else { + // end main group + $ret .= '
    '; + } + + $doc = $propertyItem->getDoc(); + if (isset($doc)) { + 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 .= ''; } $ret .= "\n"; @@ -329,27 +411,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 .= '
    '; - $count = 0; - $ret .= '

    ' . PMA_getString($properties['text']) . '

    '; - 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 .= '
    '; + $ret .= '

    ' . PMA_getString($plugin->getProperties()->getText()) + . '

    '; + + 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 .= '

    ' . __('This format has no options') . '

    '; } $ret .= '
    '; } return $ret; -} +} \ No newline at end of file diff --git a/libraries/plugins/export/ExportCodegen.class.php b/libraries/plugins/export/ExportCodegen.class.php index 11e9df24c0..13f9d0004e 100644 --- a/libraries/plugins/export/ExportCodegen.class.php +++ b/libraries/plugins/export/ExportCodegen.class.php @@ -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; } /** diff --git a/libraries/plugins/export/ExportCsv.class.php b/libraries/plugins/export/ExportCsv.class.php index 24af87d603..0ffc3ea4a8 100644 --- a/libraries/plugins/export/ExportCsv.class.php +++ b/libraries/plugins/export/ExportCsv.class.php @@ -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; } /** diff --git a/libraries/plugins/export/ExportExcel.class.php b/libraries/plugins/export/ExportExcel.class.php index 96bf0ba3cb..c77029dc2e 100644 --- a/libraries/plugins/export/ExportExcel.class.php +++ b/libraries/plugins/export/ExportExcel.class.php @@ -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; } /** diff --git a/libraries/plugins/export/ExportHtmlword.class.php b/libraries/plugins/export/ExportHtmlword.class.php index 14bc6f0941..69268b5f03 100644 --- a/libraries/plugins/export/ExportHtmlword.class.php +++ b/libraries/plugins/export/ExportHtmlword.class.php @@ -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 = ''; - + $extracted_columnspec = PMA_CommonFunctions::getInstance()->extractColumnSpec($column['Type']); - + $type = htmlspecialchars($extracted_columnspec['print_type']); if (empty($type)) { $type = ' '; diff --git a/libraries/plugins/export/ExportJson.class.php b/libraries/plugins/export/ExportJson.class.php index 21d57f4c12..a75e184afa 100644 --- a/libraries/plugins/export/ExportJson.class.php +++ b/libraries/plugins/export/ExportJson.class.php @@ -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; } /** diff --git a/libraries/plugins/export/ExportLatex.class.php b/libraries/plugins/export/ExportLatex.class.php index b95f8134df..43c9677d4f 100644 --- a/libraries/plugins/export/ExportLatex.class.php +++ b/libraries/plugins/export/ExportLatex.class.php @@ -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); diff --git a/libraries/plugins/export/ExportOds.class.php b/libraries/plugins/export/ExportOds.class.php index ae320cc926..f599d86431 100644 --- a/libraries/plugins/export/ExportOds.class.php +++ b/libraries/plugins/export/ExportOds.class.php @@ -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; } /** diff --git a/libraries/plugins/export/ExportOdt.class.php b/libraries/plugins/export/ExportOdt.class.php index eca4ae1481..2667c0b38c 100644 --- a/libraries/plugins/export/ExportOdt.class.php +++ b/libraries/plugins/export/ExportOdt.class.php @@ -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( diff --git a/libraries/plugins/export/ExportPdf.class.php b/libraries/plugins/export/ExportPdf.class.php index 9aa41553f8..df3867f518 100644 --- a/libraries/plugins/export/ExportPdf.class.php +++ b/libraries/plugins/export/ExportPdf.class.php @@ -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; } /** diff --git a/libraries/plugins/export/ExportPhparray.class.php b/libraries/plugins/export/ExportPhparray.class.php index f739fd21a4..c1116d3906 100644 --- a/libraries/plugins/export/ExportPhparray.class.php +++ b/libraries/plugins/export/ExportPhparray.class.php @@ -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; } /** diff --git a/libraries/plugins/export/ExportTexytext.class.php b/libraries/plugins/export/ExportTexytext.class.php index 7fcbc7117f..be87426a02 100644 --- a/libraries/plugins/export/ExportTexytext.class.php +++ b/libraries/plugins/export/ExportTexytext.class.php @@ -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); } /** diff --git a/libraries/plugins/export/ExportXml.class.php b/libraries/plugins/export/ExportXml.class.php index 36d15658a2..3fb8452afd 100644 --- a/libraries/plugins/export/ExportXml.class.php +++ b/libraries/plugins/export/ExportXml.class.php @@ -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; } /** diff --git a/libraries/plugins/export/ExportYaml.class.php b/libraries/plugins/export/ExportYaml.class.php index 2ac51c6b05..9c084e6b92 100644 --- a/libraries/plugins/export/ExportYaml.class.php +++ b/libraries/plugins/export/ExportYaml.class.php @@ -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; } /** diff --git a/libraries/plugins/export/ExportMediawiki.class.php b/libraries/plugins/export/todo_change_properties/ExportMediawiki.class.php similarity index 100% rename from libraries/plugins/export/ExportMediawiki.class.php rename to libraries/plugins/export/todo_change_properties/ExportMediawiki.class.php diff --git a/libraries/plugins/export/ExportSql.class.php b/libraries/plugins/export/todo_change_properties/ExportSql.class.php similarity index 100% rename from libraries/plugins/export/ExportSql.class.php rename to libraries/plugins/export/todo_change_properties/ExportSql.class.php diff --git a/libraries/plugins/import/ImportSql.class.php b/libraries/plugins/import/ImportSql.class.php index d25ea2396e..d25c71139a 100644 --- a/libraries/plugins/import/ImportSql.class.php +++ b/libraries/plugins/import/ImportSql.class.php @@ -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); } } \ No newline at end of file diff --git a/libraries/properties/PropertyItem.class.php b/libraries/properties/PropertyItem.class.php new file mode 100644 index 0000000000..21d50682c5 --- /dev/null +++ b/libraries/properties/PropertyItem.class.php @@ -0,0 +1,49 @@ + \ No newline at end of file diff --git a/libraries/properties/options/OptionsPropertyGroup.class.php b/libraries/properties/options/OptionsPropertyGroup.class.php new file mode 100644 index 0000000000..05b96222aa --- /dev/null +++ b/libraries/properties/options/OptionsPropertyGroup.class.php @@ -0,0 +1,102 @@ +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); + } +} +?> \ No newline at end of file diff --git a/libraries/properties/options/OptionsPropertyItem.class.php b/libraries/properties/options/OptionsPropertyItem.class.php new file mode 100644 index 0000000000..4a2418d34b --- /dev/null +++ b/libraries/properties/options/OptionsPropertyItem.class.php @@ -0,0 +1,127 @@ +_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"; + } +} +?> \ No newline at end of file diff --git a/libraries/properties/options/OptionsPropertyOneItem.class.php b/libraries/properties/options/OptionsPropertyOneItem.class.php new file mode 100644 index 0000000000..84b27d37e8 --- /dev/null +++ b/libraries/properties/options/OptionsPropertyOneItem.class.php @@ -0,0 +1,172 @@ +_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; + } +} +?> \ No newline at end of file diff --git a/libraries/properties/options/groups/OptionsPropertyMainGroup.class.php b/libraries/properties/options/groups/OptionsPropertyMainGroup.class.php new file mode 100644 index 0000000000..2de7eadf1c --- /dev/null +++ b/libraries/properties/options/groups/OptionsPropertyMainGroup.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/groups/OptionsPropertyRootGroup.class.php b/libraries/properties/options/groups/OptionsPropertyRootGroup.class.php new file mode 100644 index 0000000000..f1ded7fdb6 --- /dev/null +++ b/libraries/properties/options/groups/OptionsPropertyRootGroup.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/groups/OptionsPropertySubgroup.class.php b/libraries/properties/options/groups/OptionsPropertySubgroup.class.php new file mode 100644 index 0000000000..7a6a5e5a06 --- /dev/null +++ b/libraries/properties/options/groups/OptionsPropertySubgroup.class.php @@ -0,0 +1,68 @@ +_subgroupHeader; + } + + /** + * Sets the subgroup header + * + * @param string $subgroupHeader subgroup header + * + * @return void + */ + public function setSubgroupHeader($subgroupHeader) + { + $this->_subgroupHeader = $subgroupHeader; + } +} +?> \ No newline at end of file diff --git a/libraries/properties/options/items/BoolPropertyItem.class.php b/libraries/properties/options/items/BoolPropertyItem.class.php new file mode 100644 index 0000000000..480921d353 --- /dev/null +++ b/libraries/properties/options/items/BoolPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/DocPropertyItem.class.php b/libraries/properties/options/items/DocPropertyItem.class.php new file mode 100644 index 0000000000..bc69e7edbd --- /dev/null +++ b/libraries/properties/options/items/DocPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/HiddenPropertyItem.class.php b/libraries/properties/options/items/HiddenPropertyItem.class.php new file mode 100644 index 0000000000..f91c5d6e73 --- /dev/null +++ b/libraries/properties/options/items/HiddenPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/MessageOnlyPropertyItem.class.php b/libraries/properties/options/items/MessageOnlyPropertyItem.class.php new file mode 100644 index 0000000000..f80dbc8ad0 --- /dev/null +++ b/libraries/properties/options/items/MessageOnlyPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/RadioPropertyItem.class.php b/libraries/properties/options/items/RadioPropertyItem.class.php new file mode 100644 index 0000000000..4f7eef3973 --- /dev/null +++ b/libraries/properties/options/items/RadioPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/SelectPropertyItem.class.php b/libraries/properties/options/items/SelectPropertyItem.class.php new file mode 100644 index 0000000000..51d294d290 --- /dev/null +++ b/libraries/properties/options/items/SelectPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/TextPropertyItem.class.php b/libraries/properties/options/items/TextPropertyItem.class.php new file mode 100644 index 0000000000..0e0f0915fd --- /dev/null +++ b/libraries/properties/options/items/TextPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/plugins/ExportPluginProperties.class.php b/libraries/properties/plugins/ExportPluginProperties.class.php new file mode 100644 index 0000000000..b8f8465da8 --- /dev/null +++ b/libraries/properties/plugins/ExportPluginProperties.class.php @@ -0,0 +1,215 @@ +_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; + } +} +?> \ No newline at end of file diff --git a/libraries/properties/plugins/ImportPluginProperties.class.php b/libraries/properties/plugins/ImportPluginProperties.class.php new file mode 100644 index 0000000000..24ff567d61 --- /dev/null +++ b/libraries/properties/plugins/ImportPluginProperties.class.php @@ -0,0 +1,156 @@ +_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; + } +} +?> \ No newline at end of file diff --git a/libraries/properties/plugins/PluginPropertyItem.class.php b/libraries/properties/plugins/PluginPropertyItem.class.php new file mode 100644 index 0000000000..f017e9055d --- /dev/null +++ b/libraries/properties/plugins/PluginPropertyItem.class.php @@ -0,0 +1,36 @@ + \ No newline at end of file diff --git a/libraries/properties/plugins/TransformationsPluginProperties.class.php b/libraries/properties/plugins/TransformationsPluginProperties.class.php new file mode 100644 index 0000000000..abdc8e1203 --- /dev/null +++ b/libraries/properties/plugins/TransformationsPluginProperties.class.php @@ -0,0 +1,157 @@ +_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; + } +} +?> \ No newline at end of file diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php index b07b598cfd..89d0bddb84 100644 --- a/libraries/rte/rte_routines.lib.php +++ b/libraries/rte/rte_routines.lib.php @@ -1253,34 +1253,26 @@ 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) { - 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); - } + $affected = 0; + + // Execute query + if (! PMA_DBI_try_multi_query($multiple_query)) { + $outcome = false; } + // Generate output if ($outcome) { $message = __('Your SQL query has been executed successfully'); if ($routine['item_type'] == 'PROCEDURE') { $message .= '
    '; + + // 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', @@ -1295,36 +1287,70 @@ function PMA_RTN_handleExecute() $output = ''; $output .= PMA_SQP_formatHtml(PMA_SQP_parse(implode($queries))); $output .= ''; + // Display results - if ($result) { - $output .= "
    "; - $output .= sprintf( - __('Execution results of routine %s'), - $common_functions->backquote(htmlspecialchars($routine['item_name'])) - ); - $output .= ""; - $output .= ""; - foreach (PMA_DBI_get_fields_meta($result) as $key => $field) { - $output .= ""; - } - $output .= ""; - // Stored routines can only ever return ONE ROW. - $data = PMA_DBI_fetch_single_row($result); - foreach ($data as $key => $value) { - if ($value === null) { - $value = 'NULL'; - } else { - $value = htmlspecialchars($value); + $output .= "
    "; + $output .= sprintf( + __('Execution results of routine %s'), + $common_functions->backquote(htmlspecialchars($routine['item_name'])) + ); + $output .= ""; + + $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 .= "
    "; - $output .= htmlspecialchars($field->name); - $output .= "
    "; + foreach (PMA_DBI_get_fields_meta($result) as $key => $field) { + $output .= ""; + } + $output .= ""; + + $color_class = 'odd'; + + while ($row = PMA_DBI_fetch_assoc($result)) { + $output .= ""; + foreach ($row as $key => $value) { + if ($value === null) { + $value = 'NULL'; + } else { + $value = htmlspecialchars($value); + } + $output .= ""; + } + $output .= ""; + $color_class = ($color_class == 'odd') ? 'even' : 'odd'; } - $output .= ""; + + $output .= "
    "; + $output .= htmlspecialchars($field->name); + $output .= "
    " . $value . "
    " . $value . "
    "; + $num_of_rusults_set_to_display++; + } - $output .= "
    "; - } else { + + if (! PMA_DBI_more_results()) { + break; + } + + $output .= "
    "; + + PMA_DBI_free_result($result); + + } while (PMA_DBI_next_result()); + + $output .= ""; + + 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 +1362,7 @@ function PMA_RTN_handleExecute() . __('MySQL said: ') . PMA_DBI_getError(null) ); } + // Print/send output if ($GLOBALS['is_ajax_request']) { $response = PMA_Response::getInstance(); diff --git a/po/ca.po b/po/ca.po index 139fe23a4b..8f7c5d50d0 100644 --- a/po/ca.po +++ b/po/ca.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-07-18 11:12+0200\n" -"PO-Revision-Date: 2012-07-05 17:22+0200\n" +"PO-Revision-Date: 2012-07-23 17:19+0200\n" "Last-Translator: Xavier Navarro \n" "Language-Team: catalan \n" "Language: ca\n" @@ -3075,7 +3075,7 @@ msgstr "Jocs de caràcters" #: libraries/Menu.class.php:516 server_plugins.php:33 server_plugins.php:66 msgid "Plugins" -msgstr "" +msgstr "Complements" #: libraries/Menu.class.php:520 msgid "Engines" @@ -8562,15 +8562,15 @@ msgstr "Temps" #: libraries/rte/rte_triggers.lib.php:414 msgid "You must provide a trigger name" -msgstr "" +msgstr "Has de proveïr un nom de disparador" #: libraries/rte/rte_triggers.lib.php:419 msgid "You must provide a valid timing for the trigger" -msgstr "" +msgstr "Has de proveïr una sincronització vàlida pel disparador" #: libraries/rte/rte_triggers.lib.php:424 msgid "You must provide a valid event for the trigger" -msgstr "" +msgstr "Has de proveïr un event vàlid pel disparador" #: libraries/rte/rte_triggers.lib.php:430 msgid "You must provide a valid table name" @@ -8578,7 +8578,7 @@ msgstr "Has de donar un nom de taula vàlid" #: libraries/rte/rte_triggers.lib.php:436 msgid "You must provide a trigger definition." -msgstr "" +msgstr "Has de proveïr una definició de disparador." #: libraries/rte/rte_words.lib.php:22 msgid "Add routine" @@ -9142,7 +9142,7 @@ msgstr "Servidor de base de dades" #: main.php:200 msgid "Software" -msgstr "" +msgstr "Programari" #: main.php:204 msgid "Software version" @@ -9649,7 +9649,7 @@ msgstr "Veure volcat (esquema) de les bases de dades" #: server_plugins.php:67 msgid "Modules" -msgstr "" +msgstr "Mòduls" #: server_plugins.php:88 msgid "Begin" @@ -9657,15 +9657,15 @@ msgstr "Inici" #: server_plugins.php:95 msgid "Plugin" -msgstr "" +msgstr "Complement" #: server_plugins.php:96 server_plugins.php:130 msgid "Module" -msgstr "" +msgstr "Mòdul" #: server_plugins.php:97 server_plugins.php:132 msgid "Library" -msgstr "" +msgstr "Llibreria" #: server_plugins.php:98 server_plugins.php:133 tbl_tracking.php:720 msgid "Version" @@ -9673,11 +9673,11 @@ msgstr "Versió" #: server_plugins.php:99 server_plugins.php:134 msgid "Author" -msgstr "" +msgstr "Autor" #: server_plugins.php:100 server_plugins.php:135 msgid "License" -msgstr "" +msgstr "Licència" #: server_plugins.php:166 msgid "disabled" @@ -10379,11 +10379,11 @@ msgstr "Totes les variables d'estat" #: server_status.php:805 msgid "Monitor" -msgstr "" +msgstr "Monitorització" #: server_status.php:806 msgid "Advisor" -msgstr "" +msgstr "Assessorament" #: server_status.php:816 server_status.php:838 msgid "Refresh rate: " @@ -10403,7 +10403,7 @@ msgstr "Mostra només valors d'alerta" #: server_status.php:868 msgid "Filter by category..." -msgstr "" +msgstr "Filtrar per categoria..." #: server_status.php:881 msgid "Show unformatted values" diff --git a/po/gl.po b/po/gl.po index 8900a58978..93b580f1d6 100644 --- a/po/gl.po +++ b/po/gl.po @@ -4,14 +4,14 @@ msgstr "" "Project-Id-Version: phpMyAdmin 3.5.1-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-07-18 11:12+0200\n" -"PO-Revision-Date: 2012-07-19 15:41+0200\n" -"Last-Translator: Xosé \n" +"PO-Revision-Date: 2012-07-23 20:21+0200\n" +"Last-Translator: Julio Guerra \n" "Language-Team: Galician \n" "Language: gl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Weblate 1.1\n" #: browse_foreigners.php:36 browse_foreigners.php:60 js/messages.php:354 @@ -1862,7 +1862,7 @@ msgstr "Par achegarse, escolla unha sección da gráfica co rato." #: js/messages.php:306 msgid "Click reset zoom button to come back to original state." -msgstr "" +msgstr "Prema o botón de restaurar a amplación para voltar o estado orixinal." #: js/messages.php:308 msgid "Click a data point to view and possibly edit the data row." @@ -1956,7 +1956,7 @@ msgstr "Prema para marcar/desmarcar" #: js/messages.php:352 msgid "Double-click to copy column name" -msgstr "" +msgstr "Prema duas veces para copiar o nome da columna" #: js/messages.php:353 msgid "Click the drop-down arrow
    to toggle column's visibility" @@ -1989,7 +1989,7 @@ msgstr "Copiar nome da columna" #: js/messages.php:359 msgid "Right-click the column name to copy it to your clipboard." -msgstr "" +msgstr "Prema co botón dereito para copiar o nome da columna o portapapeis." #: js/messages.php:360 msgid "Show data row(s)" @@ -2287,7 +2287,7 @@ msgstr "Segundo" #: libraries/Advisor.class.php:67 #, php-format msgid "PHP threw following error: %s" -msgstr "" +msgstr "PHP mostrou o seguinte erro:%s" #: libraries/Advisor.class.php:89 #, php-format @@ -3494,7 +3494,7 @@ msgstr "" #: libraries/Types.class.php:359 msgid "A point in 2-dimensional space" -msgstr "" +msgstr "Un punto nun espacio bidimensonal" #: libraries/Types.class.php:361 msgid "A curve with linear interpolation between points" @@ -3508,15 +3508,15 @@ msgstr "Engadir un polígono" #: libraries/Types.class.php:365 msgid "A collection of points" -msgstr "" +msgstr "Unha colección de puntos" #: libraries/Types.class.php:367 msgid "A collection of curves with linear interpolation between points" -msgstr "" +msgstr "Unha coleccción de curvas con interpolación lineal entre puntos" #: libraries/Types.class.php:369 msgid "A collection of polygons" -msgstr "" +msgstr "Unha colección de poligonos" #: libraries/Types.class.php:371 msgid "A collection of geometry objects of any type" @@ -3525,7 +3525,7 @@ msgstr "" #: libraries/Types.class.php:623 libraries/Types.class.php:973 msgctxt "numeric types" msgid "Numeric" -msgstr "" +msgstr "Numérico" #: libraries/Types.class.php:642 libraries/Types.class.php:976 #, fuzzy @@ -3564,7 +3564,7 @@ msgstr "" #: libraries/Types.class.php:715 msgid "True or false" -msgstr "" +msgstr "Verdadeiro ou falso" #: libraries/Types.class.php:717 msgid "An alias for BIGINT NOT NULL AUTO_INCREMENT UNIQUE" @@ -9098,7 +9098,7 @@ msgstr "Texto completo" #: libraries/tbl_properties.inc.php:603 msgid "first" -msgstr "" +msgstr "Primeiro" #: libraries/tbl_properties.inc.php:613 #, fuzzy, php-format @@ -14003,7 +14003,6 @@ msgstr "concurrent_insert está definido como 0" #~ msgid "Click and drag the mouse to navigate the plot." #~ msgstr "Prema e arrastre o rato para navegar na gráfica ." -#, fuzzy #~| msgid "Linestring" #~ msgid "String" #~ msgstr "Cadea de liñas" @@ -14029,7 +14028,6 @@ msgstr "concurrent_insert está definido como 0" #~ msgid "Verbose multiple statements" #~ msgstr "Instrucións múltiplas extensas" -#, fuzzy #~| msgid "Data only" #~ msgid "Dates only." #~ msgstr "Só os datos" diff --git a/po/zh_CN.po b/po/zh_CN.po index de4819b2cd..76188e6c62 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-07-18 11:12+0200\n" -"PO-Revision-Date: 2012-07-21 08:15+0200\n" +"PO-Revision-Date: 2012-07-23 19:45+0200\n" "Last-Translator: shanyan baishui \n" "Language-Team: chinese_simplified \n" "Language: zh_CN\n" @@ -12338,7 +12338,7 @@ msgstr "" msgid "" "The query cache is enabled and the server receives %d queries per second. " "This rule fires if there is more than 100 queries per second." -msgstr "" +msgstr "查询缓存已启用且服务器每秒收到 %d 个查询。该规则在每秒超过 100 个查询时被触发。" #: libraries/advisory_rules.txt:160 #, php-format @@ -12365,30 +12365,29 @@ msgstr "查询缓存使用率" #: libraries/advisory_rules.txt:170 #, php-format msgid "Less than 80%% of the query cache is being utilized." -msgstr "" +msgstr "查询缓存使用不到 80%%。" #: libraries/advisory_rules.txt:171 msgid "" "This might be caused by {query_cache_limit} being too low. Flushing the " "query cache might help as well." -msgstr "" +msgstr "这可能是因为 {query_cache_limit} 太低所导致。刷新查询缓存可能会有帮助。" #: libraries/advisory_rules.txt:172 #, php-format msgid "" "The current ratio of free query cache memory to total query cache size is %s" "%%. It should be above 80%%" -msgstr "" +msgstr "当前空闲查询缓存内存为总查询缓存大小的 %s%%。此值应高于 80%%" #: libraries/advisory_rules.txt:174 msgid "Query cache fragmentation" msgstr "查询缓存碎片" #: libraries/advisory_rules.txt:177 -#, fuzzy #| msgid "The query cache is not enabled." msgid "The query cache is considerably fragmented." -msgstr "查询缓存没有启用。" +msgstr "查询缓存碎片化相当严重。" #: libraries/advisory_rules.txt:178 msgid "" diff --git a/sql.php b/sql.php index 65a50cf440..5adb0f936a 100644 --- a/sql.php +++ b/sql.php @@ -464,32 +464,11 @@ if (empty($reload) * @todo detect all this with the parser, to avoid problems finding * those strings in comments or backquoted identifiers */ - -$is_explain = $is_count = $is_export = $is_delete = $is_insert = $is_affected = $is_show = $is_maint = $is_analyse = $is_group = $is_func = $is_replace = false; -if ($is_select) { // see line 141 - $is_group = preg_match('@(GROUP[[:space:]]+BY|HAVING|SELECT[[:space:]]+DISTINCT)[[:space:]]+@i', $sql_query); - $is_func = ! $is_group && (preg_match('@[[:space:]]+(SUM|AVG|STD|STDDEV|MIN|MAX|BIT_OR|BIT_AND)\s*\(@i', $sql_query)); - $is_count = ! $is_group && (preg_match('@^SELECT[[:space:]]+COUNT\((.*\.+)?.*\)@i', $sql_query)); - $is_export = (preg_match('@[[:space:]]+INTO[[:space:]]+OUTFILE[[:space:]]+@i', $sql_query)); - $is_analyse = (preg_match('@[[:space:]]+PROCEDURE[[:space:]]+ANALYSE@i', $sql_query)); -} elseif (preg_match('@^EXPLAIN[[:space:]]+@i', $sql_query)) { - $is_explain = true; -} elseif (preg_match('@^DELETE[[:space:]]+@i', $sql_query)) { - $is_delete = true; - $is_affected = true; -} elseif (preg_match('@^(INSERT|LOAD[[:space:]]+DATA|REPLACE)[[:space:]]+@i', $sql_query)) { - $is_insert = true; - $is_affected = true; - if (preg_match('@^(REPLACE)[[:space:]]+@i', $sql_query)) { - $is_replace = true; - } -} elseif (preg_match('@^UPDATE[[:space:]]+@i', $sql_query)) { - $is_affected = true; -} elseif (preg_match('@^[[:space:]]*SHOW[[:space:]]+@i', $sql_query)) { - $is_show = true; -} elseif (preg_match('@^(CHECK|ANALYZE|REPAIR|OPTIMIZE)[[:space:]]+TABLE[[:space:]]+@i', $sql_query)) { - $is_maint = true; -} +list($is_group, $is_func, $is_count, $is_export, $is_analyse, $is_explain, + $is_delete, $is_affected, $is_insert, $is_replace, $is_show, $is_maint) + = PMA_getDisplayPropertyParams( + $sql_query, $is_select + ); // assign default full_sql_query $full_sql_query = $sql_query; @@ -497,41 +476,29 @@ $full_sql_query = $sql_query; // Handle remembered sorting order, only for single table query if ($GLOBALS['cfg']['RememberSorting'] && ! ($is_count || $is_export || $is_func || $is_analyse) - && count($analyzed_sql[0]['select_expr']) == 0 + && isset($analyzed_sql[0]['select_expr']) + && (count($analyzed_sql[0]['select_expr']) == 0) && isset($analyzed_sql[0]['queryflags']['select_from']) && count($analyzed_sql[0]['table_ref']) == 1 -) { - $pmatable = new PMA_Table($table, $db); - if (empty($analyzed_sql[0]['order_by_clause'])) { - $sorted_col = $pmatable->getUiProp(PMA_Table::PROP_SORTED_COLUMN); - if ($sorted_col) { - // retrieve the remembered sorting order for current table - $sql_order_to_append = ' ORDER BY ' . $sorted_col . ' '; - $full_sql_query = $analyzed_sql[0]['section_before_limit'] . $sql_order_to_append - . $analyzed_sql[0]['limit_clause'] . ' ' . $analyzed_sql[0]['section_after_limit']; - - // update the $analyzed_sql - $analyzed_sql[0]['section_before_limit'] .= $sql_order_to_append; - $analyzed_sql[0]['order_by_clause'] = $sorted_col; - } - } else { - // store the remembered table into session - $pmatable->setUiProp(PMA_Table::PROP_SORTED_COLUMN, $analyzed_sql[0]['order_by_clause']); - } +) { + + PMA_handleSortOrder($db, $table, $analyzed_sql, $full_sql_query); + } +$sql_limit_to_append = ' LIMIT ' . $_SESSION['tmp_user_values']['pos'] + . ', ' . $_SESSION['tmp_user_values']['max_rows'] . " "; + // Do append a "LIMIT" clause? if (($_SESSION['tmp_user_values']['max_rows'] != 'all') && ! ($is_count || $is_export || $is_func || $is_analyse) && isset($analyzed_sql[0]['queryflags']['select_from']) && ! isset($analyzed_sql[0]['queryflags']['offset']) && empty($analyzed_sql[0]['limit_clause']) -) { - $sql_limit_to_append = ' LIMIT ' . $_SESSION['tmp_user_values']['pos'] - . ', ' . $_SESSION['tmp_user_values']['max_rows'] . " "; +) { - $full_sql_query = $analyzed_sql[0]['section_before_limit'] . "\n" - . $sql_limit_to_append . $analyzed_sql[0]['section_after_limit']; + $full_sql_query = PMA_getSqlWithLimitClause($full_sql_query, $analyzed_sql, $sql_limit_to_append); + /** * @todo pretty printing of this modified query */ @@ -574,11 +541,16 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) { // If a stored procedure was called, there may be more results that are // queued up and waiting to be flushed from the buffer. So let's do that. - while (true) { + do { + PMA_DBI_store_result(); if (! PMA_DBI_more_results()) { break; } - PMA_DBI_next_result(); + } while (PMA_DBI_next_result()); + + $is_procedure = false; + if (stripos($full_sql_query, 'call') !== false) { + $is_procedure = true; } $querytime_after = array_sum(explode(' ', microtime())); @@ -937,13 +909,24 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { $printview = isset($printview) ? $printview : null; $url_query = isset($url_query) ? $url_query : null; - $displayResultsObject->setProperties( - $unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func, - $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage, $text_dir, - $is_maint, $is_explain, $is_show, $showtable, $printview, $url_query - ); - echo $displayResultsObject->getTable($result, $disp_mode, $analyzed_sql); - exit(); + if (!empty($sql_data) && ($sql_data['valid_queries'] > 1)) { + + echo getTableHtmlForMultipleQueries( + $displayResultsObject, $db, $sql_data, $goto, + $pmaThemeImage, $text_dir, $printview, $url_query, $disp_mode, $sql_limit_to_append + ); + + } else { + + $displayResultsObject->setProperties( + $unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func, + $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage, $text_dir, + $is_maint, $is_explain, $is_show, $showtable, $printview, $url_query + ); + + echo $displayResultsObject->getTable($result, $disp_mode, $analyzed_sql); + exit(); + } } @@ -1032,7 +1015,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { } // Display previous update query (from tbl_replace) - if (isset($disp_query) && $cfg['ShowSQL'] == true) { + if (isset($disp_query) && ($cfg['ShowSQL'] == true) && empty($sql_data)) { echo $common_functions->getMessage($disp_message, $disp_query, 'success'); } @@ -1097,13 +1080,24 @@ $(makeProfilingChart); $printview = isset($printview) ? $printview : null; $url_query = isset($url_query) ? $url_query : null; - $displayResultsObject->setProperties( - $unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func, - $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage, $text_dir, - $is_maint, $is_explain, $is_show, $showtable, $printview, $url_query - ); - echo $displayResultsObject->getTable($result, $disp_mode, $analyzed_sql); - PMA_DBI_free_result($result); + if (!empty($sql_data) && ($sql_data['valid_queries'] > 1) || $is_procedure) { + + echo getTableHtmlForMultipleQueries( + $displayResultsObject, $db, $sql_data, $goto, + $pmaThemeImage, $text_dir, $printview, $url_query, $disp_mode, $sql_limit_to_append + ); + + } else { + + $displayResultsObject->setProperties( + $unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func, + $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage, $text_dir, + $is_maint, $is_explain, $is_show, $showtable, $printview, $url_query + ); + + echo $displayResultsObject->getTable($result, $disp_mode, $analyzed_sql); + PMA_DBI_free_result($result); + } // BEGIN INDEX CHECK See if indexes should be checked. if (isset($query_type) && $query_type == 'check_tbl' && isset($selected) && is_array($selected)) { @@ -1176,4 +1170,286 @@ $(makeProfilingChart); if (! isset($_REQUEST['table_maintenance'])) { exit; } + + +// These functions will need for use set the required parameters for display results + +/** + * Initialize some parameters needed to display results + * + * @param string $sql_query SQL statement + * @param boolean $is_select select query or not + * + * @return array set of parameters + * + * @access public + */ +function PMA_getDisplayPropertyParams($sql_query, $is_select) +{ + + $is_explain = $is_count = $is_export = $is_delete = $is_insert = $is_affected = $is_show = $is_maint = $is_analyse = $is_group = $is_func = $is_replace = false; + + if ($is_select) { + $is_group = preg_match('@(GROUP[[:space:]]+BY|HAVING|SELECT[[:space:]]+DISTINCT)[[:space:]]+@i', $sql_query); + $is_func = ! $is_group && (preg_match('@[[:space:]]+(SUM|AVG|STD|STDDEV|MIN|MAX|BIT_OR|BIT_AND)\s*\(@i', $sql_query)); + $is_count = ! $is_group && (preg_match('@^SELECT[[:space:]]+COUNT\((.*\.+)?.*\)@i', $sql_query)); + $is_export = (preg_match('@[[:space:]]+INTO[[:space:]]+OUTFILE[[:space:]]+@i', $sql_query)); + $is_analyse = (preg_match('@[[:space:]]+PROCEDURE[[:space:]]+ANALYSE@i', $sql_query)); + } elseif (preg_match('@^EXPLAIN[[:space:]]+@i', $sql_query)) { + $is_explain = true; + } elseif (preg_match('@^DELETE[[:space:]]+@i', $sql_query)) { + $is_delete = true; + $is_affected = true; + } elseif (preg_match('@^(INSERT|LOAD[[:space:]]+DATA|REPLACE)[[:space:]]+@i', $sql_query)) { + $is_insert = true; + $is_affected = true; + if (preg_match('@^(REPLACE)[[:space:]]+@i', $sql_query)) { + $is_replace = true; + } + } elseif (preg_match('@^UPDATE[[:space:]]+@i', $sql_query)) { + $is_affected = true; + } elseif (preg_match('@^[[:space:]]*SHOW[[:space:]]+@i', $sql_query)) { + $is_show = true; + } elseif (preg_match('@^(CHECK|ANALYZE|REPAIR|OPTIMIZE)[[:space:]]+TABLE[[:space:]]+@i', $sql_query)) { + $is_maint = true; + } + + return array( + $is_group, $is_func, $is_count, $is_export, $is_analyse, $is_explain, + $is_delete, $is_affected, $is_insert, $is_replace,$is_show, $is_maint + ); + +} + +/** + * Get the database name inside a USE query + * + * @param string $sql SQL query + * @param array $databases array with all databases + * + * @return strin $db new database name + */ +function PMA_getNewDatabase($sql, $databases) +{ + $db = ''; + // loop through all the databases + foreach ($databases as $database){ + if (strpos($sql,$database['SCHEMA_NAME']) !== false) { + $db = $database; + break; + } + } + return $db; +} + +/** + * Get the table name in a sql query + * If there are several tables in the SQL query, + * first table wil lreturn + * + * @param string $sql SQL query + * @param array $tables array of names in current database + * + * @return string $table table name + */ +function PMA_getTableNameBySQL($sql, $tables) +{ + + $table = ''; + + // loop through all the tables in the database + foreach ($tables as $tbl) { + if (strpos($sql,$tbl)) { + $table .= ' ' . $tbl; + } + } + + if (count(explode(' ', trim($table))) > 1) { + $tmp_array = explode(' ', trim($table)); + return $tmp_array[0]; + } + + return trim($table); + +} + + +/** + * Generate table html when SQL statement have multiple queries + * which return displayable results + * + * @param PMA_DisplayResults $displayResultsObject object + * @param string $db database name + * @param array $sql_data information about SQL statement + * @param string $goto the URL to go back in case of errors + * @param string $pmaThemeImage path for theme images directory + * @param string $text_dir + * @param string $printview + * @param string $url_query URL query + * @param array $disp_mode the display mode + * + * @return string $table_html html content + */ +function getTableHtmlForMultipleQueries( + $displayResultsObject, $db, $sql_data, $goto, $pmaThemeImage, + $text_dir, $printview, $url_query, $disp_mode, $sql_limit_to_append +) { + + $table_html = ''; + + $tables_array = PMA_DBI_get_tables($db); + $databases_array = PMA_DBI_get_databases_full(); + $multi_sql = implode(";", $sql_data['valid_sql']); + $querytime_before = array_sum(explode(' ', microtime())); + + // Assignment for variable is not needed since the results are + // looiping using the connection + @PMA_DBI_try_multi_query($multi_sql); + + $querytime_after = array_sum(explode(' ', microtime())); + $querytime = $querytime_after - $querytime_before; + $sql_no = 0; + + do { + + // Initialize needed params related to each query + + // Use query can change the database + if (stripos($sql_data['valid_sql'][$sql_no], "use ")) { + $db = PMA_getNewDatabase($sql_data['valid_sql'][$sql_no], $databases_array); + } + + $table = PMA_getTableNameBySQL($sql_data['valid_sql'][$sql_no], $tables_array); + $result = PMA_DBI_store_result(); + $fields_meta = PMA_DBI_get_fields_meta($result); + $fields_cnt = count($fields_meta); + $parsed_sql = PMA_SQP_parse($sql_data['valid_sql'][$sql_no]); + + $analyzed_sql = PMA_SQP_analyze($parsed_sql); + $is_select = isset($analyzed_sql[0]['queryflags']['select_from']); + $unlim_num_rows = PMA_Table::countRecords($db, $table, $force_exact = true); + $showtable = PMA_Table::sGetStatusInfo($db, $table, null, true); + $url_query = PMA_generate_common_url($db, $table); + + list($is_group, $is_func, $is_count, $is_export, $is_analyse, + $is_explain, $is_delete, $is_affected, $is_insert, $is_replace, + $is_show, $is_maint) + = PMA_getDisplayPropertyParams( + $sql_data['valid_sql'][$sql_no], $is_select + ); + + // Handle remembered sorting order, only for single table query + if ($GLOBALS['cfg']['RememberSorting'] + && ! ($is_count || $is_export || $is_func || $is_analyse) + && isset($analyzed_sql[0]['select_expr']) + && (count($analyzed_sql[0]['select_expr']) == 0) + && isset($analyzed_sql[0]['queryflags']['select_from']) + && count($analyzed_sql[0]['table_ref']) == 1 + ) { + PMA_handleSortOrder($db, $table, $analyzed_sql, $sql_data['valid_sql'][$sql_no]); + } + + // Do append a "LIMIT" clause? + if (($_SESSION['tmp_user_values']['max_rows'] != 'all') + && ! ($is_count || $is_export || $is_func || $is_analyse) + && isset($analyzed_sql[0]['queryflags']['select_from']) + && ! isset($analyzed_sql[0]['queryflags']['offset']) + && empty($analyzed_sql[0]['limit_clause']) + ) { + $sql_data['valid_sql'][$sql_no] = PMA_getSqlWithLimitClause( + $sql_data['valid_sql'][$sql_no], $analyzed_sql, $sql_limit_to_append + ); + } + + if (! $is_affected) { + $num_rows = ($result) ? @PMA_DBI_num_rows($result) : 0; + } elseif (! isset($num_rows)) { + $num_rows = @PMA_DBI_affected_rows(); + } + + if ($num_rows == 0) { + continue; + } + + // Set the needed properties related to executing sql query + $displayResultsObject->__set('_db', $db); + $displayResultsObject->__set('_table', $table); + $displayResultsObject->__set('_goto', $goto); + $displayResultsObject->__set('_sql_query', $sql_data['valid_sql'][$sql_no]); + + $displayResultsObject->setProperties( + $unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func, + $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage, $text_dir, + $is_maint, $is_explain, $is_show, $showtable, $printview, $url_query + ); + + // With multiple results, operations are limied + $disp_mode = 'nnnn000000'; + $is_limited_display = true; + + // Collect the tables + $table_html .= $displayResultsObject->getTable( + $result, $disp_mode, $analyzed_sql, $is_limited_display + ); + $sql_no++; + + // Free the result to save the memory + PMA_DBI_free_result($result); + + if (! PMA_DBI_more_results()) { + break; + } + + } while (PMA_DBI_next_result()); + + return $table_html; + +} + +/** + * Handle remembered sorting order, only for single table query + * + * @param string $db database name + * @param string $table table name + * @param array $analyzed_sql the analyzed query + * @param string $full_sql_query SQL query + */ +function PMA_handleSortOrder($db, $table, &$analyzed_sql, &$full_sql_query) +{ + + $pmatable = new PMA_Table($table, $db); + if (empty($analyzed_sql[0]['order_by_clause'])) { + $sorted_col = $pmatable->getUiProp(PMA_Table::PROP_SORTED_COLUMN); + if ($sorted_col) { + // retrieve the remembered sorting order for current table + $sql_order_to_append = ' ORDER BY ' . $sorted_col . ' '; + $full_sql_query = $analyzed_sql[0]['section_before_limit'] . $sql_order_to_append + . $analyzed_sql[0]['limit_clause'] . ' ' . $analyzed_sql[0]['section_after_limit']; + + // update the $analyzed_sql + $analyzed_sql[0]['section_before_limit'] .= $sql_order_to_append; + $analyzed_sql[0]['order_by_clause'] = $sorted_col; + } + } else { + // store the remembered table into session + $pmatable->setUiProp(PMA_Table::PROP_SORTED_COLUMN, $analyzed_sql[0]['order_by_clause']); + } + +} + +/** + * Append limit clause to SQL query + * + * @param string $full_sql_query SQL query + * @param array $analyzed_sql the analyzed query + * @param string $sql_limit_to_append clause to append + * + * @return string limit clause appended SQL query + */ +function PMA_getSqlWithLimitClause($full_sql_query, $analyzed_sql, $sql_limit_to_append) +{ + return $analyzed_sql[0]['section_before_limit'] . "\n" + . $sql_limit_to_append . $analyzed_sql[0]['section_after_limit']; +} + ?> diff --git a/test/AllSeleniumTests.php b/test/AllSeleniumTests.php index 8efb1d9b5c..e1b6982a89 100644 --- a/test/AllSeleniumTests.php +++ b/test/AllSeleniumTests.php @@ -32,6 +32,7 @@ class AllSeleniumTests $suite->addTestSuite('PmaSeleniumLoginTest'); $suite->addTestSuite('PmaSeleniumXssTest'); $suite->addTestSuite('PmaSeleniumPrivilegesTest'); + $suite->addTestSuite('PmaSeleniumCreateDropDatabaseTest'); return $suite; } } diff --git a/test/classes/PMA_Types_MySQL_test.php b/test/classes/PMA_Types_MySQL_test.php index f322b87cdd..3a44622d42 100644 --- a/test/classes/PMA_Types_MySQL_test.php +++ b/test/classes/PMA_Types_MySQL_test.php @@ -263,7 +263,7 @@ class PMA_Types_MySQL_test extends PHPUnit_Framework_TestCase public function testGetFunctionsClass($class, $output){ if (! defined('PMA_MYSQL_INT_VERSION')) { - define('PMA_MYSQL_INT_VERSION', 50000); + define('PMA_MYSQL_INT_VERSION', 60000); } $this->assertEquals( @@ -398,9 +398,11 @@ class PMA_Types_MySQL_test extends PHPUnit_Framework_TestCase '39' => 'SQRT', '40' => 'TAN', '41' => 'TO_DAYS', + '42' => 'TO_SECONDS', '43' => 'TIME_TO_SEC', '44' => 'UNCOMPRESSED_LENGTH', '45' => 'UNIX_TIMESTAMP', + '46' => 'UUID_SHORT', '47' => 'WEEK', '48' => 'WEEKDAY', '49' => 'WEEKOFYEAR', diff --git a/test/libraries/PMA_bookmark_test.php b/test/libraries/PMA_bookmark_test.php index a8ea3189f4..e6716faaad 100644 --- a/test/libraries/PMA_bookmark_test.php +++ b/test/libraries/PMA_bookmark_test.php @@ -30,8 +30,8 @@ class PMA_bookmark_test extends PHPUnit_Framework_TestCase function PMA_DBI_fetch_result() { return array( - 'id' => 'id', - 'label' => 'label' + 'table1', + 'table2' ); } } @@ -68,8 +68,8 @@ class PMA_bookmark_test extends PHPUnit_Framework_TestCase public function testPMA_Bookmark_getList(){ $this->assertEquals( array( - 'id' => 'id (shared)', - 'label' => 'label (shared)' + 0 => 'table1 (shared)', + 1 => 'table2 (shared)' ), PMA_Bookmark_getList('phpmyadmin') ); diff --git a/test/selenium/PmaSeleniumCreateDropDatabaseTest.php b/test/selenium/PmaSeleniumCreateDropDatabaseTest.php new file mode 100644 index 0000000000..d408158c39 --- /dev/null +++ b/test/selenium/PmaSeleniumCreateDropDatabaseTest.php @@ -0,0 +1,41 @@ +setBrowser(Helper::getBrowserString()); + $this->setBrowserUrl(TESTSUITE_PHPMYADMIN_HOST . TESTSUITE_PHPMYADMIN_URL); + } + + public function testCreateDropDatabase() + { + $log = new PmaSeleniumTestCase($this); + $log->login(TESTSUITE_USER, TESTSUITE_PASSWORD); + $this->selectFrame("frame_content"); + $this->click("link=Databases"); + $this->waitForPageToLoad("30000"); + $this->type("id=text_create_db", "pma"); + $this->click("id=buttonGo"); + $this->assertTrue($this->isTextPresent("pma")); + + $this->click("link=pma"); + $this->waitForPageToLoad("30000"); + $this->click("link=Operations"); + $this->waitForPageToLoad("30000"); + $this->click("id=drop_db_anchor"); + $this->click("//button[@type='button']"); + + } +}