Merge branch 'master' of github.com:phpmyadmin/phpmyadmin
This commit is contained in:
commit
5a1ebc2b4a
@ -2374,6 +2374,16 @@ Design customization
|
||||
put when tables contents are displayed (you may have them displayed at
|
||||
the left side, right side, both sides or nowhere).
|
||||
|
||||
.. config:option:: $cfg['RowActionLinksWithoutUnique']
|
||||
|
||||
:type: boolean
|
||||
:default: false
|
||||
|
||||
Defines whether to show row links (Edit, Copy, Delete) and checkboxes
|
||||
for multiple row operations even when the selection does not have a unique key.
|
||||
Using row actions in the absence of a unique key may result in different/more
|
||||
rows being affected since there is no guaranteed way to select the exact row(s).
|
||||
|
||||
.. config:option:: $cfg['RememberSorting']
|
||||
|
||||
:type: boolean
|
||||
|
||||
@ -768,6 +768,9 @@ class PMA_Config
|
||||
return null;
|
||||
}
|
||||
$handle = curl_init($link);
|
||||
if ($handle === false) {
|
||||
return null;
|
||||
}
|
||||
PMA_Util::configureCurl($handle);
|
||||
curl_setopt($handle, CURLOPT_FOLLOWLOCATION, 0);
|
||||
curl_setopt($handle, CURLOPT_HEADER, 1);
|
||||
|
||||
@ -9,6 +9,9 @@ if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'libraries/Template.class.php';
|
||||
use PMA\Template;
|
||||
|
||||
/**
|
||||
* Misc functions used all over the scripts.
|
||||
*
|
||||
@ -4471,7 +4474,7 @@ class PMA_Util
|
||||
*
|
||||
* @return resource curl_handle with updated options
|
||||
*/
|
||||
public static function configureCurl(resource $curl_handle)
|
||||
public static function configureCurl($curl_handle)
|
||||
{
|
||||
if (/*overload*/mb_strlen($GLOBALS['cfg']['ProxyUrl'])) {
|
||||
curl_setopt($curl_handle, CURLOPT_PROXY, $GLOBALS['cfg']['ProxyUrl']);
|
||||
@ -4858,16 +4861,9 @@ class PMA_Util
|
||||
*/
|
||||
public static function getStartAndNumberOfRowsPanel($sql_query)
|
||||
{
|
||||
$html = '<fieldset><div>';
|
||||
|
||||
$pos = isset($_REQUEST['pos']) ? $_REQUEST['pos'] : $_SESSION['tmpval']['pos'];
|
||||
$html .= '<label for="pos">' . __('Start row:') . '</label>'
|
||||
. '<input type="number" name="pos" min="0" required="required"';
|
||||
if ($_REQUEST['unlim_num_rows'] > 0) {
|
||||
$html .= ' max="' . ($_REQUEST['unlim_num_rows'] - 1) . '"';
|
||||
}
|
||||
$html .= ' value="' . htmlspecialchars($pos) . '" />';
|
||||
|
||||
$pos = isset($_REQUEST['pos'])
|
||||
? $_REQUEST['pos']
|
||||
: $_SESSION['tmpval']['pos'];
|
||||
if (isset($_REQUEST['session_max_rows'])) {
|
||||
$rows = $_REQUEST['session_max_rows'];
|
||||
} else {
|
||||
@ -4877,22 +4873,16 @@ class PMA_Util
|
||||
$rows = $GLOBALS['cfg']['MaxRows'];
|
||||
}
|
||||
}
|
||||
$html .= '<label for="session_max_rows">'
|
||||
. __('Number of rows:')
|
||||
. '</label>'
|
||||
. '<input type="number" name="session_max_rows" min="1"'
|
||||
. ' value="' . htmlspecialchars($rows) . '" required="required" />';
|
||||
|
||||
$html .= '<input type="submit" name="submit" class="Go"'
|
||||
. ' value="' . __('Go') . '" />'
|
||||
. '<input type="hidden" name="sql_query"'
|
||||
. ' value="' . htmlspecialchars($sql_query) . '" />'
|
||||
. '<input type="hidden" name="unlim_num_rows"'
|
||||
. ' value="' . htmlspecialchars($_REQUEST['unlim_num_rows']) . '" />';
|
||||
|
||||
$html .= '</div></fieldset>';
|
||||
|
||||
return $html;
|
||||
return Template::get('startAndNumberOfRowsPanel')
|
||||
->render(
|
||||
array(
|
||||
'pos' => $pos,
|
||||
'unlim_num_rows' => $_REQUEST['unlim_num_rows'],
|
||||
'rows' => $rows,
|
||||
'sql_query' => $sql_query,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2680,6 +2680,14 @@ $cfg['LimitChars'] = 50;
|
||||
*/
|
||||
$cfg['RowActionLinks'] = 'left';
|
||||
|
||||
/**
|
||||
* Whether to show row links (Edit, Copy, Delete) and checkboxes for
|
||||
* multiple row operations even when the selection does not have a unique key.
|
||||
*
|
||||
* @global boolean $cfg['RowActionLinksWithoutUnique']
|
||||
*/
|
||||
$cfg['RowActionLinksWithoutUnique'] = false;
|
||||
|
||||
/**
|
||||
* Default sort order by primary key.
|
||||
* @global string $cfg['TablePrimaryKeyOrder']
|
||||
|
||||
@ -490,6 +490,8 @@ $strConfigNumRecentTables_name = __('Recently used tables');
|
||||
$strConfigNumFavoriteTables_name = __('Favorite tables');
|
||||
$strConfigRowActionLinks_desc = __('These are Edit, Copy and Delete links.');
|
||||
$strConfigRowActionLinks_name = __('Where to show the table row links');
|
||||
$strConfigRowActionLinksWithoutUnique_desc = __('Whether to show row links even in the absence of a unique key.');
|
||||
$strConfigRowActionLinksWithoutUnique_name = __('Show row links anyway');
|
||||
$strConfigNaturalOrder_desc
|
||||
= __('Use natural order for sorting table and database names.');
|
||||
$strConfigNaturalOrder_name = __('Natural order');
|
||||
|
||||
@ -218,6 +218,7 @@ $forms['Main_panel']['Browse'] = array(
|
||||
'RepeatCells',
|
||||
'LimitChars',
|
||||
'RowActionLinks',
|
||||
'RowActionLinksWithoutUnique',
|
||||
'TablePrimaryKeyOrder',
|
||||
'RememberSorting',
|
||||
'RelationalDisplay');
|
||||
|
||||
@ -125,6 +125,7 @@ $forms['Main_panel']['Browse'] = array(
|
||||
'RepeatCells',
|
||||
'LimitChars',
|
||||
'RowActionLinks',
|
||||
'RowActionLinksWithoutUnique',
|
||||
'TablePrimaryKeyOrder',
|
||||
'RememberSorting',
|
||||
'RelationalDisplay');
|
||||
|
||||
@ -1751,20 +1751,35 @@ function PMA_getHtmlForPreviousUpdateQuery($disp_query, $showSql, $sql_data,
|
||||
/**
|
||||
* To get the message if a column index is missing. If not will return null
|
||||
*
|
||||
* @param string $table current table
|
||||
* @param string $db current database
|
||||
* @param boolean $editable whether the results table can be editable or not
|
||||
* @param string $table current table
|
||||
* @param string $db current database
|
||||
* @param boolean $editable whether the results table can be editable or not
|
||||
* @param boolean $has_unique whether there is a unique key
|
||||
*
|
||||
* @return PMA_message $message
|
||||
*/
|
||||
function PMA_getMessageIfMissingColumnIndex($table, $db, $editable)
|
||||
function PMA_getMessageIfMissingColumnIndex($table, $db, $editable, $has_unique)
|
||||
{
|
||||
if (!empty($table) && ($GLOBALS['dbi']->isSystemSchema($db) || !$editable)) {
|
||||
$missing_unique_column_msg = PMA_message::notice(
|
||||
__(
|
||||
'Current selection does not contain a unique column.'
|
||||
. ' Grid edit, checkbox, Edit, Copy and Delete features'
|
||||
. ' are not available.'
|
||||
sprintf(
|
||||
__(
|
||||
'Current selection does not contain a unique column.'
|
||||
. ' Grid edit, checkbox, Edit, Copy and Delete features'
|
||||
. ' are not available. %s'
|
||||
),
|
||||
PMA_Util::showDocu('config', 'cfg_RowActionLinksWithoutUnique')
|
||||
)
|
||||
);
|
||||
} elseif (! empty($table) && ! $has_unique) {
|
||||
$missing_unique_column_msg = PMA_message::notice(
|
||||
sprintf(
|
||||
__(
|
||||
'Current selection does not contain a unique column.'
|
||||
. ' Grid edit, Edit, Copy and Delete features may result in'
|
||||
. ' undesired behavior. %s'
|
||||
),
|
||||
PMA_Util::showDocu('config', 'cfg_RowActionLinksWithoutUnique')
|
||||
)
|
||||
);
|
||||
} else {
|
||||
@ -1882,7 +1897,10 @@ function PMA_getQueryResponseForResultsReturned($result,
|
||||
|
||||
$just_one_table = PMA_resultSetHasJustOneTable($fields_meta);
|
||||
|
||||
$editable = ($has_unique || $updatableView) && $just_one_table;
|
||||
$editable = ($has_unique
|
||||
|| $GLOBALS['cfg']['RowActionLinksWithoutUnique']
|
||||
|| $updatableView)
|
||||
&& $just_one_table;
|
||||
|
||||
$displayParts = array(
|
||||
'edit_lnk' => $displayResultsObject::UPDATE_ROW,
|
||||
@ -1960,7 +1978,7 @@ function PMA_getQueryResponseForResultsReturned($result,
|
||||
);
|
||||
|
||||
$missing_unique_column_msg = PMA_getMessageIfMissingColumnIndex(
|
||||
$table, $db, $editable
|
||||
$table, $db, $editable, $has_unique
|
||||
);
|
||||
|
||||
$bookmark_created_msg = PMA_getBookmarkCreatedMessage();
|
||||
|
||||
816
po/be@latin.po
816
po/be@latin.po
File diff suppressed because it is too large
Load Diff
808
po/en_GB.po
808
po/en_GB.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
808
po/pt_BR.po
808
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
811
po/sr@latin.po
811
po/sr@latin.po
File diff suppressed because it is too large
Load Diff
804
po/uz@latin.po
804
po/uz@latin.po
File diff suppressed because it is too large
Load Diff
808
po/zh_CN.po
808
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
808
po/zh_TW.po
808
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
20
templates/startAndNumberOfRowsPanel.phtml
Normal file
20
templates/startAndNumberOfRowsPanel.phtml
Normal file
@ -0,0 +1,20 @@
|
||||
<fieldset>
|
||||
<div>
|
||||
<label for="pos"><?php echo __('Start row:'); ?></label>
|
||||
<input type="number" name="pos" min="0" required="required"
|
||||
<?php if ($unlim_num_rows > 0) : ?>
|
||||
max="<?php echo ($unlim_num_rows - 1); ?>"
|
||||
<?php endif; ?>
|
||||
value="<?php echo htmlspecialchars($pos); ?>" />
|
||||
|
||||
<label for="session_max_rows"><?php echo __('Number of rows:'); ?></label>
|
||||
<input type="number" name="session_max_rows" min="1"
|
||||
value="<?php echo htmlspecialchars($rows); ?>" required="required" />
|
||||
<input type="submit" name="submit" class="Go"
|
||||
value="<?php echo __('Go'); ?>" />
|
||||
<input type="hidden" name="sql_query"
|
||||
value="<?php echo htmlspecialchars($sql_query); ?>" />
|
||||
<input type="hidden" name="unlim_num_rows"
|
||||
value="<?php echo htmlspecialchars($unlim_num_rows); ?>" />
|
||||
</div>
|
||||
</fieldset>
|
||||
@ -11,6 +11,7 @@
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/core.lib.php';
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/Config.class.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'libraries/Theme.class.php';
|
||||
@ -1031,7 +1032,6 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/*
|
||||
public function testCheckHTTP()
|
||||
{
|
||||
if (! function_exists('curl_init')) {
|
||||
@ -1048,7 +1048,7 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase
|
||||
$this->object->checkHTTP("http://www.phpmyadmin.net/test/nothing")
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests for rewriting URL to SSL variant
|
||||
*
|
||||
|
||||
@ -114,16 +114,16 @@ class PMA_Util_Test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @group large
|
||||
*/
|
||||
/*
|
||||
public function testGetLatestVersion()
|
||||
{
|
||||
$GLOBALS['cfg']['ProxyUrl'] = '';
|
||||
$GLOBALS['cfg']['VersionCheckProxyUrl'] = '';
|
||||
$GLOBALS['cfg']['VersionCheck'] = true;
|
||||
$version = PMA_Util::getLatestVersion();
|
||||
$this->assertNotEmpty($version->version);
|
||||
$this->assertNotEmpty($version->date);
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test version to int conversion.
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user