From 7c61f59dcdd6133f36352809b81aa47fb4538110 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Thu, 19 Sep 2019 19:14:48 +0200 Subject: [PATCH] removing untranslated string for non-human entities, moving insecure notice to template, so it can remains translated --- i18n/bg.json | 1 - i18n/cs.json | 1 - i18n/de.json | 1 - i18n/es.json | 1 - i18n/fr.json | 1 - i18n/hu.json | 1 - i18n/it.json | 1 - i18n/nl.json | 1 - i18n/no.json | 1 - i18n/oc.json | 1 - i18n/pl.json | 1 - i18n/pt.json | 1 - i18n/ru.json | 1 - i18n/sl.json | 1 - i18n/zh.json | 1 - js/legacy.js | 7 +------ js/test/Check.js | 5 +++-- lib/Controller.php | 1 + lib/Request.php | 17 +++++++++++++++-- tpl/bootstrap.php | 6 +++++- tpl/page.php | 11 +++++++---- tst/ViewTest.php | 1 + 22 files changed, 33 insertions(+), 30 deletions(-) diff --git a/i18n/bg.json b/i18n/bg.json index 07a929c1..3c8baa55 100644 --- a/i18n/bg.json +++ b/i18n/bg.json @@ -155,7 +155,6 @@ "Could not get paste data: %s": "Взимането на информацията беше неуспешно: %s", "QR code": "QR код", - "I love you too, bot…": "И аз те обичам, бот…", "This website is using an insecure HTTP connection! Please use it only for testing.": "Този сайт използва несигурна HTTP връзка. Моля използвайте само за проби.", "For more information see this FAQ entry.": diff --git a/i18n/cs.json b/i18n/cs.json index 365d6110..bb6c4e75 100644 --- a/i18n/cs.json +++ b/i18n/cs.json @@ -155,7 +155,6 @@ "Could not get paste data: %s": "Could not get paste data: %s", "QR code": "QR code", - "I love you too, bot…": "I love you too, bot…", "This website is using an insecure HTTP connection! Please use it only for testing.": "This website is using an insecure HTTP connection! Please use it only for testing.", "For more information see this FAQ entry.": diff --git a/i18n/de.json b/i18n/de.json index a89f8208..1aae91b1 100644 --- a/i18n/de.json +++ b/i18n/de.json @@ -155,7 +155,6 @@ "Could not get paste data: %s": "Text konnte nicht geladen werden: %s", "QR code": "QR code", - "I love you too, bot…": "Ich mag Dich auch, bot…", "This website is using an insecure HTTP connection! Please use it only for testing.": "Diese Webseite verwendet eine unsichere HTTP Verbindung! Bitte benutze sie nur zum Testen.", "For more information see this FAQ entry.": diff --git a/i18n/es.json b/i18n/es.json index de6fa543..e720c42f 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -155,7 +155,6 @@ "Could not get paste data: %s": "No se pudieron obtener los datos: %s", "QR code": "Código QR", - "I love you too, bot…": "I love you too, bot…", "This website is using an insecure HTTP connection! Please use it only for testing.": "This website is using an insecure HTTP connection! Please use it only for testing.", "For more information see this FAQ entry.": diff --git a/i18n/fr.json b/i18n/fr.json index bebd1857..169cd6c0 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -164,7 +164,6 @@ "Could not get paste data: %s": "Impossible d'obtenir les données du paste: %s", "QR code": "QR code", - "I love you too, bot…": "Je t’aime aussi, bot…", "This website is using an insecure HTTP connection! Please use it only for testing.": "Ce site web utilise une connexion HTTP non sécurisée ! Veuillez l’utiliser uniquement pour des tests.", "For more information see this FAQ entry.": diff --git a/i18n/hu.json b/i18n/hu.json index cf1fe02b..023288e5 100644 --- a/i18n/hu.json +++ b/i18n/hu.json @@ -155,7 +155,6 @@ "Could not get paste data: %s": "Could not get paste data: %s", "QR code": "QR code", - "I love you too, bot…": "I love you too, bot…", "This website is using an insecure HTTP connection! Please use it only for testing.": "This website is using an insecure HTTP connection! Please use it only for testing.", "For more information see this FAQ entry.": diff --git a/i18n/it.json b/i18n/it.json index 22f6838a..a6f066d4 100644 --- a/i18n/it.json +++ b/i18n/it.json @@ -155,7 +155,6 @@ "Could not get paste data: %s": "Could not get paste data: %s", "QR code": "QR code", - "I love you too, bot…": "I love you too, bot…", "This website is using an insecure HTTP connection! Please use it only for testing.": "This website is using an insecure HTTP connection! Please use it only for testing.", "For more information see this FAQ entry.": diff --git a/i18n/nl.json b/i18n/nl.json index 00aea3b7..d1a7587b 100644 --- a/i18n/nl.json +++ b/i18n/nl.json @@ -155,7 +155,6 @@ "Could not get paste data: %s": "Could not get paste data: %s", "QR code": "QR code", - "I love you too, bot…": "I love you too, bot…", "This website is using an insecure HTTP connection! Please use it only for testing.": "This website is using an insecure HTTP connection! Please use it only for testing.", "For more information see this FAQ entry.": diff --git a/i18n/no.json b/i18n/no.json index 9d76c967..e1ec55ee 100644 --- a/i18n/no.json +++ b/i18n/no.json @@ -155,7 +155,6 @@ "Could not get paste data: %s": "Kunne ikke hente utklippsdata: %s", "QR code": "QR kode", - "I love you too, bot…": "Jeg elsker deg også, bot…", "This website is using an insecure HTTP connection! Please use it only for testing.": "Denne websiden bruker usikker HTTP tilkobling! Bruk den kun for testing.", "For more information see this FAQ entry.": diff --git a/i18n/oc.json b/i18n/oc.json index 6cd33cab..419b2638 100644 --- a/i18n/oc.json +++ b/i18n/oc.json @@ -164,7 +164,6 @@ "Could not get paste data: %s": "Recuperacion impossibla de las donadas copiadas : %s", "QR code": "Còdi QR", - "I love you too, bot…": "T’aimi tanben, robòt…", "This website is using an insecure HTTP connection! Please use it only for testing.": "Aqueste site utiliza una connexion HTTP pas segura ! Mercés de l’utilizar pas que per d’ensages.", "For more information see this FAQ entry.": diff --git a/i18n/pl.json b/i18n/pl.json index 3be5baa0..355f468e 100644 --- a/i18n/pl.json +++ b/i18n/pl.json @@ -155,7 +155,6 @@ "Could not get paste data: %s": "Nie można było pobrać danych wklejki: %s", "QR code": "Kod QR", - "I love you too, bot…": "I love you too, bot…", "This website is using an insecure HTTP connection! Please use it only for testing.": "This website is using an insecure HTTP connection! Please use it only for testing.", "For more information see this FAQ entry.": diff --git a/i18n/pt.json b/i18n/pt.json index 3ff603e0..dd041d16 100644 --- a/i18n/pt.json +++ b/i18n/pt.json @@ -155,7 +155,6 @@ "Could not get paste data: %s": "Could not get paste data: %s", "QR code": "QR code", - "I love you too, bot…": "I love you too, bot…", "This website is using an insecure HTTP connection! Please use it only for testing.": "This website is using an insecure HTTP connection! Please use it only for testing.", "For more information see this FAQ entry.": diff --git a/i18n/ru.json b/i18n/ru.json index 66d413c7..988aae97 100644 --- a/i18n/ru.json +++ b/i18n/ru.json @@ -165,7 +165,6 @@ "Could not get paste data: %s": "Не удалось получить данные записи: %s", "QR code": "QR код", - "I love you too, bot…": "Я тоже люблю тебя, бот…", "This website is using an insecure HTTP connection! Please use it only for testing.": "Данный сайт использует незащищенное HTTP подключение! Пожалуйста используйте его только для тестирования.", "For more information see this FAQ entry.": diff --git a/i18n/sl.json b/i18n/sl.json index 5e61d197..00cd1d6f 100644 --- a/i18n/sl.json +++ b/i18n/sl.json @@ -164,7 +164,6 @@ "Could not get paste data: %s": "Could not get paste data: %s", "QR code": "QR code", - "I love you too, bot…": "I love you too, bot…", "This website is using an insecure HTTP connection! Please use it only for testing.": "This website is using an insecure HTTP connection! Please use it only for testing.", "For more information see this FAQ entry.": diff --git a/i18n/zh.json b/i18n/zh.json index 2577b55a..e1cc0940 100644 --- a/i18n/zh.json +++ b/i18n/zh.json @@ -155,7 +155,6 @@ "Could not get paste data: %s": "无法获取粘贴数据:%s", "QR code": "二维码", - "I love you too, bot…": "I love you too, bot…", "This website is using an insecure HTTP connection! Please use it only for testing.": "This website is using an insecure HTTP connection! Please use it only for testing.", "For more information see this FAQ entry.": diff --git a/js/legacy.js b/js/legacy.js index 64f565a6..1d162b55 100644 --- a/js/legacy.js +++ b/js/legacy.js @@ -266,12 +266,7 @@ if (isOldBrowser()) { // some browsers (Chrome based ones) would have webcrypto support if using HTTPS if (!isSecureContext()) { - showError( - 'Your browser may require an HTTPS connection to support the WebCrypto API. Try switching to HTTPS.'.replace( - '%s', - 'https' + window.location.href.slice(4) - ) - ); + removeHiddenFromId('insecurecontextnotice'); } removeHiddenFromId('oldnotice'); init = true; diff --git a/js/test/Check.js b/js/test/Check.js index b04839ac..bf4299b6 100644 --- a/js/test/Check.js +++ b/js/test/Check.js @@ -42,7 +42,8 @@ describe('Check', function () { isSecureContext = secureProtocol || !isDomain || tld.length > 0, clean = jsdom( '' + - '', + '' + + '', { 'url': (secureProtocol ? 'https' : 'http' ) + '://' + (isDomain ? domain.join('') + tld : localhost) + '/' @@ -50,7 +51,7 @@ describe('Check', function () { ); Legacy.Check.init(); const result1 = Legacy.Check.getInit() && !Legacy.Check.getStatus(), - result2 = isSecureContext === (document.getElementById('errormessage').className === 'hidden'), + result2 = isSecureContext === (document.getElementById('insecurecontextnotice').className === 'hidden'), result3 = (document.getElementById('oldnotice').className !== 'hidden'); clean(); return result1 && result2 && result3; diff --git a/lib/Controller.php b/lib/Controller.php index 1a708735..55248c63 100644 --- a/lib/Controller.php +++ b/lib/Controller.php @@ -388,6 +388,7 @@ class Controller $page->assign('URLSHORTENER', $this->_conf->getKey('urlshortener')); $page->assign('QRCODE', $this->_conf->getKey('qrcode')); $page->assign('HTTPWARNING', $this->_conf->getKey('httpwarning')); + $page->assign('HTTPSLINK', 'https://' . $this->_request->getHost() . $this->_request->getRequestUri()); $page->assign('COMPRESSION', $this->_conf->getKey('compression')); $page->draw($this->_conf->getKey('template')); } diff --git a/lib/Request.php b/lib/Request.php index 3c885e49..80aac6af 100644 --- a/lib/Request.php +++ b/lib/Request.php @@ -193,6 +193,19 @@ class Request $this->_params[$param] : $default; } + /** + * Get host as requested by the client + * + * @access public + * @return string + */ + public function getHost() + { + return array_key_exists('HTTP_HOST', $_SERVER) ? + htmlspecialchars($_SERVER['HTTP_HOST']) : + 'localhost'; + } + /** * Get request URI * @@ -202,8 +215,8 @@ class Request public function getRequestUri() { return array_key_exists('REQUEST_URI', $_SERVER) ? - htmlspecialchars( - parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) + htmlspecialchars( + parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ) : '/'; } diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index d484edfa..fe711fa0 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -71,7 +71,7 @@ if ($MARKDOWN): endif; ?> - +