diff options
| author | 2016-02-28 12:13:19 +0100 | |
|---|---|---|
| committer | 2016-02-28 12:13:19 +0100 | |
| commit | 3b2f9533c363406087cf77c56db16a120b9523c7 (patch) | |
| tree | 14743e94e95a6970e5dfe06bd5414deaed25d0ee /app/install.php | |
| parent | 830c5aad03ff4d0cfbde4fcf275b04de6c4f4019 (diff) | |
| parent | 995cf58d249c6a2ddfd042cc5b509914295c882f (diff) | |
Merge pull request #1078 from Alkarex/CSP-no-inline
Content-Security-Policy
Diffstat (limited to 'app/install.php')
| -rw-r--r-- | app/install.php | 93 |
1 files changed, 10 insertions, 83 deletions
diff --git a/app/install.php b/app/install.php index 7ac1c4cec..80e85354d 100644 --- a/app/install.php +++ b/app/install.php @@ -2,6 +2,7 @@ if (function_exists('opcache_reset')) { opcache_reset(); } +header("Content-Security-Policy: default-src 'self'"); define('BCRYPT_COST', 9); @@ -616,27 +617,6 @@ function printStep1() { <a class="btn btn-attention next-step confirm" data-str-confirm="<?php echo _t('install.js.confirm_reinstall'); ?>" href="?step=2" tabindex="2" ><?php echo _t('install.action.reinstall'); ?></a> </form> - <script> - function ask_confirmation(e) { - var str_confirmation = this.getAttribute('data-str-confirm'); - if (!str_confirmation) { - str_confirmation = "<?php echo _t('gen.js.confirm_action'); ?>"; - } - - if (!confirm(str_confirmation)) { - e.preventDefault(); - } - } - - function init_confirm() { - confirms = document.getElementsByClassName('confirm'); - for (var i = 0 ; i < confirms.length ; i++) { - confirms[i].addEventListener('click', ask_confirmation); - } - } - - init_confirm(); - </script> <?php } elseif ($res['all'] == 'ok') { ?> <a class="btn btn-important next-step" href="?step=2" tabindex="1" ><?php echo _t('install.action.next_step'); ?></a> <?php } else { ?> @@ -674,7 +654,7 @@ function printStep2() { <div class="form-group"> <label class="group-name" for="auth_type"><?php echo _t('install.auth.type'); ?></label> <div class="group-controls"> - <select id="auth_type" name="auth_type" required="required" onchange="auth_type_change(true)" tabindex="4"> + <select id="auth_type" name="auth_type" required="required" tabindex="4"> <?php function no_auth($auth_type) { return !in_array($auth_type, array('form', 'persona', 'http_auth', 'none')); @@ -709,48 +689,6 @@ function printStep2() { </div> </div> - <script> - function show_password() { - var button = this; - var passwordField = document.getElementById(button.getAttribute('data-toggle')); - passwordField.setAttribute('type', 'text'); - button.className += ' active'; - - return false; - } - function hide_password() { - var button = this; - var passwordField = document.getElementById(button.getAttribute('data-toggle')); - passwordField.setAttribute('type', 'password'); - button.className = button.className.replace(/(?:^|\s)active(?!\S)/g , ''); - - return false; - } - toggles = document.getElementsByClassName('toggle-password'); - for (var i = 0 ; i < toggles.length ; i++) { - toggles[i].addEventListener('mousedown', show_password); - toggles[i].addEventListener('mouseup', hide_password); - } - - function auth_type_change() { - var auth_value = document.getElementById('auth_type').value, - password_input = document.getElementById('passwordPlain'), - mail_input = document.getElementById('mail_login'); - - if (auth_value === 'form') { - password_input.required = true; - mail_input.required = false; - } else if (auth_value === 'persona') { - password_input.required = false; - mail_input.required = true; - } else { - password_input.required = false; - mail_input.required = false; - } - } - auth_type_change(); - </script> - <div class="form-group form-actions"> <div class="group-controls"> <button type="submit" class="btn btn-important" tabindex="7" ><?php echo _t('gen.action.submit'); ?></button> @@ -778,7 +716,7 @@ function printStep3() { <div class="form-group"> <label class="group-name" for="type"><?php echo _t('install.bdd.type'); ?></label> <div class="group-controls"> - <select name="type" id="type" onchange="mySqlShowHide()" tabindex="1" > + <select name="type" id="type" tabindex="1"> <?php if (extension_loaded('pdo_mysql')) {?> <option value="mysql" <?php echo(isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'mysql') ? 'selected="selected"' : ''; ?>> @@ -831,19 +769,6 @@ function printStep3() { </div> </div> </div> - <script> - function mySqlShowHide() { - document.getElementById('mysql').style.display = document.getElementById('type').value === 'mysql' ? 'block' : 'none'; - if (document.getElementById('type').value !== 'mysql') { - document.getElementById('host').value = ''; - document.getElementById('user').value = ''; - document.getElementById('pass').value = ''; - document.getElementById('base').value = ''; - document.getElementById('prefix').value = ''; - } - } - mySqlShowHide(); - </script> <div class="form-group form-actions"> <div class="group-controls"> @@ -897,13 +822,14 @@ case 5: } ?> <!DOCTYPE html> -<html lang="fr"> +<html> <head> - <meta charset="utf-8"> - <meta name="viewport" content="initial-scale=1.0"> + <meta charset="UTF-8" /> + <meta name="viewport" content="initial-scale=1.0" /> <title><?php echo _t('install.title'); ?></title> - <link rel="stylesheet" type="text/css" media="all" href="../themes/base-theme/template.css" /> - <link rel="stylesheet" type="text/css" media="all" href="../themes/Origine/origine.css" /> + <link rel="stylesheet" href="../themes/base-theme/template.css?<?php echo @filemtime(PUBLIC_PATH . '/themes/base-theme/template.css'); ?>" /> + <link rel="stylesheet" href="../themes/Origine/origine.css?<?php echo @filemtime(PUBLIC_PATH . '/themes/Origine/origine.css'); ?>" /> + <meta name="robots" content="noindex,nofollow" /> </head> <body> @@ -950,5 +876,6 @@ case 5: ?> </div> </div> + <script src="../scripts/install.js?<?php echo @filemtime(PUBLIC_PATH . '/scripts/install.js'); ?>"></script> </body> </html> |
