Exemple #1
0
function show_login_form($HTTP_VARS, $errors = NULL)
{
    global $PHP_SELF;
    echo _theme_header(get_opendb_lang_var('login'), is_show_login_menu_enabled());
    echo "<h2>" . get_opendb_lang_var('login') . "</h2>";
    if (is_not_empty_array($errors)) {
        echo format_error_block($errors);
    }
    echo "<div id=\"loginFormDiv\">";
    if ($HTTP_VARS['rememberMeLogin'] == 'true') {
        echo "<p class=\"rememberMeLoginMessage\">" . get_opendb_lang_var('not_authorized_to_page_login') . "</p>";
    }
    if (strlen($HTTP_VARS['redirect']) > 0) {
        echo "<p class=\"redirectMessage\">" . get_opendb_lang_var('login_redirect_message', array('pageid' => get_page_id($HTTP_VARS['redirect']))) . "</p>";
    }
    echo "<form id=\"loginForm\" action=\"{$PHP_SELF}\" method=\"POST\" name=\"login\">";
    // The user tried to go straight to a menu item with an invalid session.
    // Set a "redirect" variable here so that after we give them a full session
    // we can redirect them back to the page they really wanted.
    if (strlen($HTTP_VARS['redirect']) > 0) {
        echo "<input type=\"hidden\" name=\"redirect\" value=\"" . $HTTP_VARS['redirect'] . "\">";
    }
    echo "<input type=\"hidden\" name=\"op\" value=\"login\">";
    echo "\n<ul>" . "\n<li><label class=\"label\" for=\"uid\">" . get_opendb_lang_var('userid') . "</label>" . "<input type=\"text\" class=\"text\" id=\"uid\" name=\"uid\" value=\"" . $HTTP_VARS['uid'] . "\"></li>" . "\n<li><label class=\"label\" for=\"password\">" . get_opendb_lang_var('password') . "</label>" . "<input type=\"password\" class=\"password\" id=\"passwd\" name=\"passwd\"></li>";
    echo "\n<li><label class=\"label\" for=\"remember\">" . get_opendb_lang_var('remember_me') . "</label>" . "<input type=\"checkbox\" class=\"remember\" id=\"remember\" name=\"remember\" value=\"true\"></li>";
    echo "</ul>" . "\n<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('login') . "\">";
    echo "</form>";
    // force uid field focus for login
    echo "\n<script type=\"text/javascript\">\n\t\tdocument.forms['login']['uid'].focus();\n\t</script>";
    if (is_site_enabled() && is_valid_opendb_mailer()) {
        if (strlen($HTTP_VARS['uid']) > 0 && get_opendb_config_var('login', 'enable_new_pwd_gen') !== FALSE && is_user_granted_permission(PERM_CHANGE_PASSWORD, $HTTP_VARS['uid'])) {
            $footer_links_r[] = array(url => $PHP_SELF . "?op=newpassword&uid=" . urlencode($HTTP_VARS['uid']), text => get_opendb_lang_var('forgot_your_pwd'));
        }
        // no point if site disabled, email is not available
        if (get_opendb_config_var('email', 'send_to_site_admin') !== FALSE) {
            $footer_links_r[] = array(text => get_opendb_lang_var('email_administrator'), target => "popup(640,480)", url => "email.php?op=send_to_site_admin&inc_menu=N");
        }
    }
    // Indicate we should show the signup link.
    if (get_opendb_config_var('login.signup', 'enable') !== FALSE) {
        $footer_links_r[] = array(url => "user_admin.php?op=signup", text => get_opendb_lang_var('sign_me_up'));
    }
    echo format_footer_links($footer_links_r);
    echo "</div>";
    echo _theme_footer();
}
Exemple #2
0
                        $user_info_lines .= "\n" . $addr_attribute_type_r['prompt'] . ": " . $value;
                    }
                }
                db_free_result($attr_results);
            }
            //if($attr_results)
        }
        db_free_result($addr_results);
    }
    //if($addr_results)
    $activate_url = get_site_url() . 'user_admin.php?op=activate&user_id=' . $HTTP_VARS['user_id'];
    $delete_url = get_site_url() . 'user_admin.php?op=delete&user_id=' . $HTTP_VARS['user_id'];
    $message = get_opendb_lang_var('new_account_email', array('admin_name' => get_opendb_lang_var('site_administrator', 'site', get_opendb_config_var('site', 'title')), 'user_info' => $user_info_lines, 'site' => get_opendb_config_var('site', 'title'), 'activate_url' => $activate_url, 'delete_url' => $delete_url));
    return send_email_to_site_admins(PERM_ADMIN_CREATE_USER, $HTTP_VARS['email_addr'], get_opendb_lang_var('new_account'), $message, $errors);
}
if (is_site_enabled()) {
    if (is_opendb_valid_session() || $HTTP_VARS['op'] == 'signup') {
        if ($HTTP_VARS['op'] == 'gfx_code_check' && is_numeric($HTTP_VARS['gfx_random_number'])) {
            secretimage($HTTP_VARS['gfx_random_number']);
        } else {
            if (is_array(get_opendb_session_var('user_listing_url_vars'))) {
                $footer_links_r[] = array(url => "user_listing.php?" . get_url_string(get_opendb_session_var('user_listing_url_vars')), text => get_opendb_lang_var('back_to_user_listing'));
            }
            if ($HTTP_VARS['op'] == 'new_user') {
                if (is_user_granted_permission(PERM_ADMIN_CREATE_USER)) {
                    echo _theme_header(get_opendb_lang_var('add_new_user'));
                    echo "<h2>" . get_opendb_lang_var('add_new_user') . "</h2>";
                    echo get_user_input_form(NULL, $HTTP_VARS);
                    echo format_footer_links($footer_links_r);
                    echo _theme_footer();
                } else {