diff --git a/ChangeLog b/ChangeLog
index 256001a8cb..c226dd6ec9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,9 @@ VerboseMultiSubmit, ReplaceHelpImg
+ Ajaxified "Create View" functionality
+ [import] New plugin: import mediawiki
+ Add Ajax support to Fast filter in order to search the term in all database tables
+- bug #3535015 [navi] DbFilter, TableFilter clear button hidden on Chrome
+
+3.5.3.0 (not yet released)
3.5.2.0 (not yet released)
- bug #3521416 [interface] JS error when editing index
diff --git a/db_operations.php b/db_operations.php
index 7b24accb0e..aca47a864a 100644
--- a/db_operations.php
+++ b/db_operations.php
@@ -631,9 +631,10 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
$test_query = '
SELECT *
- FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['pdf_pages']) . '
+ FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db'])
+ . '.' . $common_functions->backquote($cfgRelation['pdf_pages']) . '
WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'';
- $test_rs = PMA_query_as_controluser($test_query, null, PMA_DBI_QUERY_STORE);
+ $test_rs = PMA_queryAsControlUser($test_query, null, PMA_DBI_QUERY_STORE);
/*
* Export Relational Schema View
diff --git a/db_search.php b/db_search.php
index 1a2f2b9e56..f6606ba910 100644
--- a/db_search.php
+++ b/db_search.php
@@ -103,7 +103,7 @@ $sub_part = '';
if ( $GLOBALS['is_ajax_request'] != true) {
include 'libraries/db_info.inc.php';
- echo '
';
+ $response->addHTML('
');
}
/**
@@ -200,78 +200,134 @@ if (isset($_REQUEST['submit_search'])) {
return $sql;
} // end of the "PMA_getSearchSqls()" function
+ $response->addHTML(
+ PMA_dbSearchGetSearchResults(
+ $tables_selected, $searched, $option_str,
+ $search_str, $search_option, (! empty($field_str) ? $field_str : '')
+ )
+ );
+} // end 1.
-
- /**
- * Displays the results
- */
+/**
+ * Displays database search results
+ *
+ * @param array $tables_selected Tables on which search is to be performed
+ * @param string $searched The search word/phrase/regexp
+ * @param string $option_str Type of search
+ * @param string $search_str the string to search
+ * @param integer $search_option type of search
+ * (1 -> 1 word at least, 2 -> all words,
+ * 3 -> exact string, 4 -> regexp)
+ * @param string $field_str Restrict the search to this field
+ *
+ * @return string HTML for search results
+ */
+function PMA_dbSearchGetSearchResults($tables_selected, $searched, $option_str,
+ $search_str, $search_option, $field_str = null
+) {
$this_url_params = array(
'db' => $GLOBALS['db'],
'goto' => 'db_sql.php',
'pos' => 0,
'is_js_confirmed' => 0,
);
-
+ $html_output = '';
// Displays search string
- echo '
' . "\n"
- . '
';
if (count($tables_selected) > 1) {
- echo '
' . sprintf(
- _ngettext('Total: %s match', 'Total: %s matches', $num_search_result_total),
+ $html_output .= '
';
+ $html_output .= sprintf(
+ _ngettext(
+ 'Total: %s match',
+ 'Total: %s matches',
+ $num_search_result_total
+ ),
$num_search_result_total
- ) . '
' . "\n";
+ );
+ $html_output .= '';
}
-} // end 1.
+ return $html_output;
+}
+
+/**
+ * Provides search results row with browse/delete links.
+ * (for a table)
+ *
+ * @param string $each_table Tables on which search is to be performed
+ * @param array $newsearchsqls Contains SQL queries
+ * @param bool $odd_row For displaying contrasting table rows
+ *
+ * @return string HTML row
+ */
+function PMA_dbSearchGetResultsRow($each_table, $newsearchsqls, $odd_row)
+{
+ $res_cnt = PMA_DBI_fetch_value($newsearchsqls['select_count']);
+ // Start forming search results row
+ $html_output = '
';
+ $html_output .= '';
+ $html_output .= sprintf(
+ _ngettext(
+ '%1$s match in %2$s ',
+ '%1$s matches in %2$s ', $res_cnt
+ ),
+ $res_cnt, htmlspecialchars($each_table)
+ );
+ $html_output .= ' ';
+
+ if ($res_cnt > 0) {
+ $this_url_params['sql_query'] = $newsearchsqls['select_fields'];
+ $browse_result_path = 'sql.php' . PMA_generate_common_url($this_url_params);
+ $html_output .= ''
+ . __('Browse') . ' ';
+ $this_url_params['sql_query'] = $newsearchsqls['delete'];
+ $delete_result_path = 'sql.php' . PMA_generate_common_url($this_url_params);
+ $html_output .= ''
+ . __('Delete') . ' ';
+ } else {
+ $html_output .= ' '
+ .' ';
+ }// end if else
+ $html_output .= ' ';
+ return $html_output;
+}
/**
* If we are in an Ajax request, we need to exit after displaying all the HTML
@@ -279,98 +335,134 @@ if (isset($_REQUEST['submit_search'])) {
if ($GLOBALS['is_ajax_request'] == true) {
exit;
} else {
- echo '
';//end searchresults div
+ $response->addHTML('
');//end searchresults div
}
/**
- * 2. Displays the main search form
+ * Provides the main search form's html
+ *
+ * @param string $searched Keyword/Regular expression to be searched
+ * @param integer $search_option Type of search (one word, phrase etc.)
+ * @param array $tables_names_only Names of all tables
+ * @param array $tables_selected Tables on which search is to be performed
+ * @param array $url_params URL parameters
+ * @param string $field_str Restrict the search to this field
+ *
+ * @return string HTML for selection form
*/
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/db_structure.php b/db_structure.php
index 894fdc78fe..ceb281d9c3 100644
--- a/db_structure.php
+++ b/db_structure.php
@@ -460,7 +460,7 @@ foreach ($tables as $keyname => $each_table) {
?>"
id="row_tbl_">
- />
@@ -684,13 +684,8 @@ $checkall_url = 'db_structure.php?' . PMA_generate_common_url($db);
?>
-
-
-/
-
-
+
+
/
0) {
+ $checkall.prop({checked: true, indeterminate: true});
+ }
+ else {
+ $checkall.prop({checked: false, indeterminate: false});
+ }
+});
+$("input#checkall").live("change", function() {
+ var is_checked = $(this).is(":checked");
+ $(this.form).find(checkboxes_sel).prop("checked", is_checked)
+ .parents("tr").toggleClass("marked", is_checked);
+});
+
/**
* Toggles row colors of a set of 'tr' elements starting from a given element
*
diff --git a/js/server_databases.js b/js/server_databases.js
index abf31b2caf..caf59554b4 100644
--- a/js/server_databases.js
+++ b/js/server_databases.js
@@ -30,7 +30,8 @@ $(function() {
* @var selected_dbs Array containing the names of the checked databases
*/
var selected_dbs = [];
- $form.find('input:checkbox:checked').each(function () {
+ // loop over all checked checkboxes, except the #checkall checkbox
+ $form.find('input:checkbox:checked:not(#checkall)').each(function () {
$(this).closest('tr').addClass('removeMe');
selected_dbs[selected_dbs.length] = 'DROP DATABASE `' + escapeHtml($(this).val()) + '`;';
});
diff --git a/libraries/Config.class.php b/libraries/Config.class.php
index cad6eff80b..01d47aa670 100644
--- a/libraries/Config.class.php
+++ b/libraries/Config.class.php
@@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) {
/**
* Load vendor configuration.
*/
-require './libraries/vendor_config.php';
+require_once './libraries/vendor_config.php';
/**
* Configuration class
diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php
index 07d0fc8bb8..3a43a2c2bb 100644
--- a/libraries/DisplayResults.class.php
+++ b/libraries/DisplayResults.class.php
@@ -4275,10 +4275,6 @@ class PMA_DisplayResults
'sql_query' => $this->_sql_query,
'goto' => $this->_goto,
);
- $uncheckall_url = 'sql.php' . PMA_generate_common_url($_url_params);
-
- $_url_params['checkall'] = '1';
- $checkall_url = 'sql.php' . PMA_generate_common_url($_url_params);
if ($_SESSION['tmp_user_values']['disp_direction'] == self::DISP_DIR_VERTICAL) {
@@ -4312,10 +4308,9 @@ class PMA_DisplayResults
. ' alt="' . __('With selected:') . '" />';
}
- $links_html .= $checkall_link . "\n"
- . ' / ' . "\n"
- . $uncheckall_link . "\n"
- . '' . __('With selected:') . ' ' . "\n";
+ $links_html .= ' '
+ . '' . __('Check All') . ' '
+ . '' . __('With selected:') . ' ' . "\n";
$links_html .= $this->getCommonFunctions()->getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_change',
@@ -4566,13 +4561,13 @@ class PMA_DisplayResults
* @param string $transform_options transformation parameters
* @param string $default_function default transformation function
* @param object $meta the meta-information about this field
- * @param array $url_params parameters that should go to the
+ * @param array $url_params parameters that should go to the
* download link
*
* @return mixed string or float
- *
+ *
* @access private
- *
+ *
* @see _getDataCellForBlobColumns(), _getDataCellForGeometryColumns(),
* _getDataCellForNonNumericAndNonBlobColumns(),
* _getSortedColumnMessage()
@@ -4656,12 +4651,12 @@ class PMA_DisplayResults
* @param bool $is_field_truncated whether the field is truncated
*
* @return string formatted data
- *
+ *
* @access private
- *
+ *
* @see _getDataCellForNumericColumns(), _getDataCellForGeometryColumns(),
* _getDataCellForNonNumericAndNonBlobColumns(),
- *
+ *
*/
private function _getRowData(
$class, $condition_field, $analyzed_sql, $meta, $map, $data,
@@ -4838,9 +4833,9 @@ class PMA_DisplayResults
* @param string $class css classes for the td element
*
* @return string the generated HTML
- *
+ *
* @access private
- *
+ *
* @see _getTableBody(), _getCheckboxAndLinks()
*/
private function _getCheckboxForMultiRowSubmissions(
@@ -4861,7 +4856,7 @@ class PMA_DisplayResults
. '
diff --git a/libraries/Footer.class.php b/libraries/Footer.class.php
index 4af7b1867f..143c903db9 100644
--- a/libraries/Footer.class.php
+++ b/libraries/Footer.class.php
@@ -106,7 +106,7 @@ class PMA_Footer
// set current db, table and sql query in the querywindow
$query = '';
- if (strlen($GLOBALS['sql_query']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
+ if (isset($GLOBALS['sql_query']) && strlen($GLOBALS['sql_query']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
$query = PMA_escapeJsString($GLOBALS['sql_query']);
}
$this->_scripts->addCode("
diff --git a/libraries/Header.class.php b/libraries/Header.class.php
index 8323e31bcc..90c71b2591 100644
--- a/libraries/Header.class.php
+++ b/libraries/Header.class.php
@@ -337,7 +337,7 @@ class PMA_Header
*/
$GLOBALS['now'] = gmdate('D, d M Y H:i:s') . ' GMT';
/* Prevent against ClickJacking by allowing frames only from same origin */
- if (! $GLOBALS['cfg']['AllowThirdPartyFraming']) {
+ if (! $GLOBALS['cfg']['AllowThirdPartyFraming'] && ! defined('TESTSUITE')) {
header(
'X-Frame-Options: SAMEORIGIN'
);
@@ -353,7 +353,7 @@ class PMA_Header
);
}
PMA_noCacheHeader();
- if (! defined('IS_TRANSFORMATION_WRAPPER')) {
+ if (! defined('IS_TRANSFORMATION_WRAPPER') && ! defined('TESTSUITE')) {
// Define the charset to be used
header('Content-Type: text/html; charset=utf-8');
}
diff --git a/libraries/Index.class.php b/libraries/Index.class.php
index bbdd547f58..989b9d0556 100644
--- a/libraries/Index.class.php
+++ b/libraries/Index.class.php
@@ -21,50 +21,50 @@ class PMA_Index
*
* @var array
*/
- protected static $_registry = array();
+ private static $_registry = array();
/**
* @var string The name of the schema
*/
- protected $_schema = '';
+ private $_schema = '';
/**
* @var string The name of the table
*/
- protected $_table = '';
+ private $_table = '';
/**
* @var string The name of the index
*/
- protected $_name = '';
+ private $_name = '';
/**
* Columns in index
*
* @var array
*/
- protected $_columns = array();
+ private $_columns = array();
/**
* The index method used (BTREE, SPATIAL, FULLTEXT, HASH, RTREE).
*
* @var string
*/
- protected $_type = '';
+ private $_type = '';
/**
* The index choice (PRIMARY, UNIQUE, INDEX, SPATIAL, FULLTEXT)
*
* @var string
*/
- protected $_choice = '';
+ private $_choice = '';
/**
* Various remarks.
*
* @var string
*/
- protected $_remarks = '';
+ private $_remarks = '';
/**
* Any comment provided for the index with a COMMENT attribute when the
@@ -72,19 +72,19 @@ class PMA_Index
*
* @var string
*/
- protected $_comment = '';
+ private $_comment = '';
/**
* @var integer 0 if the index cannot contain duplicates, 1 if it can.
*/
- protected $_non_unique = 0;
+ private $_non_unique = 0;
/**
* Indicates how the key is packed. NULL if it is not.
*
* @var string
*/
- protected $_packed = null;
+ private $_packed = null;
/**
* Constructor
@@ -157,7 +157,7 @@ class PMA_Index
*
* @return boolean whether loading was successful
*/
- static protected function _loadIndexes($table, $schema)
+ static private function _loadIndexes($table, $schema)
{
if (isset(PMA_Index::$_registry[$schema][$table])) {
return true;
@@ -202,7 +202,8 @@ class PMA_Index
// $columns[names][]
// $columns[sub_parts][]
foreach ($columns['names'] as $key => $name) {
- $sub_part = isset($columns['sub_parts'][$key]) ? $columns['sub_parts'][$key] : '';
+ $sub_part = isset($columns['sub_parts'][$key])
+ ? $columns['sub_parts'][$key] : '';
$_columns[] = array(
'Column_name' => $name,
'Sub_part' => $sub_part,
@@ -435,7 +436,10 @@ class PMA_Index
if (! $print_mode) {
$r = ' ';
$r .= '';
$r .= $no_indexes;
if (count($indexes) < 1) {
@@ -482,24 +486,39 @@ class PMA_Index
if ($GLOBALS['cfg']['AjaxEnable']) {
$r .= ' ajax';
}
- $r .= '" ' . $row_span . '>'
- . ' ' . $common_functions->getIcon('b_edit.png', __('Edit')) . ' '
+ $r .= '" ' . $row_span . '>' . ' '
+ . $common_functions->getIcon('b_edit.png', __('Edit')) . ' '
. '' . "\n";
$this_params = $GLOBALS['url_params'];
if ($index->getName() == 'PRIMARY') {
- $this_params['sql_query'] = 'ALTER TABLE ' . $common_functions->backquote($table) . ' DROP PRIMARY KEY;';
- $this_params['message_to_show'] = __('The primary key has been dropped');
- $js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP PRIMARY KEY');
+ $this_params['sql_query'] = 'ALTER TABLE '
+ . $common_functions->backquote($table)
+ . ' DROP PRIMARY KEY;';
+ $this_params['message_to_show']
+ = __('The primary key has been dropped');
+ $js_msg = PMA_jsFormat(
+ 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY'
+ );
} else {
- $this_params['sql_query'] = 'ALTER TABLE ' . $common_functions->backquote($table) . ' DROP INDEX ' . $common_functions->backquote($index->getName()) . ';';
- $this_params['message_to_show'] = sprintf(__('Index %s has been dropped'), $index->getName());
- $js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP INDEX ' . $index->getName()) . ';';
+ $this_params['sql_query'] = 'ALTER TABLE '
+ . $common_functions->backquote($table) . ' DROP INDEX '
+ . $common_functions->backquote($index->getName()) . ';';
+ $this_params['message_to_show'] = sprintf(
+ __('Index %s has been dropped'), $index->getName()
+ );
+
+ $js_msg = PMA_jsFormat(
+ 'ALTER TABLE ' . $table . ' DROP INDEX '
+ . $index->getName() . ';'
+ );
+
}
$r .= '';
- $r .= ' ';
+ $r .= ' ';
$r .= ' ' . htmlspecialchars($index->getName()) . ' ';
+ $r .= ''
+ . htmlspecialchars($index->getName())
+ . ' ';
} else {
- $r .= '' . htmlspecialchars($index->getName()) . ' ';
+ $r .= ''
+ . htmlspecialchars($index->getName())
+ . ' ';
}
- $r .= '' . htmlspecialchars($index->getType()) . ' ';
+ $r .= ''
+ . htmlspecialchars($index->getType())
+ . ' ';
$r .= '' . $index->isUnique(true) . ' ';
$r .= '' . $index->isPacked(true) . ' ';
@@ -528,9 +553,15 @@ class PMA_Index
$r .= ' (' . $column->getSubPart() . ')';
}
$r .= '';
- $r .= '' . htmlspecialchars($column->getCardinality()) . ' ';
- $r .= '' . htmlspecialchars($column->getCollation()) . ' ';
- $r .= '' . htmlspecialchars($column->getNull(true)) . ' ';
+ $r .= ''
+ . htmlspecialchars($column->getCardinality())
+ . ' ';
+ $r .= ''
+ . htmlspecialchars($column->getCollation())
+ . ' ';
+ $r .= ''
+ . htmlspecialchars($column->getNull(true))
+ . ' ';
if ($column->getSeqInIndex() == 1) {
$r .= ''
@@ -597,7 +628,9 @@ class PMA_Index
// did not find any difference
// so it makes no sense to have this two equal indexes
- $message = PMA_Message::notice(__('The indexes %1$s and %2$s seem to be equal and one of them could possibly be removed.'));
+ $message = PMA_Message::notice(
+ __('The indexes %1$s and %2$s seem to be equal and one of them could possibly be removed.')
+ );
$message->addParam($each_index->getName());
$message->addParam($while_index->getName());
$output .= $message->getDisplay();
@@ -619,17 +652,18 @@ class PMA_Index_Column
/**
* @var string The column name
*/
- protected $_name = '';
+ private $_name = '';
/**
* @var integer The column sequence number in the index, starting with 1.
*/
- protected $_seq_in_index = 1;
+ private $_seq_in_index = 1;
/**
- * @var string How the column is sorted in the index. “A” (Ascending) or NULL (Not sorted)
+ * @var string How the column is sorted in the index. “A” (Ascending) or
+ * NULL (Not sorted)
*/
- protected $_collation = null;
+ private $_collation = null;
/**
* The number of indexed characters if the column is only partly indexed,
@@ -637,7 +671,7 @@ class PMA_Index_Column
*
* @var integer
*/
- protected $_sub_part = null;
+ private $_sub_part = null;
/**
* Contains YES if the column may contain NULL.
@@ -645,7 +679,7 @@ class PMA_Index_Column
*
* @var string
*/
- protected $_null = '';
+ private $_null = '';
/**
* An estimate of the number of unique values in the index. This is updated
@@ -656,7 +690,7 @@ class PMA_Index_Column
*
* @var integer
*/
- protected $_cardinality = null;
+ private $_cardinality = null;
public function __construct($params = array())
{
diff --git a/libraries/Menu.class.php b/libraries/Menu.class.php
index ba7dc7047d..5b854d6c08 100644
--- a/libraries/Menu.class.php
+++ b/libraries/Menu.class.php
@@ -267,12 +267,7 @@ class PMA_Menu
{
$db_is_information_schema = PMA_is_system_schema($this->_db);
$tbl_is_view = PMA_Table::isView($this->_db, $this->_table);
-
- $table_status = PMA_Table::sGetStatusInfo($this->_db, $this->_table);
- $table_info_num_rows = 0;
- if (isset($table_status['Rows'])) {
- $table_info_num_rows = $table_status['Rows'];
- }
+ $table_info_num_rows = PMA_Table::countRecords($this->_db, $this->_table);
$tabs = array();
diff --git a/libraries/OutputBuffering.class.php b/libraries/OutputBuffering.class.php
index 782e7d0686..69e12aeb9c 100644
--- a/libraries/OutputBuffering.class.php
+++ b/libraries/OutputBuffering.class.php
@@ -1,7 +1,7 @@
_mode);
+ if (! defined('TESTSUITE')) {
+ header('X-ob_mode: ' . $this->_mode);
+ }
register_shutdown_function('PMA_OutputBuffering::stop');
$this->_on = true;
}
diff --git a/libraries/RecentTable.class.php b/libraries/RecentTable.class.php
index 489e42c721..e9052964c6 100644
--- a/libraries/RecentTable.class.php
+++ b/libraries/RecentTable.class.php
@@ -83,7 +83,7 @@ class PMA_RecentTable
= " SELECT `tables` FROM " . $this->pma_table .
" WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'";
- $row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
+ $row = PMA_DBI_fetch_array(PMA_queryAsControlUser($sql_query));
if (isset($row[0])) {
return json_decode($row[0], true);
} else {
diff --git a/libraries/StorageEngine.class.php b/libraries/StorageEngine.class.php
index a5b100a9c5..33ff3f4ab6 100644
--- a/libraries/StorageEngine.class.php
+++ b/libraries/StorageEngine.class.php
@@ -23,7 +23,8 @@ define('PMA_ENGINE_DETAILS_TYPE_NUMERIC', 2); //Has no effect yet...
define('PMA_ENGINE_DETAILS_TYPE_BOOLEAN', 3); // 'ON' or 'OFF'
/**
- * base Storage Engine Class
+ * Base Storage Engine Class
+ *
* @package PhpMyAdmin
*/
class PMA_StorageEngine
@@ -75,7 +76,8 @@ class PMA_StorageEngine
AND p.plugin_name NOT IN ('FunctionEngine', 'schema')";
$storage_engines = PMA_DBI_fetch_result($sql, 'Engine');
} else {
- $storage_engines = PMA_DBI_fetch_result('SHOW STORAGE ENGINES', 'Engine');
+ $storage_engines
+ = PMA_DBI_fetch_result('SHOW STORAGE ENGINES', 'Engine');
}
}
@@ -88,7 +90,8 @@ class PMA_StorageEngine
* @param string $name The name of the select form element
* @param string $id The ID of the form field
* @param string $selected The selected engine
- * @param boolean $offerUnavailableEngines Should unavailable storage engines be offered?
+ * @param boolean $offerUnavailableEngines Should unavailable storage
+ * engines be offered?
*
* @static
* @return string html selectbox
@@ -116,8 +119,10 @@ class PMA_StorageEngine
$output .= ' ' . "\n"
+ . (strtolower($key) == $selected
+ || (empty($selected) && $details['Support'] == 'DEFAULT')
+ ? ' selected="selected"' : '')
+ . '>' . "\n"
. ' ' . htmlspecialchars($details['Engine']) . "\n"
. ' ' . "\n";
}
@@ -216,7 +221,7 @@ class PMA_StorageEngine
}
/**
- * returns the engine specific handling for
+ * Returns the engine specific handling for
* PMA_ENGINE_DETAILS_TYPE_SIZE type variables.
*
* This function should be overridden when
diff --git a/libraries/Table.class.php b/libraries/Table.class.php
index ab58384d06..84d8c4fed1 100644
--- a/libraries/Table.class.php
+++ b/libraries/Table.class.php
@@ -269,49 +269,6 @@ class PMA_Table
return null;
}
- /**
- * loads structure data
- * (this function is work in progress? not yet used)
- *
- * @return boolean
- */
- function loadStructure()
- {
- $table_info = PMA_DBI_get_tables_full(
- $this->getDbName(),
- $this->getName()
- );
-
- if (false === $table_info) {
- return false;
- }
-
- $this->settings = $table_info;
-
- if ($this->get('TABLE_ROWS') === null) {
- $this->set(
- 'TABLE_ROWS',
- PMA_Table::countRecords(
- $this->getDbName(),
- $this->getName(),
- true
- )
- );
- }
-
- $create_options = explode(' ', $this->get('TABLE_ROWS'));
-
- // export create options by its name as variables into global namespace
- // f.e. pack_keys=1 becomes available as $pack_keys with value of '1'
- foreach ($create_options as $each_create_option) {
- $each_create_option = explode('=', $each_create_option);
- if (isset($each_create_option[1])) {
- $this->set($$each_create_option[0], $each_create_option[1]);
- }
- }
- return true;
- }
-
/**
* Checks if this is a merge table
*
@@ -734,7 +691,7 @@ class PMA_Table
// must use PMA_DBI_QUERY_STORE here, since we execute another
// query inside the loop
- $table_copy_rs = PMA_query_as_controluser(
+ $table_copy_rs = PMA_queryAsControlUser(
$table_copy_query, true, PMA_DBI_QUERY_STORE
);
@@ -755,7 +712,7 @@ class PMA_Table
(\'' . implode('\', \'', $value_parts) . '\',
\'' . implode('\', \'', $new_value_parts) . '\')';
- PMA_query_as_controluser($new_table_query);
+ PMA_queryAsControlUser($new_table_query);
$last_id = PMA_DBI_insert_id();
} // end while
@@ -1051,7 +1008,7 @@ class PMA_Table
. '\'' . $common_functions->sqlAddSlashes($comments_copy_row['transformation']) . '\','
. '\'' . $common_functions->sqlAddSlashes($comments_copy_row['transformation_options']) . '\'' : '')
. ')';
- PMA_query_as_controluser($new_comment_query);
+ PMA_queryAsControlUser($new_comment_query);
} // end while
PMA_DBI_free_result($comments_copy_rs);
unset($comments_copy_rs);
@@ -1413,7 +1370,7 @@ class PMA_Table
. " AND `db_name` = '" . $this->getCommonFunctions()->sqlAddSlashes($this->db_name) . "'"
. " AND `table_name` = '" . $this->getCommonFunctions()->sqlAddSlashes($this->name) . "'";
- $row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
+ $row = PMA_DBI_fetch_array(PMA_queryAsControlUser($sql_query));
if (isset($row[0])) {
return json_decode($row[0], true);
} else {
diff --git a/libraries/Tracker.class.php b/libraries/Tracker.class.php
index 104e2735ed..dde243cbd1 100644
--- a/libraries/Tracker.class.php
+++ b/libraries/Tracker.class.php
@@ -220,7 +220,7 @@ class PMA_Tracker
" AND table_name = '" . $common_functions->sqlAddSlashes($tablename) . "' " .
" ORDER BY version DESC";
- $row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
+ $row = PMA_DBI_fetch_array(PMA_queryAsControlUser($sql_query));
if (isset($row['tracking_active']) && $row['tracking_active'] == 1) {
return true;
@@ -331,7 +331,7 @@ class PMA_Tracker
'" . $common_functions->sqlAddSlashes("\n") . "',
'" . $common_functions->sqlAddSlashes(self::_transformTrackingSet($tracking_set)) . "' )";
- $result = PMA_query_as_controluser($sql_query);
+ $result = PMA_queryAsControlUser($sql_query);
if ($result) {
// Deactivate previous version
@@ -357,8 +357,10 @@ class PMA_Tracker
$common_functions = PMA_CommonFunctions::getInstance();
$sql_query = "/*NOTRACK*/\n"
. "DELETE FROM " . self::$pma_table
- . " WHERE `db_name` = '" . $common_functions->sqlAddSlashes($dbname) . "'"
- . " AND `table_name` = '" . $common_functions->sqlAddSlashes($tablename) . "'";
+ . " WHERE `db_name` = '"
+ . $common_functions->sqlAddSlashes($dbname) . "'"
+ . " AND `table_name` = '"
+ . $common_functions->sqlAddSlashes($tablename) . "'";
$result = PMA_query_as_controluser($sql_query);
return $result;
@@ -423,7 +425,7 @@ class PMA_Tracker
'" . $common_functions->sqlAddSlashes("\n") . "',
'" . $common_functions->sqlAddSlashes(self::_transformTrackingSet($tracking_set)) . "' )";
- $result = PMA_query_as_controluser($sql_query);
+ $result = PMA_queryAsControlUser($sql_query);
return $result;
}
@@ -452,7 +454,7 @@ class PMA_Tracker
" AND `table_name` = '" . $common_functions->sqlAddSlashes($tablename) . "' " .
" AND `version` = '" . $common_functions->sqlAddSlashes($version) . "' ";
- $result = PMA_query_as_controluser($sql_query);
+ $result = PMA_queryAsControlUser($sql_query);
return $result;
}
@@ -501,7 +503,7 @@ class PMA_Tracker
" AND `table_name` = '" . $common_functions->sqlAddSlashes($tablename) . "' " .
" AND `version` = '" . $common_functions->sqlAddSlashes($version) . "' ";
- $result = PMA_query_as_controluser($sql_query);
+ $result = PMA_queryAsControlUser($sql_query);
return $result;
}
@@ -566,7 +568,7 @@ class PMA_Tracker
? ' AND tracking & ' . self::_transformTrackingSet($statement) . ' <> 0'
: " AND FIND_IN_SET('" . $statement . "',tracking) > 0" ;
}
- $row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
+ $row = PMA_DBI_fetch_array(PMA_queryAsControlUser($sql_query));
return isset($row[0])
? $row[0]
: -1;
@@ -601,7 +603,7 @@ class PMA_Tracker
$sql_query .= " AND `version` = '" . $common_functions->sqlAddSlashes($version) ."' ".
" ORDER BY `version` DESC LIMIT 1";
- $mixed = PMA_DBI_fetch_assoc(PMA_query_as_controluser($sql_query));
+ $mixed = PMA_DBI_fetch_assoc(PMA_queryAsControlUser($sql_query));
// Parse log
$log_schema_entries = explode('# log ', $mixed['schema_sql']);
@@ -1026,7 +1028,7 @@ class PMA_Tracker
" AND `table_name` = '" . $common_functions->sqlAddSlashes($result['tablename']) . "' " .
" AND `version` = '" . $common_functions->sqlAddSlashes($version) . "' ";
- $result = PMA_query_as_controluser($sql_query);
+ $result = PMA_queryAsControlUser($sql_query);
}
}
}
diff --git a/libraries/auth/config.auth.lib.php b/libraries/auth/config.auth.lib.php
index 331a8a21ec..dbcc0bf847 100644
--- a/libraries/auth/config.auth.lib.php
+++ b/libraries/auth/config.auth.lib.php
@@ -123,7 +123,7 @@ function PMA_auth_fails()
include_once './libraries/select_server.lib.php';
echo ' ' . "\n";
echo ' ' . "\n";
- PMA_select_server(true, true);
+ PMA_selectServer(true, true);
echo ' ' . "\n";
echo ' ' . "\n";
}
diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php
index 36d967e3af..270a6743b4 100644
--- a/libraries/auth/cookie.auth.lib.php
+++ b/libraries/auth/cookie.auth.lib.php
@@ -256,7 +256,7 @@ function PMA_auth()
echo '>';
include_once './libraries/select_server.lib.php';
- PMA_select_server(false, false);
+ PMA_selectServer(false, false);
echo '';
} else {
diff --git a/libraries/build_html_for_db.lib.php b/libraries/build_html_for_db.lib.php
index bfe4b1b30f..39a90860a5 100644
--- a/libraries/build_html_for_db.lib.php
+++ b/libraries/build_html_for_db.lib.php
@@ -80,7 +80,7 @@ function PMA_buildHtmlForDb(
$out = '';
if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
$out .= '';
- $out .= ' type != 'timestamp')
&& ($meta->type != 'real')
) {
- $con_val = '= ' . $row[$i];
+
+ $con_val = '= ' . $row[$i];
} elseif ((($meta->type == 'blob') || ($meta->type == 'string'))
// hexify only if this is a true not empty BLOB or a BINARY
@@ -2317,16 +2318,17 @@ class PMA_CommonFunctions
}
} elseif ($meta->type == 'bit') {
+
$con_val = "= b'"
. $this->printableBitValue($row[$i], $meta->length) . "'";
-
+
} else {
$con_val = '= \'' . $this->sqlAddSlashes($row[$i], false, true) . '\'';
- }
+ }
}
-
+
if ($con_val != null) {
-
+
$condition .= $con_val . ' AND';
if ($meta->primary_key > 0) {
diff --git a/libraries/core.lib.php b/libraries/core.lib.php
index 4a44566155..af0792703f 100644
--- a/libraries/core.lib.php
+++ b/libraries/core.lib.php
@@ -575,6 +575,9 @@ function PMA_sendHeaderLocation($uri, $use_refresh = false)
*/
function PMA_noCacheHeader()
{
+ if (defined('TESTSUITE')) {
+ return;
+ }
// rfc2616 - Section 14.21
header('Expires: ' . date(DATE_RFC1123));
// HTTP/1.1
diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php
index 83b6dea395..1b4c9909ee 100644
--- a/libraries/database_interface.lib.php
+++ b/libraries/database_interface.lib.php
@@ -663,7 +663,8 @@ function PMA_DBI_get_tables_full($database, $table = false,
$each_tables[$table_name]['TABLE_TYPE'] = 'VIEW';
} else {
/**
- * @todo difference between 'TEMPORARY' and 'BASE TABLE' but how to detect?
+ * @todo difference between 'TEMPORARY' and 'BASE TABLE'
+ * but how to detect?
*/
$each_tables[$table_name]['TABLE_TYPE'] = 'BASE TABLE';
}
@@ -880,7 +881,9 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
$databases[$database_name]['SCHEMA_DATA_FREE'] = 0;
$res = PMA_DBI_query('SHOW TABLE STATUS FROM '
- . $common_functions->backquote($database_name) . ';');
+ . $common_functions->backquote($database_name) . ';'
+ );
+
while ($row = PMA_DBI_fetch_assoc($res)) {
$databases[$database_name]['SCHEMA_TABLES']++;
$databases[$database_name]['SCHEMA_TABLE_ROWS']
@@ -1439,9 +1442,10 @@ function PMA_DBI_postConnect($link, $is_controluser = false)
if (!PMA_DRIZZLE) {
if (! empty($GLOBALS['collation_connection'])) {
PMA_DBI_query("SET CHARACTER SET 'utf8';", $link, PMA_DBI_QUERY_STORE);
+ $set_collation_con_query = "SET collation_connection = '"
+ . PMA_sqlAddSlashes($GLOBALS['collation_connection']) . "';";
PMA_DBI_query(
- "SET collation_connection = '"
- . $common_functions->sqlAddSlashes($GLOBALS['collation_connection']) . "';",
+ $set_collation_con_query,
$link,
PMA_DBI_QUERY_STORE
);
diff --git a/libraries/display_import.lib.php b/libraries/display_import.lib.php
index 3fcc213aaa..c2324332d6 100644
--- a/libraries/display_import.lib.php
+++ b/libraries/display_import.lib.php
@@ -39,7 +39,7 @@ if (empty($import_list)) {
$('#upload_form_status').css("display", "inline"); // show progress bar
$('#upload_form_status_info').css("display", "inline"); // - || -
var finished = false;
var percent = 0.0;
@@ -156,7 +156,7 @@ if ($_SESSION[$SESSION_KEY]["handler"]!="noplugin") {
>
diff --git a/libraries/display_import_ajax.lib.php b/libraries/display_import_ajax.lib.php
index e0180a2b2e..d17e7b133c 100644
--- a/libraries/display_import_ajax.lib.php
+++ b/libraries/display_import_ajax.lib.php
@@ -83,8 +83,6 @@ function PMA_import_uploadprogressCheck()
/**
* Checks if PHP 5.4 session upload-progress feature is available.
- * Due to a bug in PHP 5.4's session upload feature (see /import_status.php),
- * we need to check for cURL support.
*
* @return boolean true if PHP 5.4 session upload-progress is available,
* false if it is not
@@ -93,7 +91,6 @@ function PMA_import_sessionCheck()
{
if (PMA_PHP_INT_VERSION < 50400
|| ! ini_get('session.upload_progress.enabled')
- || ! function_exists('curl_exec')
) {
return false;
}
diff --git a/libraries/gis/pma_gis_visualization.php b/libraries/gis/pma_gis_visualization.php
index f24efe9129..df739159dd 100644
--- a/libraries/gis/pma_gis_visualization.php
+++ b/libraries/gis/pma_gis_visualization.php
@@ -124,7 +124,7 @@ class PMA_GIS_Visualization
*/
private function _sanitizeName($file_name, $ext)
{
- $file_name = PMA_sanitize_filename($file_name);
+ $file_name = PMA_sanitizeFilename($file_name);
// Check if the user already added extension;
// get the substring where the extension would be if it was included
diff --git a/libraries/import.lib.php b/libraries/import.lib.php
index ccac2b23c5..0160f0bee9 100644
--- a/libraries/import.lib.php
+++ b/libraries/import.lib.php
@@ -135,7 +135,7 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
);
} elseif ($run_query) {
if ($controluser) {
- $result = PMA_query_as_controluser(
+ $result = PMA_queryAsControlUser(
$import_run_buffer['sql']
);
} else {
diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php
index 0c482cfebf..2fbab090d5 100644
--- a/libraries/insert_edit.lib.php
+++ b/libraries/insert_edit.lib.php
@@ -21,8 +21,8 @@ if (! defined('PHPMYADMIN')) {
*
* @return array $_form_params array of insert/edit form parameters
*/
-function PMA_getFormParametersForInsertForm(
- $db, $table, $where_clauses, $where_clause_array, $err_url
+function PMA_getFormParametersForInsertForm($db, $table, $where_clauses,
+ $where_clause_array, $err_url
) {
$_form_params = array(
'db' => $db,
@@ -52,7 +52,7 @@ function PMA_getFormParametersForInsertForm(
* @return type containing insert_mode,whereClauses, result array
* where_clauses_array and found_unique_key boolean value
*/
-function PMA_getValuesForEditMode($where_clause, $table, $db)
+function PMA_getStuffForEditMode($where_clause, $table, $db)
{
$found_unique_key = false;
if (isset($where_clause)) {
@@ -191,10 +191,12 @@ function PMA_loadFirstRowInEditMode($table, $db)
*
* @return array Add some url parameters to $url_params array and return it
*/
-function PMA_urlParamsInEditMode($url_params)
+function PMA_urlParamsInEditMode($url_params, $where_clause_array, $where_clause)
{
- if (isset($_REQUEST['where_clause'])) {
- $url_params['where_clause'] = trim($_REQUEST['where_clause']);
+ if (isset($where_clause)) {
+ foreach ($where_clause_array as $key_id => $where_clause) {
+ $url_params['where_clause'] = trim($where_clause);
+ }
}
if (! empty($_REQUEST['sql_query'])) {
$url_params['sql_query'] = $_REQUEST['sql_query'];
@@ -305,7 +307,7 @@ function PMA_getDefaultForDatetime($column)
*
* @param array $column description of column in given table
* @param array $comments_map comments for every column that has a comment
- * @param boolean $timestamp_seen whether a timestamp has been seen
+ * @param boolean $timestamp_seen whether a timestamp has been seen
*
* @return array description of column in given table
*/
@@ -413,7 +415,7 @@ function PMA_isColumnChar($column)
* Retrieve set, enum, timestamp table columns
*
* @param array $column description of column in given table
- * @param boolean $timestamp_seen whether a timestamp has been seen
+ * @param boolean $timestamp_seen whether a timestamp has been seen
*
* @return array $column['pma_type'], $column['wrap'], $column['first_timestamp']
*/
@@ -569,10 +571,16 @@ function PMA_getNullifyCodeForNullColumn($column, $foreigners, $foreignData)
}
} elseif (strstr($column['True_Type'], 'set')) {
$nullify_code = '3';
- } elseif ($foreigners && isset($foreigners[$column['Field']]) && $foreignData['foreign_link'] == false) {
+ } elseif ($foreigners
+ && isset($foreigners[$column['Field']])
+ && $foreignData['foreign_link'] == false
+ ) {
// foreign key in a drop-down
$nullify_code = '4';
- } elseif ($foreigners && isset($foreigners[$column['Field']]) && $foreignData['foreign_link'] == true) {
+ } elseif ($foreigners
+ && isset($foreigners[$column['Field']])
+ && $foreignData['foreign_link'] == true
+ ) {
// foreign key with a browsing icon
$nullify_code = '6';
} else {
@@ -640,7 +648,9 @@ function PMA_getValueColumn($column, $backup_field, $column_name_appendix,
$idindex, $data, $foreignData
);
- } elseif ($GLOBALS['cfg']['LongtextDoubleTextarea'] && strstr($column['pma_type'], 'longtext')) {
+ } elseif ($GLOBALS['cfg']['LongtextDoubleTextarea']
+ && strstr($column['pma_type'], 'longtext')
+ ) {
$html_output = ' ';
$html_output .= '';
$html_output .= ''
@@ -652,6 +662,7 @@ function PMA_getValueColumn($column, $backup_field, $column_name_appendix,
);
} elseif (strstr($column['pma_type'], 'text')) {
+
$html_output .= PMA_getTextarea(
$column, $backup_field, $column_name_appendix, $unnullify_trigger,
$tabindex, $tabindex_for_value, $idindex, $text_dir,
@@ -665,7 +676,8 @@ function PMA_getValueColumn($column, $backup_field, $column_name_appendix,
} elseif ($column['pma_type'] == 'enum') {
$html_output .= PMA_getPmaTypeEnum(
- $paramsArrayForColumns, $column, $extracted_columnspec
+ $column, $backup_field, $column_name_appendix, $extracted_columnspec,
+ $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data
);
} elseif ($column['pma_type'] == 'set') {
@@ -725,14 +737,16 @@ function PMA_getForeignLink($column, $backup_field, $column_name_appendix,
list($db, $table) = $paramTableDbArray;
$html_output = '';
$html_output .= $backup_field . "\n";
- $html_output .= ' ';
+ $html_output .= ' ';
$html_output .= ' '
- . ''
. str_replace("'", "\'", $titles['Browse']) . ' ';
@@ -803,7 +817,9 @@ function PMA_getTextarea($column, $backup_field, $column_name_appendix,
$the_class = 'char';
$textAreaRows = $GLOBALS['cfg']['CharTextareaRows'];
$textareaCols = $GLOBALS['cfg']['CharTextareaCols'];
- } elseif (($GLOBALS['cfg']['LongtextDoubleTextarea'] && strstr($column['pma_type'], 'longtext'))) {
+ } elseif ($GLOBALS['cfg']['LongtextDoubleTextarea']
+ && strstr($column['pma_type'], 'longtext')
+ ) {
$textAreaRows = $GLOBALS['cfg']['TextareaRows']*2;
$textareaCols = $GLOBALS['cfg']['TextareaCols']*2;
}
@@ -825,17 +841,23 @@ function PMA_getTextarea($column, $backup_field, $column_name_appendix,
/**
* Get HTML for enum type
*
- * @param array $column description of column in given table
- * @param string $backup_field hidden input field
- * @param string $column_name_appendix the name atttibute
- * @param array $extracted_columnspec associative array containing type,
- * spec_in_brackets and possibly
- * enum_set_values (another array)
+ * @param type $column description of column in given table
+ * @param type $backup_field hidden input field
+ * @param type $column_name_appendix the name atttibute
+ * @param type $extracted_columnspec associative array containing type,
+ * spec_in_brackets and possibly
+ * enum_set_values (another array)
+ * @param type $unnullify_trigger validation string
+ * @param type $tabindex tab index
+ * @param type $tabindex_for_value offset for the values tabindex
+ * @param type $idindex id index
+ * @param type $data data to edit
*
- * @return string an html snippet
+ * @return type string an html snippet
*/
-function PMA_getPmaTypeEnum(
- $column, $backup_field, $column_name_appendix, $extracted_columnspec
+function PMA_getPmaTypeEnum($column, $backup_field, $column_name_appendix,
+ $extracted_columnspec, $unnullify_trigger, $tabindex, $tabindex_for_value,
+ $idindex, $data
) {
$html_output = '';
if (! isset($column['values'])) {
@@ -918,9 +940,9 @@ function PMA_getDropDownDependingOnLength(
$html_output .= ' '
. ' '. "\n";
@@ -1458,7 +1480,8 @@ function PMA_getActionsPanel($where_clause, $after_insert, $tabindex,
*/
function PMA_getSubmitTypeDropDown($where_clause, $tabindex, $tabindex_for_value)
{
- $html_output = '