Merge remote-tracking branch 'origin/master'

This commit is contained in:
Michal Čihař 2012-05-09 21:02:07 +02:00
commit 71d7d63d13
12 changed files with 291 additions and 191 deletions

View File

@ -12,9 +12,11 @@ if (! defined('PHPMYADMIN')) {
/**
* handles theme
*
* @todo add the possibility to make a theme depend on another theme and by default on original
* @todo add the possibility to make a theme depend on another theme
* and by default on original
* @todo make all components optional - get missing components from 'parent' theme
* @todo make css optionally replacing 'parent' css or extending it (by appending at the end)
* @todo make css optionally replacing 'parent' css or extending it
* (by appending at the end)
* @todo add an optional global css file - which will be used for both frames
*
* @package PhpMyAdmin
@ -72,8 +74,10 @@ class PMA_Theme
var $filesize_info = 0;
/**
* Loads theme information
*
* @return boolean whether loading them info was successful or not *
* @access public
* @return boolean whether loading them info was successful or not
*/
function loadInfo()
{
@ -109,11 +113,11 @@ class PMA_Theme
* returns theme object loaded from given folder
* or false if theme is invalid
*
* @static
* @access public
* @param string $folder path to theme
* @param string $folder path to theme
*
* @return object PMA_Theme
* @return object PMA_Theme
* @static
* @access public
*/
static public function load($folder)
{
@ -146,7 +150,10 @@ class PMA_Theme
return true;
} else {
trigger_error(
sprintf(__('No valid image path for theme %s found!'), $this->getName()),
sprintf(
__('No valid image path for theme %s found!'),
$this->getName()
),
E_USER_ERROR
);
return false;
@ -178,8 +185,10 @@ class PMA_Theme
/**
* set path to theme
*
* @access public
* @param string $path path to theme
* @param string $path path to theme
*
* @return void
* @access public
*/
function setPath($path)
{
@ -189,8 +198,10 @@ class PMA_Theme
/**
* sets version
*
* @access public
* @param string new version
* @param string $version version to set
*
* @return void
* @access public
*/
function setVersion($version)
{
@ -200,8 +211,8 @@ class PMA_Theme
/**
* returns version
*
* @return string version
* @access public
* @return string version
*/
function getVersion()
{
@ -212,10 +223,10 @@ class PMA_Theme
* checks theme version agaisnt $version
* returns true if theme version is equal or higher to $version
*
* @access public
* @param string $version version to compare to
* @param string $version version to compare to
*
* @return boolean
* @return boolean true if theme version is equal or higher to $version
* @access public
*/
function checkVersion($version)
{
@ -225,8 +236,10 @@ class PMA_Theme
/**
* sets name
*
* @access public
* @param string $name new name
* @param string $name name to set
*
* @return void
* @access public
*/
function setName($name)
{
@ -247,8 +260,10 @@ class PMA_Theme
/**
* sets id
*
* @access public
* @param string $id new id
* @param string $id new id
*
* @return void
* @access public
*/
function setId($id)
{
@ -258,8 +273,8 @@ class PMA_Theme
/**
* returns id
*
* @access public
* @return string id
* @return string id
* @access public
*/
function getId()
{
@ -267,8 +282,12 @@ class PMA_Theme
}
/**
* @access public
* @param string path to images for this theme
* Sets path to images for the theme
*
* @param string $path path to images for this theme
*
* @return void
* @access public
*/
function setImgPath($path)
{
@ -276,7 +295,9 @@ class PMA_Theme
}
/**
* @access public
* Returns the path to images for the theme
*
* @access public
* @return string image path for this theme
*/
function getImgPath()
@ -287,10 +308,10 @@ class PMA_Theme
/**
* load css (send to stdout, normally the browser)
*
* @access public
* @param string $type left, right or print
* @param string &$type left, right or print
*
* @return bool
* @access public
*/
function loadCss(&$type)
{
@ -322,8 +343,10 @@ class PMA_Theme
if ($type != 'print') {
$_sprites_data_file = $this->getPath() . '/sprites.lib.php';
$_sprites_css_file = './themes/sprites.css.php';
if ( (file_exists($_sprites_data_file) && is_readable($_sprites_data_file))
&& (file_exists($_sprites_css_file) && is_readable($_sprites_css_file))
if (file_exists($_sprites_data_file)
&& is_readable($_sprites_data_file)
&& file_exists($_sprites_css_file)
&& is_readable($_sprites_css_file)
) {
include $_sprites_data_file;
include $_sprites_css_file;
@ -336,7 +359,8 @@ class PMA_Theme
/**
* prints out the preview for this theme
*
* @access public
* @return void
* @access public
*/
function printPreview()
{
@ -371,7 +395,9 @@ class PMA_Theme
*/
function getCssIEClearFilter()
{
return PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 6 && PMA_USR_BROWSER_VER <= 8
return PMA_USR_BROWSER_AGENT == 'IE'
&& PMA_USR_BROWSER_VER >= 6
&& PMA_USR_BROWSER_VER <= 8
? 'filter: none'
: '';
}

View File

@ -38,9 +38,9 @@ if (@extension_loaded('ctype')) {
/**
* Checks if a given character position in the string is escaped or not
*
* @param string string to check for
* @param integer the character to check for
* @param integer starting position in the string
* @param string $string string to check for
* @param integer $pos the character to check for
* @param integer $start starting position in the string
*
* @return boolean whether the character is escaped or not
*/
@ -70,9 +70,9 @@ function PMA_STR_charIsEscaped($string, $pos, $start = 0)
/**
* Checks if a number is in a range
*
* @param integer number to check for
* @param integer lower bound
* @param integer upper bound
* @param integer $num number to check for
* @param integer $lower lower bound
* @param integer $upper upper bound
*
* @return boolean whether the number is in the range or not
*/
@ -84,8 +84,8 @@ function PMA_STR_numberInRangeInclusive($num, $lower, $upper)
/**
* Checks if a character is an SQL identifier
*
* @param string character to check for
* @param boolean whether the dot character is valid or not
* @param string $c character to check for
* @param boolean $dot_is_valid whether the dot character is valid or not
*
* @return boolean whether the character is an SQL identifier or not
*/

View File

@ -19,9 +19,9 @@ if (! defined('PHPMYADMIN')) {
/**
* Returns length of string depending on current charset.
*
* @param string string to count
* @param string $string string to count
*
* @return int string length
* @return int string length
*/
function PMA_strlen($string)
{
@ -31,11 +31,11 @@ function PMA_strlen($string)
/**
* Returns substring from string, works depending on current charset.
*
* @param string $string string to count
* @param int $start start of substring
* @param int $length length of substring
* @param string $string string to count
* @param int $start start of substring
* @param int $length length of substring
*
* @return string
* @return string the sub string
*/
function PMA_substr($string, $start, $length = 2147483647)
{
@ -45,9 +45,9 @@ function PMA_substr($string, $start, $length = 2147483647)
/**
* Returns postion of $needle in $haystack or false if not found
*
* @param string $haystack
* @param string $needle
* @param int $offset
* @param string $haystack the string being checked
* @param string $needle the string to find in haystack
* @param int $offset the search offset
*
* @return integer position of $needle in $haystack or false
*/
@ -59,9 +59,9 @@ function PMA_strpos($haystack, $needle, $offset = 0)
/**
* Make a string lowercase
*
* @param string $string
* @param string $string the string being lowercased
*
* @return string
* @return string the lower case string
*/
function PMA_strtolower($string)
{

View File

@ -19,9 +19,9 @@ if (! defined('PHPMYADMIN')) {
/**
* Returns length of string depending on current charset.
*
* @param string string to count
* @param string $string string to count
*
* @return int string length
* @return int string length
*/
function PMA_strlen($string)
{
@ -31,11 +31,11 @@ function PMA_strlen($string)
/**
* Returns substring from string, works depending on current charset.
*
* @param string $string string to count
* @param int $start start of substring
* @param int $length length of substring
* @param string $string string to count
* @param int $start start of substring
* @param int $length length of substring
*
* @return string
* @return string the sub string
*/
function PMA_substr($string, $start, $length = 2147483647)
{
@ -45,9 +45,9 @@ function PMA_substr($string, $start, $length = 2147483647)
/**
* Returns postion of $needle in $haystack or false if not found
*
* @param string $haystack
* @param string $needle
* @param int $offset
* @param string $haystack the string being checked
* @param string $needle the string to find in haystack
* @param int $offset the search offset
*
* @return integer position of $needle in $haystack or false
*/
@ -59,9 +59,9 @@ function PMA_strpos($haystack, $needle, $offset = 0)
/**
* Make a string lowercase
*
* @param string $string
* @param string $string the string being lowercased
*
* @return string
* @return string the lower case string
*/
function PMA_strtolower($string)
{

View File

@ -19,9 +19,9 @@ if (! defined('PHPMYADMIN')) {
/**
* Checks if a character is an alphanumeric one
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is an alphanumeric one or not
* @return boolean whether the character is an alphanumeric one or not
*/
function PMA_STR_isAlnum($c)
{
@ -31,9 +31,9 @@ function PMA_STR_isAlnum($c)
/**
* Checks if a character is an alphabetic one
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is an alphabetic one or not
* @return boolean whether the character is an alphabetic one or not
*/
function PMA_STR_isAlpha($c)
{
@ -43,9 +43,9 @@ function PMA_STR_isAlpha($c)
/**
* Checks if a character is a digit
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is a digit or not
* @return boolean whether the character is a digit or not
*/
function PMA_STR_isDigit($c)
{
@ -55,9 +55,9 @@ function PMA_STR_isDigit($c)
/**
* Checks if a character is an upper alphabetic one
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is an upper alphabetic one or not
* @return boolean whether the character is an upper alphabetic one or not
*/
function PMA_STR_isUpper($c)
{
@ -68,9 +68,9 @@ function PMA_STR_isUpper($c)
/**
* Checks if a character is a lower alphabetic one
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is a lower alphabetic one or not
* @return boolean whether the character is a lower alphabetic one or not
*/
function PMA_STR_isLower($c)
{
@ -80,9 +80,9 @@ function PMA_STR_isLower($c)
/**
* Checks if a character is a space one
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is a space one or not
* @return boolean whether the character is a space one or not
*/
function PMA_STR_isSpace($c)
{
@ -92,9 +92,9 @@ function PMA_STR_isSpace($c)
/**
* Checks if a character is an hexadecimal digit
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is an hexadecimal digit or not
* @return boolean whether the character is an hexadecimal digit or not
*/
function PMA_STR_isHexDigit($c)
{

View File

@ -19,9 +19,9 @@ if (! defined('PHPMYADMIN')) {
/**
* Checks if a character is an alphanumeric one
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is an alphanumeric one or not
* @return boolean whether the character is an alphanumeric one or not
*/
function PMA_STR_isAlnum($c)
{
@ -31,9 +31,9 @@ function PMA_STR_isAlnum($c)
/**
* Checks if a character is an alphabetic one
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is an alphabetic one or not
* @return boolean whether the character is an alphabetic one or not
*/
function PMA_STR_isAlpha($c)
{
@ -43,9 +43,9 @@ function PMA_STR_isAlpha($c)
/**
* Checks if a character is a digit
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is a digit or not
* @return boolean whether the character is a digit or not
*/
function PMA_STR_isDigit($c)
{
@ -59,9 +59,9 @@ function PMA_STR_isDigit($c)
/**
* Checks if a character is an upper alphabetic one
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is an upper alphabetic one or not
* @return boolean whether the character is an upper alphabetic one or not
*/
function PMA_STR_isUpper($c)
{
@ -75,9 +75,9 @@ function PMA_STR_isUpper($c)
/**
* Checks if a character is a lower alphabetic one
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is a lower alphabetic one or not
* @return boolean whether the character is a lower alphabetic one or not
*/
function PMA_STR_isLower($c)
{
@ -91,9 +91,9 @@ function PMA_STR_isLower($c)
/**
* Checks if a character is a space one
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is a space one or not
* @return boolean whether the character is a space one or not
*/
function PMA_STR_isSpace($c)
{
@ -104,16 +104,16 @@ function PMA_STR_isSpace($c)
$ord_c = ord($c);
return ($ord_c == $ord_space
|| $ord_c == $ord_NOBR
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_tab, $ord_CR));
|| $ord_c == $ord_NOBR
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_tab, $ord_CR));
} // end of the "PMA_STR_isSpace()" function
/**
* Checks if a character is an hexadecimal digit
*
* @param string character to check for
* @param string $c character to check for
*
* @return boolean whether the character is an hexadecimal digit or not
* @return boolean whether the character is an hexadecimal digit or not
*/
function PMA_STR_isHexDigit($c)
{
@ -126,8 +126,8 @@ function PMA_STR_isHexDigit($c)
$ord_c = ord($c);
return (PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine)
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Aupper, $ord_Fupper)
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Alower, $ord_Flower));
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Aupper, $ord_Fupper)
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Alower, $ord_Flower));
} // end of the "PMA_STR_isHexDigit()" function
?>

View File

@ -1,10 +1,11 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Library for extracting information about system memory and cpu. Currently supports all
* Windows and Linux plattforms
* Library for extracting information about system memory and cpu.
* Currently supports all Windows and Linux plattforms
*
* This code is based on the OS Classes from the phpsysinfo project (http://phpsysinfo.sourceforge.net/)
* This code is based on the OS Classes from the phpsysinfo project
* (http://phpsysinfo.sourceforge.net/)
*
* @package PhpMyAdmin
*/

View File

@ -1,6 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Common includes for the table level views
*
* @package PhpMyAdmin
*/
@ -34,7 +35,8 @@ $url_params['table'] = $table;
/**
* Defines the urls to return to in case of error in a sql statement
*/
$err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url(array('db' => $db,));
$err_url_0 = $cfg['DefaultTabDatabase']
. PMA_generate_common_url(array('db' => $db,));
$err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params);

View File

@ -43,7 +43,12 @@ $GLOBALS['showtable'] = array();
// we force reading of the current table status
// if $reread_info is true (for example, coming from tbl_operations.php
// and we just changed the table's storage engine)
$GLOBALS['showtable'] = PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], null, (isset($reread_info) && $reread_info ? true : false));
$GLOBALS['showtable'] = PMA_Table::sGetStatusInfo(
$GLOBALS['db'],
$GLOBALS['table'],
null,
(isset($reread_info) && $reread_info ? true : false)
);
// need this test because when we are creating a table, we get 0 rows
// from the SHOW TABLE query
@ -98,7 +103,9 @@ if ($showtable) {
}
}
// we need explicit DEFAULT value here (different from '0')
$pack_keys = (! isset($pack_keys) || strlen($pack_keys) == 0) ? 'DEFAULT' : $pack_keys;
$pack_keys = (! isset($pack_keys) || strlen($pack_keys) == 0)
? 'DEFAULT'
: $pack_keys;
unset($create_options, $each_create_option);
} // end if
?>

View File

@ -1,9 +1,9 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Display form for changing/adding table fields/columns
* Display form for changing/adding table fields/columns.
* Included by tbl_addfield.php, -_alter.php, -_create.php
*
* included by tbl_addfield.php, -_alter.php, -_create.php
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
@ -83,8 +83,9 @@ $content_cells = array();
$header_cells[] = __('Name');
$header_cells[] = __('Type')
. PMA_showMySQLDocu('SQL-Syntax', 'data-types');
$header_cells[] = __('Length/Values') . PMA_showHint(__('If column type is "enum" or "set", please enter the values using this format: \'a\',\'b\',\'c\'...<br />If you ever need to put a backslash ("\") or a single quote ("\'") amongst those values, precede it with a backslash (for example \'\\\\xyz\' or \'a\\\'b\').'));
. PMA_showMySQLDocu('SQL-Syntax', 'data-types');
$header_cells[] = __('Length/Values')
. PMA_showHint(__('If column type is "enum" or "set", please enter the values using this format: \'a\',\'b\',\'c\'...<br />If you ever need to put a backslash ("\") or a single quote ("\'") amongst those values, precede it with a backslash (for example \'\\\\xyz\' or \'a\\\'b\').'));
$header_cells[] = __('Default') . PMA_showHint(__('For default values, please enter just a single value, without backslash escaping or quotes, using this format: a'));
$header_cells[] = __('Collation');
$header_cells[] = __('Attributes');
@ -153,26 +154,46 @@ for ($i = 0; $i < $num_fields; $i++) {
// An error happened with previous inputs, so we will restore the data
// to embed it once again in this form.
$row['Field'] = (isset($_REQUEST['field_name'][$i]) ? $_REQUEST['field_name'][$i] : false);
$row['Type'] = (isset($_REQUEST['field_type'][$i]) ? $_REQUEST['field_type'][$i] : false);
$row['Collation'] = (isset($_REQUEST['field_collation'][$i]) ? $_REQUEST['field_collation'][$i] : '');
$row['Null'] = (isset($_REQUEST['field_null'][$i]) ? $_REQUEST['field_null'][$i] : '');
$row['Field'] = isset($_REQUEST['field_name'][$i])
? $_REQUEST['field_name'][$i]
: false;
$row['Type'] = isset($_REQUEST['field_type'][$i])
? $_REQUEST['field_type'][$i]
: false;
$row['Collation'] = isset($_REQUEST['field_collation'][$i])
? $_REQUEST['field_collation'][$i]
: '';
$row['Null'] = isset($_REQUEST['field_null'][$i])
? $_REQUEST['field_null'][$i]
: '';
if (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'primary_' . $i) {
if (isset($_REQUEST['field_key'][$i])
&& $_REQUEST['field_key'][$i] == 'primary_' . $i
) {
$row['Key'] = 'PRI';
} elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'index_' . $i) {
} elseif (isset($_REQUEST['field_key'][$i])
&& $_REQUEST['field_key'][$i] == 'index_' . $i
) {
$row['Key'] = 'MUL';
} elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'unique_' . $i) {
} elseif (isset($_REQUEST['field_key'][$i])
&& $_REQUEST['field_key'][$i] == 'unique_' . $i
) {
$row['Key'] = 'UNI';
} elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'fulltext_' . $i) {
} elseif (isset($_REQUEST['field_key'][$i])
&& $_REQUEST['field_key'][$i] == 'fulltext_' . $i
) {
$row['Key'] = 'FULLTEXT';
} else {
$row['Key'] = '';
}
// put None in the drop-down for Default, when someone adds a field
$row['DefaultType'] = (isset($_REQUEST['field_default_type'][$i]) ? $_REQUEST['field_default_type'][$i] : 'NONE');
$row['DefaultValue'] = (isset($_REQUEST['field_default_value'][$i]) ? $_REQUEST['field_default_value'][$i] : '');
$row['DefaultType'] = isset($_REQUEST['field_default_type'][$i])
? $_REQUEST['field_default_type'][$i]
: 'NONE';
$row['DefaultValue'] = isset($_REQUEST['field_default_value'][$i])
? $_REQUEST['field_default_value'][$i]
: '';
switch ($row['DefaultType']) {
case 'NONE' :
@ -221,12 +242,12 @@ for ($i = 0; $i < $num_fields; $i++) {
if (isset($_REQUEST['field_transformation'][$i])) {
$mime_map[$row['Field']]['transformation']
= $_REQUEST['field_transformation'][$i];
= $_REQUEST['field_transformation'][$i];
}
if (isset($_REQUEST['field_transformation_options'][$i])) {
$mime_map[$row['Field']]['transformation_options']
= $_REQUEST['field_transformation_options'][$i];
= $_REQUEST['field_transformation_options'][$i];
}
} elseif (isset($fields_meta[$i])) {
@ -340,7 +361,8 @@ for ($i = 0; $i < $num_fields; $i++) {
. '"' . ' type="text" name="field_length[' . $i . ']" size="'
. $length_values_input_size . '"' . ' value="' . htmlspecialchars(
$length_to_display
) . '"'
)
. '"'
. ' class="textfield" />'
. '<p class="enum_notice" id="enum_notice_' . $i . '_' . ($ci - $ci_offset)
. '">';
@ -370,8 +392,8 @@ for ($i = 0; $i < $num_fields; $i++) {
// for a TIMESTAMP, do not show the string "CURRENT_TIMESTAMP" as a default value
if ($type_upper == 'TIMESTAMP'
&& ! empty($default_current_timestamp)
&& isset($row['Default'])
&& ! empty($default_current_timestamp)
&& isset($row['Default'])
) {
$row['Default'] = '';
}
@ -433,10 +455,8 @@ for ($i = 0; $i < $num_fields; $i++) {
if (PMA_MYSQL_INT_VERSION < 50025
&& isset($row['Field'])
&& isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['type'])
&& $analyzed_sql[0]['create_table_fields'][$row['Field']]['type']
== 'TIMESTAMP'
&& $analyzed_sql[0]['create_table_fields'][$row['Field']]
['timestamp_not_null'] == true
&& $analyzed_sql[0]['create_table_fields'][$row['Field']]['type'] == 'TIMESTAMP'
&& $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null'] == true
) {
$row['Null'] = '';
}
@ -444,16 +464,14 @@ for ($i = 0; $i < $num_fields; $i++) {
// MySQL 4.1.2+ TIMESTAMP options
// (if on_update_current_timestamp is set, then it's TRUE)
if (isset($row['Field'])
&& isset($analyzed_sql[0]['create_table_fields'][$row['Field']]
['on_update_current_timestamp'])
&& isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])
) {
$attribute = 'on update CURRENT_TIMESTAMP';
}
if ((isset($row['Field'])
&& isset($analyzed_sql[0]['create_table_fields'][$row['Field']]
['default_current_timestamp']))
&& isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_current_timestamp']))
|| (isset($submit_default_current_timestamp)
&& $submit_default_current_timestamp)
&& $submit_default_current_timestamp)
) {
$default_current_timestamp = true;
} else {
@ -480,7 +498,8 @@ for ($i = 0; $i < $num_fields; $i++) {
if (! empty($row['Null'])
&& $row['Null'] != 'NO'
&& $row['Null'] != 'NOT NULL') {
&& $row['Null'] != 'NOT NULL'
) {
$content_cells[$i][$ci] .= ' checked="checked"';
}
@ -575,10 +594,12 @@ for ($i = 0; $i < $num_fields; $i++) {
. (($current_index == $mi || $current_index == $mi + 1)
? ' disabled="disabled"'
: '')
.'>' . sprintf(
.'>'
. sprintf(
__('after %s'),
PMA_backquote($move_columns[$mi]->name)
) . '</option>';
)
. '</option>';
}
$content_cells[$i][$ci] .= '</select>';
@ -588,7 +609,8 @@ for ($i = 0; $i < $num_fields; $i++) {
// column MIME-types
if ($cfgRelation['mimework']
&& $cfg['BrowseMIME']
&& $cfgRelation['commwork']) {
&& $cfgRelation['commwork']
) {
$content_cells[$i][$ci] = '<select id="field_' . $i . '_'
. ($ci - $ci_offset) . '" size="1" name="field_mimetype[' . $i . ']">';
$content_cells[$i][$ci] .= ' <option value="">&nbsp;</option>';
@ -617,16 +639,21 @@ for ($i = 0; $i < $num_fields; $i++) {
. '"></option>';
if (is_array($available_mime['transformation'])) {
foreach ($available_mime['transformation'] as $mimekey => $transform) {
$checked = (isset($row['Field'])
&& isset($mime_map[$row['Field']]['transformation'])
&& (preg_match('@' . preg_quote(
$match = preg_match(
'@' . preg_quote(
$available_mime['transformation_file'][$mimekey]
) . '3?@i', $mime_map[$row['Field']]['transformation']))
)
. '3?@i',
$mime_map[$row['Field']]['transformation']
);
$checked = isset($row['Field'])
&& isset($mime_map[$row['Field']]['transformation'])
&& $match
? 'selected '
: '');
: '';
$tooltip = PMA_getTransformationDescription(
$available_mime['transformation_file'][$mimekey], false
);
);
$content_cells[$i][$ci] .= '<option value="'
. $available_mime['transformation_file'][$mimekey] . '" '
. $checked . ' title="' . htmlspecialchars($tooltip) . '">'
@ -637,15 +664,15 @@ for ($i = 0; $i < $num_fields; $i++) {
$content_cells[$i][$ci] .= '</select>';
$ci++;
$val = isset($row['Field'])
&& isset($mime_map[$row['Field']]['transformation_options'])
? htmlspecialchars($mime_map[$row['Field']]['transformation_options'])
: '';
$content_cells[$i][$ci] = '<input id="field_' . $i . '_'
. ($ci - $ci_offset) . '"' . ' type="text" '
. 'name="field_transformation_options[' . $i . ']"'
. ' size="16" class="textfield"'
. ' value="' . (isset($row['Field'])
&& isset($mime_map[$row['Field']]['transformation_options'])
? htmlspecialchars($mime_map[$row['Field']]
['transformation_options'])
: '') . '"'
. ' value="' . $val . '"'
. ' />';
//$ci++;
}
@ -686,19 +713,24 @@ if ($action == 'tbl_create.php') {
<td>
<?php
if ($action == 'tbl_create.php'
|| $action == 'tbl_addfield.php') { ?>
<?php echo sprintf(
__('Add %s column(s)'), '<input type="text" id="added_fields" '
. 'name="added_fields" size="2" value="1" onfocus="this.select'
. '()" />'); ?>
<input type="submit" name="submit_num_fields" value="<?php
echo __('Go'); ?>"
|| $action == 'tbl_addfield.php'
) {
echo sprintf(
__('Add %s column(s)'), '<input type="text" id="added_fields" '
. 'name="added_fields" size="2" value="1" onfocus="this.select'
. '()" />'
); ?>
<input type="submit" name="submit_num_fields"
value="<?php echo __('Go'); ?>"
onclick="return checkFormElementInRange(this.form, 'added_fields', '<?php
echo str_replace('\'', '\\\'', __(
'You have to add at least one column.'
)); ?>', 1)"
echo str_replace(
'\'', '\\\'', __('You have to add at least one column.')
);
?>', 1)"
/>
<?php } ?>
<?php
}
?>
</td>
</tr>
</table>

View File

@ -80,7 +80,9 @@ if (false !== $possibly_uploaded_val) {
} elseif ($type == 'bit') {
$val = preg_replace('/[^01]/', '0', $val);
$val = "b'" . PMA_sqlAddSlashes($val) . "'";
} elseif (! (($type == 'datetime' || $type == 'timestamp') && $val == 'CURRENT_TIMESTAMP')) {
} elseif (! ($type == 'datetime' || $type == 'timestamp')
|| $val != 'CURRENT_TIMESTAMP'
) {
$val = "'" . PMA_sqlAddSlashes($val) . "'";
}
@ -92,7 +94,10 @@ if (false !== $possibly_uploaded_val) {
}
// The Null checkbox was unchecked for this field
if (empty($val) && ! empty($me_fields_null_prev[$key]) && ! isset($me_fields_null[$key])) {
if (empty($val)
&& ! empty($me_fields_null_prev[$key])
&& ! isset($me_fields_null[$key])
) {
$val = "''";
}
} // end else (field value in the form)

View File

@ -59,12 +59,19 @@ function PMA_tbl_getFields($db, $table)
}
$fields_null[] = $row['Null'];
$fields_type[] = $type;
$fields_collation[] = ! empty($row['Collation']) && $row['Collation'] != 'NULL'
$fields_collation[]
= ! empty($row['Collation']) && $row['Collation'] != 'NULL'
? $row['Collation']
: '';
} // end while
return array($fields_list, $fields_type, $fields_collation, $fields_null, $geom_column_present);
return array(
$fields_list,
$fields_type,
$fields_collation,
$fields_null,
$geom_column_present
);
}
/**
@ -121,28 +128,33 @@ function PMA_tbl_getSubTabs()
* 1) Browsing foreign data for a field.
* 2) Creating elements for search criteria input on fields.
*
* @param array $foreigners Array of foreign keys
* @param array $foreignData Foreign keys data
* @param string $field Column name
* @param string $tbl_fields_type Column type
* @param int $i Column index
* @param string $db Selected database
* @param string $table Selected table
* @param array $titles Selected title
* @param int $foreignMaxLimit Max limit of displaying foreign elements
* @param array $fields Array of search criteria inputs
* @param bool $in_fbs Whether we are in 'function based search'
* @param bool $in_zoom_search_edit Whether we are in zoom search edit
* @param array $foreigners Array of foreign keys
* @param array $foreignData Foreign keys data
* @param string $field Column name
* @param string $tbl_fields_type Column type
* @param int $i Column index
* @param string $db Selected database
* @param string $table Selected table
* @param array $titles Selected title
* @param int $foreignMaxLimit Max limit of displaying foreign elements
* @param array $fields Array of search criteria inputs
* @param bool $in_fbs Whether we are in 'function based search'
* @param bool $in_zoom_search_edit Whether we are in zoom search edit
*
* @return string HTML content for viewing foreing data and elements
* for search criteria input.
*/
function PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fields_type, $i, $db, $table, $titles, $foreignMaxLimit, $fields, $in_fbs = false, $in_zoom_search_edit = false)
{
function PMA_getForeignFields_Values($foreigners, $foreignData, $field,
$tbl_fields_type, $i, $db, $table, $titles, $foreignMaxLimit, $fields,
$in_fbs = false, $in_zoom_search_edit = false
) {
$str = '';
if ($foreigners && isset($foreigners[$field]) && is_array($foreignData['disp_row'])) {
if ($foreigners
&& isset($foreigners[$field])
&& is_array($foreignData['disp_row'])
) {
// f o r e i g n k e y s
$str .= '<select name="fields[' . $i . ']" id="fieldID_' . $i .'">' . "\n";
$str .= '<select name="fields[' . $i . ']" id="fieldID_' . $i .'">';
// go back to first row
// here, the 4th parameter is empty because there is no current
// value of data for the dropdown (the search page initial values
@ -151,18 +163,23 @@ function PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fie
$foreignData['disp_row'], $foreignData['foreign_field'],
$foreignData['foreign_display'], '', $foreignMaxLimit
);
$str .= '</select>' . "\n";
$str .= '</select>';
} elseif ($foreignData['foreign_link'] == true) {
if (isset($fields[$i]) && is_string($fields[$i])) {
$str .= '<input type="text" id="fieldID_' . $i . '" name="fields[' . $i . ']" value="' . $fields[$i] . '" id="field_' . md5($field) . '[' . $i .']" class="textfield" />' ;
$str .= '<input type="text" id="fieldID_' . $i . '"'
. ' name="fields[' . $i . ']" value="' . $fields[$i] . '"'
. ' id="field_' . md5($field) . '[' . $i .']" class="textfield" />';
} else {
$str .= '<input type="text" id="fieldID_' . $i . '" name="fields[' . $i . ']" id="field_' . md5($field) . '[' . $i .']" class="textfield" />' ;
$str .= '<input type="text" id="fieldID_' . $i . '"'
. ' name="fields[' . $i . ']"'
. ' id="field_' . md5($field) . '[' . $i .']" class="textfield" />';
}
$str .= <<<EOT
<a target="_blank" onclick="window.open(this.href, 'foreigners', 'width=640,height=240,scrollbars=yes'); return false" href="browse_foreigners.php?
EOT;
$str .= '' . PMA_generate_common_url($db, $table) . '&amp;field=' . urlencode($field) . '&amp;fieldkey=' . $i . '"';
$str .= '' . PMA_generate_common_url($db, $table)
. '&amp;field=' . urlencode($field) . '&amp;fieldkey=' . $i . '"';
if ($in_zoom_search_edit) {
$str .= ' class="browse_foreign"';
}
@ -171,13 +188,15 @@ EOT;
} elseif (in_array($tbl_fields_type[$i], PMA_getGISDatatypes())) {
// g e o m e t r y
$str .= '<input type="text" name="fields[' . $i . ']"'
.' size="40" class="textfield" id="field_' . $i . '" />' . "\n";
. ' size="40" class="textfield" id="field_' . $i . '" />';
if ($in_fbs) {
$edit_url = 'gis_data_editor.php?' . PMA_generate_common_url();
$edit_str = PMA_getIcon('b_edit.png', __('Edit/Insert'));
$str .= '<span class="open_search_gis_editor">';
$str .= PMA_linkOrButton($edit_url, $edit_str, array(), false, false, '_blank');
$str .= PMA_linkOrButton(
$edit_url, $edit_str, array(), false, false, '_blank'
);
$str .= '</span>';
}
@ -192,16 +211,19 @@ EOT;
// Set in search mode --> input (skipped here, so the 'else'
// section would handle it)
$value = explode(', ', str_replace("'", '', substr($tbl_fields_type[$i], 5, -1)));
$value = explode(
', ',
str_replace("'", '', substr($tbl_fields_type[$i], 5, -1))
);
$cnt_value = count($value);
if ((strncasecmp($tbl_fields_type[$i], 'enum', 4) && ! $in_zoom_search_edit)
|| (strncasecmp($tbl_fields_type[$i], 'set', 3) && $in_zoom_search_edit)
) {
$str .= '<select name="fields[' . ($i) . '][]" id="fieldID_' . $i .'">' . "\n";
$str .= '<select name="fields[' . ($i) . '][]" id="fieldID_' . $i .'">';
} else {
$str .= '<select name="fields[' . ($i) . '][]" id="fieldID_' . $i .'"'
. ' multiple="multiple" size="' . min(3, $cnt_value) . '">' . "\n";
. ' multiple="multiple" size="' . min(3, $cnt_value) . '">';
}
for ($j = 0; $j < $cnt_value; $j++) {
@ -216,7 +238,7 @@ EOT;
. $value[$j] . '</option>';
}
} // end for
$str .= '</select>' . "\n";
$str .= '</select>';
} else {
// o t h e r c a s e s
@ -234,11 +256,11 @@ EOT;
if (isset($fields[$i]) && is_string($fields[$i])) {
$str .= '<input type="text" name="fields[' . $i . ']"'
.' size="40" class="' . $the_class . '" id="fieldID_'
. $i .'" value = "' . $fields[$i] . '"/>' . "\n";
. $i .'" value = "' . $fields[$i] . '"/>';
} else {
$str .= '<input type="text" name="fields[' . $i . ']"'
.' size="40" class="' . $the_class . '" id="fieldID_'
. $i .'" />' . "\n";
. $i .'" />';
}
}
return $str;
@ -258,8 +280,9 @@ EOT;
* @return string HTML content for viewing foreing data and elements
* for search criteria input.
*/
function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $func_type, $unaryFlag, $geom_func = null)
{
function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
$func_type, $unaryFlag, $geom_func = null
) {
/**
* @todo move this to a more apropriate place
*/
@ -334,7 +357,8 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $fu
$enum_where .= ', \'' . PMA_sqlAddslashes($fields[$e]) . '\'';
}
$w = $backquoted_name . ' ' . $func_type . ' ' . $parens_open . $enum_where . $parens_close;
$w = $backquoted_name . ' ' . $func_type . ' ' . $parens_open
. $enum_where . $parens_close;
}
} elseif ($fields != '') {
@ -373,13 +397,16 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $fu
}
if ($func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN') {
$w = $backquoted_name . ' ' . $func_type . ' ' . (isset($values[0]) ? $values[0] : '')
$w = $backquoted_name . ' ' . $func_type . ' '
. (isset($values[0]) ? $values[0] : '')
. ' AND ' . (isset($values[1]) ? $values[1] : '');
} else {
$w = $backquoted_name . ' ' . $func_type . ' (' . implode(',', $values) . ')';
$w = $backquoted_name . ' ' . $func_type
. ' (' . implode(',', $values) . ')';
}
} else {
$w = $backquoted_name . ' ' . $func_type . ' ' . $quot . PMA_sqlAddslashes($fields) . $quot;;
$w = $backquoted_name . ' ' . $func_type . ' '
. $quot . PMA_sqlAddslashes($fields) . $quot;;
}
} // end if