function printStep2() { $user_default_config = Minz_Configuration::get('default_user'); ?> <?php $s2 = checkStep2(); if ($s2['all'] == 'ok') { ?> <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?> </span> <?php echo _t('install.conf.ok'); ?> </p> <?php } elseif (!empty($_POST)) { ?> <p class="alert alert-error"><?php echo _t('install.fix_errors_before'); ?> </p> <?php } ?> <form action="index.php?step=2" method="post"> <legend><?php echo _t('install.conf'); ?> </legend> <div class="form-group"> <label class="group-name" for="old_entries"><?php echo _t('install.delete_articles_after'); ?> </label> <div class="group-controls"> <input type="number" id="old_entries" name="old_entries" required="required" min="1" max="1200" value="<?php echo isset($_SESSION['old_entries']) ? $_SESSION['old_entries'] : $user_default_config->old_entries; ?> " tabindex="2" /> <?php echo _t('gen.date.month'); ?> </div> </div> <div class="form-group"> <label class="group-name" for="default_user"><?php echo _t('install.default_user'); ?> </label> <div class="group-controls"> <input type="text" id="default_user" name="default_user" required="required" size="16" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" value="<?php echo isset($_SESSION['default_user']) ? $_SESSION['default_user'] : ''; ?> " placeholder="<?php echo httpAuthUser() == '' ? 'alice' : httpAuthUser(); ?> " tabindex="3" /> </div> </div> <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"> <?php function no_auth($auth_type) { return !in_array($auth_type, array('form', 'persona', 'http_auth', 'none')); } $auth_type = isset($_SESSION['auth_type']) ? $_SESSION['auth_type'] : ''; ?> <option value="form"<?php echo $auth_type === 'form' || no_auth($auth_type) ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"'; ?> ><?php echo _t('install.auth.form'); ?> </option> <option value="persona"<?php echo $auth_type === 'persona' ? ' selected="selected"' : ''; ?> ><?php echo _t('install.auth.persona'); ?> </option> <option value="http_auth"<?php echo $auth_type === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?> ><?php echo _t('install.auth.http'); ?> (REMOTE_USER = '******')</option> <option value="none"<?php echo $auth_type === 'none' ? ' selected="selected"' : ''; ?> ><?php echo _t('install.auth.none'); ?> </option> </select> </div> </div> <div class="form-group"> <label class="group-name" for="passwordPlain"><?php echo _t('install.auth.password_form'); ?> </label> <div class="group-controls"> <div class="stick"> <input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" autocomplete="off" <?php echo $auth_type === 'form' ? ' required="required"' : ''; ?> tabindex="5" /> <a class="btn toggle-password" data-toggle="passwordPlain"><?php echo FreshRSS_Themes::icon('key'); ?> </a> </div> <?php echo _i('help'); ?> <?php echo _t('install.auth.password_format'); ?> <noscript><b><?php echo _t('gen.js.should_be_activated'); ?> </b></noscript> </div> </div> <div class="form-group"> <label class="group-name" for="mail_login"><?php echo _t('install.auth.email_persona'); ?> </label> <div class="group-controls"> <input type="email" id="mail_login" name="mail_login" value="<?php echo isset($_SESSION['mail_login']) ? $_SESSION['mail_login'] : ''; ?> " placeholder="*****@*****.**" <?php echo $auth_type === 'persona' ? ' required="required"' : ''; ?> tabindex="6"/> <noscript><b><?php echo _t('gen.js.should_be_activated'); ?> </b></noscript> </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> <button type="reset" class="btn" tabindex="8" ><?php echo _t('gen.action.cancel'); ?> </button> <?php if ($s2['all'] == 'ok') { ?> <a class="btn btn-important next-step" href="?step=3" tabindex="9" ><?php echo _t('install.action.next_step'); ?> </a> <?php } ?> </div> </div> </form> <?php }
function _i($icon, $url_only = false) { return FreshRSS_Themes::icon($icon, $url_only); }