Merge remote-tracking branch 'origin/QA_4_6' into QA_4_6

This commit is contained in:
Weblate 2016-12-13 10:31:41 +01:00
commit 353358c1f4
3 changed files with 34 additions and 45 deletions

View File

@ -66,30 +66,19 @@ if (!$config_writable || !$config_readable) {
);
}
//
// Check https connection
// Https connection warning (check done on the client side)
//
$is_https = !empty($_SERVER['HTTPS'])
&& mb_strtolower($_SERVER['HTTPS']) == 'on';
if (!$is_https) {
$text = __(
'You are not using a secure connection; all data (including potentially '
. 'sensitive information, like passwords) is transferred unencrypted!'
);
$text .= ' <a href="#" onclick="window.location.href = \'https:\' + window.location.href.substring(window.location.protocol.length);">';
// Temporary workaround to use tranlated message in older releases
$text .= str_replace(
array('[a@%s]', '[/a]'),
array('', ''),
__(
'If your server is also configured to accept HTTPS requests '
. 'follow [a@%s]this link[/a] to use a secure connection.'
)
);
$text .= '</a>';
PMA_messagesSet('notice', 'no_https', __('Insecure connection'), $text);
}
$text = __(
'You are not using a secure connection; all data (including potentially '
. 'sensitive information, like passwords) is transferred unencrypted!'
);
$text .= ' <a href="#">';
$text .= __(
'If your server is also configured to accept HTTPS requests '
. 'follow this link to use a secure connection.'
);
$text .= '</a>';
PMA_messagesSet('notice', 'no_https', __('Insecure connection'), $text);
echo '<form id="select_lang" method="post" action="'
, htmlspecialchars($_SERVER['REQUEST_URI']) , '">';

View File

@ -79,23 +79,18 @@ function PMA_messagesEnd()
*/
function PMA_messagesShowHtml()
{
$old_ids = array();
foreach ($_SESSION['messages'] as $type => $messages) {
foreach ($messages as $id => $msg) {
echo '<div class="' , $type , '" id="' , $id , '">'
if (! $msg['fresh'] && $type != 'error') {
$extra = ' hiddenmessage';
} else {
$extra = '';
}
echo '<div class="' , $type, $extra , '" id="' , $id , '">'
, '<h4>' , $msg['title'] , '</h4>'
, $msg['message'] , '</div>';
if (!$msg['fresh'] && $type != 'error') {
$old_ids[] = $id;
}
}
}
echo "\n" , '<script type="text/javascript">';
foreach ($old_ids as $id) {
echo "\nhiddenMessages.push('$id');";
}
echo "\n</script>\n";
}
/**

View File

@ -12,24 +12,29 @@ if (top != self) {
// Messages
//
// stores hidden message ids
var hiddenMessages = [];
$(function () {
var hidden = hiddenMessages.length;
for (var i = 0; i < hidden; i++) {
$('#' + hiddenMessages[i]).css('display', 'none');
if (window.location.protocol === 'https:') {
$('#no_https').remove();
} else {
$('#no_https a').click(function () {
var old_location = window.location;
window.location.href = 'https:' + old_location.href.substring(old_location.protocol.length);
return false;
});
}
if (hidden > 0) {
var hiddenmessages = $('.hiddenmessage');
if (hiddenmessages.length > 0) {
hiddenmessages.hide();
var link = $('#show_hidden_messages');
link.click(function (e) {
e.preventDefault();
for (var i = 0; i < hidden; i++) {
$('#' + hiddenMessages[i]).show(500);
}
hiddenmessages.show();
$(this).remove();
});
link.html(link.html().replace('#MSG_COUNT', hidden));
link.html(link.html().replace('#MSG_COUNT', hiddenmessages.length));
link.css('display', '');
}
});