Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pootle server 2011-12-07 20:40:13 +01:00
commit fb65975d37
27 changed files with 440 additions and 364 deletions

View File

@ -223,22 +223,23 @@ if (is_array($foreignData['disp_row'])) {
$val_ordered_current_val = htmlspecialchars($val_ordered_current_val);
$val_ordered_current_val_title = '';
} else {
$val_ordered_current_val_title =
htmlspecialchars($val_ordered_current_val);
$val_ordered_current_val_title
= htmlspecialchars($val_ordered_current_val);
$val_ordered_current_val = htmlspecialchars(
PMA_substr($val_ordered_current_val, 0, $cfg['LimitChars'])
. '...'
);
);
}
if (PMA_strlen($key_ordered_current_val) <= $cfg['LimitChars']) {
$key_ordered_current_val = htmlspecialchars($key_ordered_current_val);
$key_ordered_current_val_title = '';
} else {
$key_ordered_current_val_title =
htmlspecialchars($key_ordered_current_val);
$key_ordered_current_val =
htmlspecialchars(PMA_substr($key_ordered_current_val, 0,
$cfg['LimitChars']) . '...');
$key_ordered_current_val_title
= htmlspecialchars($key_ordered_current_val);
$key_ordered_current_val
= htmlspecialchars(
PMA_substr($key_ordered_current_val, 0, $cfg['LimitChars']) . '...'
);
}
if (! empty($data)) {

View File

@ -314,8 +314,8 @@ foreach ($tables_names_only as $each_table) {
} // end while
echo ' </select>' . "\n";
$alter_select =
'<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('selectall' => 1))) . '#db_search"'
$alter_select
= '<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('selectall' => 1))) . '#db_search"'
. ' onclick="setSelectOptions(\'db_search\', \'table_select[]\', true); return false;">' . __('Select All') . '</a>'
. '&nbsp;/&nbsp;'
. '<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('unselectall' => 1))) . '#db_search"'

View File

@ -496,8 +496,8 @@ foreach ($tables as $keyname => $each_table) {
// Show Summary
if ($is_show_stats) {
list($sum_formatted, $unit) = PMA_formatByteDown($sum_size, 3, 1);
list($overhead_formatted, $overhead_unit) =
PMA_formatByteDown($overhead_size, 3, 1);
list($overhead_formatted, $overhead_unit)
= PMA_formatByteDown($overhead_size, 3, 1);
}
?>
</tbody>

View File

@ -36,13 +36,15 @@ require_once './libraries/header_meta_style.inc.php';
<?php
// Get the enum values
$values = array();
if (isset($_GET['values']) && is_array($_GET['values'])) { // If the values are in an array
// If the values are in an array
if (isset($_GET['values']) && is_array($_GET['values'])) {
// then this page was called from itself via the "Add a value", "Drop" or "Go" buttons
$values = $_GET['values'];
foreach ($values as $key => $value) {
$values[$key] = htmlentities($value);
}
} else if (isset($_GET['values']) && is_string($_GET['values'])){ // If the values are in a string
// If the values are in a string
} elseif (isset($_GET['values']) && is_string($_GET['values'])) {
// then this page was called via a link from some external page
$values_string = htmlentities($_GET['values']);
// There is a JS port of the below parser in functions.js

View File

@ -2722,17 +2722,17 @@ $(document).ready(function() {
});
// slider for choosing how many fields to add
$enum_editor_dialog.find(".slider").slider({
animate: true,
range: "min",
value: 1,
min: 1,
max: 9,
slide: function( event, ui ) {
$(this).closest('table').find('input[type=submit]').val(
PMA_messages['enum_addValue'].replace(/%d/, ui.value)
);
}
});
animate: true,
range: "min",
value: 1,
min: 1,
max: 9,
slide: function( event, ui ) {
$(this).closest('table').find('input[type=submit]').val(
PMA_messages['enum_addValue'].replace(/%d/, ui.value)
);
}
});
// Focus the slider, otherwise it looks nearly transparent
$('.ui-slider-handle').addClass('ui-state-focus');
return false;

View File

@ -301,16 +301,16 @@ $(document).ready(function() {
PMA_convertFootnotesToTooltips($div);
// Add a slider for selecting how many columns to add to the index
$div.find('.slider').slider({
animate: true,
value: 1,
min: 1,
max: 16,
slide: function( event, ui ) {
animate: true,
value: 1,
min: 1,
max: 16,
slide: function( event, ui ) {
$(this).closest('fieldset').find('input[type=submit]').val(
PMA_messages['strAddToIndex'].replace(/%d/, ui.value)
);
}
});
}
});
// Focus the slider, otherwise it looks nearly transparent
$('.ui-slider-handle').addClass('ui-state-focus');
}

View File

@ -958,8 +958,8 @@ class PMA_Config
if (substr($pma_absolute_uri, 0, 7) != 'http://'
&& substr($pma_absolute_uri, 0, 8) != 'https://'
) {
$pma_absolute_uri =
($is_https ? 'https' : 'http')
$pma_absolute_uri
= ($is_https ? 'https' : 'http')
. ':' . (substr($pma_absolute_uri, 0, 2) == '//' ? '' : '//')
. $pma_absolute_uri;
}

View File

@ -76,9 +76,9 @@ class PMA_RecentTable
public function getFromDb()
{
// Read from phpMyAdmin database, if recent tables is not in session
$sql_query =
" SELECT `tables` FROM " . $this->pma_table .
" WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'";
$sql_query
= " SELECT `tables` FROM " . $this->pma_table .
" WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'";
$row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
if (isset($row[0])) {
@ -91,15 +91,15 @@ class PMA_RecentTable
/**
* Save recent tables into phpMyAdmin database.
*
*
*
* @return true|PMA_Message
*/
public function saveToDb()
{
$username = $GLOBALS['cfg']['Server']['user'];
$sql_query =
" REPLACE INTO " . $this->pma_table . " (`username`, `tables`)" .
" VALUES ('" . $username . "', '" . PMA_sqlAddSlashes(json_encode($this->tables)) . "')";
$sql_query
= " REPLACE INTO " . $this->pma_table . " (`username`, `tables`)" .
" VALUES ('" . $username . "', '" . PMA_sqlAddSlashes(json_encode($this->tables)) . "')";
$success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);
@ -163,7 +163,7 @@ class PMA_RecentTable
$html .= '<select name="selected_recent_table" id="recentTable">';
$html .= $this->getHtmlSelectOption();
$html .= '</select>';
return $html;
}

View File

@ -274,8 +274,8 @@ class PMA_StorageEngine
if (!empty($storage_engines[$engine])) {
$this->engine = $engine;
$this->title = $storage_engines[$engine]['Engine'];
$this->comment =
(isset($storage_engines[$engine]['Comment'])
$this->comment
= (isset($storage_engines[$engine]['Comment'])
? $storage_engines[$engine]['Comment']
: '');
switch ($storage_engines[$engine]['Support']) {

View File

@ -1391,8 +1391,8 @@ class PMA_Table
$max_rows = $GLOBALS['cfg']['Server']['MaxTableUiprefs'];
if ($rows_count > $max_rows) {
$num_rows_to_delete = $rows_count - $max_rows;
$sql_query =
' DELETE FROM ' . $pma_table .
$sql_query
= ' DELETE FROM ' . $pma_table .
' ORDER BY last_update ASC' .
' LIMIT ' . $num_rows_to_delete;
$success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);

View File

@ -161,12 +161,11 @@ function Swekey_auth_error()
}
} else {
$result = __('No valid authentication key plugged');
if ($_SESSION['SWEKEY']['CONF_DEBUG'])
{
if ($_SESSION['SWEKEY']['CONF_DEBUG']) {
$result .= "<br>" . htmlspecialchars($swekey_id);
}
unset($_SESSION['SWEKEY']['CONF_LOADED']); // reload the conf file
}
}
}
} else {
unset($_SESSION['SWEKEY']);

View File

@ -187,33 +187,28 @@ function Swekey_HttpGet($url, &$response_code)
$gSwekeyLastResult = "<not set>";
// use curl if available
if (function_exists('curl_init'))
{
if (function_exists('curl_init')) {
$sess = curl_init($url);
if (substr($url, 0, 8) == "https://")
{
if (substr($url, 0, 8) == "https://") {
global $gSwekeyCA;
if (! empty($gSwekeyCA))
{
if (file_exists($gSwekeyCA))
{
if (! curl_setopt($sess, CURLOPT_CAINFO, $gSwekeyCA))
if (! empty($gSwekeyCA)) {
if (file_exists($gSwekeyCA)) {
if (! curl_setopt($sess, CURLOPT_CAINFO, $gSwekeyCA)) {
error_log("SWEKEY_ERROR:Could not set CA file : ".curl_error($sess));
else
} else {
$caFileOk = true;
}
else
}
} else {
error_log("SWEKEY_ERROR:Could not find CA file $gSwekeyCA getting $url");
}
}
curl_setopt($sess, CURLOPT_SSL_VERIFYHOST, '2');
curl_setopt($sess, CURLOPT_SSL_VERIFYPEER, '2');
curl_setopt($sess, CURLOPT_CONNECTTIMEOUT, '20');
curl_setopt($sess, CURLOPT_TIMEOUT, '20');
}
else
{
} else {
curl_setopt($sess, CURLOPT_CONNECTTIMEOUT, '3');
curl_setopt($sess, CURLOPT_TIMEOUT, '5');
}
@ -224,18 +219,16 @@ function Swekey_HttpGet($url, &$response_code)
$curlerr = curl_error($sess);
curl_close($sess);
if ($response_code == 200)
{
if ($response_code == 200) {
$gSwekeyLastResult = $res;
return $res;
}
if (! empty($response_code))
{
if (! empty($response_code)) {
$gSwekeyLastError = $response_code;
error_log("SWEKEY_ERROR:Error $gSwekeyLastError ($curlerr) getting $url");
return "";
}
}
$response_code = 408; // Request Timeout
$gSwekeyLastError = $response_code;
@ -244,28 +237,28 @@ function Swekey_HttpGet($url, &$response_code)
}
// use pecl_http if available
if (class_exists('HttpRequest'))
{
if (class_exists('HttpRequest')) {
// retry if one of the server is down
for ($num=1; $num <= 3; $num++ )
{
for ($num=1; $num <= 3; $num++ ) {
$r = new HttpRequest($url);
$options = array('timeout' => '3');
if (substr($url, 0, 6) == "https:")
{
if (substr($url, 0, 6) == "https:") {
$sslOptions = array();
$sslOptions['verifypeer'] = true;
$sslOptions['verifyhost'] = true;
$capath = __FILE__;
$name = strrchr($capath, '/');
if (empty($name)) // windows
// windows
if (empty($name)) {
$name = strrchr($capath, '\\');
}
$capath = substr($capath, 0, strlen($capath) - strlen($name) + 1).'musbe-ca.crt';
if (! empty($gSwekeyCA))
if (! empty($gSwekeyCA)) {
$sslOptions['cainfo'] = $gSwekeyCA;
}
$options['ssl'] = $sslOptions;
}
@ -304,8 +297,7 @@ function Swekey_HttpGet($url, &$response_code)
global $http_response_header;
$res = @file_get_contents($url);
$response_code = substr($http_response_header[0], 9, 3); //HTTP/1.0
if ($response_code == 200)
{
if ($response_code == 200) {
$gSwekeyLastResult = $res;
return $res;
}
@ -355,51 +347,47 @@ function Swekey_GetFastHalfRndToken()
$cachefile = "";
// We check if we have a valid RT is the session
if (isset($_SESSION['rnd-token-date']))
if (time() - $_SESSION['rnd-token-date'] < 30)
if (isset($_SESSION['rnd-token-date'])) {
if (time() - $_SESSION['rnd-token-date'] < 30) {
$res = $_SESSION['rnd-token'];
}
}
// If not we try to get it from a temp file (PHP >= 5.2.1 only)
if (strlen($res) != 32 && $gSwekeyTokenCacheEnabled)
{
if (function_exists('sys_get_temp_dir'))
{
if (strlen($res) != 32 && $gSwekeyTokenCacheEnabled) {
if (function_exists('sys_get_temp_dir')) {
$tempdir = sys_get_temp_dir();
$cachefile = $tempdir."/swekey-rnd-token-".get_current_user();
$modif = filemtime($cachefile);
if ($modif != false)
if (time() - $modif < 30)
{
if ($modif != false) {
if (time() - $modif < 30) {
$res = @file_get_contents($cachefile);
if (strlen($res) != 32)
$res = "";
else
{
$_SESSION['rnd-token'] = $res;
$_SESSION['rnd-token-date'] = $modif;
}
if (strlen($res) != 32) {
$res = "";
} else {
$_SESSION['rnd-token'] = $res;
$_SESSION['rnd-token-date'] = $modif;
}
}
}
}
}
}
// If we don't have a valid RT here we have to get it from the server
if (strlen($res) != 32)
{
// If we don't have a valid RT here we have to get it from the server
if (strlen($res) != 32) {
$res = substr(Swekey_GetHalfRndToken(), 0, 32);
$_SESSION['rnd-token'] = $res;
$_SESSION['rnd-token-date'] = time();
if (! empty($cachefile))
{
if (! empty($cachefile)) {
// we unlink the file so no possible tempfile race attack
unlink($cachefile);
$file = fopen($cachefile, "x");
if ($file != false)
{
@fwrite($file, $res);
$file = fopen($cachefile, "x");
if ($file != false) {
@fwrite($file, $res);
@fclose($file);
}
}
}
}
return $res."00000000000000000000000000000000";
}

View File

@ -942,9 +942,12 @@ function PMA_DBI_get_columns_full($database = null, $table = null,
$columns[$column_name]['TABLE_SCHEMA'] = $database;
$columns[$column_name]['TABLE_NAME'] = $table;
$columns[$column_name]['ORDINAL_POSITION'] = $ordinal_position;
$columns[$column_name]['DATA_TYPE'] =
substr($columns[$column_name]['COLUMN_TYPE'], 0,
strpos($columns[$column_name]['COLUMN_TYPE'], '('));
$columns[$column_name]['DATA_TYPE']
= substr(
$columns[$column_name]['COLUMN_TYPE'],
0,
strpos($columns[$column_name]['COLUMN_TYPE'], '(')
);
/**
* @todo guess CHARACTER_MAXIMUM_LENGTH from COLUMN_TYPE
*/
@ -955,9 +958,12 @@ function PMA_DBI_get_columns_full($database = null, $table = null,
$columns[$column_name]['CHARACTER_OCTET_LENGTH'] = null;
$columns[$column_name]['NUMERIC_PRECISION'] = null;
$columns[$column_name]['NUMERIC_SCALE'] = null;
$columns[$column_name]['CHARACTER_SET_NAME'] =
substr($columns[$column_name]['COLLATION_NAME'], 0,
strpos($columns[$column_name]['COLLATION_NAME'], '_'));
$columns[$column_name]['CHARACTER_SET_NAME']
= substr(
$columns[$column_name]['COLLATION_NAME'],
0,
strpos($columns[$column_name]['COLLATION_NAME'], '_')
);
$ordinal_position++;
}

View File

@ -20,7 +20,7 @@ $GLOBALS['strLatexStructure'] = __('Structure of table @TABLE@');
*/
if (isset($plugin_list)) {
$hide_structure = false;
if ($plugin_param['export_type'] == 'table' && !$plugin_param['single_table']) {
if ($plugin_param['export_type'] == 'table' && ! $plugin_param['single_table']) {
$hide_structure = true;
}
$plugin_list['latex'] = array(
@ -36,62 +36,63 @@ if (isset($plugin_list)) {
);
/* what to dump (structure/data/both) */
$plugin_list['latex']['options'][] =
array('type' => 'begin_group', 'name' => 'dump_what', 'text' => __('Dump table'));
$plugin_list['latex']['options'][] =
array('type' => 'radio', 'name' => 'structure_or_data', 'values' => array('structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')));
$plugin_list['latex']['options'][]
= array('type' => 'begin_group', 'name' => 'dump_what', 'text' => __('Dump table'));
$plugin_list['latex']['options'][]
= array('type' => 'radio', 'name' => 'structure_or_data', 'values' => array('structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')));
$plugin_list['latex']['options'][] = array('type' => 'end_group');
/* Structure options */
if (!$hide_structure) {
$plugin_list['latex']['options'][] =
array('type' => 'begin_group', 'name' => 'structure', 'text' => __('Object creation options'), 'force' => 'data');
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'structure_caption', 'text' => __('Table caption'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'structure_continued_caption', 'text' => __('Table caption (continued)'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'structure_label', 'text' => __('Label key'), 'doc' => 'faq6_27');
if (!empty($GLOBALS['cfgRelation']['relation'])) {
$plugin_list['latex']['options'][] =
array('type' => 'bool', 'name' => 'relation', 'text' => __('Display foreign key relationships'));
if (! $hide_structure) {
$plugin_list['latex']['options'][]
= array('type' => 'begin_group', 'name' => 'structure', 'text' => __('Object creation options'), 'force' => 'data');
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'structure_caption', 'text' => __('Table caption'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'structure_continued_caption', 'text' => __('Table caption (continued)'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'structure_label', 'text' => __('Label key'), 'doc' => 'faq6_27');
if (! empty($GLOBALS['cfgRelation']['relation'])) {
$plugin_list['latex']['options'][]
= array('type' => 'bool', 'name' => 'relation', 'text' => __('Display foreign key relationships'));
}
$plugin_list['latex']['options'][] =
array('type' => 'bool', 'name' => 'comments', 'text' => __('Display comments'));
if (!empty($GLOBALS['cfgRelation']['mimework'])) {
$plugin_list['latex']['options'][] =
array('type' => 'bool', 'name' => 'mime', 'text' => __('Display MIME types'));
$plugin_list['latex']['options'][]
= array('type' => 'bool', 'name' => 'comments', 'text' => __('Display comments'));
if (! empty($GLOBALS['cfgRelation']['mimework'])) {
$plugin_list['latex']['options'][]
= array('type' => 'bool', 'name' => 'mime', 'text' => __('Display MIME types'));
}
$plugin_list['latex']['options'][] =
array('type' => 'end_group');
$plugin_list['latex']['options'][]
= array('type' => 'end_group');
}
/* Data */
$plugin_list['latex']['options'][] =
array('type' => 'begin_group', 'name' => 'data', 'text' => __('Data dump options'), 'force' => 'structure');
$plugin_list['latex']['options'][] =
array('type' => 'bool', 'name' => 'columns', 'text' => __('Put columns names in the first row'));
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'data_caption', 'text' => __('Table caption'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'data_continued_caption', 'text' => __('Table caption (continued)'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'data_label', 'text' => __('Label key'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'null', 'text' => __('Replace NULL with:'));
$plugin_list['latex']['options'][] =
array('type' => 'end_group');
$plugin_list['latex']['options'][]
= array('type' => 'begin_group', 'name' => 'data', 'text' => __('Data dump options'), 'force' => 'structure');
$plugin_list['latex']['options'][]
= array('type' => 'bool', 'name' => 'columns', 'text' => __('Put columns names in the first row'));
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'data_caption', 'text' => __('Table caption'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'data_continued_caption', 'text' => __('Table caption (continued)'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'data_label', 'text' => __('Label key'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'null', 'text' => __('Replace NULL with:'));
$plugin_list['latex']['options'][]
= array('type' => 'end_group');
} else {
/**
* Escapes some special characters for use in TeX/LaTeX
*
* @param string the string to convert
* @param string $string the string to convert
*
* @return string the converted string with escape codes
*
* @access private
*/
function PMA_texEscape($string) {
function PMA_texEscape($string)
{
$escape = array('$', '%', '{', '}', '&', '#', '_', '^');
$cnt_escape = count($escape);
for ($k=0; $k < $cnt_escape; $k++) {
@ -107,18 +108,20 @@ if (isset($plugin_list)) {
*
* @access public
*/
function PMA_exportFooter() {
function PMA_exportFooter()
{
return true;
}
/**
* Outputs export header
*
* @return bool Whether it suceeded
* @return bool Whether it suceeded
*
* @access public
* @access public
*/
function PMA_exportHeader() {
function PMA_exportHeader()
{
global $crlf;
global $cfg;
@ -127,7 +130,7 @@ if (isset($plugin_list)) {
. '% http://www.phpmyadmin.net' . $crlf
. '%' . $crlf
. '% ' . __('Host') . ': ' . $cfg['Server']['host'];
if (!empty($cfg['Server']['port'])) {
if (! empty($cfg['Server']['port'])) {
$head .= ':' . $cfg['Server']['port'];
}
$head .= $crlf
@ -140,12 +143,14 @@ if (isset($plugin_list)) {
/**
* Outputs database header
*
* @param string $db Database name
* @return bool Whether it suceeded
* @param string $db Database name
*
* @access public
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportDBHeader($db) {
function PMA_exportDBHeader($db)
{
global $crlf;
$head = '% ' . $crlf
. '% ' . __('Database') . ': ' . '\'' . $db . '\'' . $crlf
@ -156,40 +161,46 @@ if (isset($plugin_list)) {
/**
* Outputs database footer
*
* @param string $db Database name
* @return bool Whether it suceeded
* @param string $db Database name
*
* @access public
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportDBFooter($db) {
function PMA_exportDBFooter($db)
{
return true;
}
/**
* Outputs CREATE DATABASE statement
*
* @param string $db Database name
* @return bool Whether it suceeded
* @param string $db Database name
*
* @access public
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportDBCreate($db) {
function PMA_exportDBCreate($db)
{
return true;
}
/**
* Outputs the content of a table in LaTeX table/sideways table environment
*
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $sql_query SQL query for obtaining data
* @return bool Whether it suceeded
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $sql_query SQL query for obtaining data
*
* @access public
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
{
$result = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
$columns_cnt = PMA_DBI_num_fields($result);
@ -198,20 +209,31 @@ if (isset($plugin_list)) {
}
unset($i);
$buffer = $crlf . '%' . $crlf . '% ' . __('Data') . ': ' . $table . $crlf . '%' . $crlf
. ' \\begin{longtable}{|';
$buffer = $crlf . '%' . $crlf . '% ' . __('Data') . ': ' . $table
. $crlf . '%' . $crlf . ' \\begin{longtable}{|';
for ($index=0;$index<$columns_cnt;$index++) {
$buffer .= 'l|';
for ($index = 0; $index < $columns_cnt; $index++) {
$buffer .= 'l|';
}
$buffer .= '} ' . $crlf ;
$buffer .= ' \\hline \\endhead \\hline \\endfoot \\hline ' . $crlf;
if (isset($GLOBALS['latex_caption'])) {
$buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_data_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
. '} \\label{' . PMA_expandUserString($GLOBALS['latex_data_label'], null, array('table' => $table, 'database' => $db)) . '} \\\\';
$buffer .= ' \\caption{'
. PMA_expandUserString(
$GLOBALS['latex_data_caption'],
'PMA_texEscape',
array('table' => $table, 'database' => $db)
)
. '} \\label{'
. PMA_expandUserString(
$GLOBALS['latex_data_label'],
null,
array('table' => $table, 'database' => $db)
)
. '} \\\\';
}
if (!PMA_exportOutputHandler($buffer)) {
if (! PMA_exportOutputHandler($buffer)) {
return false;
}
@ -219,21 +241,32 @@ if (isset($plugin_list)) {
if (isset($GLOBALS['latex_columns'])) {
$buffer = '\\hline ';
for ($i = 0; $i < $columns_cnt; $i++) {
$buffer .= '\\multicolumn{1}{|c|}{\\textbf{' . PMA_texEscape(stripslashes($columns[$i])) . '}} & ';
}
$buffer .= '\\multicolumn{1}{|c|}{\\textbf{'
. PMA_texEscape(stripslashes($columns[$i])) . '}} & ';
}
$buffer = substr($buffer, 0, -2) . '\\\\ \\hline \hline ';
if (!PMA_exportOutputHandler($buffer . ' \\endfirsthead ' . $crlf)) {
if (! PMA_exportOutputHandler($buffer . ' \\endfirsthead ' . $crlf)) {
return false;
}
if (isset($GLOBALS['latex_caption'])) {
if (!PMA_exportOutputHandler('\\caption{' . PMA_expandUserString($GLOBALS['latex_data_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\\\ ')) return false;
if (! PMA_exportOutputHandler(
'\\caption{'
. PMA_expandUserString(
$GLOBALS['latex_data_continued_caption'],
'PMA_texEscape',
array('table' => $table, 'database' => $db)
)
. '} \\\\ '
)) {
return false;
}
}
if (!PMA_exportOutputHandler($buffer . '\\endhead \\endfoot' . $crlf)) {
if (! PMA_exportOutputHandler($buffer . '\\endhead \\endfoot' . $crlf)) {
return false;
}
} else {
if (!PMA_exportOutputHandler('\\\\ \hline')) {
if (! PMA_exportOutputHandler('\\\\ \hline')) {
return false;
}
}
@ -245,7 +278,8 @@ if (isset($plugin_list)) {
// print each row
for ($i = 0; $i < $columns_cnt; $i++) {
if (isset($record[$columns[$i]])
&& (! function_exists('is_null') || !is_null($record[$columns[$i]]))) {
&& (! function_exists('is_null') || ! is_null($record[$columns[$i]]))
) {
$column_value = PMA_texEscape(stripslashes($record[$columns[$i]]));
} else {
$column_value = $GLOBALS['latex_null'];
@ -259,13 +293,13 @@ if (isset($plugin_list)) {
}
}
$buffer .= ' \\\\ \\hline ' . $crlf;
if (!PMA_exportOutputHandler($buffer)) {
if (! PMA_exportOutputHandler($buffer)) {
return false;
}
}
$buffer = ' \\end{longtable}' . $crlf;
if (!PMA_exportOutputHandler($buffer)) {
if (! PMA_exportOutputHandler($buffer)) {
return false;
}
@ -277,23 +311,24 @@ if (isset($plugin_list)) {
/**
* Outputs table's structure
*
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column comments
* as comments in the structure; this is deprecated
* but the parameter is left here because export.php
* calls PMA_exportStructure() also for other export
* types which use this parameter
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @return bool Whether it suceeded
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column comments
* as comments in the structure; this is deprecated
* but the parameter is left here because export.php
* calls PMA_exportStructure() also for other export
* types which use this parameter
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
* @param string $export_type 'server', 'database', 'table'
*
* @access public
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
{
@ -316,7 +351,7 @@ if (isset($plugin_list)) {
PMA_DBI_select_db($db);
// Check if we can use Relations
if ($do_relation && !empty($cfgRelation['relation'])) {
if ($do_relation && ! empty($cfgRelation['relation'])) {
// Find which tables are related with the current one and write it in
// an array
$res_rel = PMA_getForeigners($db, $table);
@ -333,9 +368,9 @@ if (isset($plugin_list)) {
/**
* Displays the table structure
*/
$buffer = $crlf . '%' . $crlf . '% ' . __('Structure') . ': ' . $table . $crlf . '%' . $crlf
. ' \\begin{longtable}{';
if (!PMA_exportOutputHandler($buffer)) {
$buffer = $crlf . '%' . $crlf . '% ' . __('Structure') . ': ' . $table
. $crlf . '%' . $crlf . ' \\begin{longtable}{';
if (! PMA_exportOutputHandler($buffer)) {
return false;
}
@ -356,7 +391,10 @@ if (isset($plugin_list)) {
$buffer = $alignment . '} ' . $crlf ;
$header = ' \\hline ';
$header .= '\\multicolumn{1}{|c|}{\\textbf{' . __('Column') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Type') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Null') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Default') . '}}';
$header .= '\\multicolumn{1}{|c|}{\\textbf{' . __('Column')
. '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Type')
. '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Null')
. '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Default') . '}}';
if ($do_relation && $have_rel) {
$header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Links to') . '}}';
}
@ -371,19 +409,34 @@ if (isset($plugin_list)) {
// Table caption for first page and label
if (isset($GLOBALS['latex_caption'])) {
$buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
. '} \\label{' . PMA_expandUserString($GLOBALS['latex_structure_label'], null, array('table' => $table, 'database' => $db))
. '} \\\\' . $crlf;
$buffer .= ' \\caption{'
. PMA_expandUserString(
$GLOBALS['latex_structure_caption'],
'PMA_texEscape',
array('table' => $table, 'database' => $db)
)
. '} \\label{'
. PMA_expandUserString(
$GLOBALS['latex_structure_label'],
null,
array('table' => $table, 'database' => $db)
)
. '} \\\\' . $crlf;
}
$buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
// Table caption on next pages
if (isset($GLOBALS['latex_caption'])) {
$buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
. '} \\\\ ' . $crlf;
$buffer .= ' \\caption{'
. PMA_expandUserString(
$GLOBALS['latex_structure_continued_caption'],
'PMA_texEscape',
array('table' => $table, 'database' => $db)
)
. '} \\\\ ' . $crlf;
}
$buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
if (!PMA_exportOutputHandler($buffer)) {
if (! PMA_exportOutputHandler($buffer)) {
return false;
}
@ -395,7 +448,7 @@ if (isset($plugin_list)) {
$type = ' ';
}
if (!isset($row['Default'])) {
if (! isset($row['Default'])) {
if ($row['Null'] != 'NO') {
$row['Default'] = 'NULL';
}
@ -410,7 +463,8 @@ if (isset($plugin_list)) {
if ($do_relation && $have_rel) {
$local_buffer .= "\000";
if (isset($res_rel[$field_name])) {
$local_buffer .= $res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')';
$local_buffer .= $res_rel[$field_name]['foreign_table'] . ' ('
. $res_rel[$field_name]['foreign_field'] . ')';
}
}
if ($do_comments && $cfgRelation['commwork']) {
@ -437,7 +491,7 @@ if (isset($plugin_list)) {
$buffer = str_replace("\000", ' & ', $local_buffer);
$buffer .= ' \\\\ \\hline ' . $crlf;
if (!PMA_exportOutputHandler($buffer)) {
if (! PMA_exportOutputHandler($buffer)) {
return false;
}
} // end while

View File

@ -28,38 +28,38 @@ if (isset($plugin_list)) {
);
/* what to dump (structure/data/both) */
$plugin_list['odt']['options'][] =
array('type' => 'begin_group', 'text' => __('Dump table') , 'name' => 'general_opts');
$plugin_list['odt']['options'][] =
array('type' => 'radio', 'name' => 'structure_or_data', 'values' => array('structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')));
$plugin_list['odt']['options'][]
= array('type' => 'begin_group', 'text' => __('Dump table') , 'name' => 'general_opts');
$plugin_list['odt']['options'][]
= array('type' => 'radio', 'name' => 'structure_or_data', 'values' => array('structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')));
$plugin_list['odt']['options'][] = array('type' => 'end_group');
/* Structure options */
if (!$hide_structure) {
$plugin_list['odt']['options'][] =
array('type' => 'begin_group', 'name' => 'structure', 'text' => __('Object creation options'), 'force' => 'data');
$plugin_list['odt']['options'][]
= array('type' => 'begin_group', 'name' => 'structure', 'text' => __('Object creation options'), 'force' => 'data');
if (!empty($GLOBALS['cfgRelation']['relation'])) {
$plugin_list['odt']['options'][] =
array('type' => 'bool', 'name' => 'relation', 'text' => __('Display foreign key relationships'));
$plugin_list['odt']['options'][]
= array('type' => 'bool', 'name' => 'relation', 'text' => __('Display foreign key relationships'));
}
$plugin_list['odt']['options'][] =
array('type' => 'bool', 'name' => 'comments', 'text' => __('Display comments'));
$plugin_list['odt']['options'][]
= array('type' => 'bool', 'name' => 'comments', 'text' => __('Display comments'));
if (!empty($GLOBALS['cfgRelation']['mimework'])) {
$plugin_list['odt']['options'][] =
array('type' => 'bool', 'name' => 'mime', 'text' => __('Display MIME types'));
$plugin_list['odt']['options'][]
= array('type' => 'bool', 'name' => 'mime', 'text' => __('Display MIME types'));
}
$plugin_list['odt']['options'][] =
array('type' => 'end_group');
$plugin_list['odt']['options'][]
= array('type' => 'end_group');
}
/* Data */
$plugin_list['odt']['options'][] =
array('type' => 'begin_group', 'name' => 'data', 'text' => __('Data dump options'), 'force' => 'structure');
$plugin_list['odt']['options'][] =
array('type' => 'bool', 'name' => 'columns', 'text' => __('Put columns names in the first row'));
$plugin_list['odt']['options'][] =
array('type' => 'text', 'name' => 'null', 'text' => __('Replace NULL with:'));
$plugin_list['odt']['options'][] =
array('type' => 'end_group');
$plugin_list['odt']['options'][]
= array('type' => 'begin_group', 'name' => 'data', 'text' => __('Data dump options'), 'force' => 'structure');
$plugin_list['odt']['options'][]
= array('type' => 'bool', 'name' => 'columns', 'text' => __('Put columns names in the first row'));
$plugin_list['odt']['options'][]
= array('type' => 'text', 'name' => 'null', 'text' => __('Replace NULL with:'));
$plugin_list['odt']['options'][]
= array('type' => 'end_group');
} else {
$GLOBALS['odt_buffer'] = '';
@ -68,15 +68,16 @@ if (isset($plugin_list)) {
/**
* Outputs export footer
*
* @return bool Whether it suceeded
* @return bool Whether it suceeded
*
* @access public
* @access public
*/
function PMA_exportFooter() {
function PMA_exportFooter()
{
$GLOBALS['odt_buffer'] .= '</office:text>'
. '</office:body>'
. '</office:document-content>';
if (!PMA_exportOutputHandler(PMA_createOpenDocument('application/vnd.oasis.opendocument.text', $GLOBALS['odt_buffer']))) {
if (! PMA_exportOutputHandler(PMA_createOpenDocument('application/vnd.oasis.opendocument.text', $GLOBALS['odt_buffer']))) {
return false;
}
return true;
@ -85,11 +86,12 @@ if (isset($plugin_list)) {
/**
* Outputs export header
*
* @return bool Whether it suceeded
* @return bool Whether it suceeded
*
* @access public
* @access public
*/
function PMA_exportHeader() {
function PMA_exportHeader()
{
$GLOBALS['odt_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>'
. '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
. '<office:body>'
@ -100,53 +102,62 @@ if (isset($plugin_list)) {
/**
* Outputs database header
*
* @param string $db Database name
* @return bool Whether it suceeded
* @param string $db Database name
*
* @access public
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportDBHeader($db) {
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="1" text:style-name="Heading_1" text:is-list-header="true">' . __('Database') . ' ' . htmlspecialchars($db) . '</text:h>';
function PMA_exportDBHeader($db)
{
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="1" text:style-name="Heading_1" text:is-list-header="true">'
. __('Database') . ' ' . htmlspecialchars($db) . '</text:h>';
return true;
}
/**
* Outputs database footer
*
* @param string $db Database name
* @return bool Whether it suceeded
* @param string $db Database name
*
* @access public
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportDBFooter($db) {
function PMA_exportDBFooter($db)
{
return true;
}
/**
* Outputs CREATE DATABASE statement
*
* @param string $db Database name
* @return bool Whether it suceeded
* @param string $db Database name
*
* @access public
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportDBCreate($db) {
function PMA_exportDBCreate($db)
{
return true;
}
/**
* Outputs the content of a table in ODT format
*
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $sql_query SQL query for obtaining data
* @return bool Whether it suceeded
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $sql_query SQL query for obtaining data
*
* @access public
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
{
global $what;
// Gets the data from the database
@ -158,7 +169,8 @@ if (isset($plugin_list)) {
$field_flags[$j] = PMA_DBI_field_flags($result, $j);
}
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . __('Dumping data for table') . ' ' . htmlspecialchars($table) . '</text:h>';
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">'
. __('Dumping data for table') . ' ' . htmlspecialchars($table) . '</text:h>';
$GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_structure">';
$GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $fields_cnt . '"/>';
@ -209,30 +221,32 @@ if (isset($plugin_list)) {
/**
* Outputs table's structure
*
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column comments
* as comments in the structure; this is deprecated
* but the parameter is left here because export.php
* calls PMA_exportStructure() also for other export
* types which use this parameter
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @return bool Whether it suceeded
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column comments
* as comments in the structure; this is deprecated
* but the parameter is left here because export.php
* calls PMA_exportStructure() also for other export
* types which use this parameter
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
* @param string $export_type 'server', 'database', 'table'
*
* @access public
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
{
global $cfgRelation;
/* Heading */
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</text:h>';
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">'
. __('Table structure for table') . ' ' . htmlspecialchars($table) . '</text:h>';
/**
* Get the unique keys in the table

View File

@ -254,8 +254,8 @@ class PMA_GIS_Visualization
{
$this->init();
$scale_data = $this->_scaleDataSet($this->_data);
$output =
'var options = {'
$output
= 'var options = {'
. 'projection: new OpenLayers.Projection("EPSG:900913"),'
. 'displayProjection: new OpenLayers.Projection("EPSG:4326"),'
. 'units: "m",'

View File

@ -34,12 +34,12 @@ if (isset($plugin_list)) {
);
if ($plugin_param !== 'table') {
$plugin_list['csv']['options'][] =
array('type' => 'bool', 'name' => 'col_names', 'text' => __('The first line of the file contains the table column names <i>(if this is unchecked, the first line will become part of the data)</i>'));
$plugin_list['csv']['options'][]
= array('type' => 'bool', 'name' => 'col_names', 'text' => __('The first line of the file contains the table column names <i>(if this is unchecked, the first line will become part of the data)</i>'));
} else {
$hint = new PMA_Message(__('If the data in each row of the file is not in the same order as in the database, list the corresponding column names here. Column names must be separated by commas and not enclosed in quotations.'));
$plugin_list['csv']['options'][] =
array('type' => 'text', 'name' => 'columns', 'text' => __('Column names: ') . PMA_showHint($hint));
$plugin_list['csv']['options'][]
= array('type' => 'text', 'name' => 'columns', 'text' => __('Column names: ') . PMA_showHint($hint));
}
$plugin_list['csv']['options'][] = array('type' => 'end_group');
@ -129,7 +129,7 @@ if (!$analyze) {
}
}
if (!$found) {
$message = PMA_Message::error(__('Invalid column (%s) specified! Ensure that columns names are spelled correctly, separated by commas, and not enclosed in quotes.' ));
$message = PMA_Message::error(__('Invalid column (%s) specified! Ensure that columns names are spelled correctly, separated by commas, and not enclosed in quotes.'));
$message->addParam($val);
$error = true;
break;
@ -175,7 +175,8 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) {
unset($data);
// Do not parse string when we're not at the end and don't have new line inside
if (($csv_new_line == 'auto' && strpos($buffer, "\r") === false && strpos($buffer, "\n") === false)
|| ($csv_new_line != 'auto' && strpos($buffer, $csv_new_line) === false)) {
|| ($csv_new_line != 'auto' && strpos($buffer, $csv_new_line) === false)
) {
continue;
}
}
@ -269,7 +270,10 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) {
}
}
// Are we at the end?
if ($ch == $csv_new_line || ($csv_new_line == 'auto' && ($ch == "\r" || $ch == "\n")) || ($finished && $i == $len - 1)) {
if ($ch == $csv_new_line
|| ($csv_new_line == 'auto' && ($ch == "\r" || $ch == "\n"))
|| ($finished && $i == $len - 1)
) {
$csv_finish = true;
}
// Go to next char
@ -287,7 +291,10 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) {
}
// End of line
if ($csv_finish || $ch == $csv_new_line || ($csv_new_line == 'auto' && ($ch == "\r" || $ch == "\n"))) {
if ($csv_finish
|| $ch == $csv_new_line
|| ($csv_new_line == 'auto' && ($ch == "\r" || $ch == "\n"))
) {
if ($csv_new_line == 'auto' && $ch == "\r") { // Handle "\r\n"
if ($i >= ($len - 2) && !$finished) {
break; // We need more data to decide new line
@ -377,7 +384,9 @@ if ($analyze) {
$col_names = $col_names[0];
}
if ((isset($col_names) && count($col_names) != $max_cols) || !isset($col_names)) {
if ((isset($col_names) && count($col_names) != $max_cols)
|| ! isset($col_names)
) {
// Fill out column names
for ($i = 0; $i < $max_cols; ++$i) {
$col_names[] = 'COL '.($i+1);

View File

@ -47,8 +47,8 @@ if (! PMA_cacheExists('mysql_charsets', true)) {
}
//$mysql_collations_available[$row['Collation']] = ! isset($row['Compiled']) || $row['Compiled'] == 'Yes';
$mysql_collations_available[$row['COLLATION_NAME']] = true;
$mysql_charsets_available[$row['CHARACTER_SET_NAME']] =
!empty($mysql_charsets_available[$row['CHARACTER_SET_NAME']])
$mysql_charsets_available[$row['CHARACTER_SET_NAME']]
= !empty($mysql_charsets_available[$row['CHARACTER_SET_NAME']])
|| !empty($mysql_collations_available[$row['COLLATION_NAME']]);
}
PMA_DBI_free_result($res);
@ -118,8 +118,8 @@ function PMA_generateCharsetDropdownBox($type = PMA_CSDROPDOWN_COLLATION,
if (!$mysql_charsets_available[$current_charset]) {
continue;
}
$current_cs_descr =
empty($mysql_charsets_descriptions[$current_charset])
$current_cs_descr
= empty($mysql_charsets_descriptions[$current_charset])
? $current_charset
: $mysql_charsets_descriptions[$current_charset];

View File

@ -15,8 +15,8 @@ $GLOBALS['PMD']['STYLE'] = 'default';
$cfgRelation = PMA_getRelationsParam();
$GLOBALS['script_display_field'] =
'<script type="text/javascript">' . "\n" .
$GLOBALS['script_display_field']
= '<script type="text/javascript">' . "\n" .
'// <![CDATA[' . "\n" .
'var display_field = new Array();' . "\n";
@ -129,8 +129,8 @@ function get_script_contr()
}
$ti = 0;
$script_contr =
'<script type="text/javascript">' . "\n" .
$script_contr
= '<script type="text/javascript">' . "\n" .
'// <![CDATA[' . "\n" .
'var contr = new Array();' . "\n";
for ($i = 0, $cnt = count($con["C_NAME"]); $i < $cnt; $i++) {
@ -199,8 +199,8 @@ function get_all_keys($unique_only = false)
*/
function get_script_tabs()
{
$script_tabs =
'<script type="text/javascript">' . "\n" .
$script_tabs
= '<script type="text/javascript">' . "\n" .
'// <![CDATA[' . "\n" .
'var j_tabs = new Array();' . "\n" .
'var h_tabs = new Array();' . "\n" ;

View File

@ -1277,16 +1277,16 @@ if (! defined('PMA_MINIMUM_COMMON')) {
// we assume for now that this is also the true name
$subresult['select_expr'][$current_select_expr]['table_true_name'] = $chain[$size_chain - 2];
$subresult['select_expr'][$current_select_expr]['expr']
= $subresult['select_expr'][$current_select_expr]['table_name']
. '.' . $subresult['select_expr'][$current_select_expr]['expr'];
= $subresult['select_expr'][$current_select_expr]['table_name']
. '.' . $subresult['select_expr'][$current_select_expr]['expr'];
} // end if ($size_chain > 1)
// maybe a db
if ($size_chain > 2) {
$subresult['select_expr'][$current_select_expr]['db'] = $chain[$size_chain - 3];
$subresult['select_expr'][$current_select_expr]['expr']
= $subresult['select_expr'][$current_select_expr]['db']
. '.' . $subresult['select_expr'][$current_select_expr]['expr'];
= $subresult['select_expr'][$current_select_expr]['db']
. '.' . $subresult['select_expr'][$current_select_expr]['expr'];
} // end if ($size_chain > 2)
unset($chain);
@ -1336,13 +1336,13 @@ if (! defined('PMA_MINIMUM_COMMON')) {
// we assume for now that this is also the true name
$subresult['table_ref'][$current_table_ref]['table_true_name'] = $chain[$size_chain - 1];
$subresult['table_ref'][$current_table_ref]['expr']
= $subresult['table_ref'][$current_table_ref]['table_name'];
= $subresult['table_ref'][$current_table_ref]['table_name'];
// maybe a db
if ($size_chain > 1) {
$subresult['table_ref'][$current_table_ref]['db'] = $chain[$size_chain - 2];
$subresult['table_ref'][$current_table_ref]['expr']
= $subresult['table_ref'][$current_table_ref]['db']
. '.' . $subresult['table_ref'][$current_table_ref]['expr'];
= $subresult['table_ref'][$current_table_ref]['db']
. '.' . $subresult['table_ref'][$current_table_ref]['expr'];
} // end if ($size_chain > 1)
// add the table alias into the whole expression
@ -1365,10 +1365,11 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$alias = $subresult['table_ref'][$tr]['table_alias'];
$truename = $subresult['table_ref'][$tr]['table_true_name'];
for ($se=0; $se <= $current_select_expr; $se++) {
if (isset($alias) && strlen($alias) && $subresult['select_expr'][$se]['table_true_name']
== $alias) {
$subresult['select_expr'][$se]['table_true_name']
= $truename;
if (isset($alias)
&& strlen($alias)
&& $subresult['select_expr'][$se]['table_true_name'] == $alias
) {
$subresult['select_expr'][$se]['table_true_name'] = $truename;
} // end if (found the alias)
} // end for (select expressions)

View File

@ -340,8 +340,8 @@ for ($i = 0; $i < $num_fields; $i++) {
// old column default
if ($is_backup) {
$_form_params['field_default_orig[' . $i . ']'] =
(isset($row['Default']) ? $row['Default'] : '');
$_form_params['field_default_orig[' . $i . ']']
= (isset($row['Default']) ? $row['Default'] : '');
}
// here we put 'NONE' as the default value of drop-down; otherwise

View File

@ -464,8 +464,8 @@ function PMA_displayDbList($ext_dblist, $offset, $count)
} else {
$tables = PMA_getTableList($db['name']);
}
$child_visible =
(bool) (count($GLOBALS['pma']->databases) === 1 || $db_start == $db['name']);
$child_visible
= (bool) (count($GLOBALS['pma']->databases) === 1 || $db_start == $db['name']);
PMA_displayTableList($tables, $child_visible, '', $db['name']);
} elseif ($GLOBALS['cfg']['LeftFrameLight']) {
// no tables and LeftFrameLight:

View File

@ -1630,8 +1630,8 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) {
$db_rights_row = array_merge($user_defaults, $db_rights_row);
$db_rights[$db_rights_row['User']][$db_rights_row['Host']] =
$db_rights_row;
$db_rights[$db_rights_row['User']][$db_rights_row['Host']]
= $db_rights_row;
}
PMA_DBI_free_result($db_rights_result);
unset($db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row);
@ -2260,8 +2260,8 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
unset($row, $row1, $row2);
// now, we build the table...
$list_of_privileges =
'`User`, '
$list_of_privileges
= '`User`, '
. '`Host`, '
. '`Select_priv`, '
. '`Insert_priv`, '
@ -2281,8 +2281,8 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
. '`Alter_routine_priv`, '
. '`Execute_priv`';
$list_of_compared_privileges =
'`Select_priv` = \'N\''
$list_of_compared_privileges
= '`Select_priv` = \'N\''
. ' AND `Insert_priv` = \'N\''
. ' AND `Update_priv` = \'N\''
. ' AND `Delete_priv` = \'N\''

View File

@ -486,16 +486,16 @@ cleanDeprecated($server_status);
if (isset($server_status['Key_blocks_unused'])
&& isset($server_variables['key_cache_block_size'])
&& isset($server_variables['key_buffer_size'])) {
$server_status['Key_buffer_fraction_%'] =
100
$server_status['Key_buffer_fraction_%']
= 100
- $server_status['Key_blocks_unused']
* $server_variables['key_cache_block_size']
/ $server_variables['key_buffer_size']
* 100;
} elseif (isset($server_status['Key_blocks_used'])
&& isset($server_variables['key_buffer_size'])) {
$server_status['Key_buffer_fraction_%'] =
$server_status['Key_blocks_used']
$server_status['Key_buffer_fraction_%']
= $server_status['Key_blocks_used']
* 1024
/ $server_variables['key_buffer_size'];
}
@ -518,8 +518,8 @@ if (isset($server_status['Threads_created'])
&& isset($server_status['Connections'])
&& $server_status['Connections'] > 0) {
$server_status['Threads_cache_hitrate_%'] =
100 - $server_status['Threads_created'] / $server_status['Connections'] * 100;
$server_status['Threads_cache_hitrate_%']
= 100 - $server_status['Threads_created'] / $server_status['Connections'] * 100;
}
/**

View File

@ -376,8 +376,8 @@ foreach ($rows as $row_id => $vrow) {
$table_fields[$i]['Default'] = null;
}
$table_fields[$i]['len'] =
preg_match('@float|double@', $table_fields[$i]['Type']) ? 100 : -1;
$table_fields[$i]['len']
= preg_match('@float|double@', $table_fields[$i]['Type']) ? 100 : -1;
if (isset($comments_map[$table_fields[$i]['Field']])) {
@ -918,11 +918,11 @@ foreach ($rows as $row_id => $vrow) {
$fieldsize = $extracted_fieldspec['spec_in_brackets'];
} else {
/**
* This case happens for example for INT or DATE columns;
* in these situations, the value returned in $field['len']
* This case happens for example for INT or DATE columns;
* in these situations, the value returned in $field['len']
* seems appropriate.
*/
$fieldsize = $field['len'];
$fieldsize = $field['len'];
}
$fieldsize = min(max($fieldsize, $cfg['MinSizeForInputField']), $cfg['MaxSizeForInputField']);
echo $backup_field . "\n";

View File

@ -130,8 +130,8 @@ if ($GLOBALS['is_ajax_request'] != true) {
if (isset($_REQUEST['index']) && is_array($_REQUEST['index'])) {
// coming already from form
$add_fields =
count($_REQUEST['index']['columns']['names']) - $index->getColumnCount();
$add_fields
= count($_REQUEST['index']['columns']['names']) - $index->getColumnCount();
if (isset($_REQUEST['add_fields'])) {
$add_fields += $_REQUEST['added_fields'];
}

View File

@ -185,36 +185,36 @@ foreach ($loop_array as $rownumber => $where_clause) {
$query_values = array();
// Map multi-edit keys to single-level arrays, dependent on how we got the fields
$me_fields =
isset($_REQUEST['fields']['multi_edit'][$rownumber])
$me_fields
= isset($_REQUEST['fields']['multi_edit'][$rownumber])
? $_REQUEST['fields']['multi_edit'][$rownumber]
: array();
$me_fields_name =
isset($_REQUEST['fields_name']['multi_edit'][$rownumber])
$me_fields_name
= isset($_REQUEST['fields_name']['multi_edit'][$rownumber])
? $_REQUEST['fields_name']['multi_edit'][$rownumber]
: null;
$me_fields_prev =
isset($_REQUEST['fields_prev']['multi_edit'][$rownumber])
$me_fields_prev
= isset($_REQUEST['fields_prev']['multi_edit'][$rownumber])
? $_REQUEST['fields_prev']['multi_edit'][$rownumber]
: null;
$me_funcs =
isset($_REQUEST['funcs']['multi_edit'][$rownumber])
$me_funcs
= isset($_REQUEST['funcs']['multi_edit'][$rownumber])
? $_REQUEST['funcs']['multi_edit'][$rownumber]
: null;
$me_fields_type =
isset($_REQUEST['fields_type']['multi_edit'][$rownumber])
$me_fields_type
= isset($_REQUEST['fields_type']['multi_edit'][$rownumber])
? $_REQUEST['fields_type']['multi_edit'][$rownumber]
: null;
$me_fields_null =
isset($_REQUEST['fields_null']['multi_edit'][$rownumber])
$me_fields_null
= isset($_REQUEST['fields_null']['multi_edit'][$rownumber])
? $_REQUEST['fields_null']['multi_edit'][$rownumber]
: null;
$me_fields_null_prev =
isset($_REQUEST['fields_null_prev']['multi_edit'][$rownumber])
$me_fields_null_prev
= isset($_REQUEST['fields_null_prev']['multi_edit'][$rownumber])
? $_REQUEST['fields_null_prev']['multi_edit'][$rownumber]
: null;
$me_auto_increment =
isset($_REQUEST['auto_increment']['multi_edit'][$rownumber])
$me_auto_increment
= isset($_REQUEST['auto_increment']['multi_edit'][$rownumber])
? $_REQUEST['auto_increment']['multi_edit'][$rownumber]
: null;
@ -405,8 +405,10 @@ foreach ($query as $single_query) {
} // end if
foreach (PMA_DBI_get_warnings() as $warning) {
$warning_messages[] = PMA_Message::sanitize($warning['Level'] . ': #' . $warning['Code']
. ' ' . $warning['Message']);
$warning_messages[]
= PMA_Message::sanitize(
$warning['Level'] . ': #' . $warning['Code'] . ' ' . $warning['Message']
);
}
unset($result);