Subversion Repositories oidplus

Compare Revisions

Regard whitespace Rev 973 → Rev 974

/trunk/setup/includes/setup_base.js
270,20 → 270,20
//checkAccess("plugins/viathinksoft/publicPages/100_whois/whois/cli/index.html");
if (window.location.href.toLowerCase().startsWith('https://')) {
$("#enforce_ssl").val(1); // enforce SSL (because we are already SSL)
$("#enforce_ssl").val('OIDplus::ENFORCE_SSL_YES'); // enforce SSL (because we are already SSL)
} else {
// Do a SSL detection now.
// This is important because on XAMPP the SSL cert is invalid (self signed) and the user might
// be very confused if the PHP detection noticed the open 443 port and redirects the user to a
// be very confused if the PHP detection (OIDplus::ENFORCE_SSL_AUTO) notices the open 443 port and redirects the user to a
// big warning page of the browser!
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
$("#enforce_ssl").val(1); // enforce SSL (we checked that it loads correctly)
$("#enforce_ssl").val('OIDplus::ENFORCE_SSL_YES'); // enforce SSL (we checked that it loads correctly)
} else {
console.log("JS SSL detection result: "+xhr.status);
$("#enforce_ssl").val(0); // disable SSL (because it failed, e.g. because of invalid cert or closed port)
$("#enforce_ssl").val('OIDplus::ENFORCE_SSL_NO'); // disable SSL (because it failed, e.g. because of invalid cert or closed port)
}
}
};
/trunk/setup/index.php
144,11 → 144,12
 
// ----------------------------------------
 
echo '<h3>'._L('TLS').'</h3>';
echo '<p>'._L('SSL enforcement').'<br><select name="enforce_ssl" id="enforce_ssl" onclick="rebuild()">';
echo '<option value="0">'._L('No SSL available (don\'t redirect)').'</option>';
echo '<option value="1">'._L('Enforce SSL (always redirect)').'</option>';
echo '<option value="2" selected>'._L('Intelligent SSL detection (redirect if port 443 is open)').'</option>';
$is_ssl = OIDplus::isSSL();
echo '<h3>'._L('Secure connection (HTTPS)').'</h3>';
echo '<p>'._L('SSL enforcement').'<br><select name="enforce_ssl" id="enforce_ssl" onchange="rebuild()">';
echo '<option value="OIDplus::ENFORCE_SSL_NO">'._L('No SSL available (don\'t redirect)').'</option>';
echo '<option value="OIDplus::ENFORCE_SSL_YES"'.($is_ssl ? ' selected' : '').'>'._L('Enforce SSL (always redirect)').'</option>';
echo '<option value="OIDplus::ENFORCE_SSL_AUTO"'.(!$is_ssl ? ' selected' : '').'>'._L('Intelligent SSL detection (redirect if port 443 is open)').'</option>';
echo '</select></p>';
echo '</form>';
echo '</div>';