Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pootle server 2011-09-05 14:40:15 +02:00
commit d460fd82dd
21 changed files with 71 additions and 102 deletions

View File

@ -59,7 +59,7 @@ PMA_DBI_select_db($db);
$tables = PMA_DBI_get_tables($db);
$count = 0;
foreach($tables as $table) {
foreach ($tables as $table) {
$comments = PMA_getComments($db, $table);
echo '<div>' . "\n";

View File

@ -161,9 +161,10 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
// for importing via the mysql client or our Import feature)
$triggers = PMA_DBI_get_triggers($db, $each_table, '');
if (! PMA_Table::moveCopy($db, $each_table, $newname, $each_table,
isset($this_what) ? $this_what : 'data', $move, 'db_copy'))
{
if (! PMA_Table::moveCopy(
$db, $each_table, $newname, $each_table,
isset($this_what) ? $this_what : 'data', $move, 'db_copy')
) {
$_error = true;
// $sql_query is filled by PMA_Table::moveCopy()
$sql_query = $back . $sql_query;
@ -273,7 +274,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
$message = PMA_Message::success(__('Database %s has been renamed to %s'));
$message->addParam($db);
$message->addParam($newname);
} elseif (! $_error) {
} elseif (! $_error) {
$message = PMA_Message::success(__('Database %s has been copied to %s'));
$message->addParam($db);
$message->addParam($newname);

View File

@ -92,9 +92,8 @@ echo '<br />';
// 1. No table
if ($num_tables == 0) {
echo __('No tables found in database.');
}
// 2. Shows table informations on mysql >= 3.23.03
else {
} else {
// 2. Shows table information
?>
<table>
<thead>

View File

@ -258,8 +258,7 @@ if (isset($_REQUEST['submit_search'])) {
*/
if ($GLOBALS['is_ajax_request'] == true) {
exit;
}
else {
} else {
echo '</div>';//end searchresults div
}

View File

@ -155,9 +155,8 @@ function PMA_exportOutputHandler($line)
// as bzipped
if ($GLOBALS['compression'] == 'bzip' && @function_exists('bzcompress')) {
$dump_buffer = bzcompress($dump_buffer);
}
// as a gzipped file
elseif ($GLOBALS['compression'] == 'gzip' && @function_exists('gzencode')) {
} elseif ($GLOBALS['compression'] == 'gzip' && @function_exists('gzencode')) {
// as a gzipped file
// without the optional parameter level because it bug
$dump_buffer = gzencode($dump_buffer);
}
@ -632,15 +631,13 @@ if (!empty($asfile)) {
$zipfile -> addFile($dump_buffer, substr($filename, 0, -4));
$dump_buffer = $zipfile -> file();
}
}
// 2. as a bzipped file
elseif ($compression == 'bzip') {
} elseif ($compression == 'bzip') {
// 2. as a bzipped file
if (@function_exists('bzcompress')) {
$dump_buffer = bzcompress($dump_buffer);
}
}
// 3. as a gzipped file
elseif ($compression == 'gzip') {
} elseif ($compression == 'gzip') {
// 3. as a gzipped file
if (@function_exists('gzencode') && !@ini_get('zlib.output_compression')) {
// without the optional parameter level because it bug
$dump_buffer = gzencode($dump_buffer);
@ -672,13 +669,11 @@ if (!empty($asfile)) {
} else {
echo $dump_buffer;
}
}
/**
* Displays the dump...
*/
else {
} else {
/**
* Close the html tags and add the footers in dump is displayed on screen
* Displays the dump...
*
* Close the html tags and add the footers if dump is displayed on screen
*/
echo '</textarea>' . "\n"
. ' </form>' . "\n";

View File

@ -23,13 +23,11 @@ function Swekey_auth_check()
$_SESSION['SWEKEY']['VALID_SWEKEYS'] = array();
$valid_swekeys = explode("\n", @file_get_contents($confFile));
foreach ($valid_swekeys as $line) {
if (preg_match("/^[0-9A-F]{32}:.+$/", $line) != false)
{
if (preg_match("/^[0-9A-F]{32}:.+$/", $line) != false) {
$items = explode(":", $line);
if (count($items) == 2)
$_SESSION['SWEKEY']['VALID_SWEKEYS'][$items[0]] = trim($items[1]);
}
else if (preg_match("/^[A-Z_]+=.*$/", $line) != false) {
} elseif (preg_match("/^[A-Z_]+=.*$/", $line) != false) {
$items = explode("=", $line);
$_SESSION['SWEKEY']['CONF_'.trim($items[0])] = trim($items[1]);
}
@ -125,8 +123,7 @@ function Swekey_auth_error()
Swekey_EnableTokenCache($_SESSION['SWEKEY']['CONF_ENABLE_TOKEN_CACHE']);
$caFile = $_SESSION['SWEKEY']['CONF_CA_FILE'];
if (empty($caFile))
{
if (empty($caFile)) {
$caFile = __FILE__;
$pos = strrpos($caFile, '/');
if ($pos === false)
@ -137,10 +134,11 @@ function Swekey_auth_error()
// echo "<!-- exists -->\n";
}
if (file_exists($caFile))
if (file_exists($caFile)) {
Swekey_SetCAFile($caFile);
else if (! empty($caFile) && (substr($_SESSION['SWEKEY']['CONF_SERVER_CHECK'], 0, 8) == "https://"))
} elseif (! empty($caFile) && (substr($_SESSION['SWEKEY']['CONF_SERVER_CHECK'], 0, 8) == "https://")) {
return "Internal Error: CA File $caFile not found";
}
$result = null;
$swekey_id = $_GET['swekey_id'];
@ -150,21 +148,18 @@ function Swekey_auth_error()
unset($_SESSION['SWEKEY']['AUTHENTICATED_SWEKEY']);
if (! isset($_SESSION['SWEKEY']['RND_TOKEN'])) {
unset($swekey_id);
}
else {
} else {
if (strlen($swekey_id) == 32) {
$res = Swekey_CheckOtp($swekey_id, $_SESSION['SWEKEY']['RND_TOKEN'], $swekey_otp);
unset($_SESSION['SWEKEY']['RND_TOKEN']);
if (! $res) {
$result = __('Hardware authentication failed') . ' (' . Swekey_GetLastError() . ')';
}
else {
} else {
$_SESSION['SWEKEY']['AUTHENTICATED_SWEKEY'] = $swekey_id;
$_SESSION['SWEKEY']['FORCE_USER'] = $_SESSION['SWEKEY']['VALID_SWEKEYS'][$swekey_id];
return null;
}
}
else {
} else {
$result = __('No valid authentication key plugged');
if ($_SESSION['SWEKEY']['CONF_DEBUG'])
{
@ -173,9 +168,9 @@ function Swekey_auth_error()
unset($_SESSION['SWEKEY']['CONF_LOADED']); // reload the conf file
}
}
}
else
} else {
unset($_SESSION['SWEKEY']);
}
$_SESSION['SWEKEY']['RND_TOKEN'] = Swekey_GetFastRndToken();
if (strlen($_SESSION['SWEKEY']['RND_TOKEN']) != 64) {
@ -186,12 +181,9 @@ function Swekey_auth_error()
if (! isset($swekey_id)) {
?>
<script>
if (key.length != 32)
{
if (key.length != 32) {
window.location.search="?swekey_id=" + key + "&token=<?php echo $_SESSION[' PMA_token ']; ?>";
}
else
{
} else {
var url = "" + window.location;
if (url.indexOf("?") > 0)
url = url.substr(0, url.indexOf("?"));
@ -225,10 +217,11 @@ function Swekey_login($input_name, $input_go)
if (isset($_SESSION['SWEKEY']) && $_SESSION['SWEKEY']['ENABLED']) {
echo '<script type="text/javascript">';
if (empty($_SESSION['SWEKEY']['FORCE_USER']))
if (empty($_SESSION['SWEKEY']['FORCE_USER'])) {
echo 'var user = null;';
else
} else {
echo 'var user = "'.$_SESSION['SWEKEY']['FORCE_USER'].'";';
}
?>
function open_swekey_site()
@ -265,8 +258,7 @@ function Swekey_login($input_name, $input_go)
}
}
if (!empty($_GET['session_to_unset']))
{
if (!empty($_GET['session_to_unset'])) {
session_write_close();
session_id($_GET['session_to_unset']);
session_start();
@ -276,8 +268,7 @@ if (!empty($_GET['session_to_unset']))
exit;
}
if (isset($_GET['swekey_reset']))
{
if (isset($_GET['swekey_reset'])) {
unset($_SESSION['SWEKEY']);
}

View File

@ -1032,8 +1032,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
*/
if (isset($_REQUEST['grid_edit']) && $_REQUEST['grid_edit'] == true) {
$GLOBALS['grid_edit'] = true;
}
else {
} else {
$GLOBALS['grid_edit'] = false;
}

View File

@ -499,8 +499,8 @@ function PMA_DBI_get_tables_full($database, $table = false, $tbl_is_group = fals
foreach ($each_tables as $table_name => $each_table) {
if ('comment' === $tbl_is_group
&& 0 === strpos($each_table['Comment'], $table))
{
&& 0 === strpos($each_table['Comment'], $table)
) {
// remove table from list
unset($each_tables[$table_name]);
continue;

View File

@ -61,8 +61,7 @@ $tab_search['text'] = __('Search');
$tab_search['icon'] = 'ic_b_search';
$tab_search['link'] = 'db_search.php';
if (PMA_Tracker::isActive())
{
if (PMA_Tracker::isActive()) {
$tab_tracking['text'] = __('Tracking');
$tab_tracking['icon'] = 'ic_eye';
$tab_tracking['link'] = 'db_tracking.php';

View File

@ -24,7 +24,7 @@ $GLOBALS['js_include'][] = 'highcharts/highcharts.js';
/* Files required for chart exporting */
$GLOBALS['js_include'][] = 'highcharts/exporting.js';
/* < IE 9 doesn't support canvas natively */
if(PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
$GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
}
$GLOBALS['js_include'][] = 'canvg/canvg.js';

View File

@ -54,7 +54,7 @@ if (! empty($sql_query)) {
$wheres[] = '(' . implode(') OR (',$where_clause) . ')';
}
if (!empty($analyzed_sql[0]['where_clause'])) {
if (!empty($analyzed_sql[0]['where_clause'])) {
$wheres[] = $analyzed_sql[0]['where_clause'];
}

View File

@ -387,7 +387,7 @@ if ($cfgRelation['relwork'] || PMA_foreignkey_supported($tbl_type)) {
$columns = PMA_DBI_get_columns($db, $table);
if (count($columns) > 0) {
foreach($columns as $row) {
foreach ($columns as $row) {
$save_row[] = $row;
}
$saved_row_cnt = count($save_row);

View File

@ -520,7 +520,7 @@ if ($GLOBALS['is_ajax_request'] == true) {
$edited_values = array();
parse_str($_REQUEST['transform_fields_list'], $edited_values);
foreach($mime_map as $transformation) {
foreach ($mime_map as $transformation) {
$include_file = PMA_securePath($transformation['transformation']);
$column_name = $transformation['column_name'];

View File

@ -252,14 +252,11 @@ echo PMA_generate_html_tabs(PMA_tbl_getSubTabs(), $url_params, '', 'topmenu2');
</fieldset>
<?php
}
} else {
/**
* Selection criteria have been submitted -> do the work
*/
/**
* Selection criteria have been submitted -> do the work
*/
else {
// Builds the query
$sql_query = 'SELECT ' . (isset($distinct) ? 'DISTINCT ' : '');

View File

@ -352,8 +352,7 @@ foreach ($fields as $row) {
} else {
echo $row['Default'];
}
}
else {
} else {
echo '<i>' . _pgettext('None for default','None') . '</i>';
} ?></td>
<td nowrap="nowrap"><?php echo strtoupper($row['Extra']); ?></td>
@ -631,8 +630,7 @@ if (! $tbl_is_view && ! $db_is_information_schema) {
echo PMA_showMySQLDocu('Extending_MySQL', 'procedure_analyse') . "\n";
}
if (PMA_Tracker::isActive())
{
if (PMA_Tracker::isActive()) {
echo '<a href="tbl_tracking.php?' . $url_query . '">';
echo PMA_getIcon('eye.png', __('Track table'));
echo '</a>';

View File

@ -643,7 +643,7 @@ if ($last_version > 0) {
<?php
$style = 'odd';
PMA_DBI_data_seek($sql_result, 0);
while($version = PMA_DBI_fetch_array($sql_result)) {
while ($version = PMA_DBI_fetch_array($sql_result)) {
if ($version['tracking_active'] == 1) {
$version_status = __('active');
} else {

View File

@ -130,8 +130,7 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase
$this->object->set('GD2Available',$prevIsGb2Val);
if (!@function_exists('imagecreatetruecolor'))
{
if (!@function_exists('imagecreatetruecolor')) {
$this->object->checkGd2();
$this->assertEquals(0, $this->object->get('PMA_IS_GD2'), 'Function imagecreatetruecolor does not exist, PMA_IS_GD2 should be 0');
}
@ -178,23 +177,19 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase
{
$this->object->checkWebServerOs();
if (defined('PHP_OS'))
{
switch (PHP_OS)
{
case stristr(PHP_OS,'win'):
$this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'), 'PHP_OS equals: ' . PHP_OS . ' PMA_IS_WINDOWS should be 1');
break;
case stristr(PHP_OS, 'OS/2'):
$this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'), 'PHP_OS is OS/2 PMA_IS_WINDOWS should be 1 (No file permissions like Windows)');
break;
case stristr(PHP_OS, 'Linux'):
$this->assertEquals(0, $this->object->get('PMA_IS_WINDOWS'));
break;
if (defined('PHP_OS')) {
switch (PHP_OS) {
case stristr(PHP_OS,'win'):
$this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'), 'PHP_OS equals: ' . PHP_OS . ' PMA_IS_WINDOWS should be 1');
break;
case stristr(PHP_OS, 'OS/2'):
$this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'), 'PHP_OS is OS/2 PMA_IS_WINDOWS should be 1 (No file permissions like Windows)');
break;
case stristr(PHP_OS, 'Linux'):
$this->assertEquals(0, $this->object->get('PMA_IS_WINDOWS'));
break;
}
}
else
{
} else {
$this->assertEquals(0, $this->object->get('PMA_IS_WINDOWS'), 'PMA_IS_WINDOWS Default to Unix or Equiv');
define('PHP_OS','Windows');
@ -432,8 +427,7 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase
'PMA_USR_BROWSER_AGENT'
);
foreach ($defines as $define)
{
foreach ($defines as $define) {
$this->assertTrue(defined($define));
$this->assertEquals(constant($define), $this->object->get($define));
}

View File

@ -106,7 +106,7 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
public function testBackquoteForbidenWords() {
global $PMA_SQPdata_forbidden_word;
foreach ($PMA_SQPdata_forbidden_word as $forbidden){
foreach ($PMA_SQPdata_forbidden_word as $forbidden) {
$this->assertEquals("`" . $forbidden . "`", PMA_backquote($forbidden, false));
}
}

View File

@ -52,8 +52,7 @@ class PMA_getLinks_test extends PHPUnit_Framework_TestCase
if (file_exists('./js/'.$filename)) {
$mod = filemtime('./js/'.$filename);
}
else{
} else {
$this->fail("JS file doesn't exists.");
}
$this->assertEquals(PMA_includeJS($filename), '<script src="./js/'.$filename.'?ts='.$mod.'" type="text/javascript"></script>'. "\n");

View File

@ -105,8 +105,7 @@ class PMA_headerLocation_test extends PHPUnit_Extensions_OutputTestCase
if (defined('PMA_IS_IIS')) {
$this->oldIISvalue = PMA_IS_IIS;
runkit_constant_redefine('PMA_IS_IIS', NULL);
}
else {
} else {
runkit_constant_add('PMA_IS_IIS', NULL);
}
@ -116,8 +115,7 @@ class PMA_headerLocation_test extends PHPUnit_Extensions_OutputTestCase
if (defined('SID')) {
$this->oldSIDvalue = SID;
runkit_constant_redefine('SID', NULL);
}
else {
} else {
runkit_constant_add('SID', NULL);
}

View File

@ -21,7 +21,7 @@ class PmaSeleniumLoginTest extends PmaSeleniumTestCase
$this->doLogin();
// Check if login error happend
if ($this->isElementPresent("//html/body/div/div[@class='error']")){
if ($this->isElementPresent("//html/body/div/div[@class='error']")) {
$this->fail($this->getText("//html/body/div/div[@class='error']"));
}