Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2012-09-02 16:57:30 +02:00
commit 663b1bccd6
12 changed files with 172 additions and 54 deletions

View File

@ -1442,7 +1442,7 @@ class PMA_Config
*
* @static
*/
static protected function _getFontsizeOptions($current_size = '82%')
static protected function getFontsizeOptions($current_size = '82%')
{
$unit = preg_replace('/[0-9.]*/', '', $current_size);
$value = preg_replace('/[^0-9.]*/', '', $current_size);
@ -1503,7 +1503,7 @@ class PMA_Config
*
* @return string html selectbox
*/
static protected function _getFontsizeSelection()
static protected function getFontsizeSelection()
{
$current_size = $GLOBALS['PMA_Config']->get('fontsize');
// for the case when there is no config file (this is supported)
@ -1514,7 +1514,7 @@ class PMA_Config
$current_size = '82%';
}
}
$options = PMA_Config::_getFontsizeOptions($current_size);
$options = PMA_Config::getFontsizeOptions($current_size);
$return = '<label for="select_fontsize">' . __('Font size') . ':</label>' . "\n";
$return .= '<select name="set_fontsize" id="select_fontsize" class="autosubmit">' . "\n";
@ -1542,7 +1542,7 @@ class PMA_Config
return '<form name="form_fontsize_selection" id="form_fontsize_selection"'
. ' method="post" action="index.php" target="_parent">' . "\n"
. PMA_generate_common_hidden_inputs() . "\n"
. PMA_Config::_getFontsizeSelection() . "\n"
. PMA_Config::getFontsizeSelection() . "\n"
. '</form>';
}

View File

@ -175,7 +175,6 @@ class PMA_DbQbe
* Public Constructor
*
* @param string $db Database name
*
*/
public function __construct($db)
{
@ -1279,6 +1278,8 @@ class PMA_DbQbe
/**
* Provides the generated SQL query
*
* @param string $cfgRelation Relation Settings
*
* @return string SQL query
*/
private function _getSQLQuery($cfgRelation)
@ -1301,6 +1302,8 @@ class PMA_DbQbe
/**
* Provides the generated QBE form
*
* @param string $cfgRelation Relation Settings
*
* @return string QBE form
*/
public function getSelectionForm($cfgRelation)

View File

@ -83,8 +83,7 @@ class PMA_DbSearch
/**
* Public Constructor
*
* @param string $db Database name
*
* @param string $db Database name
*/
public function __construct($db)
{
@ -95,7 +94,7 @@ class PMA_DbSearch
/**
* Get CommmonFunctions
*
*
* @return CommonFunctions object
*/
public function getCommonFunctions()
@ -109,6 +108,7 @@ class PMA_DbSearch
/**
* Sets search parameters
*
* @return void
*/
private function _setSearchParams()
{
@ -129,7 +129,8 @@ class PMA_DbSearch
unset($_REQUEST['submit_search']);
} else {
$this->_criteriaSearchType = (int) $_REQUEST['criteriaSearchType'];
$this->_searchTypeDescription = $this->_searchTypes[$_REQUEST['criteriaSearchType']];
$this->_searchTypeDescription
= $this->_searchTypes[$_REQUEST['criteriaSearchType']];
}
if (empty($_REQUEST['criteriaSearchString'])
@ -142,9 +143,13 @@ class PMA_DbSearch
}
$this->_criteriaTables = array();
if (empty($_REQUEST['criteriaTables']) || ! is_array($_REQUEST['criteriaTables'])) {
if (empty($_REQUEST['criteriaTables'])
|| ! is_array($_REQUEST['criteriaTables'])
) {
unset($_REQUEST['submit_search']);
} elseif (! isset($_REQUEST['selectall']) && ! isset($_REQUEST['unselectall'])) {
} elseif (! isset($_REQUEST['selectall'])
&& ! isset($_REQUEST['unselectall'])
) {
$this->_criteriaTables = array_intersect(
$_REQUEST['criteriaTables'], $this->_tables_names_only
);
@ -170,7 +175,7 @@ class PMA_DbSearch
/**
* Builds the SQL search query
*
* @param string $table The table name
* @param string $table The table name
*
* @return array 3 SQL querys (for count, display and delete results)
*
@ -208,7 +213,7 @@ class PMA_DbSearch
/**
* Provides where clause for bulding SQL query
*
* @param string $table The table name
* @param string $table The table name
*
* @return string The generated where clause
*/
@ -225,11 +230,13 @@ class PMA_DbSearch
// Usage example: If user is seaching for a literal $ in a regexp search,
// he should enter \$ as the value.
$this->_criteriaSearchString = $this->getCommonFunctions()->sqlAddSlashes(
$this->_criteriaSearchString, ($this->_criteriaSearchType == 4 ? false : true)
$this->_criteriaSearchString,
($this->_criteriaSearchType == 4 ? false : true)
);
// Extract search words or pattern
$search_words = (($this->_criteriaSearchType > 2)
? array($this->_criteriaSearchString) : explode(' ', $this->_criteriaSearchString));
? array($this->_criteriaSearchString)
: explode(' ', $this->_criteriaSearchString));
foreach ($search_words as $search_word) {
// Eliminates empty values
@ -386,7 +393,7 @@ class PMA_DbSearch
/**
* Provides the main search form's html
*
* @param array $url_params URL parameters
* @param array $url_params URL parameters
*
* @return string HTML for selection form
*/
@ -405,8 +412,10 @@ class PMA_DbSearch
$html_output .= '<tr>';
$html_output .= '<td>' . __('Words or values to search for (wildcard: "%"):')
. '</td>';
$html_output .= '<td><input type="text" name="criteriaSearchString" size="60"'
. ' value="' . htmlspecialchars($this->_criteriaSearchString) . '" /></td>';
$html_output .= '<td><input type="text"'
. ' name="criteriaSearchString" size="60"'
. ' value="' . htmlspecialchars($this->_criteriaSearchString) . '" />';
$html_output .= '</td>';
$html_output .= '</tr>';
// choices for types of search
$html_output .= '<tr>';
@ -422,17 +431,17 @@ class PMA_DbSearch
__('Words are separated by a space character (" ").')
),
'3' => __('the exact phrase'),
'4' => __('as regular expression')
. ' ' . $this->getCommonFunctions()->showMySQLDocu('Regexp', 'Regexp')
'4' => __('as regular expression') . ' '
. $this->getCommonFunctions()->showMySQLDocu('Regexp', 'Regexp')
);
// 4th parameter set to true to add line breaks
// 5th parameter set to false to avoid htmlspecialchars() escaping in the label
// since we have some HTML in some labels
// 5th parameter set to false to avoid htmlspecialchars() escaping
// in the label since we have some HTML in some labels
$html_output .= $this->getCommonFunctions()->getRadioFields(
'criteriaSearchType', $choices, $this->_criteriaSearchType, true, false
);
$html_output .= '</td></tr>';
// displays table names as select options
// displays table names as select options
$html_output .= '<tr>';
$html_output .= '<td class="right vtop">' . __('Inside tables:') . '</td>';
$html_output .= '<td rowspan="2">';
@ -480,7 +489,7 @@ class PMA_DbSearch
$html_output .= '</fieldset>';
$html_output .= '</form>';
$html_output .= $this->_getResultDivs();
return $html_output;
}

View File

@ -96,6 +96,15 @@ class PMA_Index
$this->set($params);
}
/**
* Creates(if not already created) and returns the corresponding Index object
*
* @param string $schema database name
* @param string $table table name
* @param string $index_name index name
*
* @return object corresponding Index object
*/
static public function singleton($schema, $table, $index_name = '')
{
PMA_Index::_loadIndexes($table, $schema);
@ -193,6 +202,13 @@ class PMA_Index
}
}
/**
* Adds a list of columns to the index
*
* @param array $columns array containing details about the columns
*
* @return void
*/
public function addColumns($columns)
{
$_columns = array();
@ -234,6 +250,13 @@ class PMA_Index
return isset($this->_columns[$column]);
}
/**
* Sets index details
*
* @param array $params index details
*
* @return void
*/
public function set($params)
{
if (isset($params['columns'])) {
@ -276,21 +299,41 @@ class PMA_Index
}
}
/**
* Returns the number of columns of the index
*
* @return integer the number of the columns
*/
public function getColumnCount()
{
return count($this->_columns);
}
/**
* Returns the index comment
*
* @return string index comment
*/
public function getComment()
{
return $this->_comment;
}
/**
* Returns index remarks
*
* @return string index remarks
*/
public function getRemarks()
{
return $this->_remarks;
}
/**
* Returns concatenated remarks and comment
*
* @return string concatenated remarks and comment
*/
public function getComments()
{
$comments = $this->getRemarks();
@ -302,11 +345,21 @@ class PMA_Index
return $comments;
}
/**
* Returns index type ((BTREE, SPATIAL, FULLTEXT, HASH, RTREE)
*
* @return string index type
*/
public function getType()
{
return $this->_type;
}
/**
* Returns index choice (PRIMARY, UNIQUE, INDEX, SPATIAL, FULLTEXT)
*
* @return index choice
*/
public function getChoice()
{
return $this->_choice;
@ -328,6 +381,11 @@ class PMA_Index
);
}
/**
* Returns HTML for the index choice selector
*
* @return string HTML for the index choice selector
*/
public function generateIndexSelector()
{
$html_options = '';
@ -348,11 +406,24 @@ class PMA_Index
return $html_options;
}
/**
* Returns how the index is packed
*
* @return string how the index is packed
*/
public function getPacked()
{
return $this->_packed;
}
/**
* Returns 'No'/false if the index is not packed,
* how the index is packed if packed
*
* @param boolean $as_text whether to output should be in text
*
* @return mixed how index is paked
*/
public function isPacked($as_text = false)
{
if ($as_text) {
@ -374,11 +445,23 @@ class PMA_Index
return $this->_packed;
}
/**
* Returns integer 0 if the index cannot contain duplicates, 1 if it can
*
* @return integer 0 if the index cannot contain duplicates, 1 if it can
*/
public function getNonUnique()
{
return $this->_non_unique;
}
/**
* Returns whether the index is a 'Unique' index
*
* @param boolean $as_text whether to output should be in text
*
* @return mixed whether the index is a 'Unique' index
*/
public function isUnique($as_text = false)
{
if ($as_text) {
@ -396,16 +479,33 @@ class PMA_Index
return $r[$this->_non_unique];
}
/**
* Returns the name of the index
*
* @return string the name of the index
*/
public function getName()
{
return $this->_name;
}
/**
* Sets the name of the index
*
* @param string $name index name
*
* @return void
*/
public function setName($name)
{
$this->_name = (string) $name;
}
/**
* Returns the columns of the index
*
* @return array the columns of the index
*/
public function getColumns()
{
return $this->_columns;
@ -424,7 +524,7 @@ class PMA_Index
*/
static public function getView($table, $schema, $print_mode = false)
{
$common_functions = PMA_CommonFunctions::getInstance();
$indexes = PMA_Index::getFromTable($table, $schema);
@ -508,7 +608,7 @@ class PMA_Index
$this_params['message_to_show'] = sprintf(
__('Index %s has been dropped'), $index->getName()
);
$js_msg = PMA_jsFormat(
'ALTER TABLE ' . $table . ' DROP INDEX '
. $index->getName() . ';'

View File

@ -181,7 +181,7 @@ function PMA_DBI_try_query($query, $link = null, $options = 0,
* Run multi query statement and return results
*
* @param string $multi_query multi query statement to execute
* @param mysqli $link mysqli object
* @param mysqli $link mysqli object
*
* @return mysqli_result collection | boolean(false)
*/

View File

@ -60,8 +60,9 @@ if (! isset($is_db) || ! $is_db) {
*/
if (isset($submitcollation) && !empty($db_collation)) {
list($db_charset) = explode('_', $db_collation);
$sql_query = 'ALTER DATABASE ' . PMA_CommonFunctions::getInstance()->backquote($db) . ' DEFAULT'
. PMA_generateCharsetQueryPart($db_collation);
$sql_query = 'ALTER DATABASE '
. PMA_CommonFunctions::getInstance()->backquote($db)
. ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
$result = PMA_DBI_query($sql_query);
$message = PMA_Message::success();
unset($db_charset, $db_collation);

View File

@ -42,9 +42,9 @@ $pos = $_SESSION['tmp_user_values']['table_limit_offset'];
*/
function PMA_fillTooltip(&$tooltip_truename, &$tooltip_aliasname, $table)
{
$common_functions = PMA_CommonFunctions::getInstance();
if (strstr($table['Comment'], '; InnoDB free') === false) {
if (!strstr($table['Comment'], 'InnoDB free') === false) {
// here we have just InnoDB generated part
@ -169,7 +169,8 @@ if (true === $cfg['SkipLockedTables']) {
$sts_tmp['Type'] =& $sts_tmp['Engine'];
}
if (! empty($tbl_group) && $cfg['ShowTooltipAliasTB']
if (! empty($tbl_group)
&& $cfg['ShowTooltipAliasTB']
&& ! preg_match('@' . preg_quote($tbl_group, '@') . '@i', $sts_tmp['Comment'])
) {
continue;

View File

@ -226,13 +226,13 @@ if ($GLOBALS['is_upload'] && !empty($cfg['UploadDir'])) { ?>
<li>
<input type="radio" name="file_location" id="radio_import_file" />
<?php
echo $common_functions->getBrowseUploadFileBlock($max_upload_size);
echo $common_functions->getBrowseUploadFileBlock($max_upload_size);
?>
</li>
<li>
<input type="radio" name="file_location" id="radio_local_import_file" />
<?php
echo $common_functions->getSelectUploadFileBlock($import_list, $cfg['UploadDir']);
echo $common_functions->getSelectUploadFileBlock($import_list, $cfg['UploadDir']);
?>
</li>
</ul>

View File

@ -77,12 +77,14 @@ function PMA_detectCompression($filepath)
* @param string $sql query to run
* @param string $full query to display, this might be commented
* @param bool $controluser whether to use control user for queries
* @param array &$sql_data
*
* @return void
* @access public
*/
function PMA_importRunQuery($sql = '', $full = '', $controluser = false, &$sql_data = array())
{
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,
$last_query_with_results,
@ -97,14 +99,14 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false, &$sql_d
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'];
@ -116,9 +118,9 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false, &$sql_d
$GLOBALS['message'] = PMA_Message::error(__('"DROP DATABASE" statements are disabled.'));
$error = true;
} else {
$executed_queries++;
if ($run_query
&& $GLOBALS['finished']
&& empty($sql)
@ -138,7 +140,7 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false, &$sql_d
$sql_query = $import_run_buffer['sql'];
$sql_data['valid_sql'][] = $import_run_buffer['sql'];
$sql_data['valid_queries']++;
// If a 'USE <db>' SQL-clause was found,
// set our current $db to the new one
list($db, $reload) = PMA_lookForUse(
@ -147,7 +149,7 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false, &$sql_d
$reload
);
} elseif ($run_query) {
if ($controluser) {
$result = PMA_queryAsControlUser(
$import_run_buffer['sql']
@ -155,7 +157,7 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false, &$sql_d
} else {
$result = PMA_DBI_try_query($import_run_buffer['sql']);
}
$msg = '# ';
if ($result === false) { // execution failed
if (! isset($my_die)) {
@ -184,12 +186,12 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false, &$sql_d
} 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";
@ -915,9 +917,9 @@ $import_notice = null;
function PMA_buildSQL($db_name, &$tables, &$analyses = null,
&$additional_sql = null, $options = null
) {
$common_functions = PMA_CommonFunctions::getInstance();
/* Take care of the options */
if (isset($options['db_collation'])&& ! is_null($options['db_collation'])) {
$collation = $options['db_collation'];

View File

@ -18,7 +18,9 @@ function Swekey_auth_check()
$_SESSION['SWEKEY']['ENABLED'] = (! empty($confFile) && file_exists($confFile));
// Load the swekey.conf file the first time
if ($_SESSION['SWEKEY']['ENABLED'] && empty($_SESSION['SWEKEY']['CONF_LOADED'])) {
if ($_SESSION['SWEKEY']['ENABLED']
&& empty($_SESSION['SWEKEY']['CONF_LOADED'])
) {
$_SESSION['SWEKEY']['CONF_LOADED'] = true;
$_SESSION['SWEKEY']['VALID_SWEKEYS'] = array();
$valid_swekeys = explode("\n", @file_get_contents($confFile));

View File

@ -347,11 +347,11 @@ class ExportLatex extends ExportPlugin
'\\caption{'
. $common_functions->expandUserString(
$GLOBALS['latex_data_continued_caption'],
array(
'texEscape',
get_class($this),
'libraries/plugins/export/' . get_class($this) . ".class.php"
),
array(
'texEscape',
get_class($this),
'libraries/plugins/export/' . get_class($this) . ".class.php"
),
array('table' => $table, 'database' => $db)
)
. '} \\\\ '

View File

@ -115,7 +115,7 @@ class ImportSql extends ImportPlugin
/**
* Handles the whole import logic
*
* @param &$sql_data array 2-element array with sql data
* @param array &$sql_data 2-element array with sql data
*
* @return void
*/