Example #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();
}
Example #2
0
                                         }
                                     } else {
                                         // $return_val === FALSE
                                         echo format_error_block($errors);
                                         echo get_user_input_form(NULL, $HTTP_VARS);
                                     }
                                 } else {
                                     //is_secretimage_code_valid
                                     echo format_error_block(get_opendb_lang_var('invalid_verify_code'));
                                     echo get_user_input_form(NULL, $HTTP_VARS);
                                 }
                                 echo format_footer_links($footer_links_r);
                                 echo _theme_footer();
                             } else {
                                 $page_title = get_opendb_lang_var('new_account');
                                 echo _theme_header($page_title, is_show_login_menu_enabled());
                                 echo "\n<h2>" . $page_title . "</h2>";
                                 echo get_user_input_form(NULL, $HTTP_VARS);
                                 echo format_footer_links($footer_links_r);
                                 echo _theme_footer();
                             }
                         } else {
                             //End of $HTTP_VARS['op'] checks
                             opendb_operation_not_available();
                         }
                     }
                 }
             }
         }
     }
 }